/* =====================================================================
   AUREX "Porcelain & Obsidian" theme — loaded AFTER styles.css.
   Porcelain pages, obsidian bars, brushed-gold accents.
   Display type: Instrument Serif. Interface type: Manrope.
   Everything here is a re-skin: no class, id or data attribute that the app or its tests rely on is renamed.
===================================================================== */

/* ---------- tokens ---------- */
[data-mode="admin"], [data-mode="employee"] {
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #F7F6F3;
  --surface-3: #F1EFEA;
  --ink: #141518;
  --text: #26272C;
  --muted: #5C5E66;
  --muted-2: #6B6D74;
  --line: #E6E4DE;
  --line-2: #EFEDE8;
  --field-line: #D9D6CF;
  --hover: #F1EFEA;
  --seg: #E9E7E2;
  --shadow-1: 0 1px 2px rgba(17,18,20,.04);
  --shadow-2: 0 10px 30px rgba(17,18,20,.10), 0 2px 6px rgba(17,18,20,.06);
  --shadow-3: 0 24px 60px rgba(17,18,20,.22);
  --dark: #141518; --dark-hover: #2A2B31; --on-dark: #FFFFFF;
  --obsidian: #111214; --obsidian-2: #17181B; --obsidian-3: #1F2024; --obsidian-line: #2A2B31;
  --gold: #C6A15B; --gold-2: #B8913F; --gold-ink: #8A6A2E; --gold-deep: #7A5C24;
  --gold-soft: #F5EEDF; --gold-wash: #FBF7EE; --gold-line: #EFE3C8; --gold-pale: #E2C58A;
  --green: #1D6B4A; --green-bg: #E5F2EA; --blue: #2B5592; --blue-bg: #E7EEF8;
  --red: #A6281D; --red-bg: #FBE7E5; --violet: #5B3F8C; --violet-bg: #EDE8F5;
  --amber: #9A4A07; --amber-bg: #FDF1E3; --inkc: #4A4C53; --inkc-bg: #EEEDE9;
  --chart-1: #26272C; --chart-2: #B8913F; --chart-3: #C9C4B8; --chart-4: #2B5592; --chart-5: #1D6B4A; --chart-6: #A6281D;

  --accent: #8A6A2E;
  --accent-ink: #17181B;
  --accent2: #141518; --accent2-ink: #FFFFFF;
  --primary: #B8913F;
  --accent-contrast: #FFFFFF;
  --focus: #B8913F;
  --warn-bg: #FDF3E0; --warn-border: #EBCB8B; --warn-text: #7A5300;
  --metric-danger: #A6281D; --metric-warning: #9A4A07; --metric-teal: #1D6B4A;
  --metric-green: #1D6B4A; --metric-blue: #2B5592; --metric-purple: #5B3F8C;

  --radius-sm: 10px; --radius-md: 14px; --radius-lg: 18px;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --body-font: var(--sans);
  --display-font: var(--sans);
  --font-admin-body: var(--sans); --font-admin-display: var(--sans); --font-employee: var(--sans);
}
[data-mode="employee"] {
  --accent: #17181B; --accent-ink: #17181B; --accent2: #C6A15B; --accent2-ink: #2B2100;
}

