/* Revolution Group TSD Calculator - minimal utility CSS (no framework).
   Dark nav, white content, RG blue accent. */

:root {
  --rg-blue: #1f4e79;
  --rg-blue-dark: #123756;
  --rg-accent: #2e75b6;
  --ink: #1f2937;
  --ink-sub: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --err: #b91c1c;
  --err-bg: #fee2e2;

  /* Service-layer palette (Task #26). Mirrors the color coding of the
     rendered proposal's "Services Included" matrix so the admin editor
     and the .docx output share a visual language:
       MSP  — neutral grey    (foundational managed services)
       MSSP — Revolution blue (security-specific uplift)
       MXDR — forest green    (highest-tier detection+response)
       RMM  — warm soft orange (remote management layer, 2026-04-23)    */
  --layer-msp:     #6b7280;
  --layer-msp-bg:  #f3f4f6;
  --layer-mssp:    #1d4ed8;
  --layer-mssp-bg: #dbeafe;
  --layer-mxdr:    #047857;
  --layer-mxdr-bg: #d1fae5;
  --layer-rmm:     #9a5a2f;
  --layer-rmm-bg:  #e8a87c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--rg-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }

/* --- Layout --- */
.page { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--rg-blue-dark); color: #e5e7eb; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
/* Brand mark is 64x40 to match the Revolution_logo_Vertical PNG
   (~1.57:1 landscape mark+wordmark stacked). Keeps the "RG" letter
   fallback legible when no file is present (Task #45).              */
.brand-mark { position: relative; width: 64px; height: 40px; background: var(--rg-accent); color: white; font-weight: 700; display: flex; align-items: center; justify-content: center; border-radius: 6px; margin-right: 12px; overflow: hidden; }
/* RG logo image. Absolutely positioned over the letter mark so that
   when the image loads it fully covers the "RG" fallback text; when
   the file is missing the img is removed via onerror and only the
   letters remain visible. object-fit: contain preserves the native
   aspect ratio; small padding gives the artwork a bit of breathing
   room against the orange background.                              */
/* Logo + letter-mark fallback pairing.
   Default state: letters are display:none so they cannot leak on top of the
   PNG regardless of stacking context or cached CSS quirks. The <img> covers
   the whole .brand-mark box with a matching background fill so even
   transparent letterbox areas stay the brand accent color. If the PNG fails
   to load the inline onerror handler adds .brand-mark-no-image to the
   parent, which is the ONLY condition that un-hides the RG letters. */
.brand-mark .brand-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; box-sizing: border-box; background: var(--rg-accent); z-index: 1; }
.brand-mark .brand-mark-letters { display: none; }
.brand-mark.brand-mark-no-image .brand-mark-letters { display: block; position: relative; z-index: 0; }
.brand-name { font-weight: 600; }
.brand-sub { font-size: 0.75em; color: #94a3b8; }
.sidebar-footer { margin-top: auto; padding: 12px 16px; font-size: 0.75em; color: #94a3b8; }

.nav { display: flex; flex-direction: column; padding: 8px 0; }
.nav-link { display: flex; align-items: center; padding: 10px 16px; color: #cbd5e1; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: white; text-decoration: none; }
.nav-link.active { background: var(--rg-accent); color: white; }
.nav-icon { display: inline-block; width: 20px; margin-right: 10px; font-size: 0.85em; }

.content { flex: 1; display: flex; flex-direction: column; }
.topbar { background: white; border-bottom: 1px solid var(--line); padding: 10px 24px; text-align: right; color: var(--muted); font-size: 0.85em; }
.topbar-env::before { content: "\25CF "; color: #22c55e; }
.content-body { padding: 24px 32px; max-width: 1200px; }

/* --- Typography --- */
h1 { margin-top: 0; color: var(--rg-blue); font-weight: 600; }
h2 { color: var(--rg-blue); font-weight: 600; margin-top: 28px; }
.lead { font-size: 1.05em; color: var(--ink-sub); max-width: 800px; }
.muted { color: var(--muted); font-size: 0.9em; }

/* --- Tiles --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 24px 0 32px; }
.tile { display: block; padding: 18px 20px; background: white; border: 1px solid var(--line); border-radius: 6px; transition: box-shadow 0.15s, transform 0.15s; }
.tile:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); text-decoration: none; }
.tile-title { font-weight: 600; color: var(--rg-blue); margin-bottom: 6px; }
.tile-sub { color: var(--muted); font-size: 0.9em; }
.tile-primary { background: var(--rg-blue); border-color: var(--rg-blue-dark); }
.tile-primary .tile-title, .tile-primary .tile-sub { color: white; }
.tile-warn { border-color: var(--warn); background: var(--warn-bg); }
.tile-warn .tile-title { color: var(--warn); }

/* --- Chips --- */
.chip-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: white; border: 1px solid var(--line); padding: 4px 10px; border-radius: 12px; font-size: 0.85em; }

/* --- Card / page head --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 20px; margin-bottom: 20px; }

/* --- Form grid --- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-grid label { display: flex; flex-direction: column; font-size: 0.85em; color: var(--ink-sub); }
.form-grid label.full { grid-column: span 2; }
.form-grid label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 0.9em; }
.form-grid input[type=text], .form-grid input[type=number], .form-grid input:not([type=checkbox]), .form-grid textarea {
    padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 0.95em; margin-top: 4px;
}
.form-actions { margin-top: 14px; display: flex; gap: 8px; }

/* --- Buttons --- */
.btn { padding: 6px 14px; border: 1px solid var(--line); background: white; border-radius: 4px; font: inherit; cursor: pointer; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--rg-accent); color: white; border-color: var(--rg-accent); }
.btn-primary:hover { background: var(--rg-blue); }
.btn-sm { padding: 3px 10px; font-size: 0.85em; }

/* --- Tables --- */
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.92em; vertical-align: top; }
.grid th { background: #f8fafc; color: var(--ink-sub); font-weight: 600; font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.03em; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tr.row-review { background: var(--warn-bg); }
.grid td.actions { white-space: nowrap; }

/* --- Pills / toasts --- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.75em; margin-right: 4px; }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-off { background: #f3f4f6; color: var(--muted); }
.pill-tier { background: #eef2ff; color: var(--rg-blue); border: 1px solid #c7d2fe; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }

/* Layer pills (Task #26) — used on the Services admin grid and anywhere
   the UI wants to show which layer (MSP / MSSP / MXDR) a service belongs
   to. 1px border keeps the lighter backgrounds legible at small sizes.  */
.pill-layer-msp  { background: var(--layer-msp-bg);  color: var(--layer-msp);  border: 1px solid var(--layer-msp); }
.pill-layer-mssp { background: var(--layer-mssp-bg); color: var(--layer-mssp); border: 1px solid var(--layer-mssp); }
.pill-layer-mxdr { background: var(--layer-mxdr-bg); color: var(--layer-mxdr); border: 1px solid var(--layer-mxdr); }
.pill-layer-rmm  { background: var(--layer-rmm-bg);  color: var(--layer-rmm);  border: 1px solid var(--layer-rmm); }

/* Services admin "Included in client types" checkbox matrix — wraps into
   a responsive 3-column grid so the 10 eligible client-type codes don't
   force the editor to scroll. Pairs with .form-grid label.full in the
   editor card.                                                           */
.svc-type-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 12px;
    margin-top: 6px;
}
.svc-type-matrix label.inline { font-size: 0.88em; }

/* --- Proposals list filter row (Task #27) --- */
.proposals-filters { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.proposals-filters label.inline { flex-direction: column; align-items: stretch; font-size: 0.8em; color: var(--ink-sub); gap: 4px; }
.proposals-filters input, .proposals-filters select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 0.9em; }
.grid td.actions .btn-sm { margin-right: 4px; }
.toast { padding: 10px 14px; border-radius: 4px; margin-bottom: 14px; }
.toast-ok { background: var(--ok-bg); color: var(--ok); }
.toast-err { background: var(--err-bg); color: var(--err); }
.toast-warn { background: var(--warn-bg); color: var(--warn); }

/* --- Pricing Knobs admin page (Task #28 / #43) --------------------
   Staged-edit toolbar at top of /admin/pricing. Sits outside the
   grouped .card sections so the Save / Reset controls float above
   the data rather than getting buried inside one category.       */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dirty-count { font-size: 0.9em; }

.btn-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.btn-warn:hover { background: var(--warn); color: white; }
.btn-danger { background: var(--err); color: white; border-color: var(--err); }
.btn-danger:hover { background: var(--err-bg); color: var(--err); }

/* Phase 7 — promote-to-seed is a higher-stakes action than routine edit.
   Subtle accent draws the eye without alarming like warn/destructive. */
.btn-promote { background: #eef4fb; color: var(--rg-accent); border-color: var(--rg-accent); }
.btn-promote:hover { background: var(--rg-accent); color: white; }
.btn-promote:disabled { opacity: 0.5; cursor: not-allowed; }

.pill-info { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
.grid tr.row-dirty { background: #e0f2fe; }
.grid tr.row-review.row-dirty { background: #fef9c3; } /* review + dirty = blended warn tint */

/* --- Service Calculator sidebar (Task #30) --------------------------
   Right-rail live-pricing panel for the proposal builder. Designed to
   sit next to the NewProposal form at ~320px wide; shrinks gracefully
   on narrower viewports. Own .svc-calc- prefix so none of these rules
   collide with the rest of the form CSS.                              */
.svc-calc { position: sticky; top: 16px; padding: 16px; font-size: 0.92em; }
.svc-calc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.svc-calc-head h3 { margin: 0; color: var(--rg-blue); font-size: 1.05em; }

.svc-calc-terms { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.svc-calc-term { background: #f8fafc; border: 1px solid var(--line); border-radius: 4px; padding: 8px 6px; text-align: center; }
.svc-calc-term-primary { background: var(--rg-blue); border-color: var(--rg-blue-dark); color: white; }
.svc-calc-term-primary .svc-calc-term-sub { color: #cbd5e1; }
.svc-calc-term-label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.svc-calc-term-primary .svc-calc-term-label { color: #cbd5e1; }
.svc-calc-term-value { font-size: 1.15em; font-weight: 600; font-variant-numeric: tabular-nums; }
.svc-calc-term-sub { font-size: 0.7em; color: var(--muted); }

.svc-calc-tier { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 0.85em; }

.svc-calc-summary { border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: 10px; }
.svc-calc-summary-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.9em; }
.svc-calc-summary-row .num { font-variant-numeric: tabular-nums; }

.svc-calc-term-nav { display: flex; gap: 4px; margin-bottom: 6px; }
.svc-calc-term-tab { flex: 1; padding: 4px 6px; border: 1px solid var(--line); background: white; border-radius: 3px; font: inherit; font-size: 0.82em; color: var(--muted); cursor: pointer; }
.svc-calc-term-tab:hover { background: #f1f5f9; }
.svc-calc-term-tab.active { background: var(--rg-accent); color: white; border-color: var(--rg-accent); }

.svc-calc-lines { margin-bottom: 10px; }
.svc-calc-lines-grid { font-size: 0.82em; }
.svc-calc-lines-grid th, .svc-calc-lines-grid td { padding: 4px 6px; }
.svc-calc-group td { background: #f1f5f9; font-weight: 600; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-sub); }
.svc-calc-knob-link { display: inline-block; margin-left: 6px; font-size: 0.85em; }
.svc-calc-knob-link code { font-size: 0.85em; background: #eef2ff; color: var(--rg-blue); padding: 0 4px; }

.svc-calc-warnings { border-top: 1px solid var(--line); padding-top: 8px; }
.svc-calc-warnings h4 { margin: 0 0 6px 0; color: var(--warn); font-size: 0.88em; text-transform: uppercase; letter-spacing: 0.05em; }
.svc-calc-warning-group { margin-bottom: 8px; }
.svc-calc-warning-group ul { margin: 4px 0 0 0; padding-left: 18px; font-size: 0.85em; }
.svc-calc-warning-group li { margin-bottom: 2px; }

/* Help pages — How to Use, How It Works. Added 2026-04-23.
   Keeps the two docs pages visually consistent with the rest of the app
   (white cards on the grey page background, RG blue headings). */
.help-section { max-width: 900px; margin: 28px 0; padding: 24px 28px; background: white; border: 1px solid var(--line); border-radius: 6px; }
.help-section h2 { color: var(--rg-blue); margin-top: 0; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.help-section h3 { color: var(--rg-blue-dark); margin: 22px 0 8px; font-size: 1.05em; }
.help-section p { line-height: 1.55; color: var(--ink); }
.help-section ul, .help-section ol { line-height: 1.55; max-width: 820px; }
.help-section li { margin-bottom: 4px; }

.help-callout { background: #eef6fb; border-left: 3px solid var(--rg-accent); padding: 10px 14px; margin: 12px 0; font-size: 0.95em; color: var(--ink-sub); }

.help-formula { font-size: 1.15em; text-align: center; padding: 14px; background: #f1f5f9; border-radius: 6px; color: var(--rg-blue); letter-spacing: 0.03em; }

.help-code { background: #1f2937; color: #f1f5f9; padding: 12px 16px; border-radius: 4px; font-family: 'Consolas', 'Courier New', monospace; font-size: 0.9em; overflow-x: auto; }

.help-kv { list-style: none; padding: 0; margin: 8px 0; max-width: 700px; }
.help-kv li { padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 0.95em; }
.help-kv li:last-child { border-bottom: none; }
.help-kv code { background: #eef2ff; color: var(--rg-blue); padding: 1px 6px; border-radius: 3px; font-size: 0.9em; }

.help-table { width: 100%; max-width: 700px; border-collapse: collapse; margin: 10px 0; font-size: 0.95em; }
.help-table th, .help-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.help-table th { background: #f7f8fa; color: var(--rg-blue); font-weight: 600; }
.help-table code { background: #eef2ff; color: var(--rg-blue); padding: 1px 6px; border-radius: 3px; font-size: 0.9em; }

.help-dl { margin: 10px 0; }
.help-dl dt { color: var(--rg-blue-dark); font-weight: 600; margin-top: 14px; }
.help-dl dd { margin: 4px 0 0 0; padding-left: 16px; color: var(--ink-sub); line-height: 1.5; }

.help-footer { max-width: 900px; color: var(--muted); font-size: 0.9em; font-style: italic; padding: 14px 0; border-top: 1px solid var(--line); }

.nav-divider { height: 1px; margin: 10px 16px; background: rgba(255,255,255,0.1); }

/* Margin Analyzer — /admin/margin-analyzer. Two-column layout: scenario input
   on the left, breakdown on the right. Added 2026-04-23. */
.ma-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; margin-top: 20px; align-items: start; }
@media (max-width: 1024px) { .ma-layout { grid-template-columns: 1fr; } }

.ma-input { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; position: sticky; top: 16px; }
.ma-input h2 { color: var(--rg-blue); margin: 0 0 12px; font-size: 1.1em; }
.ma-input h3 { color: var(--rg-blue-dark); margin: 16px 0 6px; font-size: 0.92em; text-transform: uppercase; letter-spacing: 0.04em; }

.ma-field { display: block; margin-bottom: 12px; }
.ma-field > span { display: block; font-size: 0.82em; color: var(--muted); margin-bottom: 3px; }
.ma-field select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: white; }

.ma-knobs-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding: 6px 8px; background: #f5f7fb; border: 1px solid var(--line); border-radius: 4px; font-size: 0.8em; color: var(--muted); }
.ma-knobs-status button { padding: 3px 8px; font-size: 0.8em; flex: 0 0 auto; }

.ma-presets { display: flex; gap: 6px; margin-bottom: 14px; }
.ma-preset { flex: 1; padding: 5px 8px; border: 1px solid var(--rg-accent); background: white; color: var(--rg-accent); border-radius: 4px; font: inherit; font-size: 0.85em; cursor: pointer; }
.ma-preset:hover { background: var(--rg-accent); color: white; }
.ma-preset-clear { border-color: var(--muted); color: var(--muted); }
.ma-preset-clear:hover { background: var(--muted); color: white; }

.ma-counts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.ma-counts-grid label { display: block; font-size: 0.8em; }
.ma-counts-grid label > span { display: block; color: var(--muted); margin-bottom: 2px; }
.ma-counts-grid input { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; font-variant-numeric: tabular-nums; }

.ma-profile-knobs { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.85em; }
.ma-profile-knobs dl { margin: 0; }
.ma-profile-knobs dt { font-weight: 600; color: var(--ink-sub); margin-top: 8px; }
.ma-profile-knobs dd { margin: 2px 0 0; color: var(--ink); }
.ma-profile-knobs code { background: #eef2ff; color: var(--rg-blue); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.ma-tuning-link { margin-top: 10px; font-size: 0.88em; color: var(--muted); }

.ma-output { min-width: 0; }
.ma-output > section { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 18px 22px; margin-bottom: 18px; }
.ma-output h2 { color: var(--rg-blue); margin: 0 0 14px; font-size: 1.15em; padding-bottom: 8px; border-bottom: 2px solid var(--line); }

.ma-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.ma-summary-cell { padding: 12px 14px; background: #f7f8fa; border-radius: 4px; border-left: 3px solid var(--line); }
.ma-summary-cell span { display: block; }
.ma-summary-label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 3px; }
.ma-summary-value { font-size: 1.5em; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ma-summary-sub { font-size: 0.78em; color: var(--muted); margin-top: 2px; font-style: italic; }
.ma-margin-healthy { background: var(--ok-bg); border-left-color: var(--ok); }
.ma-margin-healthy .ma-summary-value { color: var(--ok); }
.ma-margin-warn { background: var(--warn-bg); border-left-color: var(--warn); }
.ma-margin-warn .ma-summary-value { color: var(--warn); }
.ma-margin-thin { background: var(--err-bg); border-left-color: var(--err); }
.ma-margin-thin .ma-summary-value { color: var(--err); }

.ma-term-compare { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.9em; color: var(--ink-sub); padding-top: 10px; border-top: 1px solid var(--line); }
.ma-term-compare strong { color: var(--ink); }
.ma-term-note { margin-left: auto; font-size: 0.85em; color: var(--muted); }

.ma-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.ma-table th { text-align: left; padding: 8px 10px; background: #f7f8fa; color: var(--rg-blue); font-weight: 600; border-bottom: 2px solid var(--line); }
.ma-table th.num { text-align: right; }
.ma-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ma-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ma-table tbody tr:hover { background: #fafbfc; }
.ma-knob-ref code { background: #eef2ff; color: var(--rg-blue); font-size: 0.8em; padding: 1px 4px; border-radius: 3px; }
.ma-total-row td { background: #f1f5f9; font-weight: 600; }

.ma-onboarding-note { font-size: 0.88em; color: var(--muted); margin-bottom: 10px; }

.ma-warnings { background: var(--warn-bg) !important; border-color: var(--warn) !important; }
.ma-warnings h2 { color: var(--warn); }
.ma-warnings ul { margin: 0; padding-left: 20px; font-size: 0.9em; }
.ma-warnings li { margin-bottom: 4px; }

.svc-calc-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 0.8em; }

/* Two-column proposal builder layout: form on the left, sidebar on the
   right rail. Fires only when both children are present, so pages without
   a .svc-calc peer (legacy forms) keep their full-width layout. */
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: flex-start; }
@media (max-width: 960px) {
  .builder-grid { grid-template-columns: 1fr; }
  .svc-calc { position: static; }
}

/* Soft-delete row styling (B3-SERVICE-DELETE, Phase 3 plan 03-02).
   Retired services remain visible in the admin grid only when "Show retired"
   is on; the row fades to ~half opacity and the service name is struck
   through so it reads at a glance as out-of-catalog. */
.row-retired { opacity: 0.55; }
.row-retired td strong { text-decoration: line-through; }

/* Phase 5 — Client Type Copy editor. The form-grid full-width labels
   already exist; we just need a flex header inside the label so the
   per-field Reset button sits next to the field title. */
.ct-copy-editor .field-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
label.full .field-head { /* applies even without the page-scoped wrapper */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
label.full textarea {
    width: 100%;
    font-family: var(--font-mono, ui-monospace, "Cascadia Code", Consolas, monospace);
    font-size: 0.95rem;
    line-height: 1.45;
}

/* Phase 5-02 — Token autocomplete + validation warning + preview */
.token-input-wrap { position: relative; }

.token-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    margin: 0.125rem 0 0 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d4d4d8);
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    min-width: 240px;
    max-height: 260px;
    overflow-y: auto;
}
.token-autocomplete li { margin: 0; padding: 0; }
.token-option {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-mono, ui-monospace, Consolas, monospace);
    font-size: 0.9rem;
    cursor: pointer;
}
.token-option:hover { background: var(--hover, #f4f4f5); }

.token-warning {
    margin-top: 0.35rem;
    padding: 0.4rem 0.6rem;
    background: #fff7e6;
    border-left: 3px solid #f59e0b;
    font-size: 0.9rem;
}
.token-warning code {
    background: rgba(245,158,11,0.15);
    padding: 0 0.25rem;
    border-radius: 2px;
}

.token-preview {
    margin-top: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: var(--muted-surface, #f9fafb);
    border: 1px dashed var(--border, #d4d4d8);
    border-radius: 4px;
}
.token-preview-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}
.token-preview pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.95rem;
}

/* Phase 6 — Client Type detail page tab strip (06-01 Task 4).
   ?tab=properties (default) / ?tab=copy. One URL per CT, unified mental
   model. Pill-button row above the form card. */
.ct-tabs {
    display: flex;
    gap: 4px;
    margin: 16px 0 12px;
    border-bottom: 2px solid var(--line, #e5e7eb);
}
.ct-tab {
    padding: 8px 14px;
    color: var(--ink-sub, #6b7280);
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
}
.ct-tab:hover { background: rgba(0,0,0,0.04); color: var(--ink, #111827); }
.ct-tab-active {
    color: var(--rg-blue, #1d4ed8);
    border-bottom-color: var(--rg-blue, #1d4ed8);
    font-weight: 600;
}

/* === Phase 8 — Add-On Calculator (R16 D-12) ===
   Interactive-chrome classes applied by AddOnCalculator.razor.
   @media print hides picker chrome + nav rails and renders a clean budget sheet.
   Class namespace .calc-* to prevent collision with existing styles. */
.calc-search       { width: 100%; max-width: 24rem; padding: 6px 8px; margin-bottom: 8px; }
.calc-qty          { width: 5rem; text-align: right; padding: 4px 6px; }
.calc-clear-all    { font-size: 0.85rem; color: var(--ink-sub, #6b7280); text-decoration: underline; }
.calc-row-remove   { background: none; border: none; cursor: pointer; color: var(--ink-sub, #6b7280); font-size: 1rem; }
.calc-rows-table   { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.calc-rows-table th,
.calc-rows-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line, #e5e7eb); }
.calc-rows-table th { font-weight: 600; }
.calc-totals       { display: flex; gap: 24px; padding-top: 12px; border-top: 2px solid var(--line, #e5e7eb); }
.calc-total-block  { flex: 1; }
.calc-total-amount { font-size: 1.4rem; font-weight: 600; margin: 4px 0 0; }
.calc-picker-row   { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; }
.calc-checkbox-col { display: inline-block; }
.calc-cadence-warn { display: inline-block; margin-top: 2px; font-size: 0.8rem;
                     color: #92400e; background: #fef3c7;
                     padding: 2px 6px; border-radius: 4px; }
.row-between       { display: flex; justify-content: space-between; align-items: baseline; }

@media print {
    .sidebar,
    .topbar,
    .calc-search,
    .calc-clear-all,
    .calc-checkbox-col,
    .calc-row-remove   { display: none !important; }

    .content           { display: block; }
    .content-body      { padding: 0; max-width: none; }
    .card              { border: none; padding: 8px 0; margin-bottom: 12px; box-shadow: none; }
    .calc-totals       { border-top: 2px solid #000; padding-top: 8px; }
}
