/* ADVIRTUOSO Tracker — colours are the validated data-viz reference palette. */

:root {
  color-scheme: light;
  --plane:          #f9f9f7;
  --surface:        #fcfcfb;
  --surface-sunk:   #f2f1ed;
  --text:           #0b0b0b;
  --text-2:         #52514e;
  --muted:          #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --ring:           rgba(42, 120, 214, 0.35);

  --series-1:       #2a78d6;
  --series-2:       #eb6834;
  --series-3:       #1baf7a;

  --good:           #0ca30c;
  --good-text:      #006300;
  --warning:        #fab219;
  --serious:        #ec835a;
  --critical:       #d03b3b;

  --radius:         10px;
  --radius-sm:      6px;
  --shadow:         0 1px 2px rgba(11, 11, 11, .06), 0 8px 24px rgba(11, 11, 11, .06);
  --sans:           system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-sunk: #232322;
    --text:         #ffffff;
    --text-2:       #c3c2b7;
    --muted:        #898781;
    --grid:         #2c2c2a;
    --baseline:     #383835;
    --border:       rgba(255, 255, 255, 0.10);
    --ring:         rgba(57, 135, 229, 0.45);
    --series-1:     #3987e5;
    --series-2:     #d95926;
    --series-3:     #199e70;
    --good-text:    #0ca30c;
    --shadow:       0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:        #0d0d0d;
  --surface:      #1a1a19;
  --surface-sunk: #232322;
  --text:         #ffffff;
  --text-2:       #c3c2b7;
  --muted:        #898781;
  --grid:         #2c2c2a;
  --baseline:     #383835;
  --border:       rgba(255, 255, 255, 0.10);
  --ring:         rgba(57, 135, 229, 0.45);
  --series-1:     #3987e5;
  --series-2:     #d95926;
  --series-3:     #199e70;
  --good-text:    #0ca30c;
  --shadow:       0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ------------------------------------------------------------- chrome --- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 9px; font-weight: 650; letter-spacing: -0.02em; }
.brand small { font-weight: 500; color: var(--muted); letter-spacing: 0; }

.tabs { display: flex; gap: 2px; margin-left: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.tabs button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 500; color: var(--text-2);
  padding: 7px 13px; border-radius: var(--radius-sm);
  flex: none; white-space: nowrap;   /* keep full label; the strip scrolls instead of clipping */
}
.tabs button:hover { background: var(--surface-sunk); color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--surface-sunk); color: var(--text); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-menu { display: flex; align-items: center; gap: 8px; }
.user-menu .who { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.user-menu .who b { color: var(--text); font-weight: 600; }

/* Sign-in gate — hides the whole app until /api/me succeeds. */
body.locked .topbar, body.locked main { display: none; }
#login-root {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--plane);
}
.login-card {
  width: min(360px, 100%);
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-brand { font-weight: 650; font-size: 18px; letter-spacing: -0.02em; }
.login-brand small { font-weight: 500; color: var(--muted); }
.login-sub { margin: -6px 0 4px; color: var(--muted); }
.login-card .field { font-size: 12.5px; color: var(--text-2); }
.login-card input { padding: 9px 11px; }
.login-error { color: var(--critical); font-size: 12.5px; min-height: 1.1em; }
.login-card button { margin-top: 2px; justify-content: center; padding: 9px; }

button, select, input, textarea { font: inherit; color: inherit; }

.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-sunk); }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.btn-primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--series-1); }
.btn-danger { color: var(--critical); }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-icon { padding: 6px 8px; }

/* -------------------------------------------------------------- layout -- */

main { padding: 18px 20px 64px; max-width: 1560px; margin: 0 auto; }

