/* AdSarathi theme
   Light lavender plane, white rounded cards, sky + navy accents.
   Colours are roles (CSS variables) so the dark theme swaps them in one place. */

:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", "Noto Sans Devanagari", sans-serif;

  --plane: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f5f6fc;
  --ink: #101a4a;
  --ink-2: #434c73;
  --muted: #666e90;
  --line: #e4e7f2;
  --line-strong: #cdd2e5;

  --navy: #0e1f82;
  --navy-deep: #0a1661;
  --sky: #1fb2f5;
  --sky-ink: #0b63a8;
  --sky-50: #e7f5fe;
  --primary: #0e1f82;
  --primary-hover: #0a1661;
  --on-primary: #ffffff;
  --focus: #1287d6;

  /* status: always paired with an icon and a word */
  --good: #0ca30c;
  --good-ink: #006300;
  --good-bg: #e7f6e7;
  --warning: #fab219;
  --warning-ink: #7a5200;
  --warning-bg: #fff4d9;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-ink: #a32424;
  --critical-bg: #fdecec;
  --info-ink: #0b63a8;
  --info-bg: #e7f5fe;

  /* charts (validated categorical order, light surface) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-other: #9aa1bd;
  --seq-track: #cde2fb;
  --seq-100: #cde2fb;
  --seq-250: #86b6ef;
  --seq-400: #3987e5;
  --seq-550: #1c5cab;
  --seq-700: #0d366b;
  --grid: #e6e9f3;
  --axis: #c6ccdf;

  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --sidebar-w: 236px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --plane: #0b1022;
  --surface: #151b30;
  --surface-2: #1c2440;
  --ink: #eef1fb;
  --ink-2: #c5cbe2;
  --muted: #929ab9;
  --line: #262f4f;
  --line-strong: #37416a;

  --navy: #2438b8;
  --navy-deep: #1a2a96;
  --sky: #2fb9f7;
  --sky-ink: #7fd2fb;
  --sky-50: #17304d;
  --primary: #3550dc;
  --primary-hover: #4863ea;
  --on-primary: #ffffff;
  --focus: #6fcbfa;

  --good-ink: #5fd35f;
  --good-bg: #12301a;
  --warning-ink: #fbc34f;
  --warning-bg: #3a2c0b;
  --critical-ink: #f08a8a;
  --critical-bg: #3a1a1e;
  --info-ink: #7fd2fb;
  --info-bg: #17304d;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-other: #6d7594;
  --seq-track: #1d3a63;
  --seq-100: #17365f;
  --seq-250: #1c5cab;
  --seq-400: #3987e5;
  --seq-550: #6da7ec;
  --seq-700: #b7d3f6;
  --grid: #232b49;
  --axis: #37416a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--sky-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; }
.icon { flex: none; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--sky); color: #06224a; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 20px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); }
:root[data-theme="dark"] .brand-name { color: var(--ink); }
.brand-name span { color: var(--sky); }
.brand-text { display: grid; line-height: 1.15; }
.brand-sub { font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.brand-mark { flex: none; border-radius: 28%; box-shadow: 0 4px 12px rgba(14, 31, 130, .22); }
.auth-art .brand-sub { color: #b9c4ff; }
.auth-art .brand-mark { box-shadow: none; }
.app-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.nav-group { margin: 14px 12px 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px; scrollbar-width: thin; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--ink-2); font-weight: 500; position: relative;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { color: var(--navy); font-weight: 600; background: var(--sky-50); }
:root[data-theme="dark"] .nav a.active { color: var(--ink); }
.nav a.active .icon { color: var(--sky-ink); }
.nav .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { flex: none; padding-top: 12px; display: grid; gap: 10px; }
.conn-card { background: var(--sky-50); border-radius: var(--r); padding: 12px; display: grid; gap: 6px; }
.conn-card strong { font-size: 13px; }
.conn-card p { font-size: 12px; color: var(--ink-2); }
.foot-row { display: flex; gap: 8px; align-items: center; }
.foot-row form { flex: 1; }

.main { flex: 1; min-width: 0; padding: 20px 26px 40px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar-title { flex: 1; min-width: 200px; }
.topbar-title p { color: var(--muted); margin-top: 2px; max-width: 70ch; }
.topbar-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-btn.menu-btn { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.user-chip:hover { text-decoration: none; }
.scrim { display: none; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.side-acct { display: none; }
.icon-btn.side-close { display: none; }
.only-small { display: none !important; }
#publish, #guard { scroll-margin-top: 120px; }

/* ------------------------------------------------------------ layout helpers */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.stack-sm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; position: sticky; top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.hidden, [hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ cards */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-head > * { min-width: 0; }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.card-tools > .seg { min-width: 0; }
.card-flat { background: var(--surface-2); border-radius: var(--r); padding: 14px; }
.card-navy { background: var(--navy); color: #fff; }
.card-navy .muted, .card-navy p { color: #cfd6ff; }
.card-navy h2 { color: #fff; }
.card-navy a { color: #9fdcff; }

.sample-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--warning-ink); background: var(--warning-bg); padding: 3px 9px; border-radius: 999px; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { text-decoration: none; background: var(--line); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sky { background: var(--sky); color: #06224a; }
.btn-sky:hover { background: #46c2f8; }
.btn-secondary { background: var(--sky-50); color: var(--navy); }
:root[data-theme="dark"] .btn-secondary { color: var(--ink); }
.btn-secondary:hover { background: var(--line); }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--critical); color: var(--critical-ink); }
.btn-danger:hover { background: var(--critical-bg); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2); position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); border: 2px solid var(--surface); }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ forms */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; align-content: start; }
.label { font-weight: 500; font-size: 13px; color: var(--ink-2); }
.label .req { color: var(--critical-ink); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input-sm { width: 104px; min-height: 34px; padding: 5px 8px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666e90' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input:disabled, .select:disabled, .textarea:disabled { background-color: var(--surface-2); color: var(--ink-2); border-color: var(--line); cursor: not-allowed; opacity: 1; -webkit-text-fill-color: var(--ink-2); }
.help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; color: var(--critical-ink); display: flex; gap: 6px; align-items: center; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--critical); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.input-group { display: flex; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 12px 0 0 12px; background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.input-group .input { border-radius: 0 12px 12px 0; }
.counter { font-size: 12px; color: var(--muted); text-align: right; }
.counter.over { color: var(--critical-ink); font-weight: 600; }

.seg { display: inline-flex; max-width: 100%; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: none; border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 500; color: var(--ink-2); cursor: pointer; font-size: 13px; white-space: nowrap; }
.seg a:hover, .seg button:hover { text-decoration: none; color: var(--ink); }
.seg .on { background: var(--surface); color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 26, 74, .12); }
:root[data-theme="dark"] .seg .on { color: var(--ink); }

/* ------------------------------------------------------------ chips, alerts */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip-good { background: var(--good-bg); color: var(--good-ink); }
.chip-warning { background: var(--warning-bg); color: var(--warning-ink); }
.chip-critical { background: var(--critical-bg); color: var(--critical-ink); }
.chip-info { background: var(--info-bg); color: var(--info-ink); }
.chip-muted { background: var(--surface-2); color: var(--ink-2); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 500; }
.delta-good { color: var(--good-ink); }
.delta-bad { color: var(--critical-ink); }
.delta-flat { color: var(--muted); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--good-bg); color: var(--good-ink); }
.alert-error { background: var(--critical-bg); color: var(--critical-ink); }
.alert-warning { background: var(--warning-bg); color: var(--warning-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert strong { font-weight: 600; }
.alert a { color: inherit; text-decoration: underline; }
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table th.num { text-align: right; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.table .actions form { display: flex; }
.table th.right { text-align: right; }
.table .title-cell { font-weight: 600; color: var(--ink); }
.table .title-cell small { display: block; font-weight: 400; color: var(--muted); }

.empty { text-align: center; padding: 36px 16px; display: grid; gap: 10px; justify-items: center; }
.empty .ill { width: 64px; height: 64px; border-radius: 20px; background: var(--sky-50); display: inline-flex; align-items: center; justify-content: center; color: var(--sky-ink); }
.empty p { color: var(--muted); max-width: 46ch; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.pager-info { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.kpi-foot { margin-top: auto; padding-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.kpi-foot .delta, .kpi-foot .muted { white-space: nowrap; }
.kpi-foot .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.spark { flex: 1 1 0; min-width: 0; max-width: 84px; height: 26px; display: flex; justify-content: flex-end; }

/* ------------------------------------------------------------ meters, segmented bars */
.meter { height: 8px; border-radius: 999px; background: var(--seq-track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }
.meter.warn > span { background: var(--warning); }
.meter.bad > span { background: var(--critical); }
.meter-row { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meter-row:last-child { border-bottom: 0; }
.segbar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.segbar > span { display: block; height: 100%; min-width: 3px; }
.split-list { display: grid; gap: 2px; margin-top: 12px; }
.split-list .item { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.split-list .item:last-child { border-bottom: 0; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------ dashboard specifics */
.greeting { display: flex; align-items: center; gap: 12px; }
.launch-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.launch-card { border-radius: 16px; padding: 18px; display: grid; gap: 6px; min-height: 124px; align-content: start; color: #06224a; background: var(--sky); }
.launch-card:hover { text-decoration: none; filter: brightness(1.04); }
.launch-card.navy { background: var(--navy); color: #fff; }
.launch-card h3 { font-size: 16px; font-weight: 600; }
.launch-card p { font-size: 13px; opacity: .92; }
.launch-card .go { margin-top: auto; padding-top: 10px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }

.feed-item { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--r); }
.feed-item .dotmark { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--info-ink); }
.feed-item.sev-critical .dotmark { background: var(--critical); }
.feed-item.sev-warning .dotmark { background: var(--warning); }
.feed-item.sev-opportunity .dotmark { background: var(--good); }
.feed-item p { color: var(--ink-2); font-size: 13px; }
a.feed-item { color: var(--ink); }
a.feed-item:hover { text-decoration: none; background: var(--sky-50); }

.week { display: grid; gap: 8px; }
.week-head, .week-row { display: grid; grid-template-columns: 96px repeat(7, minmax(0, 1fr)); gap: 4px; align-items: center; }
.week-head span { font-size: 12px; color: var(--muted); text-align: center; line-height: 22px; }
.week-head span.today { color: #fff; background: var(--navy); font-weight: 600; border-radius: 999px; width: 22px; justify-self: center; }
:root[data-theme="dark"] .week-head span.today { color: var(--sky); }
.week-row .name { font-size: 12.5px; font-weight: 500; }
.week-track { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--surface-2); border-radius: 999px; height: 22px; align-items: center; }
.week-bar { height: 18px; border-radius: 999px; background: var(--sky); color: #06224a; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 8px; overflow: hidden; white-space: nowrap; margin: 0 2px; }
.week-bar.navy { background: var(--navy); color: #fff; }
.week-bar.draft { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--ink-2); }

.promo { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.promo .art { width: 76px; height: 76px; border-radius: 22px; background: var(--sky-50); display: flex; align-items: center; justify-content: center; color: var(--navy); }
:root[data-theme="dark"] .promo .art { color: var(--sky); }

/* ------------------------------------------------------------ charts */
.chart { position: relative; min-width: 0; }
.chart-body { position: relative; }
.chart-body svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-body text { font-family: var(--font); font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-body .label-strong { fill: var(--ink); font-weight: 600; font-size: 12px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .linekey { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.viz-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 110px; box-shadow: 0 8px 24px rgba(5, 10, 40, .25); transform: translate(-50%, -100%); margin-top: -10px; white-space: nowrap; }
.viz-tip .t { opacity: .75; font-size: 11.5px; margin-bottom: 2px; }
.viz-tip .v { font-weight: 600; font-size: 14px; }
.viz-tip .r { display: flex; align-items: center; gap: 6px; }
.viz-tip .r i { width: 10px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-table { margin-top: 12px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.chart-table th, .chart-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 500; color: var(--ink-2); }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.heat .hl { font-size: 11px; color: var(--muted); text-align: center; }
.heat .dl { font-size: 11.5px; color: var(--muted); }
.heat .cell { aspect-ratio: 1 / 1; border-radius: 4px; background: var(--surface-2); min-height: 12px; }
.heat .cell:focus-visible { outline-offset: 0; }
.scale-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.scale-legend .ramp { display: flex; gap: 2px; }
.scale-legend .ramp i { width: 18px; height: 10px; border-radius: 3px; display: block; }

/* ------------------------------------------------------------ launcher */
.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.goal { position: relative; }
.goal input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.goal label { display: grid; gap: 4px; padding: 14px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; height: 100%; }
.goal label .icon { color: var(--sky-ink); }
.goal label span { font-weight: 600; }
.goal label small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.goal input:checked + label { border-color: var(--navy); background: var(--sky-50); }
:root[data-theme="dark"] .goal input:checked + label { border-color: var(--sky); }
.goal input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

.magic { background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 22px; display: grid; gap: 12px; }
.magic h2 { font-size: 18px; color: #fff; }
.magic p { color: #cfd6ff; max-width: 68ch; }
.magic .textarea { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; min-height: 76px; }
.magic .textarea::placeholder { color: #b9c3ff; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; counter-reset: step; }
.steps li { list-style: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); color: var(--ink-2); font-weight: 500; font-size: 13px; }
.steps li::before { counter-increment: step; content: counter(step); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.steps li.on { color: var(--navy); background: var(--sky-50); }
:root[data-theme="dark"] .steps li.on { color: var(--ink); }
.steps li.on::before { background: var(--primary); color: #fff; }
.steps { padding: 0; margin: 0; }

/* ------------------------------------------------------------ campaign editor */
.block { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; background: var(--surface); }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.block-head .tag { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.token { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--sky-50); color: var(--navy); font-size: 12.5px; font-weight: 500; }
:root[data-theme="dark"] .token { color: var(--ink); }
.token.unresolved { background: var(--warning-bg); color: var(--warning-ink); }
.token button { border: 0; background: transparent; cursor: pointer; padding: 2px; border-radius: 50%; display: inline-flex; color: inherit; }
.token button:hover { background: rgba(16, 26, 74, .1); }
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 30px rgba(10, 20, 60, .16); max-height: 260px; overflow: auto; padding: 4px; }
.lookup-list button { display: grid; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.lookup-list button:hover, .lookup-list button:focus { background: var(--surface-2); }
.lookup-list small { color: var(--muted); }
.lookup-list .note { padding: 10px; color: var(--muted); font-size: 12.5px; }

.ad-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.phone { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; font-size: 13px; align-self: start; }
.phone-top { display: flex; gap: 8px; align-items: center; padding: 10px 12px; }
.phone-top .pp { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.phone-top small { color: var(--muted); display: block; font-size: 11.5px; }
.phone-text { padding: 0 12px 10px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.phone-media { background: var(--surface-2); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 0; overflow: hidden; }
.phone-media img, .phone-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.phone-media .ph { padding: 18px; display: grid; gap: 6px; justify-items: center; font-size: 12.5px; }
.phone-cta { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); }
.phone-cta > div { flex: 1; min-width: 0; }
.phone-cta b { font-weight: 600; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.phone-cta small { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone-cta .cta { flex: none; max-width: 46%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-weight: 600; font-size: 12px; line-height: 1.25; text-align: center; background: var(--surface); }

.checklist { display: grid; gap: 8px; padding: 0; margin: 0; }
.checklist li { list-style: none; display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 13px; align-items: start; }
.checklist .ok { color: var(--good-ink); }
.checklist .no { color: var(--critical-ink); }
.checklist .warn { color: var(--warning-ink); }
.checklist li span small { display: block; color: var(--muted); }

.forecast-big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.range-bar { position: relative; height: 8px; border-radius: 999px; background: var(--seq-track); margin: 14px 0 6px; }
.range-bar i { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--navy); transform: translateX(-2px); }
:root[data-theme="dark"] .range-bar i { background: var(--ink); }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.fact small { color: var(--muted); display: block; font-size: 12px; }
.fact b { font-weight: 600; font-size: 15px; }
.card-navy .fact { background: rgba(255, 255, 255, .1); }
.card-navy .fact small { color: #cfd6ff; }

.reasons { display: grid; gap: 8px; padding: 0; margin: 0; }
.reasons li { list-style: none; display: grid; grid-template-columns: 20px 1fr; gap: 8px; }

.publog { display: grid; gap: 6px; max-height: 320px; overflow: auto; padding: 0; margin: 0; }
.publog li { list-style: none; display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 13px; }
.publog .ok { color: var(--good-ink); }
.publog .err { color: var(--critical-ink); }
.progress { height: 8px; border-radius: 999px; background: var(--seq-track); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--series-1); border-radius: 999px; transition: width .3s ease; }

/* ------------------------------------------------------------ suggestions */
.sug { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: start; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.sug .badge { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info-ink); }
.sug.sev-critical .badge { background: var(--critical-bg); color: var(--critical-ink); }
.sug.sev-warning .badge { background: var(--warning-bg); color: var(--warning-ink); }
.sug.sev-opportunity .badge { background: var(--good-bg); color: var(--good-ink); }
.sug h3 { font-size: 14.5px; }
.sug p { color: var(--ink-2); margin-top: 2px; }
.sug .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.sug .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------------------------------------ dialog, toast */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink); width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(5, 10, 40, .35); }
dialog::backdrop { background: rgba(8, 12, 40, .5); }
dialog:focus, dialog:focus-visible { outline: none; }   /* the buttons inside keep their own focus ring */
.dialog-body { padding: 22px; display: grid; gap: 10px; }
.dialog-body p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; flex-wrap: wrap; }
dialog.wide { width: min(720px, calc(100vw - 32px)); }
#toast-root { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 500; display: flex; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(5, 10, 40, .3); max-width: min(420px, calc(100vw - 36px)); }
.toast.err { background: var(--critical); color: #fff; }

.busy-overlay { position: fixed; inset: 0; background: rgba(8, 12, 40, .55); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.busy-box { background: var(--surface); color: var(--ink); border-radius: var(--r-lg); padding: 26px; max-width: 380px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.busy-box p { color: var(--ink-2); }

/* ------------------------------------------------------------ login + installer */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.auth-art h1 { font-size: 34px; line-height: 1.2; font-weight: 600; max-width: 18ch; letter-spacing: -0.02em; text-wrap: balance; }
.auth-art p { color: #cfd6ff; max-width: 46ch; font-size: 15px; }
.auth-art .brand-name { color: #fff; }
.auth-points { display: grid; gap: 12px; padding: 0; margin: 0; }
.auth-points li { list-style: none; display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: #e3e8ff; }
.auth-points .icon { color: var(--sky); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-form .card { width: min(420px, 100%); padding: 28px; }
.install-wrap { max-width: 760px; margin: 0 auto; padding: 32px 16px 60px; }

/* ------------------------------------------------------------ smart tools */
.btn-ghost.on-navy { color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn-ghost.on-navy:hover { background: rgba(255, 255, 255, .12); }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); font-size: 13px; }
.count-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #06224a; color: #fff; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Click to Improve: the one loud element of the app */
.improve-hero { background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 26px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.improve-hero::after { content: ""; position: absolute; right: -90px; top: -130px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(closest-side, rgba(31, 178, 245, .42), rgba(31, 178, 245, 0)); pointer-events: none; }
.improve-hero > * { position: relative; z-index: 1; }
.improve-hero h2 { font-size: 24px; color: #fff; display: flex; gap: 10px; align-items: center; letter-spacing: -0.01em; }
.improve-hero .lead { color: #e3e8ff; font-size: 15px; margin: 6px 0 12px; max-width: 60ch; }
.pill { display: inline-flex; padding: 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 12.5px; font-weight: 500; color: #fff; }
.pill-plain { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); }
.hero-note { color: #c3ccff; font-size: 12.5px; }
.hero-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-stat { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 104px; }
.hero-stat b { font-size: 24px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 12px; color: #cfd6ff; line-height: 1.35; }

.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.tool-card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 8px; align-content: start; color: var(--ink); box-shadow: inset 0 0 0 1.5px transparent; }
.tool-card:hover, .tool-card:focus-visible { text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--sky); }
.tool-icon { width: 42px; height: 42px; border-radius: 13px; background: var(--sky-50); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .tool-icon { color: var(--sky); }
.tool-card h3 { font-size: 15.5px; }
.tool-card p { color: var(--ink-2); font-size: 13px; }
.tool-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.tool-card .go { font-weight: 600; font-size: 13px; color: var(--sky-ink); display: inline-flex; gap: 4px; align-items: center; margin-left: auto; }

details.run { border-bottom: 1px solid var(--line); padding: 10px 0; }
details.run:last-of-type { border-bottom: 0; }
details.run summary { cursor: pointer; }
details.run summary > * { margin-right: 8px; }

/* Ad Doctor: seen, tapped, result */
.funnel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: stretch; }
.funnel-step { border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: grid; gap: 2px; align-content: start; box-shadow: inset 4px 0 0 var(--line-strong); min-width: 0; }
.funnel-step small { color: var(--muted); font-size: 12px; }
.funnel-step b { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.funnel-step span { font-size: 12.5px; color: var(--ink-2); }
.funnel-step em { font-style: normal; font-size: 12px; font-weight: 600; margin-top: 4px; color: var(--muted); }
.funnel-step.st-good { box-shadow: inset 4px 0 0 var(--good); }
.funnel-step.st-good em { color: var(--good-ink); }
.funnel-step.st-warn { box-shadow: inset 4px 0 0 var(--warning); }
.funnel-step.st-warn em { color: var(--warning-ink); }
.funnel-step.st-bad { box-shadow: inset 4px 0 0 var(--critical); background: var(--critical-bg); }
.funnel-step.st-bad em { color: var(--critical-ink); }
.funnel-arrow { align-self: center; color: var(--muted); display: inline-flex; }
.rx { margin-top: 14px; padding: 14px; border-radius: var(--r); background: var(--surface-2); }
.rx h3 { font-size: 15px; }
.rx p { color: var(--ink-2); margin-top: 2px; }
.rx-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; color: var(--ink); font-size: 13.5px; }

/* ads as cards: fatigue radar, running now */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ad-card { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--surface); min-width: 0; }
.ad-top { display: flex; gap: 10px; align-items: flex-start; }
.ad-top img, .ad-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); }
.ad-thumb { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.ad-top h3, .ad-top h4 { font-size: 14px; font-weight: 600; margin: 0; overflow-wrap: anywhere; line-height: 1.35; }
.ad-top small { color: var(--muted); font-size: 12px; display: block; }
.ad-top .chip { flex: none; }
.ad-text { color: var(--ink-2); font-size: 13px; white-space: pre-line; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.ad-card .facts .fact b { font-size: 14px; }
.ad-meta { gap: 8px; }
.ad-acts { gap: 6px; }

/* live ads */
.run-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: center; margin-bottom: 4px; }
.live-group { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.live-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.live-head h3 { font-size: 15.5px; overflow-wrap: anywhere; }
.live-acts { gap: 6px; }
.row-thumb, .ad-thumb.row-thumb { float: right; width: 44px; height: 44px; object-fit: cover; border-radius: 10px; margin-left: 8px; }
.table .title-cell small.issue { color: var(--critical-ink); }

/* audience x-ray, budget moves */
.share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.share-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--seq-track); overflow: hidden; min-width: 56px; }
.share-bar i { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }
.share .meter { flex: none; }
.move { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; }
.move-side { display: grid; gap: 2px; min-width: 0; }
.move-side small { color: var(--muted); font-size: 12px; }
.move-side b { font-weight: 600; overflow-wrap: anywhere; }
.move-side span { color: var(--ink-2); font-size: 12.5px; }
.move-mid { display: grid; justify-items: center; gap: 2px; color: var(--sky-ink); }
.move-amount { font-weight: 600; color: var(--ink); white-space: nowrap; }
.move-act { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px dashed var(--line-strong); padding-top: 10px; }

/* account health, scores */
.health-list { list-style: none; padding: 0; margin: 0; display: grid; }
.health-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.health-list li:last-child { border-bottom: 0; }
.hl-icon { flex: none; width: 34px; height: 34px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info-ink); }
.hl-ok .hl-icon { background: var(--good-bg); color: var(--good-ink); }
.hl-warn .hl-icon { background: var(--warning-bg); color: var(--warning-ink); }
.hl-bad .hl-icon { background: var(--critical-bg); color: var(--critical-ink); }
.score-ring { --p: 0; --ring: var(--good); width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 0;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--ring) calc(var(--p) * 1%), var(--seq-track) 0); }
.score-ring b { font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring span { font-size: 11.5px; color: var(--muted); }
.score-ring.tone-warning { --ring: var(--warning); }
.score-ring.tone-critical { --ring: var(--critical); }
.card.center .score-ring { margin: 0 auto; }
.preset { display: grid; gap: 10px; align-content: start; }
.preset .btn, .preset .chip { justify-self: start; }

/* launch guard in the campaign editor */
.guard-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.guard .score-ring { width: 80px; height: 80px; flex: none; }
.guard .score-ring b { font-size: 22px; }
.guard .card-head h2 { display: flex; gap: 8px; align-items: center; }
.guard-ok { margin-top: 10px; font-size: 13px; }
.guard-ok summary { cursor: pointer; color: var(--ink-2); }
.checklist .chip { padding: 1px 7px; font-size: 11px; vertical-align: 1px; }

/* dashboard: brief, improve, running ads */
.brief-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.brief .card-head h2, .improve-mini h2 { display: flex; gap: 8px; align-items: center; }
.brief-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.brief-list li { padding-left: 16px; position: relative; font-size: 14px; }
.brief-list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); }
.improve-mini { display: grid; gap: 10px; align-content: start; }
.run-list { display: grid; gap: 8px; }
.run-item { display: flex; gap: 12px; align-items: center; padding: 8px 10px 8px 8px; border-radius: 12px; background: var(--surface-2); color: var(--ink); min-width: 0; }
.run-item:hover { text-decoration: none; background: var(--sky-50); }
.run-item img, .run-item .ad-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface); }
.run-item b { display: block; font-weight: 600; font-size: 13.5px; }
.run-item small { color: var(--muted); font-size: 12.5px; display: block; }
.run-item .chip { flex: none; }

/* dialogs: improve, fresh version, more menu */
.imp-head { display: grid; gap: 4px; }
.imp-main { display: grid; gap: 12px; align-content: start; max-height: min(58vh, 560px); overflow: auto; padding-right: 4px; }
.imp-list { display: grid; gap: 8px; }
.imp-group { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 6px; }
.imp-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); align-items: start; background: var(--surface); }
.imp-item.off { background: var(--surface-2); }
.imp-item.off .imp-title { color: var(--muted); }
.imp-item > input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.imp-line { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.imp-title { font-weight: 600; cursor: pointer; flex: 1 1 220px; }
.imp-chips { gap: 6px; flex: none; }
.imp-why { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.imp-expect { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.imp-expect b { font-weight: 600; color: var(--ink); }
.imp-edit { margin-top: 8px; font-size: 13px; }
.imp-edit summary { cursor: pointer; color: var(--sky-ink); font-weight: 500; }
.imp-edit[open] summary { margin-bottom: 8px; }
.imp-manual { display: grid; gap: 8px; }
.imp-manual h3 { font-size: 13px; }
.imp-item.manual { background: var(--critical-bg); border-color: transparent; }
.imp-item.manual .imp-title { cursor: default; }
.imp-ico { display: inline-flex; margin-top: 1px; color: var(--critical-ink); }
.dialog-actions .grow { align-self: center; }
.menu-list { display: grid; gap: 6px; }
.menu-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 52px; font: inherit; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item b { display: block; font-weight: 600; font-size: 14px; }
.menu-item small { color: var(--muted); font-size: 12.5px; }
.menu-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--sky-50); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; flex: none; }
:root[data-theme="dark"] .menu-ico { color: var(--sky); }
.menu-item.danger { color: var(--critical-ink); }
.menu-item.danger .menu-ico { background: var(--critical-bg); color: var(--critical-ink); }
.menu-item.danger small { color: var(--critical-ink); }

/* installer result, sign-in help */
.login-box { border: 1px solid var(--line-strong); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.auth-help { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.auth-help summary { cursor: pointer; color: var(--sky-ink); font-weight: 500; }
.auth-help p { margin-top: 8px; }
.auth-help ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.auth-help .code { white-space: nowrap; word-break: normal; }

@media (max-width: 1100px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .improve-hero { grid-template-columns: minmax(0, 1fr); }
  .run-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-strip .btn { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .brief-row { grid-template-columns: minmax(0, 1fr); }
  .live-acts { width: 100%; }
}
@media (max-width: 640px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .improve-hero { padding: 20px; }
  .improve-hero h2 { font-size: 20px; }
  .hero-stat { min-width: 0; padding: 10px; }
  .hero-stat b { font-size: 20px; }
  .funnel { grid-template-columns: minmax(0, 1fr); }
  .funnel-arrow { transform: rotate(90deg); justify-self: center; }
  .move { grid-template-columns: minmax(0, 1fr); }
  .move-mid { grid-auto-flow: column; justify-content: start; justify-items: start; align-items: center; gap: 8px; }
  .move-mid .icon { transform: rotate(90deg); }
  .ad-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog-actions .grow { flex: 1 1 100%; }
  .imp-main { max-height: 62vh; }
  .health-list li { flex-wrap: wrap; }
  .health-list li > .grow { flex-basis: calc(100% - 46px); }
  .health-list li > .btn { margin-left: 46px; }
  .guard-top { align-items: flex-start; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  .with-rail { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-edit { grid-template-columns: minmax(0, 1fr); }
  .phone { max-width: 340px; }
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; width: min(286px, 86vw); }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 0 0 60px rgba(5, 10, 40, .3); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 12, 40, .5); z-index: 50; }
  .icon-btn.menu-btn { display: inline-flex; }
  .main { padding: 14px 14px 32px; }
  .topbar { position: sticky; top: 0; z-index: 40; background: var(--plane); margin: -14px -14px 14px; padding: 10px 14px; gap: 8px; }
  .topbar-title { flex: 1 1 0; min-width: 0; }
  .topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title p { display: none; }
  .topbar-tools { display: contents; }
  .topbar .acct-form { display: none; }
  .topbar .page-actions { order: 30; flex: 1 1 100%; }
  .topbar .page-actions > * { flex: 1 1 auto; }
  .side-acct { display: grid; gap: 6px; padding: 0 4px 12px; }
  .icon-btn.side-close { display: inline-flex; position: absolute; top: 18px; right: 12px; }
  .only-small { display: inline-flex !important; }
  .block-head { flex-wrap: wrap; }
  .block-head .tag { flex: 1 1 100%; }
  h1 { font-size: 18px; }
  .rail { grid-template-columns: minmax(0, 1fr); }
  .cols-2, .cols-3, .cols-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; border-radius: 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 22px; }
  .auth-art h1 { font-size: 26px; }
  .auth-points { display: none; }
  .sug { grid-template-columns: 40px 1fr; }
  .sug .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .week-head, .week-row { grid-template-columns: 70px repeat(7, minmax(0, 1fr)); }

  /* tables become stacked cards */
  .table.stackable thead { position: absolute; left: -9999px; }
  .table.stackable, .table.stackable tbody, .table.stackable tr, .table.stackable td { display: block; width: 100%; }
  .table.stackable tr { border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; margin-bottom: 10px; }
  .table.stackable td { border: 0; padding: 7px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; align-items: center; }
  .table.stackable td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .table.stackable td.title-cell { display: block; text-align: left; padding-top: 10px; }
  .table.stackable td.title-cell::before { content: none; }
  .table.stackable .actions { justify-content: flex-end; flex-wrap: wrap; }
  .table.stackable td.no-label::before { content: none; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; border-radius: 16px; }
  .kpi-value { font-size: 20px; }
  .spark { display: none; }
  .launch-cards { grid-template-columns: minmax(0, 1fr); }
  .goal-grid { grid-template-columns: minmax(0, 1fr); }
  .btn { white-space: normal; }
  .topbar-tools .select { max-width: 150px; }
  .heat { grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 1px; }
  .heat .hl { font-size: 9px; }
}
/* fingers need bigger targets than a mouse pointer */
@media (max-width: 860px), (pointer: coarse) {
  .btn-sm { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .seg a, .seg button { padding: 10px 14px; }
  .icon-btn { width: 42px; height: 42px; }
  .check { padding: 6px 0; }
  .check input { width: 20px; height: 20px; }
  .input-sm { min-height: 40px; }
  .token button { width: 30px; height: 30px; }
  .nav a { padding-top: 10px; padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar-tools, .btn, .icon-btn { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