/* dark: same palette family, driven by the user's theme choice */
@media (prefers-color-scheme: dark) {
  [data-mode]:not([data-theme="light"]) {
    --bg: #0E0F11; --surface: #16171A; --surface-2: #1B1C20; --surface-3: #212227; --seg: #23242A;
    --ink: #F3EFE7; --text: #E4E0D8; --muted: #A9A6A0; --muted-2: #9A978F;
    --line: #2A2B30; --line-2: #26272C; --field-line: #34353B; --hover: #23242A;
    --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 12px 32px rgba(0,0,0,.5); --shadow-3: 0 24px 60px rgba(0,0,0,.6);
    --dark: #E9E2D3; --dark-hover: #FFFFFF; --on-dark: #141518;
    --obsidian: #0A0B0C; --obsidian-2: #121316; --obsidian-3: #1A1B1F; --obsidian-line: #222328;
    --gold-ink: #D9B873; --gold-deep: #E2C58A; --gold-soft: #2A2418; --gold-wash: #1E1A12; --gold-line: #3A3020;
    --green: #8BD3AC; --green-bg: #17291F; --blue: #9DB8E6; --blue-bg: #17233A; --red: #F1A097; --red-bg: #3A1A17;
    --violet: #C4B1E8; --violet-bg: #251E33; --amber: #F2B676; --amber-bg: #33220F; --inkc: #C9C6BF; --inkc-bg: #26272C;
    --chart-1: #D8D2C4; --chart-2: #C6A15B; --chart-3: #4A4B52; --chart-4: #7FA0D6; --chart-5: #6CC096; --chart-6: #E0786D;
    --accent: #D9B873; --accent-ink: #E9E2D3; --accent2: #E9E2D3; --accent2-ink: #2B2100; --primary: #C6A15B; --accent-contrast: #141518;
    --warn-bg: rgba(224,166,79,.14); --warn-border: rgba(224,166,79,.4); --warn-text: #E0A64F;
    --metric-danger: #F1A097; --metric-warning: #F2B676; --metric-teal: #8BD3AC; --metric-green: #8BD3AC; --metric-blue: #9DB8E6; --metric-purple: #C4B1E8;
  }
  [data-mode="employee"]:not([data-theme="light"]) { --accent2: #C6A15B; --accent2-ink: #2B2100; --accent: #D9B873; }
}
[data-mode][data-theme="dark"] {
  --bg: #0E0F11; --surface: #16171A; --surface-2: #1B1C20; --surface-3: #212227; --seg: #23242A;
  --ink: #F3EFE7; --text: #E4E0D8; --muted: #A9A6A0; --muted-2: #9A978F;
  --line: #2A2B30; --line-2: #26272C; --field-line: #34353B; --hover: #23242A;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 12px 32px rgba(0,0,0,.5); --shadow-3: 0 24px 60px rgba(0,0,0,.6);
  --dark: #E9E2D3; --dark-hover: #FFFFFF; --on-dark: #141518;
  --obsidian: #0A0B0C; --obsidian-2: #121316; --obsidian-3: #1A1B1F; --obsidian-line: #222328;
  --gold-ink: #D9B873; --gold-deep: #E2C58A; --gold-soft: #2A2418; --gold-wash: #1E1A12; --gold-line: #3A3020;
  --green: #8BD3AC; --green-bg: #17291F; --blue: #9DB8E6; --blue-bg: #17233A; --red: #F1A097; --red-bg: #3A1A17;
  --violet: #C4B1E8; --violet-bg: #251E33; --amber: #F2B676; --amber-bg: #33220F; --inkc: #C9C6BF; --inkc-bg: #26272C;
  --chart-1: #D8D2C4; --chart-2: #C6A15B; --chart-3: #4A4B52; --chart-4: #7FA0D6; --chart-5: #6CC096; --chart-6: #E0786D;
  --accent: #D9B873; --accent-ink: #E9E2D3; --accent2: #E9E2D3; --accent2-ink: #2B2100; --primary: #C6A15B; --accent-contrast: #141518;
  --warn-bg: rgba(224,166,79,.14); --warn-border: rgba(224,166,79,.4); --warn-text: #E0A64F;
  --metric-danger: #F1A097; --metric-warning: #F2B676; --metric-teal: #8BD3AC; --metric-green: #8BD3AC; --metric-blue: #9DB8E6; --metric-purple: #C4B1E8;
}
[data-mode="employee"][data-theme="dark"] { --accent2: #C6A15B; --accent2-ink: #2B2100; --accent: #D9B873; }

/* ---------- base ---------- */
body { font-family: var(--sans); font-size: 14px; line-height: 1.45; text-rendering: optimizeLegibility; }
::selection { background: var(--gold-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--sans); letter-spacing: -.005em; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; margin-bottom: 4px; }

/* ---------- top bar: obsidian ---------- */
.topbar, [data-mode="admin"] .topbar, [data-mode="employee"] .topbar {
  background: var(--obsidian); color: #F3EBDD; border-bottom: 1px solid var(--obsidian-line);
}
.topbar .icon-btn { border-color: rgba(255,255,255,.2); border-radius: 10px; }
.demo-badge { background: rgba(198,161,91,.16); border-color: rgba(198,161,91,.4); color: var(--gold-pale); }
.signed-in-role { color: var(--gold-pale); }
.avatar { background: var(--gold); color: var(--on-gold, #1A1305); }
.notif-badge { background: var(--red); color: var(--on-red, #fff); box-shadow: 0 0 0 2px var(--obsidian); }

/* ---------- sidebar: same menu, new colours ---------- */
[data-mode="admin"] .sidebar { background: var(--surface); border-right: 1px solid var(--line); }
[data-mode="admin"] .side-link { font-weight: 600; border-radius: 10px; color: var(--text); }
[data-mode="admin"] .side-link:hover { background: var(--hover); }
[data-mode="admin"] .side-link.active, [data-mode="admin"] .side-link.active:hover { background: var(--dark); color: var(--on-dark); }
.side-link .count {
  background: var(--gold-soft); color: var(--gold-deep); border: 1px solid var(--gold-line);
  font-weight: 800; border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 7px;
}
.side-link.active .count, [data-mode="admin"] .side-link.active .count { background: var(--gold); color: var(--on-gold, #1A1305); border-color: var(--gold); }

/* ---------- page canvas ---------- */
[data-mode="admin"] .main { background: var(--bg); padding: 32px 36px 56px; }
.panel-head h1, [data-mode="admin"] h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.05; letter-spacing: -.015em; margin: 0; }
.panel-head h2 { font-family: var(--sans); font-weight: 800; font-size: 16px; }
.panel-head { margin-bottom: 18px; }
.panel-head.has-eyebrow { flex-direction: row; }
.page-eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }

/* ---------- cards, tables, inputs ---------- */
[data-mode="admin"] .metric-card, [data-mode="admin"] .chart-card, [data-mode="admin"] .table-wrap,
[data-mode="admin"] .connector-card, [data-mode="admin"] .leads-list-pane, [data-mode="admin"] .leads-detail-pane,
.chart-card, .table-wrap, .connector-card, .wa-card, .alert-card, .pending-card, .detail-card, .prop-card, .lead-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1);
}
[data-mode="admin"] .filterbar, .filterbar { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); }
.field label { font-weight: 700; letter-spacing: .02em; }
.field select, .field input[type="date"], .field input[type="text"], .field input[type="search"],
.detail-item input, .detail-item select, .detail-item textarea,
[data-mode="admin"] .field select, [data-mode="admin"] .field input[type="date"] {
  background: var(--surface); border: 1px solid var(--field-line); border-radius: 10px; color: var(--ink);
}
.detail-item input:focus, .detail-item select:focus, .detail-item textarea:focus, .field select:focus, .field input:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198,161,91,.22); outline: none;
}
table.leads-table th, [data-mode="admin"] table.leads-table th, .perf-table th, .plain-table th {
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
table.leads-table tbody tr:hover, [data-mode="admin"] table.leads-table tbody tr:hover { background: var(--surface-2); }
.lead-row.selected { border-left-color: var(--gold); background: var(--gold-wash); }
.chip-filter, [data-mode="admin"] .chip-filter { border-radius: 999px; font-weight: 700; background: var(--surface); border-color: var(--line); color: var(--muted); }
.chip-filter.active, [data-mode="admin"] .chip-filter.active, [data-mode="employee"] .chip-filter.active { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.chip-filter:hover { border-color: var(--gold); }

/* ---------- buttons ---------- */
.btn, [data-mode="admin"] .btn { border-radius: 10px; font-weight: 700; border: 1px solid var(--field-line); background: var(--surface); color: var(--ink); }
.btn:hover { background: var(--hover); border-color: var(--gold); }
.btn-primary, [data-mode="admin"] .btn-primary { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
[data-mode="employee"] .btn-primary { background: var(--gold); color: #1A1305; border-color: var(--gold); }
.btn-primary:hover { background: var(--dark-hover); border-color: var(--dark-hover); filter: none; }
[data-mode="employee"] .btn-primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.link-btn { color: var(--gold-ink); }

/* ---------- segmented control (period, Numbers/Ratios) ---------- */
.seg { display: inline-flex; background: var(--seg); border-radius: 12px; padding: 4px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(17,18,20,.14); }

/* ---------- overlays ---------- */
.overlay { background: rgba(10,12,16,.5); backdrop-filter: blur(2px); }
.drawer { background: var(--bg); box-shadow: var(--shadow-3); }
.modal-box { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-3); border: 1px solid var(--line); }
.toast { background: var(--obsidian); color: #F3EBDD; border: 1px solid var(--obsidian-line); border-radius: 12px; }
.notif-panel, .user-menu { border-radius: 16px; box-shadow: var(--shadow-3); }
.drawer-head.lead-hero { background: var(--obsidian); }

/* ---------- misc chips ---------- */
.badge-soft { border-radius: 999px; font-weight: 700; }
.pill.good { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.status-chip { font-weight: 700; }
.unassigned-chip { border-radius: 999px; }

/* =====================================================================
   Command Centre (dashboard)
===================================================================== */
.cc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.cc-head .panel-head { margin: 0; }
.cc-head h1 { font-size: 52px; line-height: 1.02; }
.cc-sub { margin-top: 8px; font-size: 15px; color: var(--muted); }
.cc-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filterbar.slim { padding: 10px 14px; gap: 12px; margin-bottom: 18px; border-radius: 14px; box-shadow: none; }
.filterbar.slim .field { flex-direction: row; align-items: center; gap: 8px; }
.filterbar.slim .field label { margin: 0; }
.filterbar.slim .field select, .filterbar.slim .field input[type="date"] { padding: 5px 9px; font-size: .82rem; }
.filterbar.slim .preview-flag { font-size: .75rem; white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (min-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.metric-card.kpi { padding: 18px 18px 0; overflow: hidden; display: flex; flex-direction: column; min-height: 188px; border-radius: 18px; }
.metric-card.kpi.clickable { transition: border-color .14s ease, box-shadow .14s ease, transform .06s ease; }
.metric-card.kpi.clickable:hover { border-color: var(--gold); box-shadow: var(--shadow-2); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-top .label { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text); }
.itile { width: 32px; height: 32px; border-radius: 10px; background: var(--gold-wash); border: 1px solid var(--gold-line); display: inline-flex; align-items: center; justify-content: center; color: var(--gold-ink); flex: 0 0 auto; }
.itile.sm { width: 28px; height: 28px; border-radius: 9px; }
.itile.dark { background: #1B1C20; border-color: #2E2F35; color: var(--gold-pale); }
.metric-card.kpi .num { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1.05; letter-spacing: -.01em; margin: 10px 0 8px; color: var(--ink); }
.kpi-delta { display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 12.5px; color: var(--muted); }
.dchip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 800; }
.dchip.good { background: var(--green-bg); color: var(--green); }
.dchip.bad { background: var(--red-bg); color: var(--red); }
.dchip.flat { background: var(--inkc-bg); color: var(--inkc); }
.dnote { color: var(--muted); }
.spark { width: calc(100% + 36px); margin: auto -18px 0; height: 54px; display: block; }
.spark .sp-line { fill: none; stroke: var(--gold-2); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .sp-area { fill: var(--gold); opacity: .13; }
.spark.bad .sp-line { stroke: var(--red); } .spark.bad .sp-area { fill: var(--red); opacity: .08; }
.spark .sp-end { fill: var(--surface); stroke: var(--gold-2); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark.bad .sp-end { stroke: var(--red); }
.spark .sp-hit { fill: transparent; }
.spark .sp-hit:hover { fill: rgba(198,161,91,.10); }

.dash-row { display: flex; gap: 16px; margin-bottom: 20px; align-items: stretch; flex-wrap: wrap; }
.dash-row > .f1 { flex: 1 1 320px; min-width: 0; }
.dash-row > .f2 { flex: 2 1 480px; min-width: 0; }
.col-stack { display: flex; flex-direction: column; gap: 16px; }
.dash-row > .f1 > .dash-card, .dash-row > .f2 > .dash-card { height: 100%; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow-1); min-width: 0; }
.dash-card.f1, .dash-card.f2 { /* when the card itself is the flex child */ }
.dash-card.dark { background: var(--obsidian-2); border-color: var(--obsidian-line); color: #F3EBDD; }
.dc-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dc-head.between { justify-content: space-between; }
.dc-head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.005em; color: var(--ink); }
.dash-card.dark .dc-head h3 { color: #F3EBDD; }
.dc-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.dash-card.dark .dc-sub { color: #A9A6A0; }
.dc-link { background: none; border: 0; padding: 0; font-size: 12.5px; font-weight: 800; color: var(--gold-ink); cursor: pointer; white-space: nowrap; }
.dc-link:hover { color: var(--gold-deep); text-decoration: underline; }
.dc-more { padding: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.chart-card-plain { min-width: 0; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.flowchart { width: 100%; height: auto; display: block; }
.flowchart .lc-ylab, .flowchart .lc-xlab { fill: var(--muted); font-size: 11px; font-weight: 600; }
.flowchart .fl-x { fill: var(--ink); font-weight: 800; }
.flowchart .fl-total { fill: var(--text); font-size: 11.5px; font-weight: 800; }
.flowchart .fl-band { fill: transparent; }
.flowchart .fl-col:hover .fl-band { fill: rgba(198,161,91,.10); }
.flowchart .lc-grid { stroke: var(--line-2); }
.flowchart .lc-axis { stroke: var(--line); }

.funnel { display: flex; flex-direction: column; gap: 14px; }
.fn-row .fn-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.fn-n { display: inline-flex; align-items: center; gap: 8px; }
.fn-n b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fn-pct { font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); }
.fn-track { height: 8px; background: var(--surface-3); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.fn-fill { height: 100%; background: var(--gold-2); border-radius: 999px; }
.fn-foot { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.fn-foot b { color: var(--ink); }

.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.dash-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-table .num, .dash-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table .clickable-row { cursor: pointer; }
.dash-table .clickable-row:hover { background: var(--surface-2); }
.dash-table .barcell { width: 26%; }
.dbar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.dbar i { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.src-tile { display: inline-flex; width: 26px; height: 26px; border-radius: 8px; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; margin-right: 10px; vertical-align: middle; }
.mini-av { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); font-size: 10px; font-weight: 800; align-items: center; justify-content: center; margin-right: 8px; vertical-align: middle; }

.att-card { display: flex; flex-direction: column; }
.att-list { display: flex; flex-direction: column; gap: 10px; }
.att-item { padding: 14px; border-radius: 12px; background: #1B1C20; border: 1px solid #26272C; display: flex; flex-direction: column; gap: 6px; }
.att-t { font-size: 13.5px; font-weight: 800; color: #F3EBDD; line-height: 1.35; }
.att-s { font-size: 12px; color: #A9A6A0; line-height: 1.45; }
.att-btn { align-self: flex-start; margin-top: 4px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid #5E4D2B; background: #1B1C20; color: #E2C58A; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit; }
.att-btn:hover { background: #26231A; }
.att-item.att-clear .att-t { color: #8BD3AC; }

.tt-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.tt-tiles > div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 8px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.tt-tiles b { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; color: var(--ink); }
.tt-tiles span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tt-notes { display: flex; flex-direction: column; gap: 8px; }
.tt-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-3); font-size: 12.5px; line-height: 1.4; }
.tt-note .ic { flex: 0 0 auto; margin-top: 1px; }
.tt-note.warn { background: var(--amber-bg); color: var(--amber); }
.tt-note.ok { background: var(--green-bg); color: var(--green); }

.cel-list { display: flex; flex-direction: column; gap: 10px; }
.cel-row { display: flex; gap: 12px; align-items: center; }
.cel-row > div { display: flex; flex-direction: column; font-size: 13px; }
.cel-row span:not(.cel-ic) { font-size: 12px; color: var(--muted); }
.cel-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--gold-wash); border: 1px solid var(--gold-line); color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cel-none { font-size: 13px; color: var(--muted); }

@media (max-width: 880px) {
  .cc-head h1 { font-size: 38px; }
  [data-mode="admin"] .main { padding: 20px 16px 90px; }
  .tt-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- sidebar: Admin group and footer ---------- */
.side-group { margin: 14px 12px 4px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.side-protect { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text); font-family: inherit; }
.side-protect:hover { border-color: var(--gold); background: var(--gold-wash); }
.side-protect .ic { color: var(--green); flex: 0 0 auto; }
.side-protect[data-level="warn"] .ic { color: var(--amber); }
.side-protect[data-level="bad"] .ic { color: var(--red); }
.side-protect span { display: flex; flex-direction: column; min-width: 0; }
.side-protect b { font-size: 13px; font-weight: 800; color: var(--ink); }
.side-protect em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px; border-top: 1px solid var(--line-2); }
.side-user .avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.side-user-text { display: flex; flex-direction: column; min-width: 0; }
.side-user-text b { font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.kpi-top { min-height: 34px; }

/* ---------- phone: two KPI cards across, compact ---------- */
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card.kpi { min-height: 150px; padding: 14px 12px 0; border-radius: 16px; }
  .metric-card.kpi .num { font-size: 36px; margin: 6px 0 4px; }
  .kpi-top .label { font-size: 12.5px; }
  .kpi-delta { font-size: 11.5px; flex-wrap: wrap; gap: 4px; }
  .kpi-top { min-height: 30px; }
  .preview-flag { white-space: normal; }
}
@media (max-width: 640px) {
  .filters .preview-flag, .filter-bar .preview-flag, .preview-flag { display: block; white-space: normal !important; overflow: visible; text-overflow: clip; max-width: 100%; }
}

/* ---------- preview strip (only shown on the private preview copy) ---------- */
#preview-strip { position: sticky; top: 0; z-index: 400; background: #C6A15B; color: #111214; text-align: center; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; padding: 6px 12px; }
body.is-preview .demo-badge { display: none; }

/* ---------- new sidebar: organisation + branch picker, search, compact links, pinned footer ---------- */
.side-top { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 8px; }
.side-org { position: relative; }
.side-org-btn { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 9px 10px; cursor: pointer; color: var(--text); font-family: inherit; }
.side-org-btn:hover { border-color: var(--gold); }
.side-org-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-org-text b { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.side-org-text em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-org-chip { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-ink); border: 1px solid var(--gold-line); }
.branch-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; }
.branch-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.branch-menu button:hover { background: var(--hover, var(--surface-2)); }
.branch-menu button.on { background: var(--gold-wash); color: var(--gold-ink); }
.branch-note { font-size: 11px; color: var(--muted); padding: 6px 10px 4px; line-height: 1.35; }
.side-search { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.side-search:hover { border-color: var(--gold); color: var(--text); }
.side-search span { flex: 1; text-align: left; }
.side-search kbd { font: inherit; font-size: 10.5px; font-weight: 700; color: var(--muted-2, var(--muted)); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
[data-mode="admin"] .side-link { padding-top: 8px; padding-bottom: 8px; }
.side-group { margin-top: 12px; }
.side-foot { position: sticky; bottom: calc(-1 * var(--space-4, 16px)); background: var(--surface); margin-top: auto; padding-bottom: 8px; z-index: 5; }
button.side-user { width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line-2); background: none; font: inherit; color: var(--text); cursor: pointer; border-radius: 0 0 10px 10px; }
button.side-user:hover { background: var(--surface-2); }
button.side-user .ic { margin-left: auto; color: var(--muted); }

/* ---------- search palette ---------- */
.cmdk-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(17,18,20,.45); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmdk { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-in input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); }
.cmdk-in kbd { font: inherit; font-size: 10.5px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; font: inherit; color: var(--text); }
.cmdk-item.sel, .cmdk-item:hover { background: var(--gold-wash); }
.cmdk-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cmdk-main b { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.cmdk-main em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- the prototype's own screens shown inside the page ---------- */
[data-mode="admin"] .main.proto-main { padding: 0; overflow: hidden; display: flex; }
.proto-frame { display: block; flex: 1; width: 100%; height: 100%; min-height: calc(100vh - 64px - var(--strip-h, 0px)); border: 0; background: transparent; }
@media (max-width: 880px) { .proto-frame { min-height: calc(100vh - 64px - 62px - var(--strip-h, 0px)); } }
.side-org-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }


/* =====================================================================
   v4 — the prototype's frame: no top bar on the owner's screens (the logo, the bell and the account card
   all live in the dark sidebar), and Command Centre cards the way the prototype draws them.
===================================================================== */

/* ---------- dark sidebar, same as the prototype ---------- */
[data-mode="admin"] .sidebar {
  --surface: var(--obsidian); --surface-2: var(--obsidian-2); --surface-3: var(--obsidian-3);
  --ink: #F3EBDD; --text: #D8D3C8; --muted: #A9A6A0; --muted-2: #8C8982;
  --line: var(--obsidian-line); --line-2: var(--obsidian-line); --hover: var(--obsidian-3);
  --dark: #1F2024; --on-dark: #FFFFFF;
  --gold-ink: #D9B873; --gold-deep: #E2C58A; --gold-soft: #2A2418; --gold-wash: #1E1A12; --gold-line: #3A3020;
  --green: #8BD3AC; --amber: #F2B676; --red: #F1A097;
  background: var(--obsidian); border-right: 1px solid var(--obsidian-line); color: var(--text);
}
[data-mode="admin"] .side-link.active, [data-mode="admin"] .side-link.active:hover { background: #1F2024; border: 1px solid #2E2F35; box-shadow: none; }
[data-mode="admin"] .side-link { border: 1px solid transparent; }
[data-mode="admin"] .side-link:hover .ic { color: var(--gold-pale); }
.side-logo { display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 12px; }
.side-logo-img { height: 24px; width: auto; align-self: flex-start; display: block; }
.side-logo-sub { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.side-user-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.side-user-row button.side-user { flex: 1; min-width: 0; border-top: 0; border-radius: 10px; padding: 6px; }
.side-user .avatar { background: var(--gold); color: var(--on-gold, #1A1305); }
.side-bell { position: relative; flex: 0 0 auto; width: 38px; height: 38px; border: 0; background: none; color: var(--muted); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.side-bell:hover { background: var(--hover); color: var(--ink); }
.side-bell .notif-badge { top: 1px; right: 1px; box-shadow: 0 0 0 2px var(--obsidian); }

/* ---------- owner screens: top bar gone on desktop, the account menu opens above the card ---------- */
[data-mode="admin"] .topbar .user-btn { display: none; }
[data-mode="admin"] .user-menu { position: fixed; left: 12px; right: auto; top: auto; bottom: 74px; width: 284px; z-index: 600; }
[data-mode="admin"] .user-menu-item { white-space: nowrap; }
@media (min-width: 881px) {
  [data-mode="admin"] .topbar { height: 0; min-height: 0; padding: 0; border: 0; box-shadow: none; background: transparent; position: static; overflow: visible; }
  [data-mode="admin"] .topbar > *:not(.user-menu-wrap) { display: none !important; }
  [data-mode="admin"] .topbar .user-menu-wrap { position: static; }
  [data-mode="admin"] .sidebar { position: sticky; top: var(--strip-h, 0px); height: calc(100vh - var(--strip-h, 0px)); align-self: flex-start; }
}
body.is-preview { --strip-h: 29px; }

/* ---------- Command Centre cards, drawn like the prototype's ---------- */
.kpi-grid { gap: 12px; }
.metric-card.kpi { min-height: 150px; padding: 14px 16px 0; border-radius: 16px; box-shadow: var(--shadow-1); }
.kpi-top { align-items: flex-start; min-height: 40px; }
.kpi-top .label { font-size: 12.5px; font-weight: 600; color: var(--muted); line-height: 1.25; }
.itile { width: 28px; height: 28px; border-radius: 9px; }
.metric-card.kpi .num { font-size: 40px; margin: 4px 0 6px; }
.dchip { border-radius: 999px; height: 20px; padding: 0 8px; font-size: 11.5px; }
.kpi-delta { font-size: 11.5px; min-height: 20px; }
.spark { width: calc(100% + 32px); margin: auto -16px 0; height: 40px; }
@media (max-width: 640px) { .metric-card.kpi { min-height: 140px; padding: 12px 12px 0; } .spark { width: calc(100% + 24px); margin: auto -12px 0; } }

/* ---------- v5 — type scale brought down to the prototype's (the page read about one size too large at 100% zoom) ---------- */
html { font-size: 14.5px; }
body { font-size: 13.5px; }
[data-mode="admin"] .sidebar { width: 236px; }
[data-mode="admin"] .side-link { font-size: 13.5px; padding-top: 7px; padding-bottom: 7px; gap: 11px; }
.side-group { font-size: 10.5px; }
.side-org-text b { font-size: 12.5px; } .side-org-text em { font-size: 10.5px; }
.side-search { font-size: 12.5px; padding: 7px 10px; }
.side-protect b { font-size: 12.5px; } .side-protect em { font-size: 11px; }
.side-user-text b { font-size: 12.5px; } .side-user-text em { font-size: 11px; }
.side-logo-img { height: 22px; }
[data-mode="admin"] .main { padding: 26px 30px 48px; }
.panel-head h1, [data-mode="admin"] h1 { font-size: 36px; }
.cc-head h1 { font-size: 44px; }
.cc-sub { font-size: 13.5px; margin-top: 6px; }
.page-eyebrow { font-size: 12px; }
.panel-head h2 { font-size: 15px; }
.dash-card { padding: 16px 18px; border-radius: 16px; }
.dash-card h3, .chart-card h3, .chart-head h3 { font-size: 15px; }
.dc-sub { font-size: 12px; }
.metric-card.kpi .num { font-size: 38px; }
.kpi-top .label { font-size: 12px; }
.seg-btn { font-size: 12.5px; padding: 6px 12px; }
.user-menu-item { font-size: 13px; }
.filterbar.slim .field select, .filterbar.slim .field input[type="date"] { font-size: .8rem; }
@media (max-width: 880px) { [data-mode="admin"] .sidebar { width: 268px; } [data-mode="admin"] .main { padding: 16px 14px calc(78px + env(safe-area-inset-bottom, 0px)); } .cc-head h1 { font-size: 34px; } }
@media (max-width: 640px) { .metric-card.kpi .num { font-size: 32px; } }
.side-org-text b { white-space: nowrap; }
.side-org-chip { font-size: 10px; padding: 1px 7px; }

/* ---------- colour themes picked in Customize (the default look needs no rule: it is the theme above) ---------- */
body[data-palette="ocean"][data-mode="admin"] {
  --bg: #F0F4FC; --surface-2: #F8FAFE; --surface-3: #E5E9F2; --hover: #E5E9F2; --seg: #DCE0E9;
  --line: #D5DAE3; --line-2: #E0E5EE; --field-line: #CACFD9;
  --dark: #0F1B2D; --dark-hover: #333D4C; --ink: #0C1624; --text: #2C3646;
  --obsidian: #0F1B2D; --obsidian-2: #1D293A; --obsidian-3: #293444; --obsidian-line: #353F4F;
  --gold: #2F5BE0; --gold-2: #2F5BE0; --gold-ink: #2242A1; --gold-deep: #1C3786; --gold-pale: #89AEF5;
  --gold-soft: #E2E8FB; --gold-wash: #F0F4FD; --gold-line: #C1CEF6;
  --primary: #2F5BE0; --accent: #2242A1; --accent2: #0F1B2D; --accent2-ink: #FFFFFF; --focus: #2F5BE0; --chart-2: #2F5BE0; --chart-1: #273242;
}
body[data-palette="forest"][data-mode="admin"] {
  --bg: #EEF6EF; --surface-2: #F7FBF8; --surface-3: #E3ECE5; --hover: #E3ECE5; --seg: #DBE4DC;
  --line: #D5DED6; --line-2: #DFE8E1; --field-line: #CAD4CC;
  --dark: #1B2E21; --dark-hover: #3D4D42; --ink: #16251A; --text: #36473C;
  --obsidian: #1B2E21; --obsidian-2: #293B2E; --obsidian-3: #344539; --obsidian-line: #3F4F45;
  --gold: #3A7D44; --gold-2: #3A7D44; --gold-ink: #2A5A31; --gold-deep: #234B29; --gold-pale: #95D59F;
  --gold-soft: #E3EDE5; --gold-wash: #F1F6F2; --gold-line: #C4D8C7;
  --primary: #3A7D44; --accent: #2A5A31; --accent2: #1B2E21; --accent2-ink: #FFFFFF; --focus: #3A7D44; --chart-2: #3A7D44; --chart-1: #324337;
}
body[data-palette="sand"][data-mode="admin"] {
  --bg: #FDF6EC; --surface-2: #FEFBF6; --surface-3: #F3ECE2; --hover: #F3ECE2; --seg: #EBE4D9;
  --line: #E6DED3; --line-2: #EFE8DE; --field-line: #DCD3C9;
  --dark: #3A2A1E; --dark-hover: #584A40; --ink: #2E2218; --text: #524439;
  --obsidian: #3A2A1E; --obsidian-2: #46372C; --obsidian-3: #504137; --obsidian-line: #5A4C42;
  --gold: #B5461F; --gold-2: #B5461F; --gold-ink: #823216; --gold-deep: #6D2A13; --gold-pale: #F4BE8F;
  --gold-soft: #F5E5E0; --gold-wash: #FAF2EF; --gold-line: #E9C8BC;
  --primary: #B5461F; --accent: #823216; --accent2: #3A2A1E; --accent2-ink: #FFFFFF; --focus: #B5461F; --chart-2: #B5461F; --chart-1: #4E3F34;
}
body[data-palette="lavender"][data-mode="admin"] {
  --bg: #F3F0FB; --surface-2: #FAF8FD; --surface-3: #E8E5F1; --hover: #E8E5F1; --seg: #E0DCE9;
  --line: #D9D6E3; --line-2: #E4E1ED; --field-line: #CFCBD9;
  --dark: #1E1535; --dark-hover: #403853; --ink: #18112A; --text: #39314D;
  --obsidian: #1E1535; --obsidian-2: #2C2341; --obsidian-3: #372F4B; --obsidian-line: #423A55;
  --gold: #7C3AED; --gold-2: #7C3AED; --gold-ink: #592AAB; --gold-deep: #4A238E; --gold-pale: #C690FA;
  --gold-soft: #EDE3FC; --gold-wash: #F6F1FE; --gold-line: #D8C4FA;
  --primary: #7C3AED; --accent: #592AAB; --accent2: #1E1535; --accent2-ink: #FFFFFF; --focus: #7C3AED; --chart-2: #7C3AED; --chart-1: #342C49;
}
body[data-palette="coral"][data-mode="admin"] {
  --bg: #FBF1EF; --surface-2: #FDF9F8; --surface-3: #F1E6E4; --hover: #F1E6E4; --seg: #E8DDDC;
  --line: #E2D7D5; --line-2: #ECE2E0; --field-line: #D7CCCA;
  --dark: #2A1517; --dark-hover: #4A383A; --ink: #221112; --text: #443133;
  --obsidian: #2A1517; --obsidian-2: #372325; --obsidian-3: #412F31; --obsidian-line: #4C3A3C;
  --gold: #D63048; --gold-2: #D63048; --gold-ink: #9A2334; --gold-deep: #801D2B; --gold-pale: #F1A7B0;
  --gold-soft: #F9E2E5; --gold-wash: #FCF1F2; --gold-line: #F3C1C8;
  --primary: #D63048; --accent: #9A2334; --accent2: #2A1517; --accent2-ink: #FFFFFF; --focus: #D63048; --chart-2: #D63048; --chart-1: #3F2C2E;
}
/* wE-oled-dark-begin */
/* Midnight OLED is dark whatever the theme switch says: start from the dark tokens, the block below then sets its own */
body[data-palette="oled"][data-mode="admin"] {
  --bg: #0E0F11; --surface: #16171A; --surface-2: #1B1C20; --surface-3: #212227; --seg: #23242A;
  --ink: #F3EFE7; --text: #E4E0D8; --muted: #A9A6A0; --muted-2: #9A978F;
  --line: #2A2B30; --line-2: #26272C; --field-line: #34353B; --hover: #23242A;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 12px 32px rgba(0,0,0,.5); --shadow-3: 0 24px 60px rgba(0,0,0,.6);
  --dark: #E9E2D3; --dark-hover: #FFFFFF; --on-dark: #141518;
  --obsidian: #0A0B0C; --obsidian-2: #121316; --obsidian-3: #1A1B1F; --obsidian-line: #222328;
  --gold-ink: #D9B873; --gold-deep: #E2C58A; --gold-soft: #2A2418; --gold-wash: #1E1A12; --gold-line: #3A3020;
  --green: #8BD3AC; --green-bg: #17291F; --blue: #9DB8E6; --blue-bg: #17233A; --red: #F1A097; --red-bg: #3A1A17;
  --violet: #C4B1E8; --violet-bg: #251E33; --amber: #F2B676; --amber-bg: #33220F; --inkc: #C9C6BF; --inkc-bg: #26272C;
  --chart-1: #D8D2C4; --chart-2: #C6A15B; --chart-3: #4A4B52; --chart-4: #7FA0D6; --chart-5: #6CC096; --chart-6: #E0786D;
  --accent: #D9B873; --accent-ink: #E9E2D3; --accent2: #E9E2D3; --accent2-ink: #2B2100; --primary: #C6A15B; --accent-contrast: #141518;
  --warn-bg: rgba(224,166,79,.14); --warn-border: rgba(224,166,79,.4); --warn-text: #E0A64F;
  --metric-danger: #F1A097; --metric-warning: #F2B676; --metric-teal: #8BD3AC; --metric-green: #8BD3AC; --metric-blue: #9DB8E6; --metric-purple: #C4B1E8;
}
/* wE-oled-dark-end */
body[data-palette="oled"][data-mode="admin"] {
  --bg: #000000; --surface: #0B0C0E; --surface-2: #111317; --surface-3: #171A1F; --seg: #171A1F;
  --ink: #F2F5F8; --text: #DDE3EA; --muted: #9AA5B1; --muted-2: #8893A0;
  --line: #1D2128; --line-2: #181C22; --field-line: #2A303A; --hover: #14171C;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5); --shadow-2: 0 12px 32px rgba(0,0,0,.7); --shadow-3: 0 24px 60px rgba(0,0,0,.8);
  --dark: #DCEBF7; --dark-hover: #FFFFFF; --on-dark: #0B0C0E;
  --obsidian: #05060A; --obsidian-2: #0C1018; --obsidian-3: #121826; --obsidian-line: #1B2433;
  --gold: #5BB8F0; --gold-2: #4A9FE0; --gold-ink: #8FD0F7; --gold-deep: #B5E1FA; --gold-pale: #BDE3FA; --gold-soft: #10202D; --gold-wash: #0D1822; --gold-line: #1F3A50;
  --primary: #5BB8F0; --accent: #8FD0F7; --accent2: #DCEBF7; --accent2-ink: #2B2100; --focus: #5BB8F0; --chart-1: #D3DCE6; --chart-2: #5BB8F0; --chart-3: #3A4350;
  --green: #7DDDB0; --green-bg: #0F2A1E; --blue: #9CC4F2; --blue-bg: #101E33; --red: #F5A39B; --red-bg: #33171A; --amber: #F2B676; --amber-bg: #2D1F0E; --inkc: #C9D1DA; --inkc-bg: #1A1E25;
  --warn-bg: rgba(224,166,79,.14); --warn-border: rgba(224,166,79,.4); --warn-text: #E0A64F;
  color-scheme: dark;
}

/* =====================================================================
   v6: top-right buttons, Add Lead, Selfie check-in, Customize, quick actions, focus and calm modes
===================================================================== */
[data-mode="admin"] .main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
[data-mode="admin"] .main-col > .main { flex: 1; min-height: 0; }
.util-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 30px 0; background: var(--bg); flex-wrap: wrap; }
.util-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; box-shadow: var(--shadow-1); }
.util-btn:hover { background: var(--hover); }
.util-btn svg { flex: none; }
.util-green { background: #1D6B4A; border-color: #1D6B4A; color: #fff; }
.util-green:hover { background: #17573C; }
.util-primary { background: var(--dark); border-color: var(--dark); color: var(--on-dark, #fff); }
.util-primary:hover { background: var(--dark-hover); }
.util-bell { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-1); }
.util-bell:hover { background: var(--hover); }
.util-bell .notif-badge { position: absolute; top: -6px; right: -6px; }
[data-mode="admin"] .notif-panel { top: calc(var(--strip-h, 0px) + 62px); right: 20px; left: auto; bottom: auto; }
@media (max-width: 880px) {
  .util-bar { padding: 10px 14px 0; gap: 8px; }
  .util-btn { height: 38px; padding: 0 12px; }
  .util-btn span { font-size: 13px; }
  [data-mode="admin"] .notif-panel { right: 10px; left: 10px; width: auto; }
}
@media (max-width: 880px) { .util-bar .util-bell { display: none; } }   /* on a phone the bell already sits in the bar above */
@media (max-width: 520px) {
  .util-btn span { display: none; }
  .util-btn { width: 40px; padding: 0; justify-content: center; }
}

/* modals shared */
.al-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.al-wide { grid-column: 1 / -1; }
.al-err { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: var(--red-bg); color: var(--red); font-size: 13px; font-weight: 600; }
.al-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 560px) { .al-grid { grid-template-columns: 1fr; } }
.lp-q { width: 100%; margin: 6px 0 10px; }
.lp-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.lp-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.lp-item:hover { background: var(--hover); border-color: var(--gold-line); }
.lp-main { display: grid; min-width: 0; }
.lp-main em { font-style: normal; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-st { font-size: 12px; font-weight: 700; color: var(--gold-ink); background: var(--gold-soft); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.lp-none { padding: 14px 4px; }

/* selfie check-in */
.selfie-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.selfie-head h2 { margin: 0; }
.selfie-x { background: transparent; border: 0; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; flex: none; }
.selfie-x:hover { background: var(--hover); color: var(--ink); }
.sf-status { margin: 8px 0 12px; }
.sf-stage { position: relative; background: #0d0e10; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 46vh; width: 100%; margin: 6px 0 12px; }
.sf-stage video, .sf-stage canvas { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.sf-stage canvas { transform: none; }
.sf-msg { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(20,21,24,.82); color: #fff; font-size: 13px; }
.sf-msg.bad { background: rgba(166,40,29,.92); }
.sf-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sf-h3 { margin: 14px 0 8px; font-size: 14px; font-weight: 800; color: var(--ink); }
.sf-team { display: grid; gap: 6px; max-height: 32vh; overflow-y: auto; }
.sf-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.sf-thumb { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.sf-nophoto { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: var(--gold-ink); background: var(--gold-soft); }
.sf-who { flex: 1; min-width: 0; display: grid; font-weight: 700; }
.sf-who em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 12px; }
.sf-when { font-size: 12.5px; font-weight: 700; color: var(--green); white-space: nowrap; }
.sf-when.sf-absent { color: var(--muted); font-weight: 600; }

/* customize */
.modal-box.cz-box { width: min(760px, 94vw); padding: 0; display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; background: var(--surface); }
.cz-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px 14px; }
.cz-head > div { flex: 1; min-width: 0; }
.cz-head h2 { margin: 0; font-size: 20px; }
.cz-head p { margin: 2px 0 0; }
.cz-badge { width: 44px; height: 44px; border-radius: 14px; background: var(--dark); color: var(--on-dark, #fff); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cz-tabs { display: flex; gap: 6px; padding: 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cz-tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.cz-tab:hover { color: var(--ink); }
.cz-tab.on { color: var(--ink); border-bottom-color: var(--gold); }
.cz-body { padding: 18px 24px; overflow-y: auto; flex: 1; min-height: 0; background: var(--bg); }
.cz-h { margin: 4px 0 8px; font-size: 15px; font-weight: 800; color: var(--ink); }
.cz-body .muted.small { margin: 0 0 12px; }
.cz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.cz-dens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cz-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.cz-card:hover { border-color: var(--gold-line); }
.cz-card.on { border-color: var(--gold); background: var(--gold-wash); }
.cz-card.cz-center { align-items: center; text-align: center; }
.cz-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cz-tick { width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cz-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.cz-sw { display: flex; gap: 5px; margin-top: 2px; }
.cz-sw i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); display: block; }
.cz-list { display: grid; gap: 8px; }
.cz-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cz-row.off { opacity: .6; }
.cz-eye, .cz-mv { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); flex: none; }
.cz-eye.on { color: var(--green); background: var(--green-bg); border-color: transparent; }
.cz-mv:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.cz-mv:disabled { opacity: .35; cursor: default; }
.cz-rt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cz-rt b { font-size: 14px; color: var(--ink); }
.cz-rt em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.cz-well { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-bottom: 10px; }
.cz-wi { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cz-wi.violet { background: var(--violet-bg); color: var(--violet); }
.cz-wi.amber { background: var(--amber-bg); color: var(--amber); }
.cz-wi.green { background: var(--green-bg); color: var(--green); }
.cz-wt { flex: 1; min-width: 0; display: grid; gap: 3px; }
.cz-wt b { font-size: 14.5px; color: var(--ink); }
.cz-wt em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.cz-sw-btn { flex: none; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--field-line); background: var(--surface); font: inherit; font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer; }
.cz-sw-btn.on { background: var(--dark); border-color: var(--dark); color: var(--on-dark, #fff); }
.cz-quick { display: flex; flex-wrap: wrap; gap: 10px; }
.cz-pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.cz-pill.on { border-color: var(--gold); background: var(--gold-wash); color: var(--gold-deep); }
.cz-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.cz-reset { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
@media (max-width: 600px) {
  .cz-tabs { overflow: visible; gap: 2px; } .cz-tab { flex: 1; flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; text-align: center; white-space: normal; }
  .cz-grid { grid-template-columns: 1fr; } .cz-dens { grid-template-columns: 1fr; }
  .cz-head, .cz-body, .cz-foot { padding-left: 16px; padding-right: 16px; } .cz-tabs { padding: 0 10px; }
  .cz-well { flex-wrap: wrap; } .cz-sw-btn { margin-left: 60px; }
}

/* dashboard extras */
.quick-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); }
.qb-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.qb-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--gold-line); background: var(--gold-wash); color: var(--gold-deep); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.qb-pill:hover { background: var(--gold-soft); }
.focus-card { margin-bottom: 14px; }
.focus-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: center; }
.focus-sprint { display: flex; align-items: center; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.sprint-clock { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: .02em; }
@media (max-width: 720px) { .focus-grid { grid-template-columns: 1fr; } .focus-sprint { justify-content: flex-start; } }
.dc-link { background: none; border: 0; padding: 0; color: var(--gold-ink); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.dc-link:hover { text-decoration: underline; }
.act-list { display: grid; }
.act-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.act-row:last-child { border-bottom: 0; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--green); flex: none; }
.act-warn .act-dot { background: var(--amber); } .act-bad .act-dot { background: var(--red); }
.act-main { flex: 1; min-width: 0; font-size: 13.5px; }
.act-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.calm-card { margin-bottom: 14px; }
.calm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.calm-list li { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13.5px; }
.calm-list li.done { background: var(--green-bg); color: var(--green); }
.ms-box { padding: 10px 14px; border-radius: 12px; background: var(--gold-wash); border: 1px solid var(--gold-line); margin-bottom: 12px; font-size: 13.5px; }
.dash-empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }

/* density */
body[data-density="relaxed"][data-mode="admin"] .main { padding: 34px 40px 60px; }
body[data-density="relaxed"][data-mode="admin"] .dash-card { padding: 24px 26px; }
body[data-density="relaxed"][data-mode="admin"] .kpi-grid { gap: 18px; }
body[data-density="compact"][data-mode="admin"] .main { padding: 16px 20px 32px; }
body[data-density="compact"][data-mode="admin"] .dash-card { padding: 13px 15px; }
body[data-density="compact"][data-mode="admin"] .kpi-grid { gap: 8px; }
body[data-density="compact"][data-mode="admin"] .metric-card.kpi { min-height: 120px; }

/* focus mode and calm metrics */
body.zen[data-mode="admin"] .sidebar, body.zen[data-mode="admin"] .util-bar .util-btn:not(#util-selfie), body.zen[data-mode="admin"] .notif-badge, body.zen[data-mode="admin"] .admin-bottom { display: none !important; }
body.zen[data-mode="admin"] .main-col { max-width: 1100px; margin: 0 auto; }
.zen-exit { position: fixed; right: 18px; bottom: 18px; z-index: 900; padding: 10px 18px; border-radius: 999px; border: 0; background: var(--dark); color: var(--on-dark, #fff); font: inherit; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-2); }
.al-grid input, .al-grid select, .al-grid textarea, .lp-q { width: 100%; box-sizing: border-box; border: 1px solid var(--field-line); border-radius: 12px; padding: 10px 12px; background: var(--surface); color: var(--ink); font: inherit; }
.al-grid textarea { resize: vertical; min-height: 64px; }
.al-grid input:focus, .al-grid select:focus, .al-grid textarea:focus, .lp-q:focus { outline: 2px solid var(--gold-line); border-color: var(--gold); }

/* wE-dark-begin: generated from three parts (tokens, rules, colour-theme blocks); the dark rules exist twice (automatic and forced dark) and once more for Midnight OLED */
/* =====================================================================
   Dark-mode contrast pass: every piece of text must reach WCAG AA (4.5:1, 3:1 for large text) on its own background.
   Tokens first (their light values equal the old hard-coded colours, so light mode is unchanged), then the dark values.
===================================================================== */
[data-mode] {
  /* light values = exactly what used to be hard-coded in the rules that now read these tokens */
  --chip-mix: 82%; --ph: #757575; --on-red: #fff; --on-ink: #fff;
  --wa-bubble-bg: #EAF6E3; --wa-bubble-line: #D5EBC9;
  --note-warn-bg: #FFF3D6; --note-warn-line: #F0C36D; --note-warn-text: #7A5300;
  --note-bad-bg: #F8E4E1; --note-bad-line: #E3B3AD; --note-bad-text: #7A2A22; --note-diff-bg: rgba(255,255,255,.55);
  --chip-amber-bg: #FEF3C7; --chip-amber-text: #92400E; --chip-amber-line: #FCD34D; --banner-amber-bg: #FFFBEB;
  --temp-hot-bg: #FBE3DE; --temp-hot-text: #A33A2E; --temp-warm-bg: #FBEFD5; --temp-warm-text: #8A5A00;
  --tip-bg: #fff; --tip-ink: #151B28; --tip-line: #E3E1DA;
  --banner-ok-bg: #EAF3E2; --banner-ok-line: #C7DDB4; --banner-ok-text: #33502C;
  --accent-wash: #FBF3E8; --decl-bg: #fdecea; --decl-line: #f3b8b3; --decl-text: #8a1c14;
}
::placeholder { color: var(--ph, #757575); opacity: 1; }
@keyframes missedpulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: .82; } }
/* the Google Sheets tile is a pale gold letter on a pale gold tint */
.src-tile[style*="BFA163" i] { color: #8A6A2E !important; }
@media (prefers-color-scheme: dark) {
  [data-mode]:not([data-theme="light"]) {
  /* the status colours are used as TEXT (visit dates, status chips), so on a dark page they need to be lighter */
    --status-new: #8EA9D8; --status-contacted: #DDAE55; --status-followup: #DB9A55; --status-sitevisit: #55BBA9;
    --status-sitevisit-done: #72AEDB; --status-sitevisit-cancelled: #DD946F; --status-sitevisit-resched: #E3A445;
    --status-meeting: #AE92DA; --status-negotiation: #AE92DA; --status-interested: #60C8BA; --status-notanswering: #CCB265;
    --status-converted: #74C285; --status-notinterested: #A8A8A2; --status-invalid: #E58478; --status-broker: #B9A3D6; --status-notreachable: #CBA88A;
    --sc-slate: #A7B4C4; --sc-blue: #8EAEE3; --sc-teal: #5FC3BB; --sc-green: #8CCB7C; --sc-olive: #C9C56A; --sc-amber: #E5AE55; --sc-coral: #EE987F; --sc-rose: #E68AAE; --sc-plum: #C59BDE; --sc-brown: #CC9C7C;
    --chip-mix: 52%; --ph: #9A978F; --on-red: #2B0F0C; --on-ink: #141518;
    --wa-bubble-bg: #1A2A21; --wa-bubble-line: #2B4535;
    --note-warn-bg: rgba(224,166,79,.14); --note-warn-line: rgba(224,166,79,.4); --note-warn-text: #EBB35E;
    --note-bad-bg: #3A1A17; --note-bad-line: #5C2B26; --note-bad-text: #F1A097; --note-diff-bg: rgba(255,255,255,.07);
    --chip-amber-bg: #33220F; --chip-amber-text: #F2B676; --chip-amber-line: #5C3E14; --banner-amber-bg: #2A1E0E;
    --temp-hot-bg: #3A1A17; --temp-hot-text: #F1A097; --temp-warm-bg: #33220F; --temp-warm-text: #F2B676;
    --tip-bg: #26272C; --tip-ink: #F3EFE7; --tip-line: #3A3B41;
    --banner-ok-bg: #17291F; --banner-ok-line: #2B4535; --banner-ok-text: #B7D9A8;
    --accent-wash: var(--gold-wash); --decl-bg: #3A1A17; --decl-line: #5C2B26; --decl-text: #F1A097;
  }
  [data-mode]:not([data-theme="light"]) .src-tile { color: var(--ink) !important; }
  [data-mode]:not([data-theme="light"]) input:disabled, [data-mode]:not([data-theme="light"]) select:disabled, [data-mode]:not([data-theme="light"]) textarea:disabled { background-color: var(--surface-2); color: var(--muted); border-color: var(--line); }
  [data-mode]:not([data-theme="light"]) .missed-badge { animation-name: missedpulse-soft; }
  [data-mode]:not([data-theme="light"]) .prop-status { background-image: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)) !important; }
  [data-mode]:not([data-theme="light"]) .prop-flag { background-image: linear-gradient(rgba(0,0,0,.22), rgba(0,0,0,.22)); }
  [data-mode]:not([data-theme="light"]) .prop-send { color: var(--on-ink); }
  [data-mode]:not([data-theme="light"])[data-mode="employee"] .tile-btn.call, [data-mode]:not([data-theme="light"]) .tile-btn.call { color: #1A1305; }
  [data-mode]:not([data-theme="light"]) .tile-btn.whatsapp, [data-mode]:not([data-theme="light"]) .btn.btn-wa { background: #13803F; border-color: #13803F; color: #fff; }
  [data-mode]:not([data-theme="light"])[data-mode="employee"] .toast { background: var(--obsidian); color: #F3EBDD; border-color: var(--obsidian-line); }
  [data-mode]:not([data-theme="light"]) img[src="/aurex-logo.png"] { content: url("/aurex-logo-white.png"); }
  [data-mode]:not([data-theme="light"]) .inv-pill.info { color: var(--blue); }
  /* colours that the scripts write straight into a style="" attribute */
  [data-mode]:not([data-theme="light"]) [style*="color:#A33A2E" i], [data-mode]:not([data-theme="light"]) [style*="color: rgb(163, 58, 46)"] { color: var(--red) !important; }
  [data-mode]:not([data-theme="light"]) [style*="color:#8A5A00" i], [data-mode]:not([data-theme="light"]) [style*="color: rgb(138, 90, 0)"] { color: var(--amber) !important; }
  [data-mode]:not([data-theme="light"]) [style*="color:#1F4D38" i], [data-mode]:not([data-theme="light"]) [style*="color: rgb(31, 77, 56)"], [data-mode]:not([data-theme="light"]) [style*="color:#2E7D32" i], [data-mode]:not([data-theme="light"]) [style*="color:#2E8B4F" i] { color: var(--green) !important; }
  [data-mode]:not([data-theme="light"]) [style*="background:#FBF1EF" i], [data-mode]:not([data-theme="light"]) [style*="background:#FDECEA" i] { background: var(--red-bg) !important; border-color: var(--line) !important; }
  [data-mode]:not([data-theme="light"]) [style*="background:#E3F1E8" i] { background: var(--green-bg) !important; border-color: var(--line) !important; }
  [data-mode]:not([data-theme="light"]) textarea { background-color: var(--surface); color: var(--ink); }
  [data-mode]:not([data-theme="light"]) .user-menu-item.danger, [data-mode]:not([data-theme="light"]) .user-menu-item.danger .ic { color: var(--red); }
  [data-mode]:not([data-theme="light"]) .msg-flag input:disabled + span { opacity: .8; }
}
[data-mode][data-theme="dark"] {
/* the status colours are used as TEXT (visit dates, status chips), so on a dark page they need to be lighter */
  --status-new: #8EA9D8; --status-contacted: #DDAE55; --status-followup: #DB9A55; --status-sitevisit: #55BBA9;
  --status-sitevisit-done: #72AEDB; --status-sitevisit-cancelled: #DD946F; --status-sitevisit-resched: #E3A445;
  --status-meeting: #AE92DA; --status-negotiation: #AE92DA; --status-interested: #60C8BA; --status-notanswering: #CCB265;
  --status-converted: #74C285; --status-notinterested: #A8A8A2; --status-invalid: #E58478; --status-broker: #B9A3D6; --status-notreachable: #CBA88A;
    --sc-slate: #A7B4C4; --sc-blue: #8EAEE3; --sc-teal: #5FC3BB; --sc-green: #8CCB7C; --sc-olive: #C9C56A; --sc-amber: #E5AE55; --sc-coral: #EE987F; --sc-rose: #E68AAE; --sc-plum: #C59BDE; --sc-brown: #CC9C7C;
  --chip-mix: 52%; --ph: #9A978F; --on-red: #2B0F0C; --on-ink: #141518;
  --wa-bubble-bg: #1A2A21; --wa-bubble-line: #2B4535;
  --note-warn-bg: rgba(224,166,79,.14); --note-warn-line: rgba(224,166,79,.4); --note-warn-text: #EBB35E;
  --note-bad-bg: #3A1A17; --note-bad-line: #5C2B26; --note-bad-text: #F1A097; --note-diff-bg: rgba(255,255,255,.07);
  --chip-amber-bg: #33220F; --chip-amber-text: #F2B676; --chip-amber-line: #5C3E14; --banner-amber-bg: #2A1E0E;
  --temp-hot-bg: #3A1A17; --temp-hot-text: #F1A097; --temp-warm-bg: #33220F; --temp-warm-text: #F2B676;
  --tip-bg: #26272C; --tip-ink: #F3EFE7; --tip-line: #3A3B41;
  --banner-ok-bg: #17291F; --banner-ok-line: #2B4535; --banner-ok-text: #B7D9A8;
  --accent-wash: var(--gold-wash); --decl-bg: #3A1A17; --decl-line: #5C2B26; --decl-text: #F1A097;
}
[data-mode][data-theme="dark"] .src-tile { color: var(--ink) !important; }
[data-mode][data-theme="dark"] input:disabled, [data-mode][data-theme="dark"] select:disabled, [data-mode][data-theme="dark"] textarea:disabled { background-color: var(--surface-2); color: var(--muted); border-color: var(--line); }
[data-mode][data-theme="dark"] .missed-badge { animation-name: missedpulse-soft; }
[data-mode][data-theme="dark"] .prop-status { background-image: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)) !important; }
[data-mode][data-theme="dark"] .prop-flag { background-image: linear-gradient(rgba(0,0,0,.22), rgba(0,0,0,.22)); }
[data-mode][data-theme="dark"] .prop-send { color: var(--on-ink); }
[data-mode][data-theme="dark"][data-mode="employee"] .tile-btn.call, [data-mode][data-theme="dark"] .tile-btn.call { color: #1A1305; }
[data-mode][data-theme="dark"] .tile-btn.whatsapp, [data-mode][data-theme="dark"] .btn.btn-wa { background: #13803F; border-color: #13803F; color: #fff; }
[data-mode][data-theme="dark"][data-mode="employee"] .toast { background: var(--obsidian); color: #F3EBDD; border-color: var(--obsidian-line); }
[data-mode][data-theme="dark"] img[src="/aurex-logo.png"] { content: url("/aurex-logo-white.png"); }
[data-mode][data-theme="dark"] .inv-pill.info { color: var(--blue); }
/* colours that the scripts write straight into a style="" attribute */
[data-mode][data-theme="dark"] [style*="color:#A33A2E" i], [data-mode][data-theme="dark"] [style*="color: rgb(163, 58, 46)"] { color: var(--red) !important; }
[data-mode][data-theme="dark"] [style*="color:#8A5A00" i], [data-mode][data-theme="dark"] [style*="color: rgb(138, 90, 0)"] { color: var(--amber) !important; }
[data-mode][data-theme="dark"] [style*="color:#1F4D38" i], [data-mode][data-theme="dark"] [style*="color: rgb(31, 77, 56)"], [data-mode][data-theme="dark"] [style*="color:#2E7D32" i], [data-mode][data-theme="dark"] [style*="color:#2E8B4F" i] { color: var(--green) !important; }
[data-mode][data-theme="dark"] [style*="background:#FBF1EF" i], [data-mode][data-theme="dark"] [style*="background:#FDECEA" i] { background: var(--red-bg) !important; border-color: var(--line) !important; }
[data-mode][data-theme="dark"] [style*="background:#E3F1E8" i] { background: var(--green-bg) !important; border-color: var(--line) !important; }
[data-mode][data-theme="dark"] textarea { background-color: var(--surface); color: var(--ink); }
[data-mode][data-theme="dark"] .user-menu-item.danger, [data-mode][data-theme="dark"] .user-menu-item.danger .ic { color: var(--red); }
[data-mode][data-theme="dark"] .msg-flag input:disabled + span { opacity: .8; }
/* Midnight OLED is dark whatever the theme switch says */
body[data-palette="oled"][data-mode="admin"] {
/* the status colours are used as TEXT (visit dates, status chips), so on a dark page they need to be lighter */
  --status-new: #8EA9D8; --status-contacted: #DDAE55; --status-followup: #DB9A55; --status-sitevisit: #55BBA9;
  --status-sitevisit-done: #72AEDB; --status-sitevisit-cancelled: #DD946F; --status-sitevisit-resched: #E3A445;
  --status-meeting: #AE92DA; --status-negotiation: #AE92DA; --status-interested: #60C8BA; --status-notanswering: #CCB265;
  --status-converted: #74C285; --status-notinterested: #A8A8A2; --status-invalid: #E58478; --status-broker: #B9A3D6; --status-notreachable: #CBA88A;
    --sc-slate: #A7B4C4; --sc-blue: #8EAEE3; --sc-teal: #5FC3BB; --sc-green: #8CCB7C; --sc-olive: #C9C56A; --sc-amber: #E5AE55; --sc-coral: #EE987F; --sc-rose: #E68AAE; --sc-plum: #C59BDE; --sc-brown: #CC9C7C;
  --chip-mix: 52%; --ph: #9A978F; --on-red: #2B0F0C; --on-ink: #141518;
  --wa-bubble-bg: #1A2A21; --wa-bubble-line: #2B4535;
  --note-warn-bg: rgba(224,166,79,.14); --note-warn-line: rgba(224,166,79,.4); --note-warn-text: #EBB35E;
  --note-bad-bg: #3A1A17; --note-bad-line: #5C2B26; --note-bad-text: #F1A097; --note-diff-bg: rgba(255,255,255,.07);
  --chip-amber-bg: #33220F; --chip-amber-text: #F2B676; --chip-amber-line: #5C3E14; --banner-amber-bg: #2A1E0E;
  --temp-hot-bg: #3A1A17; --temp-hot-text: #F1A097; --temp-warm-bg: #33220F; --temp-warm-text: #F2B676;
  --tip-bg: #26272C; --tip-ink: #F3EFE7; --tip-line: #3A3B41;
  --banner-ok-bg: #17291F; --banner-ok-line: #2B4535; --banner-ok-text: #B7D9A8;
  --accent-wash: var(--gold-wash); --decl-bg: #3A1A17; --decl-line: #5C2B26; --decl-text: #F1A097;
}
body[data-palette="oled"][data-mode="admin"] .src-tile { color: var(--ink) !important; }
body[data-palette="oled"][data-mode="admin"] input:disabled, body[data-palette="oled"][data-mode="admin"] select:disabled, body[data-palette="oled"][data-mode="admin"] textarea:disabled { background-color: var(--surface-2); color: var(--muted); border-color: var(--line); }
body[data-palette="oled"][data-mode="admin"] .missed-badge { animation-name: missedpulse-soft; }
body[data-palette="oled"][data-mode="admin"] .prop-status { background-image: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)) !important; }
body[data-palette="oled"][data-mode="admin"] .prop-flag { background-image: linear-gradient(rgba(0,0,0,.22), rgba(0,0,0,.22)); }
body[data-palette="oled"][data-mode="admin"] .prop-send { color: var(--on-ink); }
body[data-palette="oled"][data-mode="admin"] .tile-btn.whatsapp, body[data-palette="oled"][data-mode="admin"] .btn.btn-wa { background: #13803F; border-color: #13803F; color: #fff; }
body[data-palette="oled"][data-mode="admin"] img[src="/aurex-logo.png"] { content: url("/aurex-logo-white.png"); }
body[data-palette="oled"][data-mode="admin"] .inv-pill.info { color: var(--blue); }
/* colours that the scripts write straight into a style="" attribute */
body[data-palette="oled"][data-mode="admin"] [style*="color:#A33A2E" i], body[data-palette="oled"][data-mode="admin"] [style*="color: rgb(163, 58, 46)"] { color: var(--red) !important; }
body[data-palette="oled"][data-mode="admin"] [style*="color:#8A5A00" i], body[data-palette="oled"][data-mode="admin"] [style*="color: rgb(138, 90, 0)"] { color: var(--amber) !important; }
body[data-palette="oled"][data-mode="admin"] [style*="color:#1F4D38" i], body[data-palette="oled"][data-mode="admin"] [style*="color: rgb(31, 77, 56)"], body[data-palette="oled"][data-mode="admin"] [style*="color:#2E7D32" i], body[data-palette="oled"][data-mode="admin"] [style*="color:#2E8B4F" i] { color: var(--green) !important; }
body[data-palette="oled"][data-mode="admin"] [style*="background:#FBF1EF" i], body[data-palette="oled"][data-mode="admin"] [style*="background:#FDECEA" i] { background: var(--red-bg) !important; border-color: var(--line) !important; }
body[data-palette="oled"][data-mode="admin"] [style*="background:#E3F1E8" i] { background: var(--green-bg) !important; border-color: var(--line) !important; }
body[data-palette="oled"][data-mode="admin"] textarea { background-color: var(--surface); color: var(--ink); }
body[data-palette="oled"][data-mode="admin"] .user-menu-item.danger, body[data-palette="oled"][data-mode="admin"] .user-menu-item.danger .ic { color: var(--red); }
body[data-palette="oled"][data-mode="admin"] .msg-flag input:disabled + span { opacity: .8; }
/* palettes in dark: each colour theme keeps its own tint instead of falling back to its light values */
@media (prefers-color-scheme: dark) {
  body[data-palette="ocean"][data-mode="admin"]:not([data-theme="light"]) {
      --bg: #0B0E14; --surface: #11161F; --surface-2: #151C28; --surface-3: #1B2332; --seg: #1B2332; --ink: #EFF1F5; --text: #DADFE7;
      --muted: #A6ADB9; --muted-2: #949CA8; --line: #1F293A; --line-2: #1C2433; --field-line: #273449; --hover: #1B2332;
      --dark: #D6DEEB; --dark-hover: #FFFFFF; --on-dark: #0E131B; --obsidian: #07090D; --obsidian-2: #0C0F16; --obsidian-3: #11161F;
      --obsidian-line: #171E2B; --gold: #4B88F1; --gold-2: #2E75EF; --gold-ink: #88AFF2; --gold-deep: #ACC7F6; --gold-pale: #9ABBF4;
      --gold-soft: #172236; --gold-wash: #121926; --gold-line: #2B3A54; --on-gold: #1A1305; --primary: #4B88F1; --accent: #88AFF2;
      --accent2: #D6DEEB; --accent2-ink: #2B2100; --focus: #4B88F1; --chart-1: #D0D4DD; --chart-2: #4B88F1; --chart-3: #3E434C;
}
  body[data-palette="forest"][data-mode="admin"]:not([data-theme="light"]) {
      --bg: #0C120E; --surface: #131D17; --surface-2: #18251D; --surface-3: #1F2E24; --seg: #1F2E24; --ink: #EFF5F1; --text: #DAE7DE;
      --muted: #A6B9AD; --muted-2: #94A89B; --line: #24362A; --line-2: #202F25; --field-line: #2D4334; --hover: #1F2E24;
      --dark: #D6EBDD; --dark-hover: #FFFFFF; --on-dark: #101813; --obsidian: #080C0A; --obsidian-2: #0D140F; --obsidian-3: #131D17;
      --obsidian-line: #1B281F; --gold: #5DC071; --gold-2: #47B85E; --gold-ink: #A0DAAB; --gold-deep: #BDE5C5; --gold-pale: #AEE0B8;
      --gold-soft: #17361D; --gold-wash: #122616; --gold-line: #2B5434; --on-gold: #1A1305; --primary: #5DC071; --accent: #A0DAAB;
      --accent2: #D6EBDD; --accent2-ink: #2B2100; --focus: #5DC071; --chart-1: #D0DDD4; --chart-2: #5DC071; --chart-3: #3E4C43;
}
  body[data-palette="sand"][data-mode="admin"]:not([data-theme="light"]) {
      --bg: #130F0C; --surface: #1E1813; --surface-2: #251E18; --surface-3: #2F261E; --seg: #2F261E; --ink: #F5F2EF; --text: #E7E0DA;
      --muted: #B9AFA6; --muted-2: #A89D94; --line: #362C23; --line-2: #30271F; --field-line: #44372C; --hover: #2F261E;
      --dark: #EBE0D6; --dark-hover: #FFFFFF; --on-dark: #191410; --obsidian: #0C0A08; --obsidian-2: #14100D; --obsidian-3: #1E1813;
      --obsidian-line: #28211A; --gold: #EE964F; --gold-2: #EB8633; --gold-ink: #F2B788; --gold-deep: #F6CDAC; --gold-pale: #F4C29A;
      --gold-soft: #362517; --gold-wash: #261B12; --gold-line: #543E2B; --on-gold: #1A1305; --primary: #EE964F; --accent: #F2B788;
      --accent2: #EBE0D6; --accent2-ink: #2B2100; --focus: #EE964F; --chart-1: #DDD6D0; --chart-2: #EE964F; --chart-3: #4C443E;
}
  body[data-palette="lavender"][data-mode="admin"]:not([data-theme="light"]) {
      --bg: #0E0C13; --surface: #17121E; --surface-2: #1D1726; --surface-3: #241D2F; --seg: #241D2F; --ink: #F1EFF5; --text: #DFDAE7;
      --muted: #ADA6B9; --muted-2: #9C94A8; --line: #2A2237; --line-2: #251E31; --field-line: #352B46; --hover: #241D2F;
      --dark: #DED6EB; --dark-hover: #FFFFFF; --on-dark: #131019; --obsidian: #0A080D; --obsidian-2: #100D15; --obsidian-3: #17121E;
      --obsidian-line: #1F1929; --gold: #B07CF4; --gold-2: #9F5FF1; --gold-ink: #B688F2; --gold-deep: #CCACF6; --gold-pale: #C19AF4;
      --gold-soft: #241736; --gold-wash: #1B1226; --gold-line: #3D2B54; --on-gold: #1A1305; --primary: #B07CF4; --accent: #B688F2;
      --accent2: #DED6EB; --accent2-ink: #2B2100; --focus: #B07CF4; --chart-1: #D4D0DD; --chart-2: #B07CF4; --chart-3: #433E4C;
}
  body[data-palette="coral"][data-mode="admin"]:not([data-theme="light"]) {
      --bg: #120C0D; --surface: #1D1315; --surface-2: #25181A; --surface-3: #2E1F21; --seg: #2E1F21; --ink: #F5EFF0; --text: #E7DADB;
      --muted: #B9A6A9; --muted-2: #A89497; --line: #362426; --line-2: #2F2022; --field-line: #432D30; --hover: #2E1F21;
      --dark: #EBD6D9; --dark-hover: #FFFFFF; --on-dark: #181011; --obsidian: #0C0809; --obsidian-2: #140D0E; --obsidian-3: #1D1315;
      --obsidian-line: #281B1C; --gold: #ED6E7F; --gold-2: #EA5367; --gold-ink: #F08997; --gold-deep: #F5ADB7; --gold-pale: #F39BA7;
      --gold-soft: #36171B; --gold-wash: #261215; --gold-line: #542B31; --on-gold: #1A1305; --primary: #ED6E7F; --accent: #F08997;
      --accent2: #EBD6D9; --accent2-ink: #2B2100; --focus: #ED6E7F; --chart-1: #DDD0D1; --chart-2: #ED6E7F; --chart-3: #4C3E40;
}
}

body[data-palette="ocean"][data-mode="admin"][data-theme="dark"] {
  --bg: #0B0E14; --surface: #11161F; --surface-2: #151C28; --surface-3: #1B2332; --seg: #1B2332; --ink: #EFF1F5; --text: #DADFE7;
  --muted: #A6ADB9; --muted-2: #949CA8; --line: #1F293A; --line-2: #1C2433; --field-line: #273449; --hover: #1B2332;
  --dark: #D6DEEB; --dark-hover: #FFFFFF; --on-dark: #0E131B; --obsidian: #07090D; --obsidian-2: #0C0F16; --obsidian-3: #11161F;
  --obsidian-line: #171E2B; --gold: #4B88F1; --gold-2: #2E75EF; --gold-ink: #88AFF2; --gold-deep: #ACC7F6; --gold-pale: #9ABBF4;
  --gold-soft: #172236; --gold-wash: #121926; --gold-line: #2B3A54; --on-gold: #1A1305; --primary: #4B88F1; --accent: #88AFF2;
  --accent2: #D6DEEB; --accent2-ink: #2B2100; --focus: #4B88F1; --chart-1: #D0D4DD; --chart-2: #4B88F1; --chart-3: #3E434C;
}
body[data-palette="forest"][data-mode="admin"][data-theme="dark"] {
  --bg: #0C120E; --surface: #131D17; --surface-2: #18251D; --surface-3: #1F2E24; --seg: #1F2E24; --ink: #EFF5F1; --text: #DAE7DE;
  --muted: #A6B9AD; --muted-2: #94A89B; --line: #24362A; --line-2: #202F25; --field-line: #2D4334; --hover: #1F2E24;
  --dark: #D6EBDD; --dark-hover: #FFFFFF; --on-dark: #101813; --obsidian: #080C0A; --obsidian-2: #0D140F; --obsidian-3: #131D17;
  --obsidian-line: #1B281F; --gold: #5DC071; --gold-2: #47B85E; --gold-ink: #A0DAAB; --gold-deep: #BDE5C5; --gold-pale: #AEE0B8;
  --gold-soft: #17361D; --gold-wash: #122616; --gold-line: #2B5434; --on-gold: #1A1305; --primary: #5DC071; --accent: #A0DAAB;
  --accent2: #D6EBDD; --accent2-ink: #2B2100; --focus: #5DC071; --chart-1: #D0DDD4; --chart-2: #5DC071; --chart-3: #3E4C43;
}
body[data-palette="sand"][data-mode="admin"][data-theme="dark"] {
  --bg: #130F0C; --surface: #1E1813; --surface-2: #251E18; --surface-3: #2F261E; --seg: #2F261E; --ink: #F5F2EF; --text: #E7E0DA;
  --muted: #B9AFA6; --muted-2: #A89D94; --line: #362C23; --line-2: #30271F; --field-line: #44372C; --hover: #2F261E;
  --dark: #EBE0D6; --dark-hover: #FFFFFF; --on-dark: #191410; --obsidian: #0C0A08; --obsidian-2: #14100D; --obsidian-3: #1E1813;
  --obsidian-line: #28211A; --gold: #EE964F; --gold-2: #EB8633; --gold-ink: #F2B788; --gold-deep: #F6CDAC; --gold-pale: #F4C29A;
  --gold-soft: #362517; --gold-wash: #261B12; --gold-line: #543E2B; --on-gold: #1A1305; --primary: #EE964F; --accent: #F2B788;
  --accent2: #EBE0D6; --accent2-ink: #2B2100; --focus: #EE964F; --chart-1: #DDD6D0; --chart-2: #EE964F; --chart-3: #4C443E;
}
body[data-palette="lavender"][data-mode="admin"][data-theme="dark"] {
  --bg: #0E0C13; --surface: #17121E; --surface-2: #1D1726; --surface-3: #241D2F; --seg: #241D2F; --ink: #F1EFF5; --text: #DFDAE7;
  --muted: #ADA6B9; --muted-2: #9C94A8; --line: #2A2237; --line-2: #251E31; --field-line: #352B46; --hover: #241D2F;
  --dark: #DED6EB; --dark-hover: #FFFFFF; --on-dark: #131019; --obsidian: #0A080D; --obsidian-2: #100D15; --obsidian-3: #17121E;
  --obsidian-line: #1F1929; --gold: #B07CF4; --gold-2: #9F5FF1; --gold-ink: #B688F2; --gold-deep: #CCACF6; --gold-pale: #C19AF4;
  --gold-soft: #241736; --gold-wash: #1B1226; --gold-line: #3D2B54; --on-gold: #1A1305; --primary: #B07CF4; --accent: #B688F2;
  --accent2: #DED6EB; --accent2-ink: #2B2100; --focus: #B07CF4; --chart-1: #D4D0DD; --chart-2: #B07CF4; --chart-3: #433E4C;
}
body[data-palette="coral"][data-mode="admin"][data-theme="dark"] {
  --bg: #120C0D; --surface: #1D1315; --surface-2: #25181A; --surface-3: #2E1F21; --seg: #2E1F21; --ink: #F5EFF0; --text: #E7DADB;
  --muted: #B9A6A9; --muted-2: #A89497; --line: #362426; --line-2: #2F2022; --field-line: #432D30; --hover: #2E1F21;
  --dark: #EBD6D9; --dark-hover: #FFFFFF; --on-dark: #181011; --obsidian: #0C0809; --obsidian-2: #140D0E; --obsidian-3: #1D1315;
  --obsidian-line: #281B1C; --gold: #ED6E7F; --gold-2: #EA5367; --gold-ink: #F08997; --gold-deep: #F5ADB7; --gold-pale: #F39BA7;
  --gold-soft: #36171B; --gold-wash: #261215; --gold-line: #542B31; --on-gold: #1A1305; --primary: #ED6E7F; --accent: #F08997;
  --accent2: #EBD6D9; --accent2-ink: #2B2100; --focus: #ED6E7F; --chart-1: #DDD0D1; --chart-2: #ED6E7F; --chart-3: #4C3E40;
}
/* the colour themes in light: their accent is dark, so text on it must be white; the tinted sidebar needs lighter small print; the market hero needs the light accent */
body[data-palette="ocean"][data-mode="admin"], body[data-palette="forest"][data-mode="admin"], body[data-palette="sand"][data-mode="admin"], body[data-palette="lavender"][data-mode="admin"], body[data-palette="coral"][data-mode="admin"] { --on-gold: #FFFFFF; }
body[data-palette]:not([data-palette="aurex"])[data-mode="admin"] .sidebar { --muted-2: #A6A39C; }
body[data-palette]:not([data-palette="aurex"])[data-mode="admin"] .cmp-hero .eb { color: var(--gold-pale); }
body[data-palette]:not([data-palette="aurex"])[data-mode="admin"] .cmp-stats span { color: #C9C6BF; }
/* wE-dark-end */

/* The Director's "Company look" panel (Update 53). Built from the customiser's own pieces -- .cz-grid,
   .cz-card, .cz-dens are reused untouched -- so it needs only the line that warns this is company-wide
   and the bar that saves it. */
.cz-everyone { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.cz-everyone svg { flex: 0 0 auto; margin-top: 2px; }
.cz-savebar { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cz-msg { font-size: 13px; color: var(--muted); }

/* Update 75: the dates under "Leads received" and "Called" on the dashboard */
.kpi-sub { margin: 3px 0 0; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.3; }