/* One filter row scoping every view beneath it. */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filters select, .filters input {
  padding: 6px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  max-width: 190px;
}
.filters input[type="search"] { min-width: 210px; }
.filters select:focus-visible, .filters input:focus-visible { outline: 2px solid var(--ring); outline-offset: -1px; }
.filters .spacer { margin-left: auto; }
.filter-count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.grid { display: grid; gap: 14px; }
.grid-kpi  { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-2    { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); }
.grid-3    { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
section + section, .grid + .grid, .grid + section { margin-top: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 4px;
}
.card-head h3 { font-size: 14px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .tools { margin-left: auto; display: flex; gap: 4px; align-items: center; }

/* ---------------------------------------------------------- stat tiles -- */

.kpi { display: flex; flex-direction: column; gap: 3px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 27px; font-weight: 620; letter-spacing: -0.025em; line-height: 1.15; }
.kpi .foot { color: var(--muted); font-size: 12.5px; }
.kpi .foot strong { color: var(--text-2); font-weight: 600; }
.delta-up   { color: var(--good-text); font-weight: 600; }
.delta-down { color: var(--critical); font-weight: 600; }
.due-soon   { color: var(--warning); font-weight: 600; }

/* -------------------------------------------------------------- charts -- */

.chart-wrap { width: 100%; overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; }
svg.chart text { font-family: var(--sans); }
.axis-label { fill: var(--muted); font-size: 11px; }
.axis-label.tabular { font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--baseline); stroke-width: 1; }
.mark-label { fill: var(--text-2); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hit { fill: transparent; cursor: pointer; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.tooltip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  transition: opacity .09s;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12.5px;
  max-width: 280px;
}
.tooltip .tt-title { font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; gap: 12px; align-items: center; }
.tooltip .tt-row span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.tooltip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }

/* Table twin for every chart — the WCAG-clean equivalent. */
.chart-table { display: none; }
.card.as-table .chart-wrap, .card.as-table .legend { display: none; }
.card.as-table .chart-table { display: block; }

/* -------------------------------------------------------------- tables -- */

.table-wrap { width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; white-space: nowrap; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); color: var(--text-2);
  font-weight: 600; font-size: 12px; letter-spacing: .01em;
  border-bottom: 1px solid var(--baseline); cursor: pointer; user-select: none;
}
thead th.static { cursor: default; }
thead th .arrow { color: var(--muted); font-size: 10px; }
tbody tr { border-bottom: 1px solid var(--grid); }
tbody tr:hover { background: var(--surface-sunk); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.strong { font-weight: 600; }
.muted { color: var(--muted); }
.wrap-cell { white-space: normal; min-width: 180px; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }

/* --------------------------------------------------------------- chips -- */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface-sunk); color: var(--text-2);
}
.chip i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
/* Status colour is always paired with its label, never carried by hue alone. */
.chip[data-status="QUOTE"]         i { background: var(--muted); }
.chip[data-status="OPEN"]          i { background: var(--series-1); }
.chip[data-status="IN PRODUCTION"] i { background: var(--series-1); }
.chip[data-status="SHIPPED"]       i { background: var(--series-3); }
.chip[data-status="CLOSED"]        i { background: var(--good); }
.chip[data-status="ON HOLD"]       i { background: var(--warning); }
.chip[data-status="CANCELLED"]     i { background: var(--critical); }
/* Pipeline statuses are grouped by kind, not their raw WAR colour, so the dot
   stays readable and consistent in both themes; the name always carries meaning. */
.chip[data-kind="active"] i { background: var(--series-1); }
.chip[data-kind="hold"]   i { background: var(--warning); }
.chip[data-kind="won"]    i { background: var(--good); }
.chip[data-kind="lost"]   i { background: var(--muted); }

/* Deal activity timeline */
.add-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.add-note textarea {
  flex: 1; min-height: 40px; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical;
}
.add-note textarea:focus-visible { outline: 2px solid var(--ring); outline-offset: -1px; }
.add-note .btn { flex: none; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-note { padding: 9px 0 9px 14px; border-left: 2px solid var(--grid); position: relative; }
.tl-note::before {
  content: ""; position: absolute; left: -5px; top: 13px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--series-1); box-shadow: 0 0 0 2px var(--surface);
}
.tl-note + .tl-note { border-top: 0; }
.tl-meta { color: var(--muted); font-size: 12px; }
.tl-meta b { color: var(--text-2); font-weight: 600; }
.tl-body { font-size: 13px; white-space: pre-wrap; margin-top: 2px; }

/* Product file / video reference lists */
.file-list { display: flex; flex-direction: column; gap: 7px; }
.file-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-sunk); font-size: 13px;
}
.file-row a { color: var(--series-1); text-decoration: none; word-break: break-all; }
.file-row a:hover { text-decoration: underline; }
.file-row .muted { font-size: 12px; }
.file-row { align-items: flex-start; }
.file-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.file-row .btn-danger.btn-sm { margin-left: auto; align-self: center; }
.file-ic { font-size: 22px; width: 40px; text-align: center; flex: none; }

