/* LeadFlow — light SaaS UI */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --good: #15803d; --good-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2;
  --info: #6d28d9; --info-bg: #ede9fe;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --grid: #eef0f3;
  /* small surfaces that were fixed light before dark mode */
  --chip-bg: #f1f5f9;
  --row-hover: #f8faff;
  --line: #f1f3f5;
  --track: #f1f3f5;
  --knob: #ffffff;
  --off: #cbd5e1;
  --on-primary: #ffffff;
  --code-bg: #0f172a; --code-text: #e2e8f0;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25);
  /* aliases used by legacy demo pages */
  --panel: var(--surface); --accent: var(--primary); --ok: #16a34a;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/**
 * Dark mode. Every colour above is a token, so dark only redefines the tokens.
 * It is a choice you make in the sidebar (kept in this browser); nothing switches by itself.
 */
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121a2a;
  --surface-2: #182033;
  --border: #243044;
  --border-strong: #33415a;
  --text: #e7ecf5;
  --text-2: #b6c2d6;
  --muted: #93a1b8;
  --faint: #6d7c94;
  --primary: #5b9bff;
  --primary-600: #4a8af0;
  --primary-50: #16233c;
  --primary-100: #1d3153;
  --good: #4ade80; --good-bg: #10301f;
  --warn: #fbbf24; --warn-bg: #33270a;
  --bad: #f87171; --bad-bg: #3a1618;
  --info: #c4b5fd; --info-bg: #241d3d;
  --series-1: #5b9bff; --series-2: #ff8a5b; --series-3: #34d399;
  --grid: #1e2839;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .7);
  --chip-bg: #1b2437;
  --row-hover: #1a2334;
  --line: #1d2637;
  --track: #1d2637;
  --knob: #dbe4f3;
  --off: #3a465c;
  --on-primary: #0b1220;
  --code-bg: #0a1020; --code-text: #cbd5e1;
  --tip-bg: #26324a; --tip-text: #eef2f9;
  color-scheme: dark;
  /* text on the coloured callouts reads light in dark mode */
  --callout-text: #cfe0ff; --warn-text: #fde68a; --bad-text: #fecaca;
  --warn-border: #4a3a12; --bad-border: #5a2326;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: grid; place-items: center; color: #fff; }
