/* Design tokens + the app's shared language: shell, page header, buttons, pills, tables, forms. */
/* Design tokens. A cool graphite scale, one signal-orange accent, tabular numerals. */
@font-face { font-family: 'Inter'; font-weight: 300 800; font-style: normal; font-display: swap; src: url('../fonts/Inter-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 300 800; font-style: normal; font-display: swap; src: url('../fonts/Inter-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400 600; font-style: normal; font-display: swap; src: url('../fonts/JetBrainsMono.woff2') format('woff2'); }
:root {
  --ink: #0f1318;
  --ink-2: #3a424d;
  --ink-soft: #626b77;
  --ink-faint: #8e96a1;
  --canvas: #f2f3f4;
  --paper: var(--canvas);
  --card: #ffffff;
  --surface-2: #f7f8f9;
  --surface-3: #eceef1;
  --line: #e2e5e9;
  --line-strong: #cdd2d8;
  --rail: #0f1318;
  --rail-2: #181d24;
  --rail-line: #252c35;
  --rail-ink: #e9ecef;
  --rail-soft: #8d97a3;
  --accent: #ff5a1f;
  --accent-hover: #e84a10;
  --accent-ink: #c23a00;
  --accent-soft: #fff0e8;
  --accent-line: #ffc7ae;
  --go: #11805b;
  --go-soft: #e3f4ec;
  --warn: #946200;
  --warn-soft: #fdf0d0;
  --risk: #c42e2b;
  --risk-soft: #fbe7e5;
  --info: #1c58d6;
  --info-soft: #e6eefd;
  --radius: 6px;
  --radius-lg: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --cell-y: 0.72rem;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--paper); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar { width: 244px; background: var(--card); border-right: 1px solid var(--line); padding: 1.1rem 0.85rem; flex-shrink: 0; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.5rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(46, 110, 99, 0.35); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
.brand-text small { font-size: 0.72rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; overflow-y: auto; }
.nav-label { font-size: 0.66rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding: 0.9rem 0.65rem 0.35rem; }
.nav-label:first-child { padding-top: 0.2rem; }
.sidebar nav a { display: flex; align-items: center; gap: 0.65rem; padding: 0.52rem 0.65rem; border-radius: 9px; color: var(--ink-soft); text-decoration: none; font-size: 0.88rem; font-weight: 500; position: relative; }
.sidebar nav a .ico { opacity: 0.85; }
.sidebar nav a:hover { background: var(--surface-3); color: var(--ink); }
.sidebar nav a.active { background: var(--surface-3); color: var(--accent-ink); font-weight: 600; }
.sidebar nav a.active::before { content: ''; position: absolute; left: -0.85rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.me { display: flex; align-items: center; gap: 0.65rem; padding: 0.65rem 0.55rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.me-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--accent-ink); display: grid; place-items: center; font-weight: 650; font-size: 0.85rem; flex: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.me-text b { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 0.7rem; color: var(--ink-soft); }
.me form { margin: 0; }
.me-out { border: none; background: transparent; color: var(--ink-soft); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.me-out:hover { background: var(--surface-3); color: var(--risk); }

.main { flex: 1; padding: 1.6rem 2rem 2.5rem; max-width: 1180px; min-width: 0; }

/* ---- Page header ---- */
.pg-head, .page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pg-title, .page-head h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; line-height: 1.25; }
.pg-sub, .page-head .sub { color: var(--ink-soft); font-size: 0.86rem; margin-top: 0.25rem; max-width: 62ch; }
.pg-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* ---- Cards, stats ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.card > h3:first-child { margin-top: 0; font-size: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 1.25rem; background: #fff; }
.stat-cell { background: var(--card); padding: 0.95rem 1.15rem; border-right: 1px solid var(--line); }
.stat-cell:last-child { border-right: none; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.stat-label { font-size: 0.76rem; color: var(--ink-soft); font-weight: 500; }

/* ---- Tables: one look everywhere (use inside .dt-wrap) ---- */
.dt-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: visible; margin-bottom: 1.25rem; }
.dt-scroll { overflow-x: auto; }
.dt-wrap > .dt-scroll:first-child table { border-radius: 12px 12px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 0.65rem 1rem; white-space: nowrap; }
td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 1.2rem; }
th:last-child, td:last-child { padding-right: 1.2rem; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr[hidden] { display: none; }
.muted { color: var(--ink-soft); }
.cell-main { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.cell-main > span:not(.avatar) { white-space: nowrap; }
.cell-main b { display: block; font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.cell-main small { display: block; color: var(--ink-soft); font-size: 0.76rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 0.78rem; color: #fff; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.68rem; }
.avatar.sq { border-radius: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.nowrap { white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink-soft); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { color: var(--risk); background: var(--risk-soft); }
.row-actions { display: inline-flex; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; display: inline-flex; }

/* A titled strip above a table or list inside .dt-wrap / .ds-card */
.dt-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--line); }
.dt-head .t { font-weight: 600; font-size: 0.95rem; }
.dt-head .h { color: var(--ink-soft); font-size: 0.78rem; margin-top: 0.1rem; }
.main > .ds-kpis { margin-bottom: 1.25rem; }
.main > .ds-toolbar { margin-bottom: 1rem; }

/* Call attempts on a lead: Sara ✓ → Sam ✕ */
.attempts { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; }
.attempts .arrow { color: var(--ink-soft); }
.attempt { padding: 0.1rem 0.5rem; border-radius: 7px; background: var(--surface-3); color: var(--ink-soft); font-weight: 500; }
.attempt.ok { background: var(--go-soft); color: var(--go); }
.attempt.fail { background: var(--risk-soft); color: var(--risk); }
.trunc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }

audio.rec { height: 30px; max-width: 200px; vertical-align: middle; }

td.drag { cursor: grab; color: var(--ink-soft); text-align: center; user-select: none; width: 1%; padding-right: 0; }
tr.s2l-dragging { opacity: 0.5; }
.you { font-size: 0.64rem; font-weight: 600; color: var(--accent-ink); background: var(--surface-3); border-radius: 6px; padding: 0.02rem 0.35rem; margin-left: 0.3rem; vertical-align: 1px; }
select.pres { appearance: none; -webkit-appearance: none; border: none; border-radius: 20px; padding: 0.22rem 1.6rem 0.22rem 0.75rem; font: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer; background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 10px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23777' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); position: relative; }
select.pres.available { background-color: var(--go-soft); color: var(--go); }
select.pres.dnd { background-color: var(--risk-soft); color: var(--risk); }
select.pres.offline { background-color: var(--surface-3); color: var(--ink-soft); }

/* A short explanatory block inside a form, e.g. how to set something up elsewhere */
.callout { margin-top: 0.7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 1rem; font-size: 0.82rem; color: var(--ink); max-width: 640px; }
.callout-title { font-weight: 600; font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 0.35rem; }
.callout p { margin: 0 0 0.5rem; }
.callout ul { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.callout li { margin: 0.25rem 0; }
.copy-chip { display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 0.1rem 0.5rem; cursor: pointer; font: inherit; color: var(--ink-soft); vertical-align: middle; }
.copy-chip code { font-size: 0.74rem; overflow-wrap: anywhere; text-align: left; }
.copy-chip:hover { color: var(--ink); background: var(--surface-2); }

/* Activity log */
.log-day { padding: 0.5rem 1.2rem; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.log-day:first-child { border-radius: 12px 12px 0 0; }
.log-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 0.9rem; align-items: flex-start; padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--line); }
.log-row[hidden] { display: none; }
.log-row:hover { background: var(--surface-2); }
.log-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-soft); }
.log-ico.go { background: var(--go-soft); color: var(--go); }
.log-ico.warn { background: var(--warn-soft); color: var(--warn); }
.log-ico.risk { background: var(--risk-soft); color: var(--risk); }
.log-sum { color: var(--ink); }
.log-more { font-size: 0.72rem; color: var(--accent-ink); margin-left: 0.3rem; }
.log-by { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; font-size: 0.75rem; color: var(--ink-soft); }
.log-time { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; padding-top: 0.15rem; }
.log-body summary { cursor: pointer; list-style: none; }
.log-body summary::-webkit-details-marker { display: none; }

/* Attempts on a lead: one line per expert tried, with how it ended */
.trail { display: flex; flex-direction: column; gap: 0.35rem; min-width: 190px; }
.trail-step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.trail-step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.trail-step .who { font-weight: 550; color: var(--ink); white-space: nowrap; }
.trail-step .why { font-size: 0.72rem; font-weight: 600; padding: 0.08rem 0.5rem; border-radius: 20px; background: var(--surface-3); color: var(--ink-soft); white-space: nowrap; }
.trail-step.ok .dot { background: var(--go); } .trail-step.ok .why { background: var(--go-soft); color: var(--go); }
.trail-step.warn .dot { background: var(--warn); } .trail-step.warn .why { background: var(--warn-soft); color: var(--warn); }
.trail-step.fail .dot { background: var(--risk); } .trail-step.fail .why { background: var(--risk-soft); color: var(--risk); }
.trail-step.wait .dot { background: var(--info); animation: trailPulse 1.4s ease-in-out infinite; } .trail-step.wait .why { background: var(--info-soft); color: var(--info); }
@keyframes trailPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .trail-step.wait .dot { animation: none; } }

/* Where a lead came from: the widget it came through, or how it was added */
.src { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: 0.84rem; font-weight: 500; }
.src span.t { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); }
.src .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

/* Recording player */
.rec { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.5rem 0.25rem 0.3rem; border: 1px solid var(--line); border-radius: 22px; background: #fff; min-width: 150px; }
.rec-btn { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.rec-btn:hover { background: var(--accent-ink); }
.rec .i-pause { display: none; } .rec.playing .i-pause { display: grid; } .rec.playing .i-play { display: none; }
.rec-bar { flex: 1; min-width: 36px; height: 5px; border-radius: 4px; background: var(--surface-3); cursor: pointer; overflow: hidden; }
.rec-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.rec-time { font-size: 0.72rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 2.2rem; text-align: right; }
.rec.failed .rec-time { color: var(--risk); }
.rec-dl { color: var(--ink-soft); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; }
.rec-dl:hover { background: var(--surface-3); color: var(--ink); }

/* Credits */
.cr-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.cr-chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.cr-col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; }
.cr-col:hover { background: var(--surface-3); }
.cr-col i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--surface-3); }
.cr-col i.on { background: linear-gradient(180deg, var(--accent), var(--accent)); }
.cr-axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-soft); margin-top: 0.4rem; }
.cr-bar + .cr-bar { margin-top: 0.8rem; }
.cr-bar-top { display: flex; justify-content: space-between; font-size: 0.84rem; margin-bottom: 0.3rem; gap: 0.6rem; }
.cr-bar-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-track { height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.cr-track i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.cr-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.cr-amt.in { color: var(--go); } .cr-amt.out { color: var(--ink); }
.cr-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.6rem; }
.cr-meter label.plain { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; }
.cr-meter input[type=number] { padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
@media (max-width: 900px) { .cr-grid { grid-template-columns: minmax(0, 1fr); } }

/* Credits card in the sidebar */
.cr-side { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; background: var(--surface-2); }
.cr-side:hover { background: var(--surface-3); }
.cr-side .k { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-soft); font-weight: 500; }
.cr-side .v { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; margin: 0.1rem 0 0.4rem; }
.cr-side .v small { font-size: 0.72rem; font-weight: 500; color: var(--ink-soft); }
.cr-side .cr-track { height: 5px; }
.cr-side.low .cr-track i { background: var(--warn); } .cr-side.empty .cr-track i { background: var(--risk); }
.cr-side.low .v { color: var(--warn); } .cr-side.empty .v { color: var(--risk); }