/* Upload / add-link controls under each media list. */
.uploader { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.uploader select, .uploader input {
  font: inherit; font-size: 13px; padding: 6px 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.uploader input[type="url"], .uploader input[type="text"] { flex: 1; min-width: 150px; }
.uploader label.btn { cursor: pointer; }
.main-flag { color: var(--good, #2e7d32); font-size: 11.5px; font-weight: 600; }
.btn-link { background: none; border: 0; color: var(--series-1); font: inherit; font-size: 11.5px; cursor: pointer; padding: 0; text-decoration: underline; }
.btn-link:hover { opacity: .8; }

/* Editable agent suggestion (deal note / task) before approving. */
.sug-edit-body { width: 100%; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); resize: vertical; margin: 4px 0; }
.sug-task-fields { display: flex; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.sug-task-fields label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.sug-task-fields input { font: inherit; font-size: 12.5px; padding: 4px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.sug-hint { margin-right: auto; font-size: 11.5px; font-style: italic; }

/* Company logo editor. */
.logo-edit { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview {
  width: 210px; min-height: 74px; border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; padding: 8px; background: #fff;
}
.logo-preview img { max-width: 100%; max-height: 90px; object-fit: contain; }

/* Send-email dialog — layers above the drawer (overlay is z-index 200). */
.send-overlay { z-index: 210; }
.send-dialog { max-width: 520px; }

.file-thumb-link { flex: none; line-height: 0; }
.file-thumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
}

/* Contact editor (one block per person) */
.contact-edit {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px; margin-bottom: 9px; background: var(--surface-sunk);
}
.contact-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.contact-edit .field span { font-size: 11.5px; color: var(--muted); }
.contact-edit .contact-remove { margin-top: 9px; color: var(--critical); }
#add-contact { margin-top: 2px; }

/* Contact-suggestion review queue */
.tab-badge {
  display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 2px;
  background: var(--series-2); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-align: center; line-height: 17px;
}
.card.suggestions { border-left: 3px solid var(--series-2); }
.suggestion { padding: 11px 0; border-top: 1px solid var(--grid); }
.suggestion:first-of-type { border-top: 0; }
.sug-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sug-changes { margin: 7px 0; display: flex; flex-direction: column; gap: 3px; }
.diff { font-size: 13px; }
.diff-f { display: inline-block; min-width: 84px; color: var(--muted); font-size: 12px; }
.diff-from { color: var(--critical); text-decoration: line-through; }
.diff-to { color: var(--good-text); font-weight: 600; }
.sug-why { font-size: 12px; margin-bottom: 7px; }
.sug-actions { display: flex; gap: 7px; }
pre.code {
  background: var(--surface-sunk); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: 4px 0 12px;
}

.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.flag[data-level="critical"] { color: var(--critical); }
.flag[data-level="serious"]  { color: var(--serious); }
.flag[data-level="warning"]  { color: var(--warning); }
.flags { display: flex; flex-direction: column; gap: 2px; }

.bar-mini {
  position: relative; height: 6px; width: 90px; border-radius: 3px;
  background: var(--surface-sunk); overflow: hidden; display: inline-block; vertical-align: middle;
}
.bar-mini > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--series-1); }
.bar-mini.paid > i { background: var(--good); }

/* --------------------------------------------------------- pipeline ----- */

/* List | Board segmented switch (Pipeline & Orders tabs). */
.subview-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.subview-toggle .seg-btn {
  border: 0; background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 12.5px; line-height: 1; padding: 6px 12px; cursor: pointer;
}
.subview-toggle .seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.subview-toggle .seg-btn.on { background: var(--series-1); color: #fff; }
.subview-toggle .seg-btn:not(.on):hover { background: var(--surface-sunk); color: var(--text); }
.vendor-stats { margin: .1rem 0 .5rem; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.column { flex: 0 0 268px; background: var(--surface-sunk); border-radius: var(--radius); padding: 10px; }
.column-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; padding: 0 2px; }
.column-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.column-head .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.column-head .val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.deal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; margin-bottom: 7px; cursor: pointer;
}
.deal:hover { border-color: var(--baseline); }
.deal-top { display: flex; align-items: baseline; gap: 8px; }
.deal-top b { font-size: 13px; }
.deal-top .amt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.deal .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.deal .dates { color: var(--text-2); font-size: 11.5px; margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }
.deal .dates b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- modal -- */

/* Freeze the page behind an open drawer so wheel scrolling stays in the drawer. */
body:has(#modal-root:not(:empty)) { overflow: hidden; }

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 11, 11, .45);
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(660px, 100%); height: 100%; overflow-y: auto;
  background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.drawer-head {
  position: sticky; top: 0; z-index: 3; background: var(--surface);
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { font-size: 16px; }
.drawer-head .tools { margin-left: auto; display: flex; gap: 6px; }
.drawer-body { padding: 16px 18px 26px; }
.drawer-foot {
  position: sticky; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--border); padding: 12px 18px;
  display: flex; gap: 8px; align-items: center;
}
.drawer-foot .spacer { margin-left: auto; }

fieldset { border: 0; padding: 0; margin: 0 0 20px; }
fieldset > legend {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 0; margin-bottom: 9px;
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
label.field.wide { grid-column: 1 / -1; }
label.field input, label.field select, label.field textarea {
  padding: 7px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 100%;
}
label.field input:focus-visible, label.field select:focus-visible, label.field textarea:focus-visible {
  outline: 2px solid var(--ring); outline-offset: -1px;
}
label.field textarea { resize: vertical; min-height: 62px; }
label.field input[type="number"] { font-variant-numeric: tabular-nums; }

.calc {
  background: var(--surface-sunk); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-bottom: 20px;
}
.calc-row { display: flex; gap: 12px; padding: 3px 0; font-size: 13px; }
.calc-row span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-row.total { border-top: 1px solid var(--baseline); margin-top: 5px; padding-top: 7px; font-size: 14px; }
.calc-note { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.45; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  z-index: 120; opacity: 0; transition: opacity .16s, transform .16s;
  background: var(--text); color: var(--plane);
  padding: 9px 16px; border-radius: 999px; font-weight: 500; font-size: 13px;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--warning); border-radius: var(--radius);
  font-size: 13px; color: var(--text-2);
}
.banner b { color: var(--text); }
.banner .btn { margin-left: auto; flex: none; }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 14px 12px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Users & access (owner-only admin screen) */
td.nowrap { white-space: nowrap; }
.num .btn + .btn { margin-left: 6px; }
tr.u-editing td { background: var(--surface-2, rgba(127, 127, 127, .06)); }
.user-add, .user-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 4px 2px 2px; }
.user-add label, .user-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.user-add input, .user-add select, .user-edit input, .user-edit select {
  padding: 7px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 180px;
}
.user-add input:focus-visible, .user-add select:focus-visible,
.user-edit input:focus-visible, .user-edit select:focus-visible { outline: 2px solid var(--ring); outline-offset: -1px; }
.role-legend { margin: 14px 2px 2px; padding-left: 18px; color: var(--text-2); font-size: 12.5px; line-height: 1.7; }
.role-legend b { color: var(--text); }

/* Leads — strategic-tier badges */
.tier { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 19px; padding: 0 5px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; background: #8a8a86; }
.tier-A { background: #2e7d32; }
.tier-B { background: #1565c0; }
.tier-C { background: #b8860b; }
.cap-note { padding: 10px 14px; }
.btn.on { background: var(--surface-sunk); border-color: var(--series-1); }

/* Manage pipeline stages */
.stage-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row.stage-hidden .stage-name,
.stage-row.stage-hidden .stage-kind,
.stage-row.stage-hidden .stage-count { opacity: .5; }
.stage-move { display: inline-flex; gap: 2px; }
.stage-move .btn-icon { padding: 2px 5px; font-size: 10px; line-height: 1; }
.stage-name { flex: 1 1 auto; min-width: 0; padding: 6px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.stage-kind { padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.stage-count { font-size: 12px; white-space: nowrap; min-width: 52px; text-align: right; }
.stage-show { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.stage-add { margin-top: 16px; }