.logo-mark svg { width: 18px; height: 18px; stroke: #fff; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; margin-bottom: 2px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-50); color: var(--primary-600); }
.nav a .badge-new { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--primary-100); color: var(--primary-600); padding: 1px 6px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 99px; background: var(--primary-100); color: var(--primary-600); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-size: 13px; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.banner { background: var(--primary-50); color: var(--primary-600); border-bottom: 1px solid var(--primary-100); padding: 8px 32px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.page { padding: 28px 32px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; }
.page-head > div:first-child { flex: 1 1 420px; max-width: 760px; }
.page-head p { margin: 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mobile-top { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad-border, #fecaca); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }

.input, .select, textarea.input { height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input.upper { text-transform: uppercase; }
.input.upper::placeholder { text-transform: none; }
.input.invalid { border-color: var(--bad); }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 10px; color: var(--faint); }
.input-icon .input { padding-left: 34px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field > small { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }

.seg { display: inline-flex; background: var(--track); border-radius: 8px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; font-weight: 500; color: var(--text-2); cursor: pointer; font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button .count { color: var(--faint); margin-left: 4px; font-weight: 500; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 36px; height: 20px; border-radius: 99px; background: var(--off); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 99px; background: var(--knob); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--primary-100); }
.switch span { font-weight: 500; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--chip-bg); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.blue { background: var(--primary-50); color: var(--primary-600); }
.badge.ftd { background: #15803d; color: #fff; font-weight: 600; }
.badge.ftd::before { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-2); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--faint); display: grid; }
.chip button:hover { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 16px 18px 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; min-width: 0; }
.kpi .sub { flex-wrap: wrap; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.delta { font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 5px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--chip-bg); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.lab-grid { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 16px; margin-bottom: 16px; align-items: start; }

/* ---------- tables ---------- */
.table-card { overflow: hidden; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { width: 280px; max-width: 100%; }
.toolbar .select { width: auto; min-width: 140px; }
.table-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--row-hover); }
.t .chips { flex-wrap: nowrap; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .two b { display: block; font-weight: 600; }
.t .two span { color: var(--muted); font-size: 12px; }
.t-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.flag { font-size: 15px; margin-right: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.dot.on { background: #16a34a; box-shadow: 0 0 0 3px var(--good-bg); }
.dot.off { background: var(--off); }

.progress { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; width: 110px; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.progress.full i { background: #dc2626; }
.progress.high i { background: #d97706; }
.cap { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .bar { transition: opacity .12s; }
.chart .col:hover .bar, .chart .col:focus .bar { opacity: .82; }
.chart .col { outline: none; }
.chart .hit { fill: transparent; }
.chart .col:hover .hit, .chart .col:focus .hit { fill: rgba(15, 23, 42, .035); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar .v { font-variant-numeric: tabular-nums; color: var(--text-2); }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--tip-bg, var(--text)); color: var(--tip-text, #fff); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-lg); min-width: 140px; }
.tip .tt { color: var(--off); margin-bottom: 4px; }
.tip .tr { display: flex; align-items: center; gap: 8px; }
.tip .tr i { width: 10px; height: 2px; border-radius: 2px; }
.tip .tr b { margin-left: auto; font-variant-numeric: tabular-nums; }
.inline-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inline-bar .progress { width: 60px; }

/* ---------- drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 40; opacity: 0; transition: opacity .18s; }
.overlay.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--surface); z-index: 50; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease; }
.drawer.open { transform: none; }
.drawer.narrow { width: min(520px, 100vw); }
.d-head { padding: 20px 24px 0; border-bottom: 1px solid var(--border); }
.d-title { display: flex; align-items: flex-start; gap: 12px; }
.d-title h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.d-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.d-title .x { margin-left: auto; }
.tabs { display: flex; gap: 2px; margin-top: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary-600); border-bottom-color: var(--primary); }
.tabs .n { background: var(--chip-bg); color: var(--text-2); border-radius: 99px; padding: 0 6px; font-size: 11px; }
.d-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.d-foot { border-top: 1px solid var(--border); padding: 14px 24px; display: flex; gap: 8px; align-items: center; background: var(--surface-2); }
.section { margin-bottom: 26px; }
.section:last-child { margin-bottom: 0; }
.section > h4 { margin: 0 0 4px; font-size: 14px; }
.section > p.help { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 22px 0; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv > div { padding: 9px 12px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); background: var(--surface-2); font-size: 13px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.copy { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 0 0 4px; vertical-align: middle; }
.copy:hover { color: var(--primary); }
.copy svg { width: 14px; height: 14px; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); }
.tl-dot svg { width: 11px; height: 11px; stroke-width: 3; }
.tl-dot.good { border-color: #16a34a; color: #16a34a; background: var(--good-bg); }
.tl-dot.bad { border-color: #dc2626; color: #dc2626; background: var(--bad-bg); }
.tl-dot.blue { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.tl-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tl-card .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-card .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
details.code { margin-top: 10px; }
details.code summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 500; list-style: none; }
details.code summary::-webkit-details-marker { display: none; }
pre.block { background: var(--code-bg); color: var(--code-text); border-radius: 8px; padding: 12px 14px; overflow: auto; max-height: 280px; margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
pre.block .k { color: #93c5fd; }
pre.block .s { color: #86efac; }
pre.block .n { color: #fcd34d; }
.code-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 10px; }

/* mapping / kv editor */
.map-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.map-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 4px; }
.map-table td { padding: 0 4px; vertical-align: middle; }
.map-table td:last-child { width: 36px; }
.ph-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ph { font-family: ui-monospace, Menlo, monospace; font-size: 11px; padding: 2px 6px; border-radius: 5px; border: 1px dashed var(--border-strong); background: var(--surface-2); cursor: pointer; color: var(--text-2); }
.ph:hover { border-color: var(--primary); color: var(--primary); }

.sched { border: 1px solid var(--border); border-radius: var(--radius); }
.sched-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sched-row:last-child { border-bottom: 0; }
.sched-row .times { display: flex; align-items: center; gap: 8px; }
.sched-row .times .input { width: 140px; }
.sched-row.off .times { opacity: .35; pointer-events: none; }

.tag-input { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 36px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.tag-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.tag-input input { border: 0; outline: none; flex: 1; min-width: 80px; height: 26px; padding: 0 4px; background: transparent; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.quick button { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; font-size: 12px; padding: 2px 7px; cursor: pointer; color: var(--text-2); }
.quick button:hover { border-color: var(--primary); color: var(--primary); }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--primary-50); color: var(--callout-text, #1e3a8a); font-size: 13px; border: 1px solid var(--primary-100); }
.callout svg { color: var(--primary); margin-top: 1px; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border, #fde68a); color: var(--warn-text, #78350f); }
.callout.warn svg { color: var(--warn); }
.callout.bad { background: var(--bad-bg); border-color: var(--bad-border, #fecaca); color: var(--bad-text, #7f1d1d); }
.callout.bad svg { color: var(--bad); }
.result-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; }
.result-banner.good { background: var(--good-bg); color: var(--good); }
.result-banner.bad { background: var(--bad-bg); color: var(--bad); }
.result-banner.warn { background: var(--warn-bg); color: var(--warn); }
.result-banner small { font-weight: 500; margin-left: auto; opacity: .85; }

.url-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.url-box code { flex: 1; overflow-wrap: anywhere; color: var(--text-2); }

/* sources */
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; margin-bottom: 20px; }
.src-card .card-body { display: flex; flex-direction: column; gap: 12px; }
.src-stat { display: flex; gap: 20px; }
.src-stat div b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.src-stat div span { font-size: 12px; color: var(--muted); }

/* toasts & confirm */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--tip-bg, var(--text)); color: var(--tip-text, #fff); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; font-size: 13px; animation: tin .18s ease; max-width: 380px; }
.toast.bad { background: #991b1b; }
.toast svg { flex: none; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
dialog.confirm { border: 0; border-radius: 12px; padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.confirm::backdrop { background: rgba(15, 23, 42, .35); }
dialog.confirm .c-body { padding: 20px 22px; }
dialog.confirm h3 { margin: 0 0 6px; font-size: 16px; }
dialog.confirm p { margin: 0; color: var(--muted); white-space: pre-line; }
dialog.confirm .c-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 500px at 50% -10%, #dbeafe, transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 32px; }
.login-card h1 { margin: 16px 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }

.loading { opacity: .55; transition: opacity .15s; pointer-events: none; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .lab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 60; width: 260px; box-shadow: var(--shadow-lg); }
  .sidebar.open { display: flex; }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 700; }
  .page { padding: 20px 16px 40px; }
  .banner { padding: 8px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .value { font-size: 22px; }
  .page-head .actions { width: 100%; }
  .kv { grid-template-columns: 110px 1fr; }
  .d-head, .d-body { padding-left: 16px; padding-right: 16px; }
  .d-foot { padding: 12px 16px; }
  .toolbar .input-icon { width: 100%; }
  .sched-row { grid-template-columns: 1fr; }
}

/* status mix bar */
.sbar { display: flex; gap: 2px; width: 100%; min-width: 120px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.sbar i { display: flex; align-items: center; justify-content: center; min-width: 3px; font-style: normal; cursor: default; }
.sbar i span { font-size: 11px; font-weight: 600; }
.sbar i:hover { filter: brightness(1.08); }

.sidebar-foot .who, .sidebar-foot .avatar { cursor: pointer; }
.sidebar-foot .who:hover b { color: var(--primary); }
.login-card .logo-mark svg { stroke: #fff; }
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th, .perm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table th { font-size: 12px; font-weight: 500; color: var(--muted); }
.perm-table input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.perm-table tr:hover td { background: var(--surface-2); }
.secret { display: flex; align-items: center; gap: 10px; background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: .04em; }
.secret button { margin-left: auto; color: var(--text); font-family: Inter, system-ui, sans-serif; letter-spacing: 0; }
.ip-row { display: grid; grid-template-columns: 1.2fr 1.5fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
@media (max-width: 820px) { .ip-row { grid-template-columns: 1fr; } }

/* date range picker */
.drp { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drp .select { width: auto; min-width: 150px; }
.drp .input[type=date] { width: 150px; }
@media (max-width: 820px) { .drp { width: 100%; } .drp .select { flex: 1 1 100%; } .drp .input[type=date] { flex: 1; width: auto; min-width: 0; } }

/* ---------- 2FA ---------- */
.login-card.wide { max-width: 520px; }
.input.otp { font-family: var(--mono, ui-monospace, monospace); font-size: 26px; letter-spacing: .35em; text-align: center; height: 52px; }
.input.otp.sm-otp { font-size: 18px; height: 38px; width: 150px; letter-spacing: .25em; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 16px; }
.steps > li > b { display: block; margin-bottom: 2px; }
.steps > li > span { color: var(--muted); font-size: 13px; }
.qr-row { display: flex; gap: 16px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.qr { width: 164px; height: 164px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.codes code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; font-size: 15px; letter-spacing: .05em; }

/* ---------- leads selection / inject ---------- */
.t th.pick, .t td.pick { width: 36px; padding-right: 0; cursor: default; }
.t td.pick input, .t th.pick input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.t tr.selected td { background: var(--primary-50); }
.selbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 16px 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--primary-50); border: 1px solid var(--primary-100); position: sticky; top: 8px; z-index: 5; }
.mini-list { border: 1px solid var(--border); border-radius: var(--radius); max-height: 320px; overflow: auto; }
.mini-list > div { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini-list > div:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .why { flex-basis: 100%; color: var(--muted); font-size: 12px; padding-left: 2px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- broker quick setup ---------- */
.qs-card.card { padding: 14px 16px; background: linear-gradient(180deg, var(--primary-50), var(--surface)); border-color: var(--primary-100); }
.q-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--primary-100); }
.q-h { margin: 12px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.q-h:first-child { margin-top: 0; }
.tpl { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; }
.tpl > div:first-child { flex: 1; }
textarea.input { height: auto; padding: 8px 10px; line-height: 1.45; resize: vertical; width: 100%; }
.input.needs { border-color: #f59e0b; background: #fffbeb; }
.import-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; }
.import-box summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.import-box[open] summary { margin-bottom: 8px; }

/* ---------- smart routing ---------- */
.smart-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; }
.smart-card.on { border-color: #bbf7d0; background: linear-gradient(90deg, #f0fdf4, var(--surface) 60%); }
.smart-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.smart-card.on .smart-ic { background: var(--good-bg); color: var(--good); }

/* ---------- system status ---------- */
.dash-grid.even { grid-template-columns: 1fr 1fr; }
.status-hero { display: flex; align-items: center; gap: 18px; padding: 20px 22px; margin-bottom: 16px; flex-wrap: wrap; }
.status-hero h2 { margin: 0 0 2px; font-size: 20px; }
.status-hero p { margin: 0; color: var(--muted); }
.status-hero.good { border-color: #bbf7d0; }
.status-hero.warn { border-color: #fde68a; background: #fffdf5; }
.status-hero.bad { border-color: #fecaca; background: #fffafa; }
.problems { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); }
.pulse { width: 14px; height: 14px; border-radius: 99px; flex: none; position: relative; background: var(--good); }
.pulse.warn { background: #f59e0b; } .pulse.bad { background: #ef4444; }
.pulse::after { content: ""; position: absolute; inset: -5px; border-radius: 99px; border: 2px solid currentColor; opacity: .35; color: inherit; }
.pulse.good::after { color: #16a34a; } .pulse.warn::after { color: #f59e0b; } .pulse.bad::after { color: #ef4444; }
.uptime-num { text-align: right; }
.uptime-num b { display: block; font-size: 24px; letter-spacing: -.01em; }
.uptime-num span { color: var(--muted); font-size: 12px; }
.comp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.comp { padding: 14px 16px; }
.comp-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.comp-ic .i { width: 16px; height: 16px; }
.comp-head { font-size: 16px; font-weight: 600; margin: 10px 0 8px; }
.comp-rows > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 13px; }
.comp-rows > div > span:first-child { color: var(--muted); flex: none; }
.comp-rows > div > span:last-child { text-align: right; min-width: 0; }
.uptime-bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 34px; }
.uptime-bars i { border-radius: 3px; background: #dfe3e8; cursor: default; }
.uptime-bars i.ok { background: #22c55e; } .uptime-bars i.degraded { background: #f59e0b; } .uptime-bars i.down { background: #ef4444; }
.uptime-bars i:hover { filter: brightness(.9); }
.dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.bad { background: #ef4444; box-shadow: 0 0 0 3px var(--bad-bg); }
.alert-list { display: grid; gap: 8px; }
.al { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.al.resolved { opacity: .7; }
@media (max-width: 1100px) { .comp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .comp-grid, .dash-grid.even { grid-template-columns: 1fr; }
  .uptime-num { text-align: left; }
  .codes { grid-template-columns: 1fr 1fr; }
  .uptime-bars { gap: 2px; }
}

/* ---------- buyer FTD review ---------- */
.buyer-ftd.pending { border-color: #fde68a; background: #fffdf5; }
.buyer-ftd.rejected { background: var(--surface-2); }
.buyer-ftd.approved { border-color: #bbf7d0; }
.btn.sm.danger { border-color: #fecaca; }

/* ---------- clickable counts ---------- */
.linkbtn { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--primary-100); text-underline-offset: 3px; }
.linkbtn:hover { background: var(--primary-50); text-decoration-color: var(--primary); }
.kpi-link { cursor: pointer; font: inherit; color: inherit; width: 100%; }
.kpi-link:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.kpi-link .i { width: 12px; height: 12px; vertical-align: -1px; }
.i.flip { transform: rotate(180deg); }

/* ---------- CRG loss, statements, balances ---------- */
.crg-loss { display: flex; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: var(--radius); background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; font-size: 13px; }
.crg-loss svg { color: var(--bad); flex: none; margin-top: 1px; }
dialog.confirm.wide { width: min(980px, calc(100vw - 24px)); max-width: none; }
.stmt-preview { border: 1px solid var(--border); border-radius: 10px; overflow: auto; max-height: 60vh; background: var(--chip-bg); padding: 10px; }
.stmt-preview img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); }
.bal-hero { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 18px 20px; border: 1px solid #bbf7d0; background: linear-gradient(90deg, #f0fdf4, var(--surface)); border-radius: 12px; margin-bottom: 20px; }
.bal-hero.warn { border-color: #fde68a; background: linear-gradient(90deg, #fffbeb, var(--surface)); }
.bal-hero.bad { border-color: #fecaca; background: linear-gradient(90deg, #fef2f2, var(--surface)); }
.bal-hero .label { color: var(--muted); font-size: 13px; }
.bal-hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; }
.bal-hero.bad .big { color: var(--bad); }
.bal-math { min-width: 280px; flex: 1; max-width: 420px; font-size: 14px; }
.bal-math > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.bal-math > div.sub { color: var(--muted); font-size: 12px; }
.bal-math > div.tot { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.mini-bars i { flex: 1; min-width: 4px; background: var(--series-1, #2a78d6); border-radius: 2px 2px 0 0; opacity: .85; }
.mini-bars i { max-width: 22px; }
.usdt-due { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 8px; font-size: 14px; }
.usdt-due > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.usdt-due b { font-size: 16px; padding: 4px 10px; border-radius: 8px; background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.net-line { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #047857; min-height: 18px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.chip-btn:disabled { opacity: .55; cursor: not-allowed; }
.chip-btn .i { width: 14px; height: 14px; }

/* ---------- lead quality ---------- */
.qscore { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); cursor: help; font-variant-numeric: tabular-nums; }
.qscore.good { background: var(--good-bg); color: var(--good); border-color: #bbf7d0; }
.qscore.warn { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.qscore.bad { background: var(--bad-bg); color: var(--bad); border-color: #fecaca; }
.hold-n.on { background: var(--warn-bg); color: var(--warn) !important; border-radius: 99px; padding: 0 6px; font-weight: 600; }
.qpanel.held { border-color: #fde68a; background: #fffdf5; }
.qgauge { width: 56px; height: 56px; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 4px solid var(--border); flex: none; line-height: 1; }
.qgauge b { font-size: 18px; } .qgauge span { font-size: 10px; color: var(--muted); }
.qgauge.good { border-color: #86efac; } .qgauge.warn { border-color: #fcd34d; } .qgauge.bad { border-color: #fca5a5; }
.qgauge.bad b { color: var(--bad); } .qgauge.warn b { color: var(--warn); } .qgauge.good b { color: var(--good); }
.qflags { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.qflags li { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.qflags .pts, .qcheck .pts { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--bad); font-size: 12px; min-width: 30px; }
.qcheck-list { display: grid; gap: 2px; margin-top: 14px; }
.qcheck { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qcheck input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.qcheck b { display: block; font-weight: 600; font-size: 13px; }
.qcheck small { color: var(--muted); font-size: 12px; }
.qcheck.dim b { color: var(--muted); }

/* Telegram bot */
.t tbody tr.dim td { opacity: .6; }
.help { color: var(--muted); font-size: 13px; }
.bot-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; }
.bot-pill.on { background: #f0fdf4; color: var(--good); border-color: #bbf7d0; }
.bot-pill .i { width: 14px; height: 14px; }
.bot-chat { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-chat .i { width: 14px; height: 14px; color: #229ed9; flex: none; }
.bot-chat.bad, .bot-chat.bad .i { color: var(--bad); }
.bot-chat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.bot-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.bot-h .i { width: 16px; height: 16px; color: var(--muted); }
.bot-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bot-kv span { color: var(--muted); }
.bot-reason { margin-top: 4px; color: var(--bad); font-style: italic; }
.bot-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.bot-how p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.bot-log { display: grid; gap: 8px; }
.bot-log-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.bot-log-row > .row { grid-column: 1 / -1; }
.bot-log-row > .row:empty { display: none; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chips button { min-width: 48px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; color: var(--text-2); cursor: pointer; }
.day-chips button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.cap-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.link-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border); margin: 10px 0; }
.link-code code { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
#lk-wait { display: flex; align-items: center; gap: 6px; }
#lk-wait .i { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .bot-log-row { grid-template-columns: 1fr; }
  .bot-log-row > div:nth-child(2) { text-align: left !important; }
  .link-code code { font-size: 16px; word-break: break-all; }
}
.link-steps { gap: 8px; }
.link-steps > li > b { display: inline; margin: 0; }
.wallet-line { white-space: nowrap; }
.wallet-line + .wallet-line { margin-top: 3px; }
.usdt-due .fee-box { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usdt-due b.plain { background: none; border: 0; color: var(--text); padding: 0; font-size: 14px; }
@media (max-width: 640px) { .usdt-due { flex-wrap: wrap; justify-content: flex-start; gap: 8px; } }

/* lead integrity report */
.ig-ev { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: var(--surface-2); }
.ig-ev-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ig-ev-vals { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; font-size: 13px; }
.ig-ev-vals .mono.bad { color: var(--bad); }
.ig-arrow { color: var(--muted); }
.mono.bad { color: var(--bad); }

/* Leads: live updates */
.live-toggle { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border, #e5e7eb); background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.live-toggle.on { border-color: #bbf7d0; }
.live-toggle .dot.on { animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 5px var(--good-bg); } }
.t tr.fresh > td { animation: lead-fresh 3s ease-out; }
@keyframes lead-fresh { from { background: var(--primary-100); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .live-toggle .dot.on, .t tr.fresh > td { animation: none; } }

/* Notifications: the bell at the top right */
.lf-top { display: flex; justify-content: flex-end; padding: 14px 32px 0; max-width: 1320px; width: 100%; margin: 0 auto; }
.lf-top + #banner + .page, .lf-top ~ .page { padding-top: 10px; }
.lf-alertbox { position: relative; }
.lf-alertbtn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: inherit; display: grid; place-items: center; cursor: pointer; }
.lf-alertbtn:hover { background: var(--surface-2); }
.lf-alertbtn svg { width: 18px; height: 18px; }
.lf-alertbtn .count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad, #dc2626); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.lf-alertpanel { position: absolute; right: 0; top: 46px; width: min(400px, 92vw); max-height: 70vh; overflow: auto; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.lf-alerthead { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.lf-alerthead b { flex: 1; }
.lf-alertitem { display: flex; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lf-alertitem:hover { background: var(--surface-2); }
.lf-alertitem.unread { background: var(--primary-50); }
.lf-alertitem .sev { flex: none; width: 9px; height: 9px; border-radius: 99px; margin-top: 5px; background: var(--muted); }
.lf-alertitem .sev.bad { background: var(--bad, #dc2626); }
.lf-alertitem .sev.warn { background: var(--warn, #d97706); }
.lf-alertitem .sev.info { background: var(--primary, #2563eb); }
.lf-alertitem b { display: block; font-size: 13px; }
.lf-alertitem span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.lf-alertempty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 820px) {
  .main { position: relative; }
  .lf-top { position: absolute; top: 4px; right: 12px; padding: 0; width: auto; z-index: 55; }
  .lf-alertbtn { width: 34px; height: 34px; }
}

/* an empty chart shows a small icon, not one stretched to the chart's width */
.chart .empty svg { width: 28px; height: 28px; }

/* setup other parts depend on: pinned in the bell, and a red bar on every page while something blocks */
.lf-alertsec { padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lf-alertsec span { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.lf-alertitem.required { background: color-mix(in srgb, var(--bad, #dc2626) 6%, var(--surface)); }
.lf-alertitem .holds { color: var(--bad, #dc2626); }
.lf-setupbar { display: flex; gap: 10px; align-items: flex-start; margin: 12px 24px 0; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--bad, #dc2626) 35%, transparent); background: color-mix(in srgb, var(--bad, #dc2626) 8%, var(--surface)); }
.lf-setupbar svg { flex: none; width: 16px; height: 16px; color: var(--bad, #dc2626); margin-top: 2px; }
.lf-setupbar .linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--bad, #dc2626); text-decoration: underline; cursor: pointer; }
@media (max-width: 700px) { .lf-setupbar { margin: 10px 16px 0; } }

/* tables fit a laptop screen: secondary text in a cell wraps instead of pushing columns off to the right */
.t td .small, .t .two span, .t td.wrap, .t td.wrap b { white-space: normal; }
.t td.wrap { min-width: 180px; }
.t td.wrap .badge, .t td.wrap .chip { white-space: nowrap; }
.t td.wrap-lg { min-width: 230px; }
.t .deal-sum { display: flex; gap: 6px; align-items: flex-start; }
.t .deal-sum .small { min-width: 150px; }
.t td .cell-line { display: block; margin-top: 2px; font-size: 12px; }
/* a small dialog with any content (e.g. picking a supplier deal) */
dialog.confirm.modal-md { width: min(620px, calc(100vw - 32px)); }
dialog.confirm.modal-md .c-body { max-height: 70vh; overflow: auto; }

.t th, .t td { padding-left: 12px; padding-right: 12px; }
.t td.wrap .chips { flex-wrap: wrap; }
.t td.wrap .badge.plain { white-space: normal; height: auto; min-height: 22px; padding: 3px 8px; border-radius: 10px; line-height: 1.35; text-align: left; }
.t td .small.nw { white-space: nowrap; }

/* setup checklist at the top of a brand's / partner's window */
.checklist-host { margin-top: 10px; }
.checklist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cl-step { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--text-2); }
.cl-step.done { color: var(--good, #15803d); border-color: color-mix(in srgb, var(--good, #15803d) 30%, transparent); background: color-mix(in srgb, var(--good, #15803d) 6%, var(--surface)); }
.cl-step.todo { color: #92400e; border-color: #fcd34d; background: #fffbeb; font-weight: 600; }
.cl-step.opt { color: var(--muted); }
.cl-step:hover { filter: brightness(.97); }