/* Additional Zoho fields (widget page, CRM values) */
.crm-map { margin-top: 1.4rem; }
.crm-rows { display: grid; gap: 0.6rem; margin-top: 0.6rem; }
.crm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 0.7rem; align-items: start; padding: 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.crm-field { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.crm-field-label { font-weight: 600; font-size: 0.86rem; }
.crm-field code { font-size: 0.74rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.crm-field .crm-pick { width: 100%; max-width: none; }
.crm-field:not(.chosen) .crm-field-label, .crm-field:not(.chosen) code { display: none; }
.crm-field.chosen .crm-pick { display: none; }
.fields .crm-row input[type=text], .fields .crm-row select { max-width: none; width: 100%; }
.crm-value { display: grid; gap: 0.35rem; min-width: 0; }
.crm-value .crm-insert { font-size: 0.78rem; color: var(--ink-soft); padding: 0.3rem 0.5rem; }
.crm-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.crm-preview { margin-top: 0.8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 1rem; font-size: 0.82rem; }
.crm-preview table td { padding: 0.35rem 0.6rem 0.35rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.crm-preview table tr:last-child td { border-bottom: none; }
.crm-problems { margin-top: 1rem; background: var(--warn-soft); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.85rem 1rem; font-size: 0.82rem; }
.crm-problems .callout-title { color: var(--warn); }
.crm-problem { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.crm-problem:last-of-type { border-bottom: none; }
@media (max-width: 760px) { .crm-row { grid-template-columns: minmax(0, 1fr); } }

/* Installations */
.ins-check { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.ins-check input { flex: 1; min-width: 240px; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 0.86rem; background: #fff; }
.ins-out { margin-top: 0.9rem; padding: 0.85rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 0.84rem; }
.ins-out p { margin: 0.4rem 0; }
.ins-out.good { background: var(--surface-2); border-color: var(--line); } .ins-out.warn { background: var(--warn-soft); border-color: var(--line-strong); } .ins-out.bad { background: var(--risk-soft); border-color: #f0c5c2; }
.ins-head { font-weight: 600; word-break: break-all; }
.ins-note { margin-top: 0.3rem; font-size: 0.76rem; color: var(--ink-soft); max-width: 340px; line-height: 1.4; }

/* Where it runs */
.where-read { margin-top: 0.6rem; font-size: 0.82rem; padding: 0.6rem 0.8rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); max-width: 640px; }
.where-read:empty { display: none; }
.where-read div + div { margin-top: 0.3rem; }
.where-warn { color: var(--warn); }
.where-bad { color: var(--risk); } .where-read.where-bad { background: var(--risk-soft); border-color: #f0c5c2; }
.where-ok { color: var(--accent-ink); } .where-read.where-ok { background: var(--surface-2); border-color: var(--line); }
.where-try { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.where-try input { flex: 1; min-width: 260px; max-width: 520px; }

/* ---- Status badges (same look as pills) ---- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 20px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.go { background: var(--go-soft); color: var(--go); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.risk { background: var(--risk-soft); color: var(--risk); }
.badge.neutral { background: var(--surface-3); color: var(--ink-soft); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; background: var(--accent); color: #fff; border: 1px solid transparent; padding: 0.5rem 1rem; border-radius: 10px; font: inherit; font-size: 0.86rem; font-weight: 550; cursor: pointer; text-decoration: none; box-shadow: 0 1px 2px rgba(25, 29, 34, 0.12), inset 0 1px 0 rgba(255,255,255,0.12); transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--accent-ink); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: 0 1px 1px rgba(25, 29, 34, 0.04); }
.btn.secondary:hover { background: var(--surface-3); }
.btn.danger { color: var(--risk); }
.btn.block { width: 100%; }

/* ---- Forms ---- */
form.stacked label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.95rem 0 0.3rem; }
form.stacked label:first-child { margin-top: 0; }
form.stacked input, form.stacked select, .field-input {
  width: 100%; max-width: 440px; padding: 0.52rem 0.7rem; border: 1px solid var(--line); border-radius: 9px; font-size: 0.875rem; font-family: inherit; background: #fff; color: var(--ink);
}
form.stacked input:focus, form.stacked select:focus { outline: 2px solid var(--go-soft); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.4rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .fields .form-grid input[type=text], .fields .form-grid input[type=password], .fields .form-grid input[type=email], .fields .form-grid select { max-width: none; }
.form-hint { color: var(--ink-soft); font-weight: 400; font-size: 0.76rem; }
.form-section { margin: 1.4rem 0 0.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 1.4rem; }

.flash { padding: 0.7rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; font-size: 0.88rem; display: flex; align-items: center; gap: 0.6rem; }
.flash.info { background: var(--surface-3); color: var(--accent-ink); border: 1px solid var(--line); }
.flash.error { background: var(--risk-soft); color: var(--risk); border: 1px solid #f0c5c2; }

.empty-state { color: var(--ink-soft); font-size: 0.9rem; padding: 1rem 0; }

/* ---- Login ---- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 500px at 50% -10%, #e4efe9 0%, transparent 60%), var(--paper); }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2rem 2rem 1.7rem; width: min(400px, 100%); box-shadow: 0 18px 50px rgba(25, 29, 34, 0.1); }
.login-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-card h1 { font-size: 1.35rem; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.login-card .lead { color: var(--ink-soft); font-size: 0.86rem; margin: 0.25rem 0 0; }
.login-card form.stacked input { max-width: none; padding: 0.62rem 0.8rem; }
.login-card .btn { padding: 0.65rem 1rem; margin-top: 1.3rem; }
.login-card .result { margin-top: 1.3rem; padding: 0.9rem 1rem; border-radius: 10px; font-family: ui-monospace, monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; }
.login-card .result.ok { background: var(--surface-3); color: var(--accent-ink); }
.login-card .result.fail { background: var(--risk-soft); color: var(--risk); }
.login-foot { margin: 1.2rem 0 0; font-size: 0.74rem; color: var(--ink-soft); text-align: center; }

/* ---- Settings UI: grouped navigation, status pills, switch, metric tiles, cards, row sections ---- */
.ico { flex-shrink: 0; vertical-align: -3px; }
.ui-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 0.875rem; }
.ui-nav { background: var(--surface-2); border-right: 1px solid var(--line); border-radius: 12px 0 0 12px; padding: 1.1rem 0.75rem; display: flex; flex-direction: column; gap: 1.1rem; }
.ui-nav-title { font-weight: 600; font-size: 0.95rem; padding: 0 0.6rem; }
.ui-nav-group { display: flex; flex-direction: column; gap: 0.1rem; }
.ui-nav-label { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); padding: 0 0.6rem 0.3rem; }
.ui-nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 8px; color: var(--ink-soft); text-decoration: none; }
.ui-nav a:hover { background: var(--surface-3); color: var(--ink); }
.ui-nav a.active { background: var(--go-soft); color: var(--accent-ink); font-weight: 600; }
.ui-main { padding: 1.3rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.ui-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ui-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.ui-sub { color: var(--ink-soft); font-size: 0.8rem; margin-top: 0.2rem; }
.ui-back { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink-soft); font-size: 0.8rem; text-decoration: none; margin-bottom: 0.5rem; }
.ui-back:hover { color: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 20px; white-space: nowrap; }
.pill.go { background: var(--go-soft); color: var(--go); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.risk { background: var(--risk-soft); color: var(--risk); }
.pill.neutral { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }

.ui-switch-wrap { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-soft); font-size: 0.8rem; }
.ui-switch { position: relative; width: 38px; height: 22px; border-radius: 22px; border: none; background: var(--line-strong); cursor: pointer; padding: 0; transition: background 0.15s; }
.ui-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.ui-switch.on { background: var(--go); }
.ui-switch.on::after { transform: translateX(16px); }
.ui-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ui-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.65rem; }
.ui-metric { background: var(--surface-2); border-radius: 8px; padding: 0.75rem 0.9rem; }
.ui-metric .k { font-size: 0.72rem; color: var(--ink-soft); }
.ui-metric .v { font-size: 1.4rem; font-weight: 600; line-height: 1.3; }
.ui-metric .v small { font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); }

.ui-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ui-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
.ui-card-head .t { font-weight: 600; }
.ui-card-head .h { color: var(--ink-soft); font-size: 0.78rem; }
.ui-card-body { padding: 0.95rem 1rem; }
.ui-code { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.75rem; font-family: ui-monospace, monospace; font-size: 0.76rem; white-space: pre-wrap; word-break: break-all; }

.btn.sm { padding: 0.32rem 0.75rem; font-size: 0.8rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.35rem; }
.btn.sm.secondary { background: #fff; }
.btn.danger { color: var(--risk); }

.ui-table { width: 100%; }
.ui-trow { display: grid; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--line); }
.ui-trow:last-child { border-bottom: none; }
.ui-trow.head { padding-top: 0.5rem; padding-bottom: 0.5rem; background: var(--surface-2); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.ui-trow .muted { color: var(--ink-soft); }
.ui-trow .host { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.ui-trow .host span { overflow: hidden; text-overflow: ellipsis; }
.ui-empty { padding: 1.1rem 1rem; color: var(--ink-soft); font-size: 0.85rem; }
.cols-sites { grid-template-columns: minmax(0, 1.8fr) minmax(120px, 1fr) 120px 120px; }

details.ui-row { border-bottom: 1px solid var(--line); }
details.ui-row:last-of-type { border-bottom: none; }
details.ui-row > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 1rem; }
details.ui-row > summary::-webkit-details-marker { display: none; }
details.ui-row > summary:hover { background: var(--surface-2); }
.ui-row .r-title { font-weight: 500; }
.ui-row .r-sum { color: var(--ink-soft); font-size: 0.78rem; margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; }
.ui-row .r-edit { border: 1px solid var(--line); border-radius: 8px; padding: 0.22rem 0.7rem; font-size: 0.78rem; background: #fff; color: var(--ink); white-space: nowrap; }
.ui-row .r-edit::after { content: 'Edit'; }
details.ui-row[open] .r-edit::after { content: 'Close'; }
details.ui-row[open] > summary { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ui-row .r-body { padding: 1rem 1rem 1.15rem; background: #fff; }

.fields label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.9rem 0 0.3rem; }
.fields label:first-child { margin-top: 0; }
.fields label.plain { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; font-size: 0.875rem; }
.fields input[type=text], .fields input[type=number], .fields input[type=time], .fields input[type=password], .fields input[type=email], .fields select, .fields textarea {
  width: 100%; max-width: 440px; padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.875rem; font-family: inherit; background: #fff;
}
.fields input:focus, .fields select:focus, .fields textarea:focus { outline: 2px solid var(--go-soft); border-color: var(--accent); }
.fields textarea { max-width: 540px; }
.fields .hint { color: var(--ink-soft); font-size: 0.78rem; margin: 0.35rem 0 0; max-width: 540px; }

.ui-savebar { position: sticky; bottom: 1rem; display: none; justify-content: space-between; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 1rem; box-shadow: 0 8px 24px rgba(25, 29, 34, 0.12); }
.ui-savebar.show { display: flex; }

.ui-log { font-size: 0.85rem; }
.ui-log details > summary { list-style: none; cursor: pointer; }
.ui-log details > summary::-webkit-details-marker { display: none; }
.ui-log .chg { margin: 0.5rem 0 0; padding: 0.55rem 0.75rem; background: var(--surface-2); border-radius: 8px; font-size: 0.78rem; color: var(--ink-soft); }
.ui-log .chg b { color: var(--ink); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Trigger row: three ways to open the popup, each with its own options */
.ui-trig { display: grid; gap: 0.6rem; margin-top: 0.7rem; }
.ui-trig-item { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.fields label.ui-trig-head, .ui-trig-head { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.75rem 0.9rem; cursor: pointer; margin: 0; font-size: 0.875rem; font-weight: 400; }
.ui-trig-head input { margin-top: 0.2rem; }
.ui-trig-head input { flex: none; }
.ui-trig-head b { display: block; font-weight: 600; }
.ui-trig-head small { display: block; color: var(--ink-soft); font-weight: 400; font-size: 0.78rem; margin-top: 0.1rem; }
.ui-trig-item:has(> .ui-trig-head input:checked) { border-color: var(--line-strong); background: var(--surface-2); }
.ui-trig-body { padding: 0 0.9rem 0.95rem 2.45rem; }
.ui-trig-body > label:first-child { margin-top: 0.2rem; }
.ui-two { margin-top: 0.9rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.ui-choice { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.3rem; }
.fields .ui-choice label.opt, .ui-choice .opt { display: inline-block; margin: 0; font-weight: 400; cursor: pointer; position: relative; }
.ui-choice .opt input { position: absolute; opacity: 0; pointer-events: none; }
.ui-choice .opt span { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.75rem; background: #fff; font-size: 0.82rem; }
.ui-choice .opt input:checked + span { border-color: var(--accent, var(--accent)); background: var(--surface-3); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent, var(--accent)); }
.ui-choice .opt input:focus-visible + span { outline: 2px solid var(--accent, var(--accent)); outline-offset: 2px; }
.ui-choice.icons .opt span { flex-direction: column; gap: 0.2rem; width: 86px; padding: 0.55rem 0.3rem; text-align: center; }
.ui-choice.icons em { font-style: normal; font-size: 0.7rem; color: var(--ink-soft); }
.ui-swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; align-items: center; }
.ui-swatches .sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; margin: 0; position: relative; overflow: hidden; }
.ui-swatches .sw.on { box-shadow: 0 0 0 2px var(--accent, var(--accent)); }
.ui-swatches .sw-default { background: linear-gradient(135deg, #ddb959 0%, #a3812f 100%); }
.ui-swatches .sw-custom { background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444); display: inline-block; }
.ui-swatches .sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
/* Preview of the floating button - mirrors the widget script's own styles */
.pv-stage { position: relative; height: 130px; margin: 0.2rem 0 0.8rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: repeating-linear-gradient(45deg, var(--canvas), var(--canvas) 10px, var(--surface-3) 10px, var(--surface-3) 20px); }
.pv-note { position: absolute; top: 8px; left: 10px; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.pv-fab { position: absolute; right: 18px; bottom: 18px; display: inline-flex; align-items: center; gap: 0.5rem; border: none; border-radius: 999px; padding: 0.85rem 1.3rem; font-weight: 700; font-size: 0.92rem; font-family: inherit; cursor: pointer; background: linear-gradient(135deg, #ddb959 0%, #a3812f 100%); color: #201a0a; box-shadow: 0 10px 30px rgba(23,20,15,0.28); transition: transform 0.18s ease, box-shadow 0.18s ease; z-index: 0; }
.pv-fab.pv-left { right: auto; left: 18px; }
.pv-fab svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pv-fab.pv-icon-only { width: 58px; height: 58px; padding: 0; justify-content: center; }
.pv-fab.pv-icon-only svg { width: 26px; height: 26px; }
.pv-fab.pv-hover-lift:hover { transform: translateY(-3px); }
.pv-fab.pv-hover-grow:hover { transform: scale(1.08); }
.pv-fab.pv-hover-glow:hover { box-shadow: 0 0 0 5px rgba(221,185,89,0.35), 0 12px 34px rgba(23,20,15,0.34); }
.pv-fab.pv-anim-float { animation: pvFloat 3.2s ease-in-out infinite; }
.pv-fab.pv-anim-wiggle { animation: pvWiggle 5s ease-in-out infinite; }
.pv-fab.pv-anim-pulse::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; z-index: -1; pointer-events: none; animation: pvPulse 2.2s ease-out infinite; }
@keyframes pvFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes pvWiggle { 0%, 70%, 100% { rotate: 0deg; } 74% { rotate: -9deg; } 78% { rotate: 9deg; } 82% { rotate: -7deg; } 86% { rotate: 7deg; } 90% { rotate: -3deg; } }
@keyframes pvPulse { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pv-fab, .pv-fab::after { animation: none !important; transition: none !important; } }

/* Settings pages use the room there is: the app's own sidebar already takes its share. */
.main:has(> .ui-shell) { max-width: 1360px; }

/* ---- Widget list ---------------------------------------------------------------------------- */
.wl { gap: 1.15rem; }
.wl .ui-title { font-size: 1.3rem; letter-spacing: -0.01em; }
.ds-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.ds-kpi { padding: 0.95rem 1.15rem; border-right: 1px solid var(--line); min-width: 0; }
.ds-kpi:last-child { border-right: none; }
.ds-kpi .k { font-size: 0.74rem; color: var(--ink-soft); font-weight: 500; }
.ds-kpi .v { margin-top: 0.3rem; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; display: flex; align-items: baseline; gap: 0.5rem; }
.ds-kpi .v small { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); letter-spacing: 0; }
.ds-kpi .s { margin-top: 0.35rem; font-size: 0.74rem; color: var(--ink-soft); }
.delta { display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.74rem; font-weight: 600; letter-spacing: 0; padding: 0.1rem 0.4rem; border-radius: 6px; }
.delta.up { color: var(--go); background: var(--go-soft); }
.delta.down { color: var(--risk); background: var(--risk-soft); }

.ds-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ds-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.ds-tabs button { white-space: nowrap; border: none; background: transparent; padding: 0.38rem 0.8rem; border-radius: 8px; font: inherit; font-size: 0.82rem; font-weight: 500; color: var(--ink-soft); cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem; }
.ds-tabs button span { font-size: 0.7rem; background: rgba(0,0,0,0.06); border-radius: 10px; padding: 0.02rem 0.45rem; }
.ds-tabs button:hover { color: var(--ink); }
.ds-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(25,29,34,0.12); }
.ds-search { position: relative; display: flex; align-items: center; margin: 0; }
.ds-search .ico { position: absolute; left: 0.7rem; color: var(--ink-soft); pointer-events: none; }
.ds-search { max-width: 100%; }
.ds-search input { width: 280px; max-width: 100%; padding: 0.5rem 2rem 0.5rem 2.1rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 0.85rem; background: #fff; }
.ds-search input:focus { outline: 2px solid var(--go-soft); border-color: var(--accent); }
.ds-search kbd { position: absolute; right: 0.55rem; font: inherit; font-size: 0.68rem; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 0.35rem; background: var(--surface-2); }

.ds-card { overflow: visible; }
.wl-row { display: grid; grid-template-columns: 124px minmax(0, 2.3fr) 150px minmax(0, 1.2fr) 140px 78px 92px 40px; align-items: center; gap: 1rem; padding: 0.95rem 1.2rem; border-bottom: 1px solid var(--line); position: relative; }
.wl-row[hidden] { display: none; }
.wl-headrow { padding-top: 0.6rem; padding-bottom: 0.6rem; background: var(--surface-2); border-radius: 12px 12px 0 0; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.wl-headrow > span { font-size: 0.68rem; }
.wl-item { transition: background 0.12s; }
.wl-item:hover { background: var(--surface-2); }
.wl-item:focus-within { background: var(--surface-2); }
.c-widget { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.wl-tile { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), 0 2px 6px rgba(25,29,34,0.12); }
.wl-id { min-width: 0; }
.wl-name { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-weight: 600; font-size: 0.95rem; }
.wl-link { color: var(--ink); text-decoration: none; }
.wl-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.wl-item:hover .wl-link { color: var(--accent-ink); }
.wl-link:focus-visible { outline: none; }
.wl-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.wl-key { position: relative; z-index: 2; margin-top: 0.2rem; display: inline-flex; align-items: center; gap: 0.4rem; border: none; background: transparent; padding: 0.1rem 0.35rem 0.1rem 0; border-radius: 6px; color: var(--ink-soft); cursor: pointer; font: inherit; }
.wl-key code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; }
.wl-key .ico { opacity: 0; transition: opacity 0.12s; }
.wl-item:hover .wl-key .ico, .wl-key:focus-visible .ico { opacity: 1; }
.wl-key:hover { color: var(--ink); }
.c-status { display: flex; align-items: center; gap: 0.65rem; position: relative; z-index: 2; }
.c-status form { margin: 0; display: flex; }
.c-status .pill { min-width: 6.2rem; justify-content: center; }
.c-sites { display: flex; align-items: center; gap: 0.4rem; min-width: 0; font-size: 0.82rem; }
.wl-site { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; color: var(--ink); }
.wl-site span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-site .ico { flex: none; color: var(--ink-soft); }
.wl-more { flex: none; font-size: 0.7rem; font-weight: 600; color: var(--ink-soft); background: var(--surface-3); border-radius: 10px; padding: 0.05rem 0.45rem; }
.c-sites .muted, .c-team .muted, .c-rate .muted { color: var(--ink-soft); }
.c-leads { display: flex; align-items: center; gap: 0.6rem; }
.c-leads b { min-width: 1.6rem; font-size: 0.95rem; font-weight: 600; text-align: right; }
.c-leads svg { color: var(--accent); }
.c-leads .line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.c-leads .area { fill: currentColor; opacity: 0.1; }
.wl-rate { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.85rem; }
.wl-rate::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wl-rate.good { color: var(--go); } .wl-rate.mid { color: var(--warn); } .wl-rate.low { color: var(--risk); }
.ds-avatars { display: inline-flex; }
.ds-avatars i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 0.68rem; font-weight: 600; color: #fff; border: 2px solid #fff; margin-left: -7px; }
.ds-avatars i:first-child { margin-left: 0; }
.ds-avatars i.more { background: var(--surface-3); color: var(--ink-soft); }
.c-menu { position: relative; z-index: 3; display: flex; justify-content: flex-end; }
.ds-menu { position: relative; }
.ds-menu summary { list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-soft); }
.ds-menu summary::-webkit-details-marker { display: none; }
.ds-menu summary:hover, .ds-menu[open] summary { background: var(--surface-3); color: var(--ink); }
.ds-pop { position: absolute; right: 0; top: 36px; min-width: 214px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.3rem; box-shadow: 0 12px 32px rgba(25,29,34,0.16); display: flex; flex-direction: column; z-index: 20; }
.ds-pop a, .ds-pop button { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; padding: 0.5rem 0.65rem; border: none; background: transparent; border-radius: 7px; font: inherit; font-size: 0.83rem; color: var(--ink); cursor: pointer; text-decoration: none; }
.ds-pop a:hover, .ds-pop button:hover { background: var(--surface-3); }
.ds-pop form { margin: 0; }
.ds-pop hr { border: none; border-top: 1px solid var(--line); margin: 0.3rem 0.2rem; }
.ds-pop .danger { color: var(--risk); }
.ds-pop .ico { color: var(--ink-soft); flex: none; }
.ds-pop .danger .ico { color: var(--risk); }
.ds-empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-soft); display: grid; gap: 0.35rem; justify-items: center; border-bottom: 1px solid var(--line); }
.ds-empty[hidden] { display: none; }
.ds-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.7rem 1.2rem; font-size: 0.78rem; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.ds-foot .muted { color: var(--ink-soft); }
.ds-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 2rem)); box-shadow: 0 24px 64px rgba(25,29,34,0.28); color: var(--ink); }
.ds-dialog::backdrop { background: rgba(25,29,34,0.45); backdrop-filter: blur(2px); }
.ds-dialog form { padding: 1.3rem 1.4rem 1.2rem; }
.ds-dialog-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.ds-dialog-head .t { font-size: 1.1rem; font-weight: 600; }
.ds-dialog-head .muted { color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.2rem; }
.ds-x { border: none; background: transparent; cursor: pointer; color: var(--ink-soft); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.ds-x:hover { background: var(--surface-3); color: var(--ink); }
.ds-dialog .fields input, .ds-dialog input[type=text], .ds-dialog input[type=email], .ds-dialog input[type=password], .ds-dialog select { max-width: none; }
.ds-dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; }
.ds-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); background: #191d22; color: #fff; font-size: 0.82rem; padding: 0.55rem 0.95rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 50; }
.ds-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Columns give way gracefully as the card narrows (it depends on the card, not the window). */
@container (max-width: 1000px) {
  .wl-row { grid-template-columns: 124px minmax(0, 2fr) 150px minmax(0, 1fr) 140px 78px 40px; }
  .c-team { display: none; }
}
@container (max-width: 860px) {
  .wl-row { grid-template-columns: 124px minmax(0, 2fr) 150px 140px 78px 40px; }
  .c-sites { display: none; }
}
@container (max-width: 700px) {
  .wl-row { grid-template-columns: 124px minmax(0, 1fr) 150px 40px; }
  .c-leads, .c-rate { display: none; }
}
@container (max-width: 500px) {
  .wl-row { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 0.7rem; }
  .c-created { display: none; }
  .c-status { grid-column: 1; }
  .wl-headrow { display: none; }
}
@media (max-width: 900px) { .ds-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ds-kpi:nth-child(2) { border-right: none; } .ds-kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

/* Tables size themselves by the card they sit in, not the window: the app's own sidebars eat most of a narrow window. */
.ui-card { container-type: inline-size; }
@container (max-width: 700px) {
  .cols-sites { grid-template-columns: minmax(0, 1fr) auto; }
  .ui-trow.head { display: none; }
  .ui-trow .hide-sm { display: none; }
}

@media (max-width: 1000px) {
  .ui-shell { grid-template-columns: minmax(0, 1fr); }
  .ui-nav { border-radius: 12px 12px 0 0; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; padding: 0.7rem 0.75rem; }
  .ui-nav-title, .ui-nav-label { display: none; }
  .ui-nav-group { flex-direction: row; flex-wrap: wrap; }
  .cols-sites { grid-template-columns: minmax(0, 1fr) auto; }
  .ui-trow.head { display: none; }
  .ui-trow .hide-sm { display: none; }
  .ui-two { grid-template-columns: minmax(0, 1fr); }
  .ui-trig-body { padding-left: 0.9rem; }
}

/* ---- Small screens: the sidebar becomes a top bar ---- */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.7rem 1rem; gap: 0.6rem; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; flex: none; }
  .nav-label { display: none; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar nav a.active::before { display: none; }
  .me { margin-left: auto; padding: 0.3rem; border: none; background: transparent; }
  .me-text { display: none; }
  .main { padding: 1rem 1rem 2rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Lead source rules */
.src-field { max-width: 460px; }
.src-field select { width: 100%; max-width: none; }
.src-rules { display: grid; gap: 0.7rem; margin-top: 0.8rem; }
.src-rule { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 0.8rem 0.9rem; }
.src-rule-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.src-rule-n { font-weight: 700; font-size: 0.8rem; letter-spacing: 0.02em; color: var(--ink-soft); text-transform: uppercase; }
.src-rule-tools { display: inline-flex; gap: 0.2rem; }
.src-rule-tools .icon-btn:disabled { opacity: 0.3; cursor: default; }
.src-if { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.src-conds { display: grid; gap: 0.45rem; }
.src-cond { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.src-cond > select { flex: 0 0 9.5rem; width: 9.5rem; }
.src-cond > input[type=text] { flex: 1 1 9rem; min-width: 0; }
.src-cond > .icon-btn { flex: 0 0 auto; }
.fields .src-cond input[type=text], .fields .src-then select, .fields .src-then input[type=text] { max-width: none; width: 100%; }
.fields .src-cond > select { max-width: none; }
.src-then { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--line); }
.src-then-label { font-weight: 600; font-size: 0.84rem; }
.src-then-value { flex: 1 1 14rem; min-width: 0; }
.src-test { margin-top: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 1rem; }
.src-test-title { font-weight: 600; font-size: 0.84rem; margin-bottom: 0.5rem; }
.src-test-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; justify-items: start; }
.fields .src-test-grid input[type=text] { max-width: none; width: 100%; }
.src-test-out { margin: 0.6rem 0 0; font-size: 0.84rem; min-height: 1.2em; }
.src-test-out.ok { color: var(--ok, #1b7a4b); font-weight: 600; }

/* CRM values: each part folds away with a one-line summary */
.crm-sub { border-top: 1px solid var(--line); }
.crm-sub:last-of-type { border-bottom: 1px solid var(--line); }
.crm-sub > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.85rem 0.1rem; cursor: pointer; list-style: none; }
.crm-sub > summary::-webkit-details-marker { display: none; }
.crm-sub > summary::after { content: ""; flex: 0 0 auto; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg) translateY(-2px); transition: transform .15s; order: 3; align-self: center; }
.crm-sub[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.crm-sub-title { font-weight: 600; font-size: 0.9rem; }
.crm-sub-sum { margin-left: auto; font-size: 0.82rem; color: var(--ink-soft); text-align: right; }
.crm-sub-body { padding: 0 0.1rem 1.1rem; }
.src-test { margin-top: 0.9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 1rem; }
.src-test > summary { cursor: pointer; font-weight: 600; font-size: 0.84rem; }
.src-test[open] > summary { margin-bottom: 0.6rem; }

/* Default / Custom / Advanced */
.mode-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; margin: 0.7rem 0 1rem; padding: 0.3rem; border: 1px solid var(--line); border-radius: 12px; background: #f6f5f1; }
.mode-seg button { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.55rem 0.4rem; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; font: inherit; color: var(--ink-soft); }
.mode-seg button b { font-size: 0.86rem; color: var(--ink); }
.mode-seg button small { font-size: 0.72rem; text-align: center; line-height: 1.25; }
.mode-seg button[aria-checked="true"] { background: #fff; border-color: var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.06); color: var(--ink); }
.mode-seg button[aria-checked="true"] b { color: var(--accent, var(--accent)); }
.mode-seg button:focus-visible { outline: 2px solid var(--accent, var(--accent)); outline-offset: 1px; }
.src-match { display: inline-block; width: auto; max-width: none; padding: 0.15rem 1.6rem 0.15rem 0.5rem; margin: 0 0.15rem; font-weight: 600; }
.src-cond[data-join]:not(:first-child)::before { content: attr(data-join); flex: 0 0 100%; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
@media (max-width: 520px) { .mode-seg small { display: none; } }
.mode-seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* "What leads get": every value in effect, and where it came from */
.crm-effective { margin: 0.2rem 0 1.1rem; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.crm-eff-title { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.4rem; }
.crm-effective ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.crm-effective li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: baseline; font-size: 0.86rem; }
.crm-effective .k { color: var(--ink-soft); }
.crm-effective .v { overflow-wrap: anywhere; }
.eff-tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.03em; white-space: nowrap; }
.eff-tag.platform { background: #ecebe6; color: #6b6a63; }
.eff-tag.basic { background: #dcefe6; color: #1e6b4d; }
.eff-tag.advanced { background: var(--info-soft); color: var(--info); }
.crm-eff-key { margin: 0.6rem 0 0; font-size: 0.74rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; align-items: center; }
@media (max-width: 560px) { .crm-effective li { grid-template-columns: minmax(0, 1fr) auto; } .crm-effective .k { grid-column: 1 / -1; } }
.eff-pair { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }

.c-created { font-size: 0.78rem; line-height: 1.3; }
.crm-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--accent-ink, var(--accent-ink)); text-decoration: none; }
.crm-link:hover { text-decoration: underline; }
.wchips { display: flex; flex-wrap: wrap; gap: 0.25rem; max-width: 220px; }
.wchip { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: #eef3f0; color: var(--ink-2); font-size: 0.74rem; font-weight: 600; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.wchip.more { background: #ecebe6; color: #6b6a63; }


/* =====================================================================================================
   Design system v3 - "dispatch console"
   Graphite rail, cool canvas, hairline structure, tabular monospace numerals, one signal accent.
   Everything below overrides the older rules above on purpose; the old selectors stay valid.
   ===================================================================================================== */
html { font-size: 15px; }
body { font-family: var(--font); font-size: 1rem; line-height: 1.45; background: var(--canvas); color: var(--ink); font-feature-settings: 'ss01' 1, 'cv11' 1; letter-spacing: -0.003em; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.mono, .num, td.nowrap.muted, .rec-time, .stat-num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mono { font-size: 0.8rem; }
kbd { font-family: var(--mono); }

/* ---- Shell: rail + stage ---- */
.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { width: auto; background: var(--rail); border-right: none; color: var(--rail-ink); padding: 0.9rem 0.7rem 0.8rem; gap: 0.9rem; position: sticky; top: 0; height: 100vh; }
.brand { padding: 0.2rem 0.45rem 0.5rem; color: var(--rail-ink); border-bottom: 1px solid var(--rail-line); margin: 0 -0.2rem 0.1rem; padding-bottom: 0.85rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #0f1318; box-shadow: none; }
.brand-text b { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.02em; color: #fff; }
.brand-text small { color: var(--rail-soft); font-size: 0.72rem; }
.sidebar nav { gap: 1px; }
.nav-label { color: #6c7683; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.12em; padding: 1rem 0.6rem 0.4rem; }
.sidebar nav a { color: var(--rail-soft); border-radius: 6px; padding: 0.46rem 0.6rem; font-size: 0.9rem; font-weight: 500; gap: 0.62rem; }
.sidebar nav a .ico { opacity: 0.9; }
.sidebar nav a:hover { background: var(--rail-2); color: #fff; }
.sidebar nav a.active { background: var(--rail-2); color: #fff; font-weight: 550; }
.sidebar nav a.active::before { left: -0.7rem; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar nav a.active .ico { color: var(--accent); opacity: 1; }
.sidebar nav a .nav-count { margin-left: auto; font-family: var(--mono); font-size: 0.7rem; color: var(--rail-soft); background: var(--rail-line); border-radius: 4px; padding: 0 0.38rem; line-height: 1.5; }
.sidebar nav a .nav-count.live { background: var(--accent); color: #0f1318; font-weight: 600; }
.me { border: 1px solid var(--rail-line); background: var(--rail-2); border-radius: 8px; padding: 0.5rem 0.5rem; }
.me-avatar { border-radius: 6px; background: #2a323d; color: #fff; width: 30px; height: 30px; font-size: 0.8rem; }
.me-text b { color: #fff; font-size: 0.82rem; }
.me-text small { color: var(--rail-soft); }
.me-out { color: var(--rail-soft); }
.me-out:hover { background: #232a33; color: #fff; }
.cr-side { background: var(--rail-2); border-color: var(--rail-line); color: var(--rail-ink); border-radius: 8px; }
.cr-side:hover { background: #1d232b; }
.cr-side .k { color: var(--rail-soft); }
.cr-side .v { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; letter-spacing: -0.03em; color: #fff; }
.cr-side .v small { font-family: var(--font); color: var(--rail-soft); }
.cr-side .cr-track { background: #2a323d; }
.cr-side .cr-track i { background: var(--accent); }
.cr-side.low .cr-track i { background: #e0a21a; } .cr-side.low .v { color: #f3b93a; }
.cr-side.empty .cr-track i { background: #e5524f; } .cr-side.empty .v { color: #ff7a77; }

.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 52px; display: flex; align-items: center; gap: 1rem; padding: 0 2rem; background: #fff; border-bottom: 1px solid var(--line); }
.qf { position: relative; flex: 0 1 380px; margin: 0; }
.qf .ico { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.qf input { width: 100%; height: 34px; padding: 0 2.2rem 0 2.2rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font: inherit; font-size: 0.88rem; color: var(--ink); }
.qf input::placeholder { color: var(--ink-faint); }
.qf input:focus { outline: none; background: #fff; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15, 19, 24, 0.07); }
.qf kbd { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); font-size: 0.68rem; color: var(--ink-soft); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.34rem; background: #fff; }
.qf-pop { position: absolute; left: 0; right: 0; top: 40px; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 14px 36px rgba(15, 19, 24, 0.14); padding: 0.3rem; max-height: 62vh; overflow: auto; display: none; z-index: 50; }
.qf-pop.show { display: block; }
.qf-pop .g { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); padding: 0.55rem 0.55rem 0.25rem; }
.qf-pop a { display: flex; align-items: center; gap: 0.6rem; padding: 0.42rem 0.55rem; border-radius: 5px; color: var(--ink); text-decoration: none; font-size: 0.88rem; }
.qf-pop a small { margin-left: auto; color: var(--ink-faint); font-size: 0.74rem; }
.qf-pop a:hover, .qf-pop a.on { background: var(--surface-3); }
.qf-pop .none { padding: 0.8rem 0.6rem; color: var(--ink-soft); font-size: 0.85rem; }
.health { margin-left: auto; display: flex; align-items: center; gap: 0.3rem; }
.hchip { display: inline-flex; align-items: center; gap: 0.45rem; height: 30px; padding: 0 0.6rem; border-radius: 6px; font-size: 0.8rem; color: var(--ink-2); text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.hchip:hover { background: var(--surface-3); }
.hchip i { width: 7px; height: 7px; border-radius: 50%; background: var(--go); box-shadow: 0 0 0 3px var(--go-soft); flex: none; }
.hchip.warn i { background: #e0a21a; box-shadow: 0 0 0 3px var(--warn-soft); }
.hchip.risk i { background: var(--risk); box-shadow: 0 0 0 3px var(--risk-soft); }
.hchip.idle i { background: var(--ink-faint); box-shadow: 0 0 0 3px var(--surface-3); }
.hchip b { font-family: var(--mono); font-weight: 500; letter-spacing: -0.02em; }
.density { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; margin-left: 0.4rem; }
.density button { border: none; background: #fff; width: 30px; height: 28px; display: grid; place-items: center; color: var(--ink-faint); cursor: pointer; }
.density button + button { border-left: 1px solid var(--line); }
.density button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.main { max-width: 1320px; width: 100%; padding: 1.7rem 2rem 3rem; }
body[data-density="compact"] { --cell-y: 0.36rem; }

/* ---- Page head ---- */
.pg-head, .page-head { margin-bottom: 1.4rem; align-items: flex-end; }
.pg-title, .page-head h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.pg-sub, .page-head .sub { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.3rem; }
.ui-title { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.02em; }
.wl .ui-title { font-size: 1.35rem; }

/* ---- Surfaces: hairlines, no shadows, 8px corners ---- */
.card, .dt-wrap, .ui-card, .ui-shell, .ds-kpis, .stat-grid, .login-card { border-color: var(--line); border-radius: 8px; box-shadow: none; }
.card { padding: 1.2rem 1.3rem; }
.ds-kpis, .stat-grid { background: #fff; }
.ds-kpi, .stat-cell { padding: 1rem 1.2rem 1.05rem; }
.ds-kpi .k, .stat-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.ds-kpi .v, .stat-num { margin-top: 0.5rem; font-family: var(--mono); font-size: 1.85rem; font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.ds-kpi .v small { font-family: var(--font); font-size: 0.8rem; font-weight: 500; letter-spacing: 0; }
.ds-kpi .s { margin-top: 0.5rem; font-size: 0.78rem; color: var(--ink-soft); }
.delta { border-radius: 4px; font-family: var(--mono); font-size: 0.72rem; }

/* ---- Tables: ledger style ---- */
.dt-wrap { background: #fff; }
table { font-size: 0.9rem; }
th { background: var(--surface-2); color: var(--ink-soft); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; padding: 0.55rem 1rem; border-bottom: 1px solid var(--line-strong); }
td { padding: var(--cell-y) 1rem; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 1.25rem; }
tbody tr:hover { background: var(--surface-2); }
td.nowrap.muted { font-size: 0.78rem; color: var(--ink-soft); }
.cell-main b { font-weight: 600; font-size: 0.92rem; letter-spacing: -0.01em; }
.cell-main small { font-size: 0.78rem; color: var(--ink-soft); }
.avatar { border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.avatar.sm { border-radius: 5px; }
.avatar.sq { border-radius: 6px; }
.icon-btn { border-radius: 6px; border-color: var(--line-strong); width: 30px; height: 30px; background: #fff; }
.icon-btn:hover { background: var(--surface-3); }
.dt-head { padding: 0.85rem 1.25rem; }
.dt-head .t { font-size: 0.95rem; letter-spacing: -0.01em; }
.ds-foot { font-size: 0.8rem; }

/* ---- Status: a dot and a word ---- */
.badge { padding: 0; background: none; border-radius: 0; font-size: 0.86rem; font-weight: 550; color: var(--ink); gap: 0.45rem; }
.badge::before { width: 7px; height: 7px; opacity: 1; }
.badge.go::before { background: var(--go); } .badge.warn::before { background: #e0a21a; } .badge.risk::before { background: var(--risk); } .badge.neutral::before { background: var(--ink-faint); }
.badge.go, .badge.warn, .badge.risk, .badge.neutral { background: none; }
.badge.go { color: var(--go); } .badge.risk { color: var(--risk); } .badge.warn { color: var(--ink); } .badge.neutral { color: var(--ink-soft); }
.pill { border-radius: 5px; font-size: 0.72rem; font-weight: 600; padding: 0.12rem 0.5rem; }
.pill.neutral { background: var(--surface-3); border: none; color: var(--ink-2); }
.trail-step .why { border-radius: 4px; font-weight: 600; }
.trail-step.wait .dot { background: var(--accent); }
.trail-step.wait .why { background: var(--accent-soft); color: var(--accent-ink); }
.src span.t { border-radius: 5px; }
.you { background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; }
select.pres { border-radius: 5px; }
.rec { border-radius: 6px; background: #fff; border-color: var(--line-strong); }
.rec-btn { border-radius: 5px; background: var(--ink); }
.rec-btn:hover { background: var(--accent); color: #0f1318; }
.rec-bar i { background: var(--accent); }

/* ---- Buttons ---- */
.btn { background: var(--ink); color: #fff; border-radius: 6px; padding: 0 0.95rem; height: 34px; font-size: 0.88rem; font-weight: 550; letter-spacing: -0.005em; border: 1px solid var(--ink); }
.btn:hover { background: #262e38; border-color: #262e38; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn.danger { color: var(--risk); }
.btn.sm { height: 28px; padding: 0 0.7rem; font-size: 0.8rem; }
.btn.signal { background: var(--accent); border-color: var(--accent); color: #0f1318; }
.btn.signal:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }

/* ---- Forms ---- */
form.stacked label, .fields label { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); }
form.stacked input, form.stacked select, .field-input, .fields input[type=text], .fields input[type=number], .fields input[type=time], .fields input[type=password], .fields input[type=email], .fields select, .fields textarea, .ds-search input, .ins-check input {
  border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; font-size: 0.9rem; padding: 0.46rem 0.65rem; color: var(--ink);
}
.fields input[type=text], .fields input[type=number], .fields input[type=time], .fields input[type=password], .fields input[type=email], .fields select { min-height: 34px; }
form.stacked input:focus, form.stacked select:focus, .fields input:focus, .fields select:focus, .fields textarea:focus, .ds-search input:focus, .ins-check input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-section { font-size: 0.64rem; letter-spacing: 0.12em; }
.fields .hint, .hint { color: var(--ink-soft); font-size: 0.8rem; }
.callout { border-radius: 6px; background: var(--surface-2); border-color: var(--line); }
.callout-title { color: var(--ink-soft); letter-spacing: 0.1em; font-size: 0.66rem; }
.flash { border-radius: 6px; font-size: 0.9rem; }
.flash.info { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); border-left: 3px solid var(--accent); }
.flash.error { background: var(--risk-soft); border-color: #f0c5c2; border-left: 3px solid var(--risk); }
.ui-switch { background: var(--line-strong); }
.ui-switch.on { background: var(--accent); }
.ui-switch::after { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }

/* ---- Toolbar, underline tabs, search ---- */
.ds-toolbar { align-items: flex-end; gap: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.ds-tabs { background: none; padding: 0; gap: 1.35rem; border-radius: 0; overflow-x: auto; }
.ds-tabs button { border-radius: 0; padding: 0.55rem 0; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); gap: 0.45rem; }
.ds-tabs button span { font-family: var(--mono); font-size: 0.7rem; background: var(--surface-3); color: var(--ink-2); border-radius: 4px; padding: 0 0.4rem; }
.ds-tabs button:hover { color: var(--ink); }
.ds-tabs button.on { background: none; box-shadow: none; color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.ds-tabs button.on span { background: var(--ink); color: #fff; }
.ds-search { margin-bottom: 0.45rem; }
.ds-search input { border-radius: 6px; padding: 0.4rem 2rem 0.4rem 2.1rem; font-size: 0.88rem; min-height: 32px; }
.ds-search kbd { border-radius: 4px; background: #fff; }
.main > .ds-toolbar { margin-bottom: 1rem; }
.mode-seg { background: var(--surface-2); border-radius: 8px; }
.mode-seg button { border-radius: 6px; }

/* ---- Settings frame + rows ---- */
.ui-shell { background: #fff; }
.ui-nav { background: var(--surface-2); border-radius: 8px 0 0 8px; }
.ui-nav a { border-radius: 6px; }
.ui-nav a:hover { background: var(--surface-3); }
.ui-nav a.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong), inset 3px 0 0 var(--accent); }
.ui-nav-label { letter-spacing: 0.12em; font-size: 0.64rem; font-weight: 600; }
.ui-metric { background: var(--surface-2); border-radius: 6px; }
.ui-metric .v { font-family: var(--mono); font-weight: 500; letter-spacing: -0.04em; }
details.ui-row > summary:hover { background: var(--surface-2); }
.ui-row .r-title { font-weight: 600; letter-spacing: -0.01em; }
.ui-row .r-edit { border-radius: 5px; border-color: var(--line-strong); font-weight: 500; }
details.ui-row[open] > summary { background: var(--surface-2); }
.ui-savebar { border-radius: 8px; border-color: var(--line-strong); box-shadow: 0 10px 30px rgba(15, 19, 24, 0.14); }
.ui-choice .opt span { border-radius: 6px; }
.ui-choice .opt input:checked + span { border-color: var(--ink); background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.ui-trig-item { border-radius: 6px; }
.ui-trig-item:has(> .ui-trig-head input:checked) { border-color: var(--ink); background: #fff; }
.crm-row, .crm-effective, .src-rule, .src-test { border-radius: 6px; }
.crm-effective { background: var(--surface-2); border-color: var(--line); }
.crm-eff-title, .src-rule-n { letter-spacing: 0.1em; }
.crm-sub-sum { font-family: var(--mono); font-size: 0.78rem; }
.eff-tag { border-radius: 4px; }
.wchip { border-radius: 4px; background: var(--surface-3); color: var(--ink-2); }

/* ---- Widget list ---- */
.wl-headrow { background: var(--surface-2); border-radius: 8px 8px 0 0; font-weight: 600; letter-spacing: 0.1em; font-size: 0.64rem; }
.wl-headrow > span { font-size: 0.64rem; }
.wl-row { padding: var(--cell-y) 1.25rem; padding-top: calc(var(--cell-y) + 0.2rem); padding-bottom: calc(var(--cell-y) + 0.2rem); }
.wl-tile { border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.wl-name { font-size: 1rem; letter-spacing: -0.015em; }
.c-created { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-soft); letter-spacing: -0.02em; }
.c-leads b, .wl-rate { font-family: var(--mono); font-weight: 500; letter-spacing: -0.03em; }
.ds-avatars i { border-radius: 5px; border-color: #fff; }
.ds-pop { border-radius: 8px; box-shadow: 0 14px 36px rgba(15, 19, 24, 0.16); border-color: var(--line-strong); }
.ds-pop a:hover, .ds-pop button:hover { background: var(--surface-3); }
.ds-menu summary { border-radius: 6px; }
.ds-dialog { border-radius: 10px; }
.ds-empty { padding: 2.6rem 1rem; }

/* ---- Credits, activity, installations ---- */
.cr-col i.on { background: var(--accent); }
.cr-track i { background: var(--ink); }
.cr-amt { font-family: var(--mono); letter-spacing: -0.03em; font-weight: 500; }
.log-ico { border-radius: 6px; }
.log-day { font-weight: 600; letter-spacing: 0.1em; }

/* ---- Login ---- */
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); padding: 0; background: #fff; place-items: stretch; }
.login-art { background: var(--rail); color: #fff; padding: 2.6rem 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { border: none; margin: 0; padding: 0; color: #fff; }
.login-art h2 { font-size: clamp(1.8rem, 3.2vw, 2.7rem); line-height: 1.08; letter-spacing: -0.04em; font-weight: 650; margin: 0 0 1rem; max-width: 15ch; }
.login-art p { color: var(--rail-soft); font-size: 1rem; max-width: 40ch; margin: 0; }
.login-ruler { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background: repeating-linear-gradient(90deg, #2b333d 0 1px, transparent 1px 12px); -webkit-mask-image: linear-gradient(to top, #000, transparent); mask-image: linear-gradient(to top, #000, transparent); }
.login-readout { font-family: var(--mono); font-size: 0.78rem; color: var(--rail-soft); letter-spacing: 0.02em; position: relative; }
.login-readout b { color: var(--accent); font-weight: 500; }
.login-form-side { display: grid; place-items: center; padding: 2rem 1.5rem; }
.login-card { border: none; padding: 0; width: min(380px, 100%); background: transparent; }
.login-card h1 { font-size: 1.6rem; letter-spacing: -0.035em; }
.login-card form.stacked input { padding: 0.62rem 0.8rem; min-height: 40px; }
.login-card .btn { height: 40px; margin-top: 1.3rem; }
@media (max-width: 900px) { .login-shell { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---- Narrow screens: the rail becomes a top strip ---- */
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.6rem 0.8rem; gap: 0.4rem 1rem; }
  .brand { border: none; margin: 0; padding: 0; }
  .sidebar nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; flex: none; }
  .nav-label { display: none; }
  .sidebar nav a.active::before { display: none; }
  .me, .cr-side { display: none; }
  .topbar { padding: 0.55rem 1rem; position: static; height: auto; flex-wrap: wrap; gap: 0.5rem 0.8rem; }
  .qf { flex: 1 1 100%; }
  .health { margin-left: 0; flex-wrap: wrap; }
  .main { padding: 1.2rem 1rem 2.5rem; }
}
@media (max-width: 640px) { .qf kbd { display: none; } .density { display: none; } .main { padding: 1.1rem 0.85rem 2.5rem; } .pg-title { font-size: 1.35rem; } }


/* ---- Dashboard ---- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.dash-main .dt-wrap { margin-bottom: 0; }
.dash-side { display: grid; gap: 1.25rem; }
.lead-kpi .v { color: var(--ink); }
.lead-kpi .v small { color: var(--accent-ink); font-family: var(--mono); font-size: 1rem; margin-left: 0.15rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.panel-h { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.panel-h small { margin-left: auto; font-size: 0.74rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.panel-empty { padding: 1rem; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.45; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.5); animation: livePulse 2s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(255, 90, 31, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.rn-item, .att-row, .ex-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--line); }
.rn-item:last-child, .att-row:last-child, .ex-row:last-child { border-bottom: none; }
.rn-item > div, .att-row > div, .ex-row > div { min-width: 0; flex: 1; }
.rn-item b, .att-row b, .ex-row b { display: block; font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn-item small, .att-row small, .ex-row small { display: flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--ink-soft); }
.rn-timer { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; letter-spacing: -0.04em; color: var(--accent-ink); background: var(--accent-soft); border-radius: 5px; padding: 0.1rem 0.45rem; }
.att-tel { font-size: 0.78rem; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0.2rem 0.45rem; white-space: nowrap; }
.att-tel:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.pdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.pdot.available { background: var(--go); } .pdot.dnd { background: var(--risk); }
.ex-n { font-size: 0.95rem; color: var(--ink); min-width: 1.4rem; text-align: right; }
.funnel { padding: 0.5rem 1rem 0.9rem; }
.fn-row { margin-top: 0.75rem; }
.fn-top { display: flex; justify-content: space-between; font-size: 0.84rem; color: var(--ink-2); margin-bottom: 0.3rem; }
.fn-top b { font-family: var(--mono); font-weight: 500; letter-spacing: -0.03em; color: var(--ink); }
.fn-bar { height: 8px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.fn-bar i { display: block; height: 100%; border-radius: 2px; }
.fn-bar i.ink { background: var(--ink); } .fn-bar i.mid { background: var(--ink-faint); } .fn-bar i.go { background: var(--accent); }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-side { grid-template-columns: minmax(0, 1fr); } }

/* ---- Refinements after the first review ---- */
.cell-main > div { min-width: 0; }
.cell-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.cell-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.wl-row { grid-template-columns: 108px minmax(200px, 2.3fr) 150px minmax(0, 1.2fr) 140px 78px 92px 40px; }
@container (max-width: 1000px) { .wl-row { grid-template-columns: 108px minmax(190px, 2fr) 150px minmax(0, 1fr) 140px 78px 40px; } }
@container (max-width: 860px) { .wl-row { grid-template-columns: 108px minmax(180px, 2fr) 150px 140px 78px 40px; } }
@container (max-width: 700px) { .wl-row { grid-template-columns: 108px minmax(0, 1fr) 150px 40px; } }
@container (max-width: 500px) { .wl-row { grid-template-columns: minmax(0, 1fr) 40px; } }
.wl-name { flex-wrap: nowrap; white-space: nowrap; }
.wl-name .wl-link { overflow: hidden; text-overflow: ellipsis; }
select.pres { background-color: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0.28rem 1.7rem 0.28rem 0.65rem; font-size: 0.82rem; font-weight: 550; }
select.pres.available { background-color: #fff; color: var(--go); }
select.pres.dnd { background-color: #fff; color: var(--risk); }
select.pres.offline { background-color: #fff; color: var(--ink-soft); }
select.pres:hover { background-color: var(--surface-2); }


/* ---- Leads: combinable filters ---- */
.fbar { margin-bottom: 1rem; display: grid; gap: 0.7rem; }
.fbar-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.fbar-top .ds-search { margin: 0; }
.fchips { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }
.fchip { position: relative; display: inline-flex; align-items: center; gap: 0.55rem; height: 36px; padding: 0 0.85rem 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; font-size: 0.9rem; font-weight: 550; color: var(--ink-2); transition: background .12s, border-color .12s, transform .12s; user-select: none; }
.fchip input { position: absolute; opacity: 0; pointer-events: none; }
.fchip::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.fchip.s-connected::before { background: var(--go); } .fchip.s-progress::before { background: #e0a21a; } .fchip.s-missed::before { background: var(--risk); }
.fchip em { font-family: var(--mono); font-style: normal; font-size: 0.74rem; color: var(--ink-soft); background: var(--surface-3); border-radius: 4px; padding: 0 0.4rem; }
.fchip:hover { border-color: var(--ink-faint); }
.fchip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.fchip:has(input:checked) em { background: rgba(255, 255, 255, 0.16); color: #fff; }
.fchip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.fbar-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.fdrop { position: relative; }
.fdrop > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; height: 32px; padding: 0 0.7rem; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 0.86rem; color: var(--ink-soft); background: transparent; user-select: none; }
.fdrop > summary::-webkit-details-marker { display: none; }
.fdrop > summary b { font-weight: 600; color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdrop > summary:hover { border-style: solid; background: #fff; }
.fdrop[open] > summary, .fdrop.active > summary { border-style: solid; border-color: var(--ink); background: #fff; color: var(--ink); }
.fdrop.active > summary b { color: var(--accent-ink); }
.fpop { position: absolute; left: 0; top: 38px; min-width: 230px; max-height: 340px; overflow: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 16px 40px rgba(15, 19, 24, 0.16); padding: 0.35rem; z-index: 40; }
.fopt { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.55rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.fopt:hover { background: var(--surface-3); }
.fopt input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.fopt span { flex: 1; }
.fopt em { font-family: var(--mono); font-style: normal; font-size: 0.74rem; color: var(--ink-soft); }
.fpop-date { padding: 0.6rem; min-width: 290px; }
.fpresets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.7rem; }
.fpresets button { border: 1px solid var(--line-strong); background: #fff; border-radius: 6px; padding: 0.28rem 0.6rem; font: inherit; font-size: 0.82rem; color: var(--ink-2); cursor: pointer; }
.fpresets button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.frange { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.frange label { display: grid; gap: 0.25rem; font-size: 0.74rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }
.frange input { font: inherit; font-size: 0.9rem; font-family: var(--mono); padding: 0.4rem 0.5rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); text-transform: none; letter-spacing: 0; }
.frange input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fclear { display: inline-flex; align-items: center; gap: 0.3rem; height: 32px; padding: 0 0.5rem; border: none; background: none; color: var(--accent-ink); font: inherit; font-size: 0.84rem; font-weight: 550; cursor: pointer; }
.fclear:hover { text-decoration: underline; }
.fclear[hidden] { display: none; }
.fbar-count { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }


/* =====================================================================================================
   v4: drama. A full-width graphite band behind every page title, big type, overlapping KPI cards,
   colour-coded status tags, a speed gauge and an hourly chart on the dashboard.
   ===================================================================================================== */
.main { max-width: none; padding: 0 0 3.5rem; }
.main > *:not(.pg-head):not(script) { max-width: 1320px; margin-left: auto; margin-right: auto; width: calc(100% - 4rem); }
.main > .flash { margin-top: 1.2rem; }

/* the band */
.pg-head { display: block; position: relative; overflow: hidden; background: var(--rail); color: #fff; margin: 0 0 1.5rem; padding: 0; }
.pg-head::before { content: ''; position: absolute; inset: auto 0 0 0; height: 84px; background: repeating-linear-gradient(90deg, #2e3743 0 1px, transparent 1px 10px), repeating-linear-gradient(90deg, #3d4856 0 1px, transparent 1px 50px); -webkit-mask-image: linear-gradient(to top, #000 10%, transparent); mask-image: linear-gradient(to top, #000 10%, transparent); pointer-events: none; }
.pg-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--accent) 0 140px, transparent 140px); }
.pg-in { position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; padding: 2rem 2rem 2.6rem; display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem 2.5rem; flex-wrap: wrap; }
.pg-head:has(+ .ds-kpis) .pg-in { padding-bottom: 4.6rem; }
.pg-eyebrow { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.pg-title { color: #fff; font-size: 2.7rem; font-weight: 650; letter-spacing: -0.055em; line-height: 1.02; margin: 0.45rem 0 0; }
.pg-sub { color: var(--rail-soft); font-size: 1rem; line-height: 1.45; margin-top: 0.7rem; max-width: 56ch; }
.pg-lead { min-width: 0; }
.pg-stats { display: flex; gap: 2.4rem; margin-left: auto; }
.pg-stat .v { font-family: var(--mono); font-size: 2.6rem; font-weight: 500; letter-spacing: -0.06em; line-height: 1; color: #fff; }
.pg-stat .k { margin-top: 0.5rem; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rail-soft); }
.pg-stat.go .v { color: #3ddc97; } .pg-stat.warn .v { color: #ffc247; } .pg-stat.risk .v { color: #ff7a73; }
.pg-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.pg-head .btn { background: #fff; color: var(--ink); border-color: #fff; }
.pg-head .btn:hover { background: var(--accent); border-color: var(--accent); color: #0f1318; }
.pg-head .btn.secondary { background: transparent; color: #fff; border-color: #4a5461; }
.pg-head .btn.secondary:hover { background: #232a33; border-color: #6b7684; color: #fff; }
.pg-head .btn.signal { background: var(--accent); border-color: var(--accent); color: #0f1318; }

/* KPI cards overlap the band */
.pg-head + .ds-kpis { margin-top: -3rem; position: relative; z-index: 2; box-shadow: 0 18px 40px rgba(15, 19, 24, 0.14); border-color: var(--line); border-radius: 10px; }
.ds-kpi { position: relative; padding: 1.2rem 1.4rem 1.25rem 1.6rem; }
.ds-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-strong); }
.ds-kpi:first-child::before, .ds-kpi.k-signal::before { background: var(--accent); }
.ds-kpi.k-go::before { background: var(--go); } .ds-kpi.k-risk::before { background: var(--risk); }
.ds-kpi .v { font-size: 2.7rem; letter-spacing: -0.06em; }
.ds-kpi .k { font-size: 0.68rem; letter-spacing: 0.12em; }

/* status tags */
.badge { padding: 0.2rem 0.55rem; border-radius: 5px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; gap: 0.4rem; background: var(--surface-3); color: var(--ink-2); }
.badge::before { width: 6px; height: 6px; }
.badge.go { background: var(--go-soft); color: var(--go); } .badge.go::before { background: var(--go); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.warn::before { background: #e0a21a; animation: tagPulse 1.6s ease-in-out infinite; }
.badge.risk { background: var(--risk-soft); color: var(--risk); } .badge.risk::before { background: var(--risk); }
.badge.neutral { background: var(--surface-3); color: var(--ink-soft); } .badge.neutral::before { background: var(--ink-faint); }
@keyframes tagPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .badge.warn::before { animation: none; } }

/* rows: an accent bar on hover */
tbody tr { position: relative; }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* the rail glows where you are */
.sidebar nav a.active { background: linear-gradient(90deg, rgba(255, 90, 31, 0.2), rgba(255, 90, 31, 0) 80%), var(--rail-2); }
.brand-mark { box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.16); }

/* settings: a dark navigation panel */
.ui-shell { border-radius: 10px; overflow: hidden; box-shadow: 0 1px 0 rgba(15, 19, 24, 0.04); }
.ui-nav { background: var(--rail); border-right: none; border-radius: 0; }
.ui-nav-title { color: #fff; font-size: 1.05rem; letter-spacing: -0.02em; }
.ui-nav-label { color: #6c7683; }
.ui-nav a { color: var(--rail-soft); }
.ui-nav a:hover { background: var(--rail-2); color: #fff; }
.ui-nav a.active { background: var(--rail-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.ui-title { font-size: 1.7rem; letter-spacing: -0.045em; }
.wl .ui-title { font-size: 1.9rem; }

/* dashboard hero */
@keyframes barUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (max-width: 1000px) { .main > *:not(.pg-head):not(script) { width: calc(100% - 2rem); } .pg-in { padding: 1.4rem 1rem 2rem; } .pg-head:has(+ .ds-kpis) .pg-in { padding-bottom: 4rem; } .pg-title { font-size: 2rem; } .pg-stats { margin-left: 0; gap: 1.6rem; flex-wrap: wrap; } .hero-in { padding: 1.4rem 1rem 4.2rem; } .hero-cta { position: static; align-self: flex-start; } }

/* settings pages: the same dark band, behind the frame */
.main:has(> .ui-shell)::before { content: ''; display: block; height: 172px; background: var(--rail); background-image: repeating-linear-gradient(90deg, #2e3743 0 1px, transparent 1px 10px), repeating-linear-gradient(90deg, #3d4856 0 1px, transparent 1px 50px); background-size: 100% 70px; background-repeat: no-repeat; background-position: bottom; border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--accent) 0 140px, transparent 140px) 1; margin-bottom: 0; }
.main > .ui-shell { margin-top: -100px; position: relative; z-index: 2; box-shadow: 0 18px 40px rgba(15, 19, 24, 0.14); }

/* widget list: columns that fit at every card width */
@container (max-width: 1000px) { .wl-row { grid-template-columns: 96px minmax(170px, 2fr) 128px minmax(0, 1fr) 120px 66px 40px; gap: 0.8rem; } }
@container (max-width: 860px) { .wl-row { grid-template-columns: 96px minmax(150px, 2fr) 128px 120px 66px 40px; gap: 0.8rem; } }
@container (max-width: 700px) { .wl-row { grid-template-columns: 96px minmax(0, 1fr) 128px 40px; } }
@container (max-width: 500px) { .wl-row { grid-template-columns: minmax(0, 1fr) 40px; } }
.wl-headrow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* =====================================================================================================
   v5: more drama. One continuous dark stage (top bar + slanted header band with speed stripes and a ghosted
   title), heavier type, ink-edged panels, rows that animate in.
   ===================================================================================================== */
/* a single dark stage */
.topbar { background: var(--rail); border-bottom: 1px solid #1d232b; }
.qf input { background: #171c23; border-color: #2a323d; color: #fff; }
.qf input::placeholder { color: #6c7683; }
.qf input:focus { background: #1d232b; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.22); }
.qf .ico { color: #6c7683; }
.qf kbd { background: #171c23; border-color: #2a323d; color: #8d97a3; }
.hchip { color: #c4cbd3; }
.hchip:hover { background: #171c23; }
.hchip b { color: #fff; }
.density { border-color: #2a323d; }
.density button { background: #171c23; color: #6c7683; }
.density button + button { border-left-color: #2a323d; }
.density button[aria-pressed="true"] { background: var(--accent); color: #0f1318; }

/* the slanted band, speed stripes, ghost title */
.pg-head { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 34px), 0 100%); margin-bottom: 0; }
.pg-head::after { content: ''; position: absolute; top: 0; bottom: 0; right: -60px; width: 560px; left: auto; height: auto; z-index: 0; background: linear-gradient(115deg, transparent 0 42%, var(--accent) 42% 47%, transparent 47% 52%, rgba(255, 90, 31, 0.6) 52% 55%, transparent 55% 60%, rgba(255, 90, 31, 0.3) 60% 61.5%, transparent 61.5%); opacity: 0.95; }
.pg-in { padding: 2.4rem 2rem 3.4rem; }
.pg-head:has(+ .ds-kpis) .pg-in { padding-bottom: 5.4rem; }
.pg-title { font-size: 3.4rem; font-weight: 700; letter-spacing: -0.065em; line-height: 0.98; }
.pg-sub { font-size: 1.05rem; max-width: 52ch; }
.pg-eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.72rem; letter-spacing: 0.2em; }
.pg-eyebrow::before { content: ''; width: 8px; height: 8px; background: var(--accent); transform: rotate(45deg); }
.pg-stat .v { font-size: 3.1rem; }
.pg-stats { gap: 2.8rem; }
.pg-stats, .pg-actions { position: relative; z-index: 1; }
.pg-head + * { margin-top: 1.6rem; }
.pg-head + .ds-kpis { margin-top: -3.4rem; }

/* heavier panels: an ink edge on top */
.dt-wrap, .panel, .ui-card, .card, .ds-kpis { border-top: 3px solid var(--ink); border-radius: 4px 4px 8px 8px; }
.panel:first-child { border-top-color: var(--accent); }
.ds-kpis { border-top-width: 3px; }
.ds-kpi .v { font-size: 3.1rem; }
.dt-head .t { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
th { background: #fff; border-bottom: 2px solid var(--ink); color: var(--ink); }

/* motion: rows and panels rise into place */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
tbody tr, .panel, .ds-kpi, .fchip, .wl-item { animation: rise 0.5s cubic-bezier(.2, .8, .2, 1) both; }
tbody tr:nth-child(1), .ds-kpi:nth-child(1), .panel:nth-child(1) { animation-delay: 40ms; } tbody tr:nth-child(2), .ds-kpi:nth-child(2), .panel:nth-child(2) { animation-delay: 80ms; }
tbody tr:nth-child(3), .ds-kpi:nth-child(3), .panel:nth-child(3) { animation-delay: 120ms; } tbody tr:nth-child(4), .ds-kpi:nth-child(4), .panel:nth-child(4) { animation-delay: 160ms; }
tbody tr:nth-child(5) { animation-delay: 200ms; } tbody tr:nth-child(6) { animation-delay: 240ms; } tbody tr:nth-child(7) { animation-delay: 280ms; } tbody tr:nth-child(8) { animation-delay: 320ms; }
tbody tr:nth-child(9) { animation-delay: 360ms; } tbody tr:nth-child(10) { animation-delay: 400ms; } tbody tr:nth-child(n+11) { animation-delay: 440ms; }
.wl-item:nth-of-type(1) { animation-delay: 60ms; } .wl-item:nth-of-type(2) { animation-delay: 120ms; } .wl-item:nth-of-type(3) { animation-delay: 180ms; } .wl-item:nth-of-type(n+4) { animation-delay: 240ms; }
@media (prefers-reduced-motion: reduce) { tbody tr, .panel, .ds-kpi, .fchip, .wl-item { animation: none; } }

/* rail: a bigger brand block */
.brand-mark { width: 36px; height: 36px; border-radius: 9px; }
.brand-text b { font-size: 1.05rem; letter-spacing: -0.03em; }
.sidebar nav a { padding: 0.55rem 0.7rem; font-size: 0.93rem; }

/* tags a touch bolder */
.badge { font-size: 0.68rem; padding: 0.24rem 0.6rem; }
.pill { font-weight: 700; }

@media (max-width: 1000px) { .pg-ghost { display: none; } .pg-head::after { width: 280px; right: -80px; opacity: 0.55; } .pg-title { font-size: 2.3rem; } .pg-stat .v { font-size: 2.2rem; } .pg-head { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), 0 100%); } }


/* ---- chart cards ---- */
.chartcard { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.6rem; align-items: center; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 4px 4px 8px 8px; padding: 1.1rem 1.4rem 1rem; margin-bottom: 1.25rem; }
.cc-title { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.5rem; font-weight: 650; font-size: 1.05rem; letter-spacing: -0.02em; }
.cc-title small { font-weight: 400; font-size: 0.78rem; color: var(--ink-soft); letter-spacing: 0; }
.cc-svg { width: 100%; height: auto; display: block; overflow: visible; }
.cc-bar { transform-box: fill-box; transform-origin: bottom; animation: barUp 0.7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d); }
.cc-bar:hover rect:not([fill="transparent"]) { filter: brightness(1.12); }
.cc-side { display: grid; gap: 0.55rem; }
.cc-row { display: grid; grid-template-columns: 10px 1fr auto 3.4rem; align-items: center; gap: 0.6rem; font-size: 0.92rem; padding: 0.55rem 0.7rem; border-radius: 6px; background: var(--surface-2); }
.cc-row i { width: 10px; height: 10px; border-radius: 3px; background: var(--ink-faint); }
.cc-row.go i { background: #1fae7a; } .cc-row.warn i { background: #e8a928; } .cc-row.risk i { background: #e5524f; }
.cc-row b { font-family: var(--mono); font-weight: 500; font-size: 1.15rem; letter-spacing: -0.04em; }
.cc-row em { font-family: var(--mono); font-style: normal; font-size: 0.78rem; color: var(--ink-soft); text-align: right; }
.donutcard { grid-template-columns: 170px minmax(0, 1fr) 260px; }
.donut { width: 170px; height: 170px; }
.donut-seg { animation: donutIn 1s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes donutIn { from { stroke-dasharray: 0 400; } }
.facts { display: grid; gap: 0.7rem; }
.fact { border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 0.9rem; }
.fact .k { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.fact .v { font-family: var(--mono); font-size: 1.7rem; font-weight: 500; letter-spacing: -0.05em; margin-top: 0.2rem; }
@media (max-width: 1100px) { .chartcard, .donutcard { grid-template-columns: minmax(0, 1fr); } .donut { margin: 0 auto; } }

/* KPI deltas */
.vs { font-family: var(--mono); font-size: 0.74rem; letter-spacing: -0.02em; }
.vs.good { color: var(--go); } .vs.bad { color: var(--risk); } .vs.flat { color: var(--ink-soft); }

/* team leaderboard */
.board { margin-bottom: 1.25rem; }
.bd-row { display: grid; grid-template-columns: 26px 200px minmax(0, 1fr) 4.4rem; align-items: center; gap: 0.9rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); }
.bd-row:last-child { border-bottom: none; }
.bd-name b { display: block; font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em; }
.bd-name small { display: flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--ink-soft); }
.bd-bar { position: relative; height: 12px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bd-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; animation: grow 0.8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
.bd-bar i.placed { background: var(--ink-faint); } .bd-bar i.conn { background: var(--accent); }
@keyframes grow { from { transform: scaleX(0); } }
.bd-n { text-align: right; font-size: 0.85rem; color: var(--ink-soft); } .bd-n b { color: var(--ink); font-size: 1.05rem; font-weight: 500; }
@media (max-width: 700px) { .bd-row { grid-template-columns: 26px minmax(0, 1fr) 4rem; } .bd-bar { display: none; } }

/* v5 cleanups */
.pg-head::after { right: -170px; width: 440px; opacity: 0.9; }
.pg-head:has(.pg-stats) .pg-ghost { display: none; }

/* settings pages: a real header band, same language as the other pages */
.main:has(> .ui-shell)::before {
  content: 'Settings'; display: block; height: 200px; box-sizing: border-box;
  padding: 3.4rem max(2rem, calc((100% - 1320px) / 2 + 2rem)) 0;
  color: #fff; font-size: 3.4rem; font-weight: 700; letter-spacing: -0.065em; line-height: 1;
  background:
    linear-gradient(115deg, transparent 0 74%, var(--accent) 74% 77%, transparent 77% 80%, rgba(255, 90, 31, 0.6) 80% 82%, transparent 82% 85%, rgba(255, 90, 31, 0.3) 85% 86%, transparent 86%),
    repeating-linear-gradient(90deg, #2e3743 0 1px, transparent 1px 10px) bottom / 100% 70px no-repeat,
    var(--rail);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 34px), 0 100%);
  border: none; border-image: none; margin: 0;
}
.main > .ui-shell { margin-top: -88px; }
@media (max-width: 1000px) { .main:has(> .ui-shell)::before { font-size: 2.3rem; height: 150px; padding-top: 2.2rem; } .main > .ui-shell { margin-top: -66px; } }
.ui-nav-title { display: none; }


/* overview report row on the dashboard */
.report-row { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.25rem; margin-top: 1.25rem; align-items: stretch; }
.report-row .chartcard { margin-bottom: 0; }
.report-row .chartcard:first-child { grid-template-columns: minmax(0, 1fr) 220px; }
.donutcard.compact { grid-template-columns: minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.dn-top { display: flex; align-items: center; gap: 1rem; }
.dn-top .donut { width: 118px; height: 118px; flex: none; }
.cc-title.stacked { flex-direction: column; gap: 0.2rem; margin: 0; }
.facts.two { grid-template-columns: 1fr 1fr; }
.facts.two .fact .v { font-size: 1.3rem; }
@media (max-width: 1180px) { .report-row, .report-row .chartcard:first-child { grid-template-columns: minmax(0, 1fr); } }

/* the band's stats never run into the speed stripes */
.pg-stats:last-child { margin-right: 11rem; }
@media (max-width: 1000px) { .pg-stats:last-child { margin-right: 0; } }

.report-row .chartcard:first-child { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; align-items: start; }
.report-row .chartcard:first-child .cc-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-row .chartcard { padding-bottom: 1.2rem; }


/* dashboard: metrics only */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.25rem; align-items: stretch; }
.now-body { padding: 1.1rem 1.2rem 1.3rem; display: grid; gap: 1.1rem; }
.now-n { display: flex; align-items: baseline; gap: 0.7rem; }
.now-n b { font-family: var(--mono); font-size: 3.4rem; font-weight: 500; letter-spacing: -0.07em; line-height: 1; }
.now-n span { color: var(--ink-soft); font-size: 0.95rem; }
.now-wait { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 0.8rem; }
.now-wait b { font-size: 1.15rem; }
@media (max-width: 1100px) { .metric-grid { grid-template-columns: minmax(0, 1fr); } }


/* =====================================================================================================
   v6: Light (velvet grey, the default) and Dark (ember). One layout, two skins.
   Everything that has a colour reads it from the tokens below, so a page never needs to know the theme.
   The theme is chosen by <html data-theme="light|dark">; the toggle in the sidebar sets it.
   This layer overrides the older ones on purpose; the older selectors stay valid.
   ===================================================================================================== */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #343a41; --ink-2: #4a5059; --ink-soft: #6f7782; --ink-faint: #a0a7b1;
  --canvas: #e2e5e9; --paper: #e2e5e9;
  --card: #f6f7f9; --surface-2: #eff1f3; --surface-3: #e3e6ea; --surface-solid: #f6f7f9;
  --line: #dadde2; --line-strong: #c9ced5; --line-soft: #e3e6ea;
  --accent: #1f3f6e; --accent-hover: #183360; --accent-ink: #1c3a66; --accent-soft: #e3e6ea; --accent-line: #c9ced5;
  --go: #1c3a66; --go-soft: #e1e4e8;
  --warn: #4a525c; --warn-soft: #e1e4e8;
  --risk: #c0392f; --risk-soft: #f6dcd9;
  --info: #1f3f6e; --info-soft: #e3e6ea;
  --live: #f0a21a;
  --page: linear-gradient(180deg, #e9ebee 0%, #dde0e5 100%);
  --sidebar: linear-gradient(180deg, #eceef1 0%, #e1e4e8 100%);
  --sidebar-edge: transparent; --sidebar-shadow: 10px 0 30px -18px rgba(52, 58, 65, 0.35);
  --sidebar-ink: #5d6571; --hover: rgba(52, 58, 65, 0.06);
  --surface: linear-gradient(168deg, #f9fafb 0%, #edeff2 100%);
  --hero-bg: linear-gradient(168deg, #f9fafb 0%, #eceef1 100%);
  --shadow: 0 22px 44px -22px rgba(52, 58, 65, 0.38), 0 2px 8px rgba(52, 58, 65, 0.07);
  --shadow-sm: 0 6px 14px -8px rgba(52, 58, 65, 0.35), 0 1px 2px rgba(52, 58, 65, 0.06);
  --pop-shadow: 0 18px 44px -12px rgba(52, 58, 65, 0.42);
  --raised: linear-gradient(180deg, #fafbfc, #eceef1);
  --field: #fafbfc; --field-focus: #ffffff;
  --track: #d9dde2; --track-shadow: inset 0 1px 3px rgba(52, 58, 65, 0.2);
  --inset: linear-gradient(180deg, #eceef1, #e3e6ea); --inset-shadow: inset 0 2px 6px rgba(52, 58, 65, 0.12);
  --p1: #35599a; --p2: #12294f; --on-p: #ffffff;
  --p-bg: radial-gradient(130% 95% at 50% -25%, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0) 58%), linear-gradient(180deg, #33578f 0%, #1b3763 52%, #112648 100%);
  --p-shadow: 0 14px 24px -12px rgba(18, 42, 82, 0.78), 0 2px 5px rgba(18, 42, 82, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 -12px 16px -10px rgba(5, 16, 38, 0.6);
  --bub: rgba(255, 255, 255, 0.2); --bub-ink: #ffffff;
  --mark: var(--p-bg); --on-mark: #ffffff;
  --c-go: #1f3f6e; --c-prog: #a3aab3; --c-miss: #c0392f; --c-line: #1f3f6e; --c-rgb: 31, 63, 110;
  --b-go-bg: var(--p-bg); --b-go-ink: #ffffff; --b-go-line: transparent;
  --b-warn-bg: #dfe2e7; --b-warn-ink: #3a4048; --b-warn-line: transparent;
  --b-risk-bg: #f6dcd9; --b-risk-ink: #b8352b; --b-risk-line: transparent;
  --b-neutral-bg: #e3e6ea; --b-neutral-ink: #6f7782;
  --tab-on-bg: linear-gradient(180deg, #fafbfc, #eceef1); --tab-on-line: #1f3f6e; --em-on-bg: #1f3f6e; --em-on-ink: #ffffff;
  --sel-bg: #e6e9ed; --sel-bar: #1f3f6e; --th-bg: transparent;
  --at-off: #d9dde2; --at-on: #1f3f6e;
  --tl-line: #d9dde2; --tl-dot: #a3aab3; --tl-on: #1f3f6e; --tl-ring: #d9dde2;
  --h-weight: 800; --h-style: normal; --h-spacing: -0.05em; --hl-bg: none; --hl-ink: #16305a; --n-weight: 750; --n-style: normal;
  --f1: #16305a; --f2: #6b7480; --f3: #a3aab3;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --grain-opacity: 0.1;
  --tip-bg: #1b2f52;
  --tab-focus: rgba(31, 63, 110, 0.2);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4eae3; --ink-2: #d8c9bd; --ink-soft: #ab988a; --ink-faint: #6f6055;
  --canvas: #0a0605; --paper: #0a0605;
  --card: #150e0a; --surface-2: #1b130e; --surface-3: #261a12; --surface-solid: #140c08;
  --line: rgba(255, 170, 110, 0.13); --line-strong: rgba(255, 170, 110, 0.22); --line-soft: rgba(255, 170, 110, 0.07);
  --accent: #ff7a2f; --accent-hover: #ff8a3d; --accent-ink: #ff8a3d; --accent-soft: rgba(255, 106, 31, 0.14); --accent-line: rgba(255, 106, 31, 0.4);
  --go: #ffa266; --go-soft: rgba(255, 106, 31, 0.16);
  --warn: #d8cabe; --warn-soft: rgba(255, 255, 255, 0.07);
  --risk: #ff8b9b; --risk-soft: rgba(240, 84, 106, 0.14);
  --info: #ff8a3d; --info-soft: rgba(255, 106, 31, 0.14);
  --live: #ff8a3d;
  --page: radial-gradient(1200px 640px at 62% -12%, rgba(190, 76, 16, 0.5), transparent 66%), radial-gradient(900px 520px at 100% 55%, rgba(120, 44, 10, 0.24), transparent 70%), linear-gradient(180deg, #0e0705 0%, #080504 45%, #070403 100%);
  --sidebar: linear-gradient(180deg, #120a06 0%, #0a0604 100%);
  --sidebar-edge: rgba(255, 170, 110, 0.08); --sidebar-shadow: none;
  --sidebar-ink: #ab988a; --hover: rgba(255, 170, 110, 0.07);
  --surface: linear-gradient(160deg, #1b120d 0%, #0f0907 100%);
  --hero-bg: radial-gradient(560px 320px at 88% 0%, rgba(255, 106, 31, 0.3), transparent 70%), linear-gradient(160deg, #21140d 0%, #0f0907 100%);
  --shadow: 0 36px 60px -34px rgba(0, 0, 0, 0.95), inset 0 -26px 50px -36px rgba(255, 106, 31, 0.14);
  --shadow-sm: 0 14px 24px -16px rgba(0, 0, 0, 0.9);
  --pop-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.85);
  --raised: linear-gradient(160deg, #261810, #150d09);
  --field: #0c0705; --field-focus: #120a06;
  --track: #0b0705; --track-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8);
  --inset: #0b0705; --inset-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.7);
  --p1: #ff7a2f; --p2: #e5520f; --on-p: #1b0a02; --p-bg: linear-gradient(180deg, #ff7a2f, #e5520f); --p-shadow: 0 14px 26px -12px rgba(255, 106, 31, 0.8), inset 0 -3px 8px rgba(120, 30, 0, 0.35);
  --bub: #1b0a02; --bub-ink: #ff8a3d;
  --mark: linear-gradient(160deg, #ff8a3d, #d9460a); --on-mark: #1b0a02;
  --c-go: #ff8a3d; --c-prog: #8c7a6c; --c-miss: #f0546a; --c-line: #ff8a3d; --c-rgb: 255, 106, 31;
  --b-go-bg: rgba(255, 106, 31, 0.16); --b-go-ink: #ffa266; --b-go-line: rgba(255, 106, 31, 0.32);
  --b-warn-bg: rgba(255, 255, 255, 0.06); --b-warn-ink: #d3c4b8; --b-warn-line: rgba(255, 255, 255, 0.08);
  --b-risk-bg: rgba(240, 84, 106, 0.14); --b-risk-ink: #ff8b9b; --b-risk-line: rgba(240, 84, 106, 0.3);
  --b-neutral-bg: rgba(255, 255, 255, 0.06); --b-neutral-ink: #ab988a;
  --tab-on-bg: linear-gradient(160deg, #2a170d, #170d07); --tab-on-line: rgba(255, 106, 31, 0.5); --em-on-bg: rgba(255, 106, 31, 0.2); --em-on-ink: #ffb061;
  --sel-bg: linear-gradient(90deg, rgba(255, 106, 31, 0.14), rgba(255, 106, 31, 0.02)); --sel-bar: #ff6a1f; --th-bg: transparent;
  --at-off: #0b0705; --at-on: linear-gradient(90deg, #c9460c, #ff8a3d);
  --tl-line: rgba(255, 106, 31, 0.25); --tl-dot: #8a4a22; --tl-on: #ff8a3d; --tl-ring: rgba(255, 106, 31, 0.2);
  --h-weight: 600; --h-style: normal; --h-spacing: -0.045em; --hl-bg: linear-gradient(90deg, #ffb061, #ff6a1f); --hl-ink: transparent; --n-weight: 600; --n-style: normal;
  --f1: linear-gradient(90deg, #c9460c, #ff8a3d); --f2: linear-gradient(90deg, #b23d0a, #ff7a2f); --f3: linear-gradient(90deg, #7a2a08, #d8672a);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --grain-opacity: 0.05;
  --tip-bg: #26170f;
  --tab-focus: rgba(255, 106, 31, 0.25);
}

/* ---- Base ---- */
html { font-size: 15px; }
body { background: var(--page); background-color: var(--canvas); background-attachment: fixed; color: var(--ink); letter-spacing: -0.005em; font-feature-settings: normal; }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 400; background-image: var(--grain); opacity: var(--grain-opacity); }
a { color: var(--accent-ink); }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.num, td.nowrap.muted, .rec-time, .stat-num, .ds-kpi .v, .pg-stat .v, .fact .v, .now-n b, .cc-row b, .bd-n, .fn-top b, .cr-side .v, .hchip b, .c-created, .c-leads b, .wl-rate, .cr-amt, .fchip em, .fbar-count, .fopt em, .vs, .delta, .rn-timer, .ds-tabs button span { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---- Shell: sidebar + stage ---- */
.app-shell { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); border-right: 1px solid var(--sidebar-edge); box-shadow: var(--sidebar-shadow); padding: 1.1rem 0.8rem 1rem; gap: 0.7rem; z-index: 5; }
.brand { border-bottom: none; margin: 0; padding: 0.2rem 0.5rem 0.9rem; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--mark); color: var(--on-mark); box-shadow: 0 10px 18px -8px rgba(0, 0, 0, 0.55); }
.brand-text b { color: var(--ink); font-size: 1rem; font-weight: 700; letter-spacing: -0.025em; }
.brand-text small { color: var(--ink-faint); }
.nav-label { color: var(--ink-faint); font-size: 0.64rem; font-weight: 650; letter-spacing: 0.12em; padding: 1rem 0.75rem 0.4rem; }
.sidebar nav { gap: 2px; }
.sidebar nav a { color: var(--sidebar-ink); border-radius: 12px; height: 38px; padding: 0 0.75rem; font-size: 0.9rem; font-weight: 550; gap: 0.7rem; }
.sidebar nav a:hover { background: var(--hover); color: var(--ink); }
.sidebar nav a.active { background: var(--p-bg); color: var(--on-p); font-weight: 600; box-shadow: var(--p-shadow); }
.sidebar nav a.active::before { display: none; }
.sidebar nav a.active .ico { color: inherit; opacity: 1; }
.sidebar nav a .nav-count { font-family: var(--font); font-size: 0.7rem; font-weight: 700; background: var(--surface-3); color: var(--ink); border-radius: 10px; padding: 0 0.45rem; }
.sidebar nav a.active .nav-count { background: rgba(255, 255, 255, 0.22); color: inherit; }
.sidebar nav a .nav-count.live { background: var(--live); color: #1a1205; }

.theme-toggle { display: flex; background: var(--track); box-shadow: var(--track-shadow); border-radius: 13px; padding: 3px; }
.theme-toggle button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem; height: 32px; border: none; background: transparent; border-radius: 10px; color: var(--ink-soft); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.login-theme { position: fixed; top: 1rem; right: 1rem; width: 180px; z-index: 6; }

.cr-side { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: var(--shadow-sm); padding: 0.8rem 0.9rem; }
.cr-side:hover { background: var(--surface); filter: brightness(1.03); }
.cr-side .k { color: var(--ink-soft); }
.cr-side .v { font-family: var(--font); font-weight: 650; font-size: 1.1rem; color: var(--ink); letter-spacing: -0.02em; }
.cr-side .v small { color: var(--ink-soft); }
.cr-side .cr-track { background: var(--track); box-shadow: var(--track-shadow); height: 6px; }
.cr-side .cr-track i { background: linear-gradient(90deg, var(--p1), var(--p2)); }
.cr-side.low .cr-track i { background: var(--live); } .cr-side.low .v { color: var(--ink); }
.cr-side.empty .cr-track i { background: var(--risk); } .cr-side.empty .v { color: var(--risk); }
.me { border: none; background: transparent; padding: 0.5rem 0.4rem 0; }
.me-avatar { border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-ink); width: 32px; height: 32px; box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.4); }
.me-text b { color: var(--ink); }
.me-text small { color: var(--ink-faint); }
.me-out { color: var(--ink-faint); }
.me-out:hover { background: var(--hover); color: var(--risk); }

.stage { min-width: 0; }
.topbar { position: static; height: auto; padding: 1.15rem 2rem 0; background: transparent; border: none; max-width: 1360px; width: 100%; margin: 0 auto; }
.qf { flex: 0 1 400px; }
.qf input { background: var(--field); border: 1px solid var(--line-strong); border-radius: 14px; height: 38px; color: var(--ink); box-shadow: var(--track-shadow); }
.qf input::placeholder { color: var(--ink-faint); }
.qf input:focus { background: var(--field-focus); border-color: var(--accent); box-shadow: 0 0 0 3px var(--tab-focus); }
.qf .ico { color: var(--ink-faint); }
.qf kbd { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink-soft); }
.qf-pop { background: var(--surface-solid); border-color: var(--line-strong); border-radius: 14px; box-shadow: var(--pop-shadow); }
.qf-pop a { color: var(--ink); } .qf-pop a:hover, .qf-pop a.on { background: var(--surface-3); }
.qf-pop .g { color: var(--ink-faint); } .qf-pop a small { color: var(--ink-faint); } .qf-pop .none { color: var(--ink-soft); }
.hchip { color: var(--ink-2); border-radius: 20px; height: 32px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.hchip:hover { background: var(--raised); filter: brightness(1.04); }
.hchip b { color: var(--ink); }
.hchip i { background: var(--c-go); box-shadow: 0 0 0 3px var(--surface-3); }
.hchip.warn i { background: var(--live); box-shadow: 0 0 0 3px var(--surface-3); }
.hchip.risk i { background: var(--risk); box-shadow: 0 0 0 3px var(--risk-soft); }
.hchip.idle i { background: var(--ink-faint); box-shadow: 0 0 0 3px var(--surface-3); }
.density { border: none; background: var(--track); box-shadow: var(--track-shadow); border-radius: 12px; padding: 3px; gap: 2px; margin-left: 0.2rem; }
.density button { background: transparent; border-radius: 9px; color: var(--ink-faint); height: 28px; }
.density button + button { border-left: none; }
.density button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.main { max-width: 1360px; width: 100%; margin: 0 auto; padding: 0.4rem 2rem 3.5rem; }
.main > *:not(.pg-head):not(script) { width: auto; max-width: none; margin-left: 0; margin-right: 0; }

/* ---- Page head: a calm header, no band ---- */
.pg-head { display: block; position: static; overflow: visible; clip-path: none; background: none; color: var(--ink); margin: 0 0 1.4rem; padding: 0; }
.pg-head::before, .pg-head::after, .pg-ghost { display: none; }
.pg-in { max-width: none; margin: 0; padding: 1.2rem 0 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 1.2rem 2.5rem; flex-wrap: wrap; }
.pg-head:has(+ .ds-kpis) .pg-in { padding-bottom: 0; }
.pg-eyebrow { font-family: var(--font); font-size: 0.7rem; font-weight: 650; letter-spacing: 0.18em; color: var(--accent-ink); }
.pg-eyebrow::before { display: none; }
.pg-title { color: var(--ink); font-size: 2.6rem; font-weight: var(--h-weight); font-style: var(--h-style); letter-spacing: var(--h-spacing); line-height: 1.04; margin: 0.4rem 0 0; }
.pg-sub { color: var(--ink-soft); font-size: 1rem; max-width: 60ch; margin-top: 0.6rem; }
.pg-stats { gap: 2.2rem; margin: 0; }
.pg-stats:last-child { margin-right: 0; }
.pg-stat .v { color: var(--ink); font-size: 2.4rem; font-weight: var(--n-weight); letter-spacing: -0.05em; }
.pg-stat .k { color: var(--ink-soft); }
.pg-stat.go .v, .pg-stat.warn .v { color: var(--ink); } .pg-stat.risk .v { color: var(--risk); }
.pg-head + * { margin-top: 0; }
.pg-head + .ds-kpis { margin-top: 0; box-shadow: var(--shadow); }
.pg-head .btn, .pg-head .btn.secondary, .pg-head .btn.signal { /* back to the shared look */ }

/* ---- Surfaces ---- */
.card, .dt-wrap, .panel, .ui-card, .ui-shell, .ds-kpis, .stat-grid, .chartcard, .ds-dialog {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); color: var(--ink);
}
.panel:first-child { border-top-color: var(--line); }
.ds-kpis { overflow: hidden; }
.dt-wrap { overflow: visible; }
.card { padding: 1.3rem 1.4rem; }
.panel-h { color: var(--ink); border-bottom: 1px solid var(--line-soft); font-size: 0.7rem; letter-spacing: 0.12em; padding: 0.9rem 1.2rem; }
.panel-h small { color: var(--ink-soft); }
.dt-head { border-bottom: 1px solid var(--line-soft); }
.dt-head .t { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; }
.dt-head .h, .muted, .cell-main small { color: var(--ink-soft); }
.callout, .crm-effective, .crm-row, .crm-preview, .ins-out { background: var(--inset); box-shadow: var(--inset-shadow); border: 1px solid var(--line-soft); border-radius: 14px; }
.callout-title, .crm-eff-title, .src-rule-n { color: var(--ink-soft); }

/* ---- KPI strip (other pages) ---- */
.ds-kpi::before { background: var(--line-strong); width: 3px; }
.ds-kpi:first-child::before, .ds-kpi.k-signal::before { background: var(--accent); }
.ds-kpi.k-go::before { background: var(--c-go); } .ds-kpi.k-risk::before { background: var(--risk); }
.ds-kpi .k { color: var(--ink-soft); }
.ds-kpi .v { font-size: 2.6rem; font-weight: var(--n-weight); letter-spacing: -0.05em; }
.ds-kpi .v small { color: var(--ink-soft); }
.lead-kpi .v small { color: var(--ink-soft); font-family: var(--font); }
.ds-kpi, .stat-cell { border-color: var(--line); }

/* ---- Tables ---- */
table { color: var(--ink); }
th { background: var(--th-bg); color: var(--ink-faint); font-size: 0.66rem; font-weight: 650; letter-spacing: 0.12em; border-bottom: 1px solid var(--line); padding: 0.9rem 1rem 0.7rem; }
thead tr:first-child th:first-child { border-top-left-radius: 21px; }
thead tr:first-child th:last-child { border-top-right-radius: 21px; }
td { border-bottom: 1px solid var(--line-soft); }
tbody tr:hover { background: var(--hover); }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--sel-bar); }
td.nowrap.muted { color: var(--ink-soft); }
.cell-main b { color: var(--ink); font-weight: 650; }
.ds-foot { color: var(--ink-soft); }

/* avatars: calm and neutral, never a rainbow */
:root, :root[data-theme="light"] { --avatar-bg: linear-gradient(180deg, #e9ebee, #d3d7dd); --avatar-ink: #3e444c; --avatar-line: transparent; }
:root[data-theme="dark"] { --avatar-bg: linear-gradient(160deg, #2a1b13, #150d09); --avatar-ink: #ffb061; --avatar-line: rgba(255, 170, 110, 0.12); }
.avatar { background: var(--avatar-bg); color: var(--avatar-ink); border: 1px solid var(--avatar-line); border-radius: 50%; box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.4); font-weight: 700; }
.avatar.sq { border-radius: 10px; }
.ds-avatars i { background: var(--avatar-bg); color: var(--avatar-ink); border-color: var(--surface-solid); }
.icon-btn { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); box-shadow: var(--shadow-sm); }
.icon-btn:hover { background: var(--raised); color: var(--ink); filter: brightness(1.04); }
.icon-btn.danger:hover { color: var(--risk); background: var(--risk-soft); }
.copy-chip { background: var(--raised); border-color: var(--line); color: var(--ink-soft); }
.copy-chip:hover { background: var(--surface-3); color: var(--ink); }
.you { background: var(--accent-soft); color: var(--accent-ink); }
.src span.t { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }

/* ---- Status ---- */
.badge, .pill { text-transform: none; letter-spacing: 0; font-size: 0.76rem; font-weight: 650; padding: 0.22rem 0.7rem 0.22rem 0.6rem; border-radius: 12px; border: 1px solid transparent; background: var(--b-neutral-bg); color: var(--b-neutral-ink); }
.badge::before { width: 6px; height: 6px; opacity: 1; animation: none; }
.badge.go, .pill.go { background: var(--b-go-bg); color: var(--b-go-ink); border-color: var(--b-go-line); } .badge.go::before { background: currentColor; }
.badge.warn, .pill.warn { background: var(--b-warn-bg); color: var(--b-warn-ink); border-color: var(--b-warn-line); } .badge.warn::before { background: currentColor; animation: none; }
.badge.risk, .pill.risk { background: var(--b-risk-bg); color: var(--b-risk-ink); border-color: var(--b-risk-line); } .badge.risk::before { background: currentColor; }
.badge.neutral, .pill.neutral { background: var(--b-neutral-bg); color: var(--b-neutral-ink); border-color: transparent; } .badge.neutral::before { background: currentColor; }
.attempt { background: var(--surface-3); color: var(--ink-soft); }
.attempt.ok { background: var(--go-soft); color: var(--go); } .attempt.fail { background: var(--risk-soft); color: var(--risk); }
.trail-step .dot { background: var(--ink-faint); }
.trail-step.ok .dot { background: var(--c-go); } .trail-step.ok .why { background: var(--go-soft); color: var(--go); }
.trail-step.warn .dot { background: var(--ink-soft); } .trail-step.warn .why { background: var(--warn-soft); color: var(--warn); }
.trail-step.fail .dot { background: var(--risk); } .trail-step.fail .why { background: var(--risk-soft); color: var(--risk); }
.trail-step.wait .dot { background: var(--live); } .trail-step.wait .why { background: var(--accent-soft); color: var(--accent-ink); }
.trail-step .who { color: var(--ink); } .trail-step .why { border-radius: 8px; background: var(--surface-3); color: var(--ink-soft); }
.pdot.available { background: var(--c-go); } .pdot.dnd { background: var(--risk); } .pdot { background: var(--ink-faint); }
select.pres, select.pres.available, select.pres.dnd, select.pres.offline { background-color: var(--raised); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8f98' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); }
select.pres.available { color: var(--ink); } select.pres.dnd { color: var(--risk); } select.pres.offline { color: var(--ink-soft); }
select.pres:hover { background-color: var(--surface-3); }
.rec { background: var(--raised); border-color: var(--line-strong); border-radius: 22px; }
.rec-btn { background: var(--p-bg); color: var(--on-p); border-radius: 50%; }
.rec-btn:hover { background: var(--p-bg); color: var(--on-p); filter: brightness(1.08); }
.rec-bar { background: var(--track); box-shadow: var(--track-shadow); } .rec-bar i { background: var(--c-line); }
.rec-dl:hover { background: var(--hover); }

/* ---- Buttons: pills ---- */
.btn { border-radius: 999px; height: 36px; padding: 0 1.1rem; background: var(--p-bg); color: var(--on-p); border: 1px solid var(--p2); box-shadow: var(--p-shadow); font-weight: 650; letter-spacing: -0.005em; }
.btn:hover { background: var(--p-bg); border-color: var(--p2); filter: brightness(1.07); }
.btn.signal, .pg-head .btn.signal { background: var(--p-bg); border-color: var(--p2); color: var(--on-p); }
.btn.secondary, .btn.sm.secondary, .pg-head .btn.secondary { background: var(--raised); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover, .pg-head .btn.secondary:hover { background: var(--raised); border-color: var(--line-strong); color: var(--ink); filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); filter: none; }
.btn.danger { color: var(--risk); }
.btn.sm { height: 30px; padding: 0 0.85rem; }
.pg-head .btn { background: var(--p-bg); color: var(--on-p); border-color: var(--p2); }
.pg-head .btn:hover { background: var(--p-bg); color: var(--on-p); border-color: var(--p2); }

/* ---- Forms ---- */
form.stacked label, .fields label { color: var(--ink-2); }
form.stacked input, form.stacked select, .field-input, .fields input[type=text], .fields input[type=number], .fields input[type=time], .fields input[type=password], .fields input[type=email], .fields input[type=url], .fields input[type=date], .fields select, .fields textarea, .ds-search input, .ins-check input, .cr-meter input[type=number], .frange input, .src-rule input, .src-rule select, .crm-row input, .crm-row select, textarea {
  background: var(--field); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--track-shadow);
}
form.stacked input:focus, form.stacked select:focus, .fields input:focus, .fields select:focus, .fields textarea:focus, .ds-search input:focus, .ins-check input:focus, .frange input:focus {
  outline: none; background: var(--field-focus); border-color: var(--accent); box-shadow: 0 0 0 3px var(--tab-focus);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
.form-section, .fields .hint, .hint, .form-hint { color: var(--ink-soft); }
.flash { border-radius: 14px; }
.flash.info { background: var(--inset); box-shadow: var(--inset-shadow); border-color: var(--line); color: var(--ink); border-left: 3px solid var(--accent); }
.flash.error { background: var(--risk-soft); border-color: var(--line-strong); color: var(--risk); border-left: 3px solid var(--risk); }
.ui-switch { background: var(--track); box-shadow: var(--track-shadow); }
.ui-switch.on { background: var(--p-bg); box-shadow: none; }

/* ---- Toolbar, tabs, filters ---- */
.ds-toolbar { border-bottom-color: var(--line); }
.ds-tabs button { color: var(--ink-soft); }
.ds-tabs button span { background: var(--surface-3); color: var(--ink-2); border-radius: 8px; }
.ds-tabs button:hover { color: var(--ink); }
.ds-tabs button.on { background: none; color: var(--ink); border-bottom-color: var(--accent); }
.ds-tabs button.on span { background: var(--em-on-bg); color: var(--em-on-ink); }
.ds-search kbd { background: var(--surface-3); color: var(--ink-soft); }
.mode-seg { background: var(--track); box-shadow: var(--track-shadow); border-color: transparent; border-radius: 14px; }
.mode-seg button[aria-checked="true"] { background: var(--raised); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.fchip { height: 38px; padding: 0 0.95rem 0 0.85rem; border-radius: 19px; background: var(--raised); border: 1px solid var(--line-strong); color: var(--ink-2); font-weight: 600; box-shadow: var(--shadow-sm); }
.fchip::before { background: var(--ink-faint); }
.fchip.s-connected::before { background: var(--c-go); } .fchip.s-progress::before { background: var(--c-prog); } .fchip.s-missed::before { background: var(--c-miss); }
.fchip em { background: var(--track); color: var(--ink-soft); border-radius: 8px; padding: 0 0.45rem; }
.fchip:hover { border-color: var(--ink-faint); }
.fchip:has(input:checked) { background: var(--tab-on-bg); border: 1.5px solid var(--tab-on-line); color: var(--ink); }
.fchip:has(input:checked) em { background: var(--em-on-bg); color: var(--em-on-ink); }
.fchip:has(input:focus-visible) { outline: 2px solid var(--accent); }
.fdrop > summary { border: 1px dashed var(--line-strong); border-radius: 16px; height: 34px; color: var(--ink-soft); padding: 0 0.85rem; }
.fdrop > summary b { color: var(--ink); }
.fdrop > summary:hover { background: var(--raised); border-style: solid; }
.fdrop[open] > summary, .fdrop.active > summary { background: var(--raised); border-style: solid; border-color: var(--tab-on-line); color: var(--ink); }
.fdrop.active > summary b { color: var(--accent-ink); }
.fpop, .ds-pop { background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--pop-shadow); color: var(--ink); }
.fopt:hover, .ds-pop a:hover, .ds-pop button:hover { background: var(--surface-3); }
.fopt input { accent-color: var(--accent); }
.fopt em, .fbar-count { color: var(--ink-soft); }
.fpresets button { background: var(--raised); border-color: var(--line-strong); color: var(--ink-2); border-radius: 10px; }
.fpresets button:hover { background: var(--p-bg); color: var(--on-p); border-color: var(--p2); }
.frange label { color: var(--ink-soft); }
.fclear { color: var(--accent-ink); }

/* ---- Settings frame ---- */
.ui-shell { overflow: hidden; border-radius: 24px; }
.ui-nav { background: var(--surface-2); border-right: 1px solid var(--line-soft); border-radius: 0; }
.ui-nav a { color: var(--ink-soft); border-radius: 12px; }
.ui-nav a:hover { background: var(--hover); color: var(--ink); }
.ui-nav a.active { background: var(--p-bg); color: var(--on-p); box-shadow: var(--p-shadow); }
.ui-nav-label { color: var(--ink-faint); }
.ui-metric { background: var(--inset); box-shadow: var(--inset-shadow); border-radius: 14px; }
details.ui-row > summary:hover, details.ui-row[open] > summary { background: var(--hover); }
.ui-row .r-edit { background: var(--raised); border-color: var(--line-strong); border-radius: 10px; color: var(--ink); }
.ui-row .r-body { background: transparent; }
.ui-savebar { background: var(--surface-solid); border-color: var(--line-strong); border-radius: 18px; box-shadow: var(--pop-shadow); }
.ui-choice .opt span { background: var(--raised); border-color: var(--line-strong); border-radius: 12px; color: var(--ink-2); }
.ui-choice .opt input:checked + span { background: var(--tab-on-bg); border-color: var(--tab-on-line); box-shadow: 0 0 0 1px var(--tab-on-line); color: var(--ink); }
.ui-trig-item { background: var(--raised); border-radius: 14px; }
.ui-trig-item:has(> .ui-trig-head input:checked) { background: var(--tab-on-bg); border-color: var(--tab-on-line); }
.ui-swatches .sw { border-color: var(--surface-solid); }
.eff-tag.platform, .wchip.more { background: var(--surface-3); color: var(--ink-soft); }
.eff-tag.basic { background: var(--go-soft); color: var(--go); }
.wchip { background: var(--surface-3); color: var(--ink-2); }
.wl-headrow { background: transparent; border-bottom: 1px solid var(--line); color: var(--ink-faint); }
.wl-tile { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 6px 14px -6px rgba(0, 0, 0, 0.4); border-radius: 12px; }
.ds-dialog { box-shadow: var(--pop-shadow); border-radius: 22px; }
.ds-dialog::backdrop { background: rgba(10, 8, 6, 0.55); }
.ds-menu summary:hover { background: var(--hover); }
.ds-toast { background: var(--surface-solid); color: var(--ink); border: 1px solid var(--line-strong); }
.ins-out.warn, .crm-problems { background: var(--warn-soft); }
.ins-out.bad { background: var(--risk-soft); border-color: var(--line-strong); }
.where-bad { color: var(--risk); }

/* ---- Credits, activity, installations ---- */
.cr-track { background: var(--track); box-shadow: var(--track-shadow); } .cr-track i, .cr-col i.on { background: linear-gradient(90deg, var(--p1), var(--p2)); }
.cr-col i { background: var(--surface-3); } .cr-col:hover { background: var(--hover); }
.cr-amt.in { color: var(--c-go); }
.log-day { background: var(--surface-2); color: var(--ink-faint); border-bottom-color: var(--line-soft); }
.log-row { border-bottom-color: var(--line-soft); } .log-row:hover { background: var(--hover); }
.log-ico { background: var(--surface-3); color: var(--ink-soft); } .log-ico.go { background: var(--go-soft); color: var(--go); } .log-ico.warn { background: var(--warn-soft); color: var(--warn); } .log-ico.risk { background: var(--risk-soft); color: var(--risk); }
.log-sum { color: var(--ink); } .log-time, .log-by { color: var(--ink-soft); }

/* ---- Settings page title (replaces the old dark band) ---- */
.main:has(> .ui-shell)::before { content: 'Settings'; display: block; height: auto; padding: 1.2rem 0 1.4rem; color: var(--ink); font-size: 2.6rem; font-weight: var(--h-weight); font-style: var(--h-style); letter-spacing: var(--h-spacing); line-height: 1.04; background: none; clip-path: none; border: none; }
.main > .ui-shell { margin-top: 0; box-shadow: var(--shadow); }

/* ---- Motion: gentle ---- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
tbody tr, .panel, .ds-kpi, .fchip, .wl-item { animation-duration: 0.4s; }

/* ---- Login ---- */
.login-shell { background: var(--page); background-color: var(--canvas); background-attachment: fixed; }
.login-art { background: var(--hero-bg); color: var(--ink); border-right: 1px solid var(--line); }
.login-art .brand { color: var(--ink); }
.login-art h2 { color: var(--ink); font-weight: var(--h-weight); letter-spacing: var(--h-spacing); }
.login-art p, .login-readout { color: var(--ink-soft); }
.login-readout b { color: var(--accent-ink); }
.login-ruler { display: none; }
.login-card { background: transparent; border: none; box-shadow: none; }
.login-card h1 { color: var(--ink); font-weight: var(--h-weight); letter-spacing: var(--h-spacing); }
.login-card .lead { color: var(--ink-soft); }
.src span.t.plain { background: var(--surface-3); color: var(--ink-soft); }

/* ---- Dashboard (v6): hero card, trend KPIs, insights ---- */
.hc-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--ink-soft); font-size: 0.88rem; flex-wrap: wrap; }
.hc-tools { display: flex; align-items: center; gap: 0.9rem; }
.live-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 650; color: var(--ink); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 5px rgba(240, 162, 26, 0.18); }
.hc-main { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 1.5rem; align-items: center; margin-top: 0.4rem; }
.hc-eb { font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-ink); font-weight: 650; }
.hc-h1 { margin: 0.8rem 0 0; font-size: clamp(2.2rem, 4.2vw, 3.6rem); line-height: 1.04; font-weight: var(--h-weight); font-style: var(--h-style); letter-spacing: var(--h-spacing); max-width: 14em; color: var(--ink-faint); }
.hc-h1 b { font-weight: inherit; color: var(--hl-ink); background: var(--hl-bg); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="dark"] .hc-h1 { color: var(--ink); }
.hc-chips { display: flex; flex-wrap: wrap; margin-top: 1.3rem; color: var(--ink-soft); font-size: 0.86rem; }
.hc-chips span { padding: 0 1.1rem; border-left: 1px solid var(--line); } .hc-chips span:first-child { padding-left: 0; border-left: none; }
.hc-ring { width: 250px; height: auto; }
.ring-track { stroke: var(--surface-3); }
:root[data-theme="dark"] .ring-track { stroke: rgba(255, 170, 110, 0.12); }
.ring-arc { stroke: var(--c-line); }
:root[data-theme="dark"] .ring-arc { filter: drop-shadow(0 0 10px rgba(255, 106, 31, 0.7)); }
.ring-num { fill: var(--ink); font-weight: 800; letter-spacing: -4px; font-family: var(--font); }
.ring-sub { fill: var(--ink-faint); font-family: var(--font); }
.hc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 1.7rem; border-top: 1px solid var(--line); }
.hc-kpi { padding: 1.15rem 1.3rem 1.3rem; border-left: 1px solid var(--line); }
.hc-kpi:first-child { border-left: none; padding-left: 0; }
.hc-kpi .k { color: var(--ink-soft); font-size: 0.82rem; font-weight: 550; }
.hc-kpi .v { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.6rem; margin-top: 0.55rem; font-size: 2.7rem; line-height: 1; font-weight: var(--n-weight); font-style: var(--n-style); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.hc-kpi .v small { font-size: 1.15rem; color: var(--ink-soft); font-weight: 500; margin-left: 0.15rem; letter-spacing: 0; }
.hc-kpi .v svg polyline { stroke: var(--c-line); }
:root[data-theme="dark"] .hc-kpi .v svg polyline { filter: drop-shadow(0 0 4px rgba(255, 106, 31, 0.6)); }
.hc-kpi.risk .v svg polyline { stroke: var(--c-miss); }
.hc-kpi.risk .v > span:first-child { color: var(--ink); }
.hc-kpi .s { margin-top: 0.7rem; font-size: 0.78rem; }
.vs.good { color: var(--ink); font-weight: 650; } .vs.bad { color: var(--risk); font-weight: 650; } .vs.flat { color: var(--ink-soft); }
:root[data-theme="dark"] .vs.good { color: var(--accent-ink); }
@media (max-width: 1000px) { .hc-main { grid-template-columns: 1fr; } .hc-ring { display: none; } .hc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hc-kpi:nth-child(odd) { border-left: none; padding-left: 0; } }

/* charts take their colours from the theme */
.chartcard { padding: 1.3rem 1.5rem 1.2rem; }
.report-row { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; margin-top: 1.25rem; }
.cc-title { font-weight: 700; }
.cc-title small { color: var(--ink-soft); }
.cc-grid { stroke: var(--line); } .cc-axis { fill: var(--ink-faint); font-family: var(--font); }
.seg-c { fill: var(--c-go); } .seg-p { fill: var(--c-prog); } .seg-m { fill: var(--c-miss); } .seg-0 { fill: var(--line-strong); }
.cc-row { background: var(--inset); box-shadow: var(--inset-shadow); border-radius: 12px; }
.cc-row i { background: var(--ink-faint); }
.cc-row.go i { background: var(--c-go); } .cc-row.warn i { background: var(--c-prog); } .cc-row.risk i { background: var(--c-miss); }
.cc-row em { color: var(--ink-soft); }
.dn-track { stroke: var(--surface-3); } .dn-go { stroke: var(--c-go); } .dn-warn { stroke: var(--c-prog); } .dn-risk { stroke: var(--c-miss); }
.dn-num { fill: var(--ink); font-family: var(--font); } .dn-lab { fill: var(--ink-soft); font-family: var(--font); }
.fact { border-left: 3px solid var(--accent); } .fact .k { color: var(--ink-soft); } .fact .v { font-weight: var(--n-weight); font-family: var(--font); letter-spacing: -0.04em; }
.donutcard.wide { grid-template-columns: auto minmax(0, 1fr) minmax(240px, 0.8fr); gap: 2.2rem; margin: 1.25rem 0 0; }
.donutcard.wide .cc-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .donutcard.wide { grid-template-columns: minmax(0, 1fr); } .donutcard.wide .cc-side { grid-template-columns: minmax(0, 1fr); } }
.fn-bar { background: var(--track); box-shadow: var(--track-shadow); border-radius: 6px; height: 10px; } .fn-bar i { border-radius: 6px; }
.fn-bar i.ink { background: var(--f1); } .fn-bar i.mid { background: var(--f2); } .fn-bar i.go { background: var(--f3); }
.fn-top, .fn-top b { color: var(--ink); } .fn-top span { color: var(--ink-2); }
.live-dot { background: var(--live); }
.rn-timer { background: var(--accent-soft); color: var(--accent-ink); }
.now-n b { font-weight: var(--n-weight); letter-spacing: -0.06em; }
.now-wait { border-top-color: var(--line-soft); }

/* insights */
.insights .panel-h { border-bottom: none; padding-bottom: 0.3rem; }
.insight { display: flex; gap: 0.85rem; padding: 0.95rem 1.2rem; border-top: 1px solid var(--line-soft); }
.insights .panel-h + .insight { border-top: none; }
.insight-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--raised); color: var(--accent-ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.insight b { display: block; font-weight: 650; line-height: 1.35; }
.insight p { margin: 0.25rem 0 0; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.5; }
.insight a { display: inline-block; margin-top: 0.4rem; font-size: 0.84rem; font-weight: 650; color: var(--accent-ink); text-decoration: none; }
.insight a:hover { text-decoration: underline; }
@media (max-width: 1180px) { .report-row { grid-template-columns: minmax(0, 1fr); } }

/* ---- Leads: the side panel ---- */
.leads-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.leads-split.has-panel { grid-template-columns: minmax(0, 1fr) 360px; }
.leads-main { min-width: 0; }
tr[data-row] { cursor: pointer; }
tr[data-row]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr[data-row].is-open td { background: var(--sel-bg); }
tr[data-row].is-open td:first-child { box-shadow: inset 3px 0 0 var(--sel-bar); }
.lead-panel { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.lead-panel[hidden] { display: none; }
.lp-head { position: relative; padding: 1.4rem 1.5rem 1.2rem; background: var(--hero-bg); border-bottom: 1px solid var(--line); }
.lp-x { position: absolute; right: 0.9rem; top: 0.8rem; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.lp-x:hover { background: var(--hover); color: var(--ink); }
.lp-av { width: 52px; height: 52px; font-size: 1.15rem; background: var(--p-bg); color: var(--on-p); border: none; box-shadow: var(--p-shadow); }
.lp-name { margin-top: 0.8rem; font-size: 1.5rem; font-weight: var(--h-weight); letter-spacing: var(--h-spacing); line-height: 1.1; }
.lp-contact { margin-top: 0.35rem; color: var(--ink-soft); font-size: 0.86rem; overflow-wrap: anywhere; }
.lp-badge { margin-top: 0.8rem; }
.lp-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.lp-body { padding: 0.2rem 1.5rem 1.5rem; }
.lp-sec { font-size: 0.66rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin: 1.4rem 0 0.8rem; }
.lp-tl { position: relative; padding-left: 1.4rem; }
.lp-tl::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 8px; width: 2px; background: var(--tl-line); }
.lp-ev { position: relative; padding-bottom: 0.95rem; }
.lp-ev::before { content: ''; position: absolute; left: -1.4rem; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-solid); border: 2px solid var(--tl-dot); box-sizing: border-box; }
.lp-ev.ok::before { border-color: var(--tl-on); background: var(--tl-on); }
.lp-ev.wait::before { background: var(--tl-on); border-color: var(--tl-on); box-shadow: 0 0 0 5px var(--tl-ring); }
.lp-ev.fail::before { border-color: var(--risk); }
.lp-ev b { display: block; font-weight: 650; font-size: 0.9rem; }
.lp-ev small { display: block; color: var(--ink-soft); font-size: 0.78rem; margin-top: 0.1rem; }
.lp-kv { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); gap: 0.55rem 0.7rem; margin: 0; font-size: 0.84rem; }
.lp-kv dt { color: var(--ink-soft); } .lp-kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.lp-kv a { color: var(--accent-ink); text-decoration: none; } .lp-kv a:hover { text-decoration: underline; }
.lp-none { grid-column: 1 / -1; color: var(--ink-soft); font-weight: 400 !important; }
@media (max-width: 1180px) {
  .leads-split.has-panel { grid-template-columns: minmax(0, 1fr); }
  .lead-panel { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; top: auto; max-height: 72vh; z-index: 60; box-shadow: var(--pop-shadow); }
}
.lp-actions [hidden] { display: none; }

/* ---- Narrow screens (v6): the sidebar becomes a top strip ---- */
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.7rem 0.9rem; gap: 0.5rem 1rem; border-right: none; border-bottom: 1px solid var(--line); box-shadow: none; }
  .brand { padding: 0; }
  .sidebar nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; flex: none; gap: 4px; }
  .sidebar nav a { white-space: nowrap; height: 36px; }
  .nav-label { display: none; }
  .me, .cr-side { display: none; }
  .theme-toggle { margin-left: auto; width: 170px; }
  .topbar { padding: 0.8rem 1rem 0; flex-wrap: wrap; gap: 0.5rem 0.8rem; }
  .qf { flex: 1 1 100%; }
  .health { margin-left: 0; flex-wrap: wrap; }
  .main { padding: 0.6rem 1rem 2.5rem; }
  .pg-title { font-size: 2.1rem; }
  .hc-chips span { padding: 0 0.7rem; }
  .login-theme { top: 0.6rem; right: 0.6rem; width: 150px; }
}
@media (max-width: 640px) {
  .density, .qf kbd { display: none; }
  .main { padding: 0.5rem 0.85rem 2.5rem; }
  .hc-top { flex-direction: column; align-items: flex-start; }
  .hc-kpi .v { font-size: 2.1rem; }
  .hc-kpi .v svg { display: none; }
  .donutcard.wide, .chartcard { padding: 1rem; }
  .lead-panel { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; }
}

/* ---- Inter: its own spacing for text, tight tracking only on large headings ---- */
body { letter-spacing: 0; font-feature-settings: 'calt' 1, 'cv05' 1; }
.hc-h1, .pg-title, .ui-title, .lp-name, .login-card h1, .login-art h2, .main:has(> .ui-shell)::before { font-feature-settings: 'calt' 1, 'ss03' 0; }

/* ---- Native controls follow the theme even when a page gives them no class (zero specificity: any class rule still wins) ---- */
:where(select, textarea, input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=submit], [type=button], [type=file], [type=hidden])) { background-color: var(--field); color: var(--ink); border-color: var(--line-strong); }
:where(select option) { background: var(--surface-solid); color: var(--ink); }
.select-pill { padding: 0.45rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 0.84rem; box-shadow: var(--track-shadow); }

/* ---- Error pages ---- */
.err-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; padding: 1.6rem 2rem; gap: 1rem; }
.err-shell .brand { width: fit-content; }
.err-card { align-self: center; justify-self: center; text-align: center; max-width: 30rem; padding: 0 0.5rem 4rem; }
.err-code { font-size: clamp(4.5rem, 14vw, 8rem); font-weight: var(--h-weight); letter-spacing: -0.06em; line-height: 1; background: var(--hl-bg); -webkit-background-clip: text; background-clip: text; color: var(--hl-ink); }
.err-card h1 { margin: 0.8rem 0 0; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.err-card p { color: var(--ink-soft); margin: 0.7rem 0 0; line-height: 1.55; }
.err-actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.6rem; flex-wrap: wrap; }

/* ---- Call feedback: the expert's page (opened from a text message, on a phone) ---- */
.fb-page { min-height: 100vh; max-width: 30rem; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.fb-brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.2rem 1.2rem; }
.fb-brand b { font-weight: 700; letter-spacing: -0.02em; }
.fb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 1.5rem 1.3rem 1.4rem; }
.fb-eyebrow { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink); }
.fb-card h1 { margin: 0.5rem 0 0; font-size: 1.55rem; line-height: 1.2; letter-spacing: -0.03em; font-weight: var(--h-weight); }
.fb-meta { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.88rem; }
.fb-banner { margin-top: 1rem; padding: 0.7rem 0.9rem; border-radius: 14px; background: var(--inset); box-shadow: var(--inset-shadow); font-size: 0.88rem; color: var(--ink-2); }
.fb-banner.ok { border-left: 3px solid var(--accent); } .fb-banner.bad { color: var(--risk); }
.fb-choices { display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.fb-choice { display: grid; grid-template-columns: 2.6rem 1fr 1.6rem; align-items: center; gap: 0.8rem; width: 100%; text-align: left; padding: 0.95rem 1rem; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--raised); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow-sm); }
.fb-choice:active { transform: scale(0.99); }
.fb-ico { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.fb-text b { display: block; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.015em; }
.fb-text small { display: block; color: var(--ink-soft); font-size: 0.8rem; margin-top: 0.1rem; line-height: 1.35; }
.fb-tick { opacity: 0; color: var(--on-p); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--p-bg); }
.fb-choice.on { border: 1.5px solid var(--tab-on-line); background: var(--tab-on-bg); }
.fb-choice.on .fb-tick { opacity: 1; }
.fb-choice.good .fb-ico { color: var(--c-go); } .fb-choice.junk .fb-ico { color: var(--c-miss); }
.fb-note { margin-top: 1rem; }
.fb-note summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 0.9rem; }
.fb-note textarea { width: 100%; margin-top: 0.6rem; padding: 0.6rem 0.8rem; font: inherit; border-radius: 14px; border: 1px solid var(--line-strong); resize: vertical; }
.fb-note p { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.78rem; }
.fb-reach { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); }
.fb-reach:last-child { border-bottom: none; }
label.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---- Login (v6.1): a product preview beside a welcome card ---- */
.login-art { gap: 1.6rem; padding: 2.4rem 3rem 2.2rem; justify-content: flex-start; }
.la-copy { margin-top: 1.2rem; }
.la-eyebrow { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-ink); }
.login-art h2 { margin: 0.7rem 0 0.9rem; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.06; max-width: 13em; }
.login-art p { max-width: 36ch; line-height: 1.55; }
.la-window { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 1.3rem 1.4rem 0.5rem; max-width: 33rem; position: relative; z-index: 1; }
.la-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.la-k { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.la-big { font-size: 3rem; font-weight: var(--n-weight); letter-spacing: -0.05em; line-height: 1.05; margin-top: 0.3rem; color: var(--ink); }
.la-big small { font-size: 1.05rem; font-weight: 500; letter-spacing: 0; color: var(--ink-soft); }
.la-ring .ring-arc { stroke: var(--c-line); }
.la-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 1rem 0 0.2rem; }
.la-stats div { padding: 0.8rem 0.9rem; border-left: 1px solid var(--line); }
.la-stats div:first-child { border-left: none; padding-left: 0; }
.la-stats b { display: block; font-size: 1.5rem; font-weight: var(--n-weight); letter-spacing: -0.04em; color: var(--ink); }
.la-stats span { font-size: 0.74rem; color: var(--ink-soft); }
.la-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line-soft); }
.la-stats + .la-rows .la-row:first-child { border-top: none; }
.la-row b { display: block; font-size: 0.9rem; font-weight: 650; color: var(--ink); }
.la-row small { display: block; color: var(--ink-soft); font-size: 0.76rem; }
.la-live { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.86rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.la-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(240, 162, 26, 0.2); }
.la-points { list-style: none; margin: auto 0 0; padding: 1.2rem 0 0; display: flex; gap: 1.6rem; flex-wrap: wrap; color: var(--ink-soft); font-size: 0.86rem; }
.la-points li { display: inline-flex; align-items: center; gap: 0.5rem; }
.la-points .ico { color: var(--accent-ink); }
.login-form-side { padding: 3rem 2rem; }
.login-card { width: min(400px, 100%); }
.lf-eyebrow { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-ink); }
.login-card h1 { margin: 0.6rem 0 0; font-size: 1.9rem; line-height: 1.12; }
.login-card .lead { font-size: 0.95rem; margin-top: 0.6rem; line-height: 1.5; }
.login-card form.stacked label { margin-top: 1.1rem; }
.login-card form.stacked input { min-height: 44px; border-radius: 14px; }
.login-card .btn { height: 46px; margin-top: 1.5rem; font-size: 0.95rem; }
.lf-help { margin: 1.3rem 0 0; font-size: 0.82rem; color: var(--ink-faint); text-align: center; line-height: 1.5; }
.login-mobile-brand { display: none; margin-bottom: 1.6rem; }
@media (max-width: 900px) { .login-mobile-brand { display: flex; } .login-form-side { padding-top: 4.5rem; } }

/* ---- Expert app (the page on an expert's phone) and its Team admin page ---- */
.ea-page { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
.ea-setup { margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: 16px; background: var(--inset); box-shadow: var(--inset-shadow); border: 1px solid var(--line-soft); }
.ea-setup > div > b { display: block; font-size: 1rem; letter-spacing: -0.01em; }
.ea-setup p { margin: 0.35rem 0 0.8rem; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.5; }
.ea-setup .btn { width: 100%; height: 44px; }
.ea-setup [hidden] { display: none; }
.ea-section { margin-top: 1.6rem; }
.ea-section h2 { margin: 0 0.3rem 0.7rem; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.ea-section h2 span { color: var(--accent-ink); margin-left: 0.3rem; }
.ea-call { margin-bottom: 0.9rem; padding: 1.1rem 1.1rem 0.9rem; border-radius: 22px; }
.ea-call-head b { display: block; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.ea-call-head span { display: block; color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.15rem; }
.ea-btns { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.ea-btns .fb-choice { grid-template-columns: 2.2rem 1fr; padding: 0.7rem 0.8rem; border-radius: 16px; }
.ea-btns .fb-ico { width: 2.2rem; height: 2.2rem; }
.ea-btns .fb-text b { font-size: 1rem; }
.ea-note { display: inline-block; margin-top: 0.7rem; font-size: 0.85rem; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.ea-empty { display: flex; gap: 0.9rem; align-items: center; padding: 1.1rem; border-radius: 22px; }
.ea-empty p { margin: 0.1rem 0 0; color: var(--ink-soft); font-size: 0.86rem; }
.ea-list { padding: 0.3rem 1.1rem; border-radius: 22px; }
.ea-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.8rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.ea-row:last-child { border-bottom: none; }
.ea-row b { display: block; font-size: 0.94rem; } .ea-row small { color: var(--ink-soft); font-size: 0.76rem; }
.ea-row a { font-size: 0.82rem; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.ea-foot { text-align: center; color: var(--ink-faint); font-size: 0.82rem; margin-top: 1.8rem; }
.ea-admin { display: grid; gap: 1.25rem; max-width: 46rem; }
.ea-linkrow { display: flex; gap: 0.6rem; }
.ea-linkrow input { flex: 1; min-width: 0; padding: 0.55rem 0.8rem; font: inherit; font-size: 0.86rem; border-radius: 12px; border: 1px solid var(--line-strong); }
.ea-share { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.ea-qr { display: flex; gap: 1.2rem; align-items: center; margin-top: 1.2rem; }
.ea-qr-img { width: 168px; height: 168px; flex: none; padding: 0.5rem; border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.ea-qr-img svg { width: 100%; height: 100%; display: block; }
.ea-qr p { margin: 0; max-width: 18rem; }
.ea-admin h3 { margin: 0 0 0.6rem; font-size: 1.05rem; letter-spacing: -0.02em; }
#teamTable th, #teamTable td { padding-left: 0.7rem; padding-right: 0.7rem; }
#teamTable th:first-child, #teamTable td:first-child { padding-left: 0.6rem; }
#teamTable th:last-child, #teamTable td:last-child { padding-right: 1rem; }

/* ---- Call feedback: the note ---- */
.fb-cellnote { display: block; margin-top: 0.3rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: 0.76rem; font-style: italic; }
.fb-step { margin: 1.4rem 0 0.7rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: var(--ink-2); }
.fb-step span { font-weight: 500; color: var(--ink-faint); }
.fb-banner { display: flex; gap: 0.6rem; align-items: flex-start; }
.fb-banner .ico { flex: none; margin-top: 0.1rem; color: var(--accent-ink); }
.fb-banner a { color: var(--accent-ink); font-weight: 650; }
.fb-notebox textarea { width: 100%; padding: 0.7rem 0.85rem; font: inherit; border-radius: 14px; border: 1px solid var(--line-strong); resize: vertical; min-height: 5.5rem; }
.fb-notebox .btn { width: 100%; height: 46px; margin-top: 0.7rem; }
.fb-saved { display: flex; align-items: center; gap: 0.4rem; margin: 0.7rem 0 0; color: var(--ink-soft); font-size: 0.82rem; }
.fb-saved .ico { color: var(--accent-ink); }
.ea-note-line { display: block; margin-top: 0.15rem; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 11rem; }
