/* Diamond Payments CRM - design system (light). */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --ink: #0e1a2b;
  --ink-2: #4a5568;
  --ink-3: #8b95a7;
  --line: #e7eaf1;
  --line-2: #d9dee8;
  --brand: #2f5bea;
  --brand-2: #1f43c9;
  --brand-soft: #eef2ff;
  --brand-ring: rgba(47, 91, 234, .18);
  --good: #0f8a5f;
  --good-soft: #e8f7f0;
  --warn: #b25e09;
  --warn-soft: #fff4e5;
  --bad: #c8372d;
  --bad-soft: #fdeeec;
  --heat-0: #f1f3f8;
  --heat-1: #dfe7ff;
  --heat-2: #bccdff;
  --heat-3: #8daaff;
  --heat-4: #5a83f6;
  --heat-5: #2f5bea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(15, 26, 43, .04), 0 1px 3px rgba(15, 26, 43, .06);
  --shadow-2: 0 10px 24px -8px rgba(15, 26, 43, .14), 0 2px 6px rgba(15, 26, 43, .06);
  --shadow-3: 0 24px 64px -16px rgba(15, 26, 43, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
.num, td.num, th.num, .value, .tabular { font-variant-numeric: tabular-nums; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 15px; letter-spacing: -.01em; margin: 0; font-weight: 650; }
.muted { color: var(--ink-3); }
.mono, code { font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: -.01em; }
.ico { flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; transition: grid-template-columns .25s var(--ease); }
.app.collapsed { --sidebar: 76px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand .word { font-weight: 750; font-size: 15.5px; letter-spacing: -.02em; }
.brand .word span { color: var(--ink-3); font-weight: 550; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 14px 10px 6px; white-space: nowrap; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 550; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-2); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; color: #fff; background: var(--bad); border-radius: 999px; padding: 1px 7px; }
.nav .count.soft { background: #e3a008; }
.sev { width: 10px; height: 10px; border-radius: 3px; flex: none; margin-top: 5px; }
.sev.critical { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.sev.warning { background: #e3a008; box-shadow: 0 0 0 3px var(--warn-soft); }
.sev.info { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .body { flex: 1; min-width: 0; }
.alert-list .body strong { display: block; font-size: 14px; }
.alert-list .body .detail { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.alert-list .body .meta { color: var(--ink-3); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.alert-list .acts { display: flex; gap: 6px; align-items: center; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px; background: var(--surface); }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips a b { font-weight: 700; margin-left: 4px; opacity: .7; }
.all-in { padding: 10px 12px; margin: 4px 0 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; line-height: 1.6; }
.all-in strong { font-size: 15px; }
.per-txn { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.per-txn > div { display: grid; gap: 4px; }
.per-txn span { font-size: 12.5px; }
.per-txn strong { font-size: 20px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.facts.deal dd { font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }

/* Onboarding board: one lane per stage, scrolls sideways on small screens */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 160px; }
.lane header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; font-size: 13px; }
.lane-empty { margin: 4px; }
.deal-card { padding: 10px 12px; display: grid; gap: 3px; transition: transform .15s ease, box-shadow .15s ease; }
.deal-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2, var(--shadow-1)); }
.deal-card .name { font-weight: 650; color: var(--ink); }
.deal-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.deal-card .icon-btn { width: 28px; height: 28px; }

/* Stage stepper on a prospect */
.stepper { display: flex; flex-wrap: wrap; gap: 6px; }
.stepper form { margin: 0; }
.step { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2); box-shadow: none; height: 32px; font-size: 12.5px; }
.step.done { background: var(--good-soft); color: var(--good); border-color: transparent; }
.step.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Support ticket thread */
.thread { display: grid; gap: 10px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; max-width: 88%; }
.msg.staff { justify-self: end; background: var(--brand-soft); border-color: transparent; }
.msg.internal { background: var(--warn-soft); }
.msg .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 4px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Profit: share of each surcharge dollar (one bar, 6 parts, legend + % labels below) */
.waterfall { display: flex; gap: 2px; height: 26px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.waterfall span { min-width: 3px; transform-origin: left; animation: grow-x .8s var(--ease) both; }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.w-rebate { background: #d97706; } .w-cost { background: #7c3aed; } .w-cost2 { background: #0891b2; }
.w-cost3 { background: #64748b; } .w-res { background: #2f5bea; } .w-profit { background: #0f8a5f; }
.qr { width: 220px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr svg { width: 100%; height: auto; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.codes span { padding: 10px 14px; background: var(--surface-2); border-radius: 9px; font-size: 16px; text-align: center; letter-spacing: .08em; }
.idle-warning { position: fixed; z-index: 65; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 14px; align-items: center;
  padding: 12px 14px 12px 18px; border-radius: 14px; background: #0e1a2b; color: #fff; box-shadow: var(--shadow-3); animation: toast-in .35s var(--ease) both; }
@media print { .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; } .app { display: block; } .card { box-shadow: none; } }
.sidebar .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); margin: 0 -14px -18px; padding: 14px 18px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #5b8cff, #2346d8); color: #fff; font-weight: 700; font-size: 13px; }
.me .who { min-width: 0; line-height: 1.25; }
.me .who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: var(--ink-3); }
.me .icon-btn { margin-left: auto; }
.app.collapsed .brand .word, .app.collapsed .nav a span, .app.collapsed .nav-label, .app.collapsed .me .who,
.app.collapsed .nav .count { display: none; }
.app.collapsed .nav a { justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: rgba(246, 247, 251, .82); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 1px 0 rgba(15, 26, 43, .02); }
.content { padding: 8px 28px 64px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 10px 0 18px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { color: var(--ink-3); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--brand); }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- search */
.search { position: relative; flex: 1; max-width: 520px; }
.search input[type=search] {
  width: 100%; height: 40px; padding: 0 70px 0 40px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface); font: inherit; color: var(--ink); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s;
}
.search input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.search > .ico { position: absolute; left: 13px; top: 11px; color: var(--ink-3); pointer-events: none; z-index: 1; }
.search kbd { position: absolute; right: 10px; top: 9px; font: 600 11px/20px Inter, sans-serif; color: var(--ink-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--surface-2); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-3); padding: 6px; max-height: 420px; overflow: auto;
  transform-origin: top; animation: pop .16s var(--ease);
}
.search-results a { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.search-results a.active, .search-results a:hover { background: var(--brand-soft); }
.search-results .kind { font-size: 11px; font-weight: 650; color: var(--ink-3); width: 64px; flex: none; text-transform: uppercase; letter-spacing: .04em; }
.search-results .detail { color: var(--ink-3); font-size: 12.5px; }
.search-results .none { padding: 14px; color: var(--ink-3); }

/* ---------------------------------------------------------------- live status */
.live { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; }
.dot.s-live::after, .dot.pulse::after { animation: ring 2.4s var(--ease) infinite; }
.dot.s-stale, .dot.s-syncing, .dot.stale { background: #e3a008; }
.dot.s-syncing::after { animation: ring 1.2s var(--ease) infinite; }
.dot.s-error, .dot.bad { background: var(--bad); }
.dot.idle { background: var(--ink-3); }
@keyframes ring { 0% { transform: scale(1); opacity: .5; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
.topbar .spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons & inputs */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: 600 13.5px/1 Inter, sans-serif;
  cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .1s, border-color .15s;
  box-shadow: 0 1px 2px rgba(31, 67, 201, .25), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn:hover, button:hover { background: var(--brand-2); color: #fff; }
.btn:active, button:active { transform: translateY(1px); }
.btn.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.btn.secondary:hover, button.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost, button.ghost, button.link { background: none; color: var(--brand); box-shadow: none; padding: 0 6px; height: auto; }
button.link:hover { background: none; color: var(--brand-2); text-decoration: underline; }
.btn.sm, button.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { width: 34px; height: 34px; padding: 0; background: none; color: var(--ink-3); box-shadow: none; border-radius: 9px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.btn .spin, button .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface);
  font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 76px; padding: 9px 11px; width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
label.field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
label.field input, label.field select { width: 100%; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card.pad { padding: 18px 20px; }
.card.lift { transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.card h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; } /* wide content scrolls inside its card instead of stretching the page */
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; }
dl.facts dt { color: var(--ink-3); font-size: 13px; }
dl.facts dd { margin: 0; font-weight: 500; }

/* ---------------------------------------------------------------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { position: relative; padding: 16px 18px 14px; overflow: hidden; }
.kpi .label { color: var(--ink-3); font-size: 12.5px; font-weight: 550; }
.kpi .value { font-size: 26px; font-weight: 720; letter-spacing: -.025em; margin-top: 6px; line-height: 1.15; }
.kpi .foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 22px; flex-wrap: wrap; padding-right: 76px; }
.kpi .hint { color: var(--ink-3); font-size: 12px; }
.kpi .spark { position: absolute; right: 14px; bottom: 14px; width: 68px; height: 22px; opacity: .85; }
.spark path { fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s .25s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; padding: 2px 7px 2px 5px;
  border-radius: 999px; opacity: 0; animation: fade-up .4s .55s var(--ease) forwards; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--ink-3); background: var(--surface-2); }
.delta.invert.up { color: var(--bad); background: var(--bad-soft); }
.delta.invert.down { color: var(--good); background: var(--good-soft); }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- date range */
.rangebar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px; }
.segmented { position: relative; display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 11px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a { position: relative; z-index: 1; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; transition: color .2s; }
.segmented a.on { color: var(--ink); }
.segmented .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 8px; background: var(--surface);
  box-shadow: var(--shadow-1); transition: left .3s var(--ease), width .3s var(--ease); }
.rangebar .custom { display: flex; gap: 8px; align-items: center; margin-left: auto; color: var(--ink-3); font-size: 13px; flex-wrap: wrap; }
.rangebar .custom input { height: 32px; }
.rangelabel { color: var(--ink-3); font-size: 13px; margin: 10px 2px 16px; }
.rangelabel strong { color: var(--ink); }

/* ---------------------------------------------------------------- pills & status */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.info { background: var(--brand-soft); color: var(--brand-2); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--surface-2); color: var(--ink-2); }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; font-size: 13px; white-space: nowrap; }
.status.quiet { color: var(--bad); }
.status.warn { color: var(--warn); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); color: var(--ink-3); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--line); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[data-dir="asc"]::after { content: " ↑"; } th[data-dir="desc"]::after { content: " ↓"; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbfe; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.dim td { color: var(--ink-3); }
tfoot th { background: var(--surface-2); color: var(--ink); font-size: 13px; border-top: 1px solid var(--line-2); border-bottom: 0; }
td.num, th.num { text-align: right; }
/* Tables that must fit the screen without sideways scrolling */
table.fit td.name { white-space: normal; min-width: 170px; }
table.fit td.name .dot { display: inline-block; margin-left: 6px; vertical-align: 1px; }
/* The small second line wraps, so it never widens its column */
table.fit .sub { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 2px; white-space: normal; line-height: 1.35; }
table.fit td.num .sub { max-width: 150px; margin-left: auto; }
table.fit .sub a { color: inherit; }
table.fit td.result { white-space: normal; min-width: 110px; }
table.fit td.result .muted { display: block; font-size: 12px; margin-top: 2px; }
@media (max-width: 1280px) { table.fit th, table.fit td { padding-left: 10px; padding-right: 10px; } }
@media (max-width: 1200px) { table.fit .xl { display: none; } table.fit td.name { min-width: 130px; } }
table.fit .phone-only { display: none; }
table.fit .sub .status { white-space: normal; }
@media (max-width: 760px) {
  table.fit .wide, table.fit .contact { display: none; }
  table.fit .phone-only { display: block; }
  table.fit td.result { min-width: 0; }
  table.fit th, table.fit td { padding: 10px 8px; }
  table.fit td.name { min-width: 0; }
}
.table-tools { display: flex; gap: 6px; align-items: center; }
table.compact th, table.compact td { padding-top: 7px; padding-bottom: 7px; }
.colmenu { position: absolute; right: 0; top: 40px; z-index: 30; width: 230px; padding: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); animation: pop .16s var(--ease); }
.colmenu label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.colmenu label:hover { background: var(--surface-2); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- filters */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; padding: 16px; }
.summaryline { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 2px 14px; color: var(--ink-3); }
.summaryline strong { color: var(--ink); font-weight: 650; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin: 14px 0; color: var(--ink-3); }

/* ---------------------------------------------------------------- charts */
.chart { position: relative; padding: 18px 20px 12px; margin: 0; }
.chart figcaption { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.chart figcaption .muted { font-size: 12.5px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: Inter, sans-serif; }
.chart .mark { fill: var(--brand); transform-box: fill-box; transform-origin: bottom; animation: grow .7s var(--ease) both; }
.chart .bar:hover .mark { fill: var(--brand-2); }
.chart .hit { fill: transparent; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.tooltip { position: absolute; z-index: 5; pointer-events: none; background: #0e1a2b; color: #fff; padding: 9px 12px; border-radius: 10px;
  font-size: 12px; line-height: 1.55; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-3);
  transition: left .12s var(--ease), top .12s var(--ease), opacity .12s; }
.tooltip strong { display: block; font-size: 12.5px; margin-bottom: 2px; }

.heat { padding: 18px 20px; }
.heat table { border-spacing: 3px; width: auto; }
.heat td, .heat th { padding: 0; border: 0; }
.heat th { font-size: 11px; color: var(--ink-3); font-weight: 550; padding-right: 8px; text-align: right; }
.heat .cell { width: 22px; height: 22px; border-radius: 5px; background: var(--heat-0); animation: fade-in .5s var(--ease) both; }
.heat .cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat .l1 { background: var(--heat-1); } .heat .l2 { background: var(--heat-2); } .heat .l3 { background: var(--heat-3); }
.heat .l4 { background: var(--heat-4); } .heat .l5 { background: var(--heat-5); }
.heat .hours th { text-align: left; padding: 4px 0 0; font-size: 10.5px; }
.heat .legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-3); margin-top: 12px; }
.heat .legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.movers { list-style: none; margin: 0; padding: 0; }
.movers li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.movers li:last-child { border-bottom: 0; }
.movers .bar-track { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; max-width: 120px; }
.movers .bar-fill { height: 100%; border-radius: 6px; transform-origin: left; animation: grow-x .8s .2s var(--ease) both; }
.movers .up .bar-fill { background: var(--good); } .movers .down .bar-fill { background: var(--bad); }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------------------------------------------------------- live feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .what { min-width: 0; }
.feed .what strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .what span { color: var(--ink-3); font-size: 12px; }
.feed .amt { text-align: right; font-weight: 650; }
.feed .amt span { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.feed .icon-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--good-soft); color: var(--good); }
.feed .icon-dot.bad { background: var(--bad-soft); color: var(--bad); }
.feed li.enter { animation: slide-in .5s var(--ease) both, flash 2.2s .2s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background: var(--brand-soft); } 100% { background: transparent; } }

/* ---------------------------------------------------------------- drawer */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(14, 26, 43, .28); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface);
  box-shadow: var(--shadow-3); transform: translateX(104%); transition: transform .32s var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 16px; }
.drawer header .icon-btn { margin-left: auto; }
.drawer .body { padding: 20px; overflow: auto; }
.drawer .big { font-size: 30px; font-weight: 750; letter-spacing: -.03em; }
.drawer dl.facts { margin-top: 18px; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 0%, #e9ecf3 40%, var(--surface-2) 80%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- toasts & progress */
.toasts { position: fixed; z-index: 60; top: 18px; right: 18px; display: grid; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: center; min-width: 280px; max-width: 420px; padding: 12px 16px; border-radius: 12px;
  background: #0e1a2b; color: #fff; box-shadow: var(--shadow-3); animation: toast-in .35s var(--ease) both; font-weight: 500; }
.toast.out { animation: toast-out .3s var(--ease) both; }
.toast .badge { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--good); }
.toast.bad .badge { background: var(--bad); }
.toast .badge path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick .4s .2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes tick { to { stroke-dashoffset: 0; } }
.progress { position: fixed; z-index: 70; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, #5b8cff, var(--brand));
  box-shadow: 0 0 10px var(--brand-ring); opacity: 0; transition: width .4s var(--ease), opacity .3s; }
.progress.run { opacity: 1; width: 80%; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .2s; }
.progress.done { opacity: 0; width: 100%; transition: width .2s, opacity .4s .2s; }

/* ---------------------------------------------------------------- banners & empty states */
.banner { position: relative; overflow: hidden; display: flex; gap: 14px; align-items: center; padding: 14px 18px; margin-bottom: 18px;
  border-radius: var(--radius); background: linear-gradient(120deg, #eef2ff, #f5f0ff); border: 1px solid #dfe4ff; }
.banner .ico { color: var(--brand); }
.banner .close { margin-left: auto; }
.burst { position: absolute; left: 34px; top: 50%; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 8px; height: 8px; background: linear-gradient(135deg, #5b8cff, #2346d8); transform: rotate(45deg);
  border-radius: 1px; opacity: 0; animation: burst 1.1s var(--ease) forwards; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0) rotate(45deg) scale(.4); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(225deg) scale(1); } }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty .ico { color: var(--line-2); margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- sign in */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.auth .hero { position: relative; overflow: hidden; isolation: isolate; padding: 40px 48px 48px; color: #fff;
  display: flex; flex-direction: column; background: #070f2b; }
.auth .hero .brand { position: relative; z-index: 2; }
.auth .hero .brand .word { color: #fff; }
.auth .hero .brand .word span { color: rgba(255, 255, 255, .6); }

/* Slow-drifting aurora light behind everything */
.aurora { position: absolute; inset: -25%; z-index: -2; filter: blur(70px); opacity: .85; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.aurora .b1 { width: 60%; height: 60%; left: 5%; top: 0; background: radial-gradient(circle, #1d4ed8 0%, transparent 65%); animation: drift-a 22s ease-in-out infinite alternate; }
.aurora .b2 { width: 55%; height: 55%; right: 0; top: 20%; background: radial-gradient(circle, #0ea5e9 0%, transparent 62%); opacity: .7; animation: drift-b 26s ease-in-out infinite alternate; }
.aurora .b3 { width: 50%; height: 50%; left: 25%; bottom: 0; background: radial-gradient(circle, #6d28d9 0%, transparent 62%); opacity: .55; animation: drift-c 30s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(14%, 10%) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-16%, 8%) scale(.9); } }
@keyframes drift-c { to { transform: translate(10%, -14%) scale(1.1); } }
.dots { position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.2px); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 55% 45%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 55% 45%, #000 20%, transparent 75%); }

/* The diamond on its stage */
.stage { position: relative; flex: 1; display: grid; place-items: center; min-height: 380px; }
.halo { position: absolute; width: 520px; height: 520px; max-width: 95%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, .42) 0%, rgba(37, 99, 235, .22) 35%, transparent 68%);
  animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); opacity: .8; } }
.gem-wrap { position: relative; width: min(330px, 62%); animation: float 7s ease-in-out infinite; }
.gem { display: block; width: 100%; height: auto; filter: drop-shadow(0 26px 40px rgba(14, 165, 233, .45)) drop-shadow(0 0 1px rgba(255, 255, 255, .6)); }
.shine { position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .75) 48%, rgba(255, 255, 255, .15) 54%, transparent 62%);
  background-size: 260% 100%; background-position: 130% 0; animation: sweep 6s 1.2s ease-in-out infinite; mix-blend-mode: soft-light; }
@keyframes sweep { 0% { background-position: 130% 0; } 35%, 100% { background-position: -40% 0; } }
@keyframes float { 50% { transform: translateY(-14px); } }
.floor { position: absolute; top: calc(50% + min(150px, 24%)); width: 220px; height: 26px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(14, 165, 233, .45), transparent 70%); filter: blur(6px); animation: shadow 7s ease-in-out infinite; }
@keyframes shadow { 50% { transform: scaleX(.82); opacity: .6; } }

/* Twinkling sparkles (4-point stars) */
.sparkle { position: absolute; width: 14px; height: 14px; opacity: 0; animation: twinkle 3.6s ease-in-out infinite; }
.sparkle::before, .sparkle::after { content: ""; position: absolute; left: 50%; top: 50%; background: #fff; border-radius: 2px;
  box-shadow: 0 0 8px rgba(186, 230, 253, .9); transform: translate(-50%, -50%); }
.sparkle::before { width: 2px; height: 100%; } .sparkle::after { width: 100%; height: 2px; }
.s1 { left: 22%; top: 24%; animation-delay: .2s; } .s2 { right: 20%; top: 18%; animation-delay: 1.4s; transform: scale(.7); }
.s3 { right: 16%; top: 58%; animation-delay: 2.3s; } .s4 { left: 18%; top: 66%; animation-delay: .9s; transform: scale(.6); }
.s5 { left: 46%; top: 10%; animation-delay: 3s; transform: scale(.5); } .s6 { right: 32%; bottom: 14%; animation-delay: 1.9s; transform: scale(.55); }
@keyframes twinkle { 0%, 100% { opacity: 0; scale: .4; rotate: 0deg; } 40% { opacity: 1; scale: 1; rotate: 45deg; } 60% { opacity: .9; } }

/* Frosted glass hint cards */
.glass { position: absolute; display: flex; gap: 10px; align-items: center; padding: 10px 14px 10px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 14px 34px rgba(2, 6, 23, .35); font-size: 12px; line-height: 1.3; animation: float 8s ease-in-out infinite; }
.glass strong { display: block; font-size: 13px; }
.glass span:not(.dot):not(.tick) { color: rgba(255, 255, 255, .65); }
.glass .tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(16, 185, 129, .9); color: #fff; }
.glass .dot { background: #34d399; }
.g1 { left: 6%; top: 30%; animation-delay: -2s; }
.g2 { right: 5%; bottom: 22%; animation-delay: -5s; }

.auth .copy { position: relative; z-index: 2; }
.auth .hero h2 { font-size: 34px; line-height: 1.12; letter-spacing: -.035em; max-width: 480px; margin: 0 0 10px; font-weight: 750; }
.auth .hero p { color: rgba(255, 255, 255, .68); max-width: 420px; font-size: 15px; margin: 0; }
.auth .panel { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.mobile-brand { display: none; }
@media (max-width: 900px) { .mobile-brand { display: block; } }
.auth form { width: min(380px, 100%); display: grid; gap: 14px; animation: fade-up .5s var(--ease) both; }
.auth form h1 { font-size: 26px; }
.auth form .btn, .auth form button { height: 42px; }
.alert { padding: 11px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 550; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .hero { display: none; } }

/* ---------------------------------------------------------------- misc */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.done { text-decoration: line-through; color: var(--ink-3); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; margin: 8px 0 12px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.tz { color: var(--ink-3); font-size: 11px; margin-left: 4px; font-weight: 500; }
.note { color: var(--ink-3); font-size: 12px; margin-top: 10px; }
details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px 18px; font-weight: 600; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; transition: transform .2s var(--ease); font-size: 16px; color: var(--ink-3); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
.reveal { animation: fade-up .45s var(--ease) both; }

/* ---------------------------------------------------------------- phones */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .content { padding: 4px 16px 96px; }
  .live .label { display: none; }
  .search kbd { display: none; }
  .bottom-nav { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; justify-content: space-around;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 4px 10px; }
  .bottom-nav a.on { color: var(--brand); }
  .rangebar .custom { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spark path { stroke-dashoffset: 0; } .delta { opacity: 1; }
}
