/* Elevarus Grow: a calm, well-run service desk. Stripe-like product UI, light and dark.
   Tinted slate neutrals + one deep green from the Elevarus logo (hue 162) for actions and selection.
   Data colours are their own validated set (--viz-*). Status colours always travel with a word.
   Every colour is an OKLCH token; dark mode only redefines tokens. */

:root {
  color-scheme: light;

  /* surfaces */
  --page: oklch(0.977 0.005 240);
  --surface: oklch(1 0 0);
  --sunken: oklch(0.966 0.006 240);
  --hover: oklch(0.975 0.007 240);
  --line: oklch(0.917 0.008 240);
  --line-strong: oklch(0.855 0.012 240);

  /* ink */
  --ink: oklch(0.22 0.025 252);
  --ink-2: oklch(0.42 0.022 252);      /* secondary text, ~7.5:1 on white */
  --ink-3: oklch(0.505 0.02 252);      /* hints, timestamps, ~5.3:1 on white, ~4.9:1 on sunken */

  /* brand */
  --brand: oklch(0.5 0.12 162);        /* links, icons, selected text */
  --brand-fill: oklch(0.5 0.12 162);   /* primary buttons: white text ~5.4:1 */
  --brand-fill-hover: oklch(0.445 0.11 164);
  --on-brand: oklch(0.995 0.005 162);
  --brand-soft: oklch(0.956 0.035 162);
  --brand-line: oklch(0.86 0.06 162);
  --brand-draft: oklch(0.8 0.08 162);
  --brand-ring: oklch(0.7 0.14 162 / 0.4);
  --brand-accent: var(--brand);

  /* status: text / soft background / border */
  --ok: oklch(0.47 0.12 150);   --ok-soft: oklch(0.955 0.04 150);
  --warn: oklch(0.5 0.11 62);   --warn-soft: oklch(0.962 0.045 85);  --warn-line: oklch(0.86 0.07 80);
  --bad: oklch(0.5 0.17 25);    --bad-soft: oklch(0.958 0.03 22);   --bad-line: oklch(0.87 0.06 22);
  --busy: var(--brand);         --busy-soft: var(--brand-soft);
  --idle: oklch(0.49 0.014 252); --idle-soft: oklch(0.952 0.006 252);

  /* data colours: fixed order, separated in hue and lightness for colour-vision differences */
  --viz-1: oklch(0.53 0.12 162);  /* green */
  --viz-2: oklch(0.57 0.16 252);  /* blue */
  --viz-3: oklch(0.67 0.17 45);   /* orange */
  --viz-4: oklch(0.52 0.19 292);  /* violet */
  --viz-5: oklch(0.74 0.15 75);   /* amber */
  --viz-6: oklch(0.66 0.15 350);  /* pink */
  --viz-7: oklch(0.48 0.09 55);   /* brown */
  --viz-muted: oklch(0.84 0.012 240);
  --viz-warn2: oklch(0.79 0.11 80);
  --viz-idle: oklch(0.74 0.012 240);
  --chart-grid: oklch(0.93 0.006 240);
  --ring-track: oklch(0.94 0.01 220);

  /* type: 15px body, a clear step to every heading */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-xs: 0.8125rem;   /* 13 */
  --t-sm: 0.875rem;    /* 14 */
  --t-base: 0.9375rem; /* 15 */
  --t-md: 1.0625rem;   /* 17 */
  --t-lg: 1.375rem;    /* 22 */
  --t-xl: 2rem;        /* 32: scorecard numbers */
  --t-2xl: 2.25rem;    /* 36: page titles */

  /* space (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 28px; --s8: 32px; --s10: 40px; --s12: 48px;
  --pad: 24px; /* panel inset */
  --gap: 24px; /* between panels */

  --r-sm: 7px; --r: 10px; --r-lg: 14px;
  --shadow: 0 1px 2px oklch(0.3 0.02 252 / 0.05), 0 3px 10px oklch(0.3 0.02 252 / 0.05);
  --shadow-hover: 0 2px 4px oklch(0.3 0.02 252 / 0.06), 0 10px 24px oklch(0.3 0.02 252 / 0.08);
  --shadow-pop: 0 12px 32px oklch(0.25 0.03 252 / 0.18), 0 2px 6px oklch(0.25 0.03 252 / 0.08);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);       /* strong ease-out: UI feedback */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);   /* arrivals */
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1);  /* things moving on screen */

  --z-sticky: 10; --z-drawer: 30; --z-toast: 50;

  /* app shell: the side menu sits on a second, slightly cooler neutral layer */
  --side-w: 272px;
  --rail: oklch(0.965 0.007 240);
  --rail-hover: oklch(0.93 0.01 240);
  --backdrop: oklch(0.2 0.02 252 / 0.45);
  --toast-bg: oklch(0.24 0.025 252);
  --toast-ink: oklch(0.98 0.004 252);
  --selection: oklch(0.88 0.07 162);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: oklch(0.17 0.012 255);
    --surface: oklch(0.212 0.014 255);
    --sunken: oklch(0.185 0.012 255);
    --hover: oklch(0.24 0.015 255);
    --line: oklch(0.295 0.015 255);
    --line-strong: oklch(0.375 0.017 255);

    --ink: oklch(0.955 0.006 255);
    --ink-2: oklch(0.8 0.014 255);
    --ink-3: oklch(0.69 0.016 255);

    --brand: oklch(0.79 0.13 162);
    --brand-fill: oklch(0.5 0.115 162);
    --brand-fill-hover: oklch(0.55 0.12 162);
    --on-brand: oklch(0.995 0.005 162);
    --brand-soft: oklch(0.29 0.05 162);
    --brand-line: oklch(0.42 0.07 162);
    --brand-draft: oklch(0.47 0.08 162);
    --brand-ring: oklch(0.72 0.13 162 / 0.45);

    --ok: oklch(0.8 0.14 150);   --ok-soft: oklch(0.29 0.05 150);
    --warn: oklch(0.84 0.13 80); --warn-soft: oklch(0.3 0.05 70);   --warn-line: oklch(0.45 0.07 70);
    --bad: oklch(0.78 0.14 25);  --bad-soft: oklch(0.3 0.06 25);    --bad-line: oklch(0.45 0.09 25);
    --idle: oklch(0.78 0.014 255); --idle-soft: oklch(0.275 0.012 255);

    --viz-1: oklch(0.7 0.14 162);
    --viz-2: oklch(0.7 0.14 252);
    --viz-3: oklch(0.75 0.15 48);
    --viz-4: oklch(0.68 0.17 292);
    --viz-5: oklch(0.84 0.14 85);
    --viz-6: oklch(0.76 0.13 350);
    --viz-7: oklch(0.64 0.09 55);
    --viz-muted: oklch(0.45 0.015 255);
    --viz-warn2: oklch(0.62 0.1 65);
    --viz-idle: oklch(0.55 0.014 255);
    --chart-grid: oklch(0.27 0.013 255);
    --ring-track: oklch(0.28 0.014 255);

    --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 3px 10px oklch(0 0 0 / 0.2);
    --shadow-hover: 0 2px 4px oklch(0 0 0 / 0.35), 0 10px 24px oklch(0 0 0 / 0.3);
    --shadow-pop: 0 14px 36px oklch(0 0 0 / 0.5), 0 2px 6px oklch(0 0 0 / 0.3);

    --rail: oklch(0.19 0.013 255);
    --rail-hover: oklch(0.25 0.015 255);
    --backdrop: oklch(0.08 0.01 255 / 0.6);
    --toast-bg: oklch(0.93 0.006 255);
    --toast-ink: oklch(0.2 0.02 255);
    --selection: oklch(0.42 0.08 162);
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* client branding (app.js applyBrand): a thin brand bar on top, and a short crossfade when it changes */
:root.branded body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: var(--z-toast);
  background: linear-gradient(90deg, var(--brand-fill) 0 62%, var(--brand-accent) 62%); pointer-events: none;
}
:root.theming, :root.theming body, :root.theming .shell, :root.theming .sidebar, :root.theming .panel, :root.theming a, :root.theming .btn {
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease), fill 0.5s var(--ease), stroke 0.5s var(--ease);
}
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: var(--t-base)/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
h1, h2, h3 { text-wrap: balance; margin: 0; color: var(--ink); }
p { text-wrap: pretty; }
.num, time, .tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--selection); color: var(--ink); }
input, textarea { caret-color: var(--brand); }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* hidden data tables for screen readers: tables ignore width, so their box clips them */
#wk-table, #tr-table { position: relative; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: var(--s3); top: var(--s3); z-index: 100; background: var(--surface); padding: var(--s2) var(--s3); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.skip:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); box-shadow: none; }

/* ---------- app shell: side menu + main column ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
/* the rail colour runs the full page height, even past the sticky menu */
@media (min-width: 901px) { .shell { background: linear-gradient(90deg, var(--rail) calc(var(--side-w) - 1px), var(--line) 0 var(--side-w), transparent 0); } }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  background: var(--rail); border-right: 1px solid var(--line); z-index: var(--z-drawer);
}
.side-top { display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 var(--s4) 0 var(--s6); flex: none; }
.brand { display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; color: var(--ink); font-weight: 680; font-size: var(--t-md); letter-spacing: -0.015em; }
.brand:hover { text-decoration: none; }
.mark { width: 19px; height: 27px; flex: none; }
.brand-co { font-weight: 500; color: var(--ink-2); }
.icon-btn { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: var(--r); color: var(--ink-2); cursor: pointer; transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 140ms var(--ease); }
.icon-btn:hover { background: var(--rail-hover); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.icon-btn .i { width: 20px; height: 20px; }
.side-close { display: none; }

.nav { flex: 1; overflow-y: auto; padding: var(--s2) var(--s4) var(--s5); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-label { font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); padding: var(--s6) var(--s3) var(--s2); margin: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px var(--s3); border-radius: var(--r);
  color: var(--ink-2); font-weight: 560; transition: background-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.nav-item:hover { background: var(--rail-hover); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 620; }
.nav-item[aria-current="page"] .i { color: var(--brand); }
.nav-item .i { width: 18px; height: 18px; }
.nav-item .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nav-item.site { color: var(--ink); }
.nav-item.site.open { font-weight: 620; }
.nav-item .paused { font-size: var(--t-xs); color: var(--ink-3); font-weight: 500; }
.nav-sub { margin: 4px 0 var(--s3) 23px !important; padding-left: var(--s3) !important; border-left: 1px solid var(--line-strong); }
.nav-sub a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 38px; padding: 7px var(--s3); border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--t-base); font-weight: 520; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.nav-sub a:hover { background: var(--rail-hover); color: var(--ink); text-decoration: none; }
.nav-sub a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 620; }
.nav-sub a[aria-current="page"] .count { color: var(--brand); background: var(--surface); border-color: transparent; }

.side-foot { flex: none; padding: var(--s4) var(--s5) var(--s5); border-top: 1px solid var(--line); display: grid; gap: var(--s3); }
.env { display: flex; gap: 6px; flex-wrap: wrap; }
.env .pill { height: 26px; font-size: var(--t-xs); }
.add-site { width: 100%; }

/* client logos: a letter underneath, the site's own icon on top once it loads */
.avatar {
  position: relative; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: var(--av, 26px); height: var(--av, 26px); border-radius: calc(var(--av, 26px) * 0.26);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-size: calc(var(--av, 26px) * 0.46); font-weight: 650; line-height: 1;
}
.avatar img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: contain; opacity: 0; transition: opacity 200ms var(--ease); }
.avatar.has-img { color: transparent; }
.avatar.has-img img { opacity: 1; }
.avatar.lg { --av: 56px; border-radius: 14px; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: calc(var(--z-drawer) - 1); opacity: 0; transition: opacity 220ms var(--ease); }
body.nav-open .backdrop { opacity: 1; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(312px, 86vw); box-shadow: var(--shadow-pop);
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms var(--ease-move), visibility 0s linear 200ms;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform 280ms var(--ease), visibility 0s; }
  body.nav-open { overflow: hidden; }
  .side-close { display: inline-grid; }
  .mobilebar {
    position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--s2);
    height: 60px; padding: 0 var(--s4) 0 var(--s2); background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mobile-site { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; font-weight: 600; font-size: var(--t-sm); }
  .mobile-site .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- page ---------- */
.wrap { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--s10) var(--s10) 64px; }
@media (min-width: 1800px) { .wrap { padding-left: var(--s12); padding-right: var(--s12); } }
.wrap:focus { outline: none; }
.ext { display: inline-flex; align-items: center; gap: 5px; }
.ext .i { width: 14px; height: 14px; }
.page-head .avatar { margin-top: 2px; }
.head-id { display: flex; gap: var(--s5); align-items: center; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s6); flex-wrap: wrap; margin-bottom: var(--s8); }
.page-head h1 { font-size: var(--t-2xl); line-height: 1.12; font-weight: 700; letter-spacing: -0.028em; display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.page-head h1 .badge { height: 28px; font-size: var(--t-sm); padding: 0 12px; letter-spacing: 0; }
.page-head .sub { margin: 10px 0 0; color: var(--ink-2); font-size: var(--t-md); display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; }
.sub > span + span::before { content: "·"; color: var(--line-strong); margin-right: var(--s3); }

/* ---------- buttons ---------- */
.btn[hidden] { display: none; }
.btn {
  font: inherit; font-weight: 580; font-size: var(--t-base); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 42px; padding: 0 var(--s5); border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px oklch(0.3 0.02 252 / 0.06); cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 140ms var(--ease);
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); box-shadow: 0 1px 2px oklch(0.3 0.08 162 / 0.25), inset 0 1px 0 oklch(1 0 0 / 0.12); }
.btn.primary:hover { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.sm { height: 34px; padding: 0 var(--s4); font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.65; cursor: default; transform: none; }
.btn .spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn .i { width: 17px; height: 17px; }
.actions { display: flex; gap: var(--s2) var(--s3); flex-wrap: wrap; align-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- badges & status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px; height: 25px; padding: 0 10px; border-radius: 999px;
  font-size: var(--t-xs); font-weight: 620; line-height: 1; white-space: nowrap; background: var(--idle-soft); color: var(--idle);
  vertical-align: middle;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.busy { background: var(--busy-soft); color: var(--busy); }
.badge.busy::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: var(--t-sm); font-weight: 560; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel + .panel { margin-top: var(--gap); }
.split > aside > * + * { margin-top: var(--gap); } /* cards loaded into wrapper divs (traffic, city pages) */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--pad); border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--t-md); font-weight: 650; letter-spacing: -0.012em; line-height: 1.3; }
.panel-head p { margin: 4px 0 0; color: var(--ink-2); font-size: var(--t-sm); max-width: 72ch; }
.panel-body { padding: var(--pad); }
.panel-foot { padding: var(--s4) var(--pad); border-top: 1px solid var(--line); background: var(--sunken); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; justify-content: flex-end; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.panel-foot .hint { margin-right: auto; }

/* client layout: main column + details rail */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
.split > * { min-width: 0; }
@media (min-width: 1500px) { .split { grid-template-columns: minmax(0, 1fr) 400px; } }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .split > aside { order: -1; } .split.rail-last > aside { order: 0; } }
.side-link { font-size: var(--t-sm); font-weight: 580; white-space: nowrap; }

/* ---------- key/value details ---------- */
.kv { margin: 0; display: grid; }
.kv > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s4); padding: var(--s4) 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv > div:last-child { padding-bottom: 0; }
.kv dt { color: var(--ink-2); font-size: var(--t-sm); padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .hint { display: block; margin-top: 3px; }

.meter { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin-top: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.meter > span { display: block; height: 100%; background: var(--viz-1); border-radius: inherit; transition: width 400ms var(--ease); }
.meter.over > span { background: var(--bad); }

/* ---------- tables / rows ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); padding: var(--s3) var(--pad); background: var(--sunken); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: var(--s5) var(--pad); border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 150ms var(--ease); }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover { background: var(--hover); }
.table .name { font-weight: 620; color: var(--ink); font-size: var(--t-md); }
.table .dim { color: var(--ink-3); font-size: var(--t-sm); margin-top: 3px; }
.table .right { text-align: right; }
.panel > .table:first-child th:first-child { border-top-left-radius: var(--r-lg); }
.panel > .table:first-child th:last-child { border-top-right-radius: var(--r-lg); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; gap: var(--s4); align-items: flex-start; justify-content: space-between; padding: var(--s5) var(--pad); border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows .main { min-width: 0; flex: 1; }
.rows .title { font-weight: 620; color: var(--ink); overflow-wrap: anywhere; }
.rows a.title { transition: color 150ms var(--ease); }
.rows a.title:hover { color: var(--brand); }
.rows .meta { color: var(--ink-3); font-size: var(--t-sm); margin-top: 3px; }
.rows .why {
  all: unset; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  color: var(--ink-2); font-size: var(--t-sm); line-height: 1.55; margin-top: var(--s2); max-width: 72ch; cursor: pointer; border-radius: 4px;
  transition: color 150ms var(--ease);
}
.rows .why:hover { color: var(--ink); }
.rows .why[aria-expanded="true"] { -webkit-line-clamp: unset; line-clamp: unset; display: block; }
.rows .why:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rows .side { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }
.rows .when { color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--sunken); color: var(--ink-2); font-size: var(--t-sm); font-weight: 660; box-shadow: inset 0 0 0 1px var(--line); }
li:first-child > .rank.lead { background: var(--brand-fill); color: var(--on-brand); box-shadow: none; }

/* activity timeline */
.timeline { list-style: none; margin: 0; padding: var(--s3) var(--pad) var(--s5); }
.timeline li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: var(--s4); padding: var(--s4) 0; position: relative; }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 36px; bottom: -8px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .tick { width: 12px; height: 12px; border-radius: 50%; margin: 6px 3px 0; background: var(--idle); box-shadow: 0 0 0 4px var(--surface); }
.timeline .tick.ok { background: var(--ok); } .timeline .tick.warn { background: var(--warn); } .timeline .tick.bad { background: var(--bad); }
.timeline .tick.busy { background: var(--busy); animation: pulse 1.4s ease-in-out infinite; }
.timeline .what { font-weight: 620; }
.timeline .detail { color: var(--ink-2); font-size: var(--t-sm); overflow-wrap: anywhere; margin-top: 2px; }
.timeline .when { color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }

.count { font-size: var(--t-xs); font-weight: 620; color: var(--ink-2); background: var(--sunken); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; line-height: 20px; font-variant-numeric: tabular-nums; }

/* ---------- summary strip: one panel, cells divided by hairlines ---------- */
.stats { display: grid; grid-template-columns: 1.15fr 1.15fr 1fr 1fr 1.35fr; gap: 1px; background: var(--line); overflow: hidden; margin-bottom: var(--gap); }
.stat { background: var(--surface); padding: var(--s5) var(--pad) var(--pad); min-width: 0; display: grid; align-content: start; gap: 4px; }
.stat .k { font-size: var(--t-sm); color: var(--ink-2); font-weight: 520; }
.stat .v { font-size: var(--t-xl); font-weight: 680; letter-spacing: -0.03em; line-height: 1.2; min-height: 40px; display: flex; align-items: center; gap: var(--s2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .v.text { font-size: var(--t-lg); }
.stat .v .of { font-size: var(--t-base); font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.stat .v .badge { height: 28px; font-size: var(--t-sm); padding: 0 12px; }
.stat .d { font-size: var(--t-sm); color: var(--ink-3); overflow-wrap: anywhere; }
.stat .meter { margin-top: 6px; }
@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stat { grid-column: span 2; }
  .stat:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat, .stat:nth-child(n+4) { grid-column: span 1; }
  .stat:nth-child(-n+2), .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: var(--s4); }
}

/* ---------- charts ---------- */
.chart { padding: var(--s5) var(--pad) var(--s4); min-height: 280px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ax { fill: var(--ink-3); font-size: 12.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink-2); font-size: 12.5px; font-weight: 650; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.panel-head .total { text-align: right; flex: none; }
.panel-head .total strong { display: block; font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.panel-head .total span { font-size: var(--t-xs); color: var(--ink-3); }

/* ---------- not-connected panel ---------- */
.connect { padding: var(--pad); display: grid; gap: var(--s4); justify-items: start; }
.connect p { margin: 0; color: var(--ink-2); font-size: var(--t-sm); }

/* ---------- sites table ---------- */
.site-cell { display: flex; gap: var(--s4); align-items: center; min-width: 0; }
.site-cell .avatar { --av: 40px; border-radius: 11px; }
.table td.num-cell { font-variant-numeric: tabular-nums; }
.table .big { font-size: var(--t-lg); font-weight: 680; letter-spacing: -0.02em; }
.table .meter { width: 140px; margin-left: auto; }
.table td { vertical-align: middle; }
.table .title { display: block; font-weight: 620; color: var(--ink); overflow-wrap: anywhere; max-width: 72ch; }
.table a.title:hover { color: var(--brand); }
.add-site[aria-current] { background: var(--surface); border-color: var(--brand); color: var(--brand); }
@media (max-width: 720px) { .table .meter { margin-left: 0; } .table.responsive td.right { text-align: left; } }

/* ---------- forms ---------- */
form { margin: 0; }
.form { display: grid; gap: var(--s6); align-content: start; }
.field { display: grid; gap: 7px; align-content: start; }
.label { font-weight: 620; font-size: var(--t-sm); color: var(--ink); }
.hint { color: var(--ink-3); font-size: var(--t-sm); font-weight: 400; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], select, textarea {
  font: inherit; font-size: var(--t-base); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); padding: 9px 12px; width: 100%; min-height: 42px;
  box-shadow: inset 0 1px 2px oklch(0.3 0.02 252 / 0.05);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
input[type=text]:hover, input[type=email]:hover, input[type=url]:hover, input[type=password]:hover, input[type=number]:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input[type=file] { font: inherit; font-size: var(--t-sm); color: var(--ink-2); }
input[type=file]::file-selector-button { font: inherit; font-weight: 580; margin-right: var(--s3); height: 34px; padding: 0 var(--s4); border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
textarea { resize: vertical; line-height: 1.6; }
textarea.doc { min-height: 380px; font: var(--t-sm)/1.7 var(--mono); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; }
.swatch-row { display: flex; gap: var(--s2); align-items: center; }
.swatch-row input[type=color] { flex: none; width: 52px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.swatch-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.swatch-row input[type=text] { font-family: var(--mono); text-transform: lowercase; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand-fill); flex: none; }
.check strong { display: block; font-weight: 620; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 0; }
.section-title { font-size: var(--t-md); font-weight: 650; margin: 0; letter-spacing: -0.01em; }

.days { display: flex; gap: 8px; flex-wrap: wrap; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.days span { display: inline-grid; place-items: center; min-width: 54px; height: 40px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 560; font-size: var(--t-sm); text-transform: capitalize; transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 140ms var(--ease); }
.days label:active span { transform: scale(0.95); }
.days input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.days input:focus-visible + span { box-shadow: 0 0 0 4px var(--brand-ring); }

.choice { display: grid; gap: var(--s3); }
.choice label { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4) var(--s5); border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
.choice label:hover { border-color: var(--ink-3); }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input[type=radio] { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--brand-fill); flex: none; }
.choice strong { font-weight: 620; }
.choice .grow { flex: 1; min-width: 0; display: grid; gap: var(--s2); }

/* ---------- notes ---------- */
.note { padding: var(--s4) var(--s5); border-radius: var(--r); background: var(--brand-soft); color: var(--ink); border: 1px solid var(--brand-line); }
.note.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.note.bad { background: var(--bad-soft); border-color: var(--bad-line); }
.note strong { font-weight: 660; }
.note ul { margin: var(--s1) 0 0; padding-left: 18px; }
.stack { display: grid; gap: var(--s4); }
.mb { margin-bottom: var(--gap); }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 72px var(--s6); }
.empty .mark { display: block; width: 36px; height: 52px; margin: 0 auto var(--s5); }
.empty h2 { font-size: var(--t-lg); margin-bottom: var(--s3); letter-spacing: -0.02em; }
.empty p { color: var(--ink-2); max-width: 52ch; margin: 0 auto var(--s6); }
.empty-inline { padding: var(--s6) var(--pad); color: var(--ink-2); }
.sk { display: block; height: 13px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken) 0%, var(--line) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk + .sk { margin-top: var(--s3); }
.sk.h { height: 32px; width: 280px; margin-bottom: var(--s8); }
.sk.w60 { width: 60%; } .sk.w40 { width: 40%; } .sk.w80 { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- steps (add client) ---------- */
.steps { display: flex; gap: var(--s2) var(--s3); margin: 0 0 var(--s8); padding: 0; list-style: none; flex-wrap: wrap; align-items: center; }
.steps li { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); color: var(--ink-3); font-weight: 560; }
.steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--line-strong); margin-right: var(--s1); }
.steps .n { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); font-size: var(--t-xs); background: var(--surface); transition: background-color 200ms var(--ease), color 200ms var(--ease); }
.steps li.on { color: var(--ink); } .steps li.on .n { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); }
.steps li.done { color: var(--ink-2); } .steps li.done .n { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.narrow { max-width: 760px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: var(--s6); z-index: var(--z-toast); transform: translate(-50%, 16px) scale(0.97); opacity: 0; pointer-events: none;
  background: var(--toast-bg); color: var(--toast-ink); padding: 12px var(--s5); border-radius: var(--r); font-size: var(--t-base); font-weight: 520; box-shadow: var(--shadow-pop);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease); max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); transition-duration: 260ms; }

@media (max-width: 720px) {
  :root { --pad: 16px; --gap: 16px; --t-2xl: 1.75rem; --t-xl: 1.75rem; }
  .wrap { padding: var(--s6) var(--s4) var(--s12); }
  .page-head { margin-bottom: var(--s6); align-items: flex-start; }
  .head-id { align-items: flex-start; gap: var(--s4); }
  .avatar.lg { --av: 48px; }
  .page-head .sub { flex-direction: column; align-items: flex-start; gap: 3px; font-size: var(--t-base); }
  .sub > span + span::before { display: none; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .panel-head { padding: var(--s4) var(--pad); }
  .panel-head:has(> .btn) { flex-wrap: wrap; }
  .panel-head > .btn { order: 1; }
  .chart { padding: var(--s4) var(--pad) var(--s3); min-height: 0; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s4); padding: var(--s4) var(--pad); border-bottom: 1px solid var(--line); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { padding: 0; border: 0; }
  .table.responsive td:first-child { grid-column: 1 / -1; }
  .table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: var(--t-xs); color: var(--ink-3); font-weight: 600; margin-bottom: 3px; }
  .rows > li { flex-direction: column; gap: var(--s2); padding: var(--s4) var(--pad); }
  .kv > div { grid-template-columns: 100px minmax(0, 1fr); gap: var(--s3); }
  .timeline li { grid-template-columns: 18px minmax(0, 1fr); gap: var(--s3); }
  .timeline .when { grid-column: 2; text-align: left; }
  .btn { height: 44px; }
  .btn.sm { height: 36px; }
}

/* ---------- Overview: scorecards, goals, up next, charts ---------- */
.ov-row { display: grid; gap: var(--gap); margin-bottom: var(--gap); align-items: start; }
.ov-row > * + * { margin-top: 0 !important; }
.ov-top { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.ov-charts { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: stretch; }
.ov-charts > .panel { display: flex; flex-direction: column; }
.ov-charts > .panel > .chart { flex: 1; }
#ov-traffic { scroll-margin-top: var(--s6); }
#ov-activity { scroll-margin-top: var(--s6); }
.ov .split > div > * + * { margin-top: var(--gap); }
.ov h3 { font-size: var(--t-base); font-weight: 650; }

/* the at-a-glance strip: one panel, five linked cells divided by hairlines */
.score { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); overflow: hidden; margin-bottom: var(--gap); }
.sc { position: relative; background: var(--surface); color: var(--ink); padding: var(--s5) var(--s6) var(--s5); min-width: 0; display: grid; grid-template-rows: auto auto auto 1fr; gap: 4px; transition: background-color 180ms var(--ease); }
.sc:hover { background: var(--hover); text-decoration: none; }
.sc:active { background: var(--sunken); }
.sc:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 0; }
.sc .k { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: var(--t-sm); color: var(--ink-2); font-weight: 540; }
.sc .go { width: 16px; height: 16px; color: var(--ink-3); transition: transform 180ms var(--ease), color 180ms var(--ease); }
.sc:hover .go { color: var(--brand); transform: translateX(3px); }
.sc .v { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; min-height: 44px; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; flex-wrap: wrap; row-gap: 0; margin-top: 2px; }
.sc .v .of { font-size: var(--t-sm); font-weight: 500; color: var(--ink-3); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: flex-end; padding-bottom: 6px; }
.sc .v .badge { height: 30px; font-size: var(--t-sm); padding: 0 12px; letter-spacing: 0; }
.sc .v .v-text { font-size: var(--t-md); font-weight: 620; color: var(--ink-2); letter-spacing: -0.01em; }
.sc .v .sk { width: 80px; height: 24px; }
.sc .d { font-size: var(--t-sm); color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.sc .sp { align-self: end; display: block; height: 36px; margin-top: var(--s4); }
.spark { display: block; width: 100%; height: 36px; overflow: visible; }
.spark-line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--viz-1); fill-opacity: 0.12; }
.spark-ref { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark-bar { fill: var(--viz-1); }
.spark-bar.zero { fill: var(--line-strong); }
.mini-bar { display: flex; gap: 2px; height: 10px; margin-top: 13px; border-radius: 999px; overflow: hidden; }
.checks { display: flex; align-items: flex-end; gap: 3px; height: 36px; }
.checks .ck { flex: 1; max-width: 16px; height: 20px; border-radius: 3px; background: var(--ok); opacity: 0.85; }
.checks .ck.warn { background: var(--warn); height: 28px; opacity: 1; }
.checks .ck.bad { background: var(--bad); height: 36px; opacity: 1; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 640; font-variant-numeric: tabular-nums; }
.delta .tri { width: 9px; height: 9px; fill: currentColor; }
.delta.good { color: var(--ok); } .delta.bad { color: var(--bad); } .delta.flat { color: var(--ink-2); }
@media (max-width: 1480px) {
  .score { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sc { grid-column: span 2; }
  .sc:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 600px) {
  .score { grid-template-columns: 1fr 1fr; }
  .sc, .sc:nth-child(n+4) { grid-column: span 1; }
  .sc:first-child { grid-column: 1 / -1; }
  .sc { padding: var(--s4); }
  .sc .v { font-size: 1.5rem; min-height: 34px; }
  .sc .v .of { padding-bottom: 3px; overflow: visible; }
  .mobilebar .brand { font-size: var(--t-base); }
  .sc .sp { height: 30px; margin-top: var(--s3); }
}

/* goals: the weekly ring, the streak, milestones, city pages */
.momentum { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 300px; }
.goal-ring { padding: var(--s6); border-right: 1px solid var(--line); display: grid; justify-items: center; align-content: start; gap: var(--s4); text-align: center; }
.ring-wrap { position: relative; width: 168px; height: 168px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring circle { fill: none; stroke-width: 11; }
.ring-track { stroke: var(--ring-track); }
.ring-live { stroke: var(--viz-1); stroke-linecap: round; }
.ring-draft { stroke: var(--brand-draft); stroke-linecap: round; }
.goal-ring > .ring { width: 168px; height: 168px; }
.ring-num { position: absolute; inset: 0; display: grid; place-content: center; line-height: 1.1; }
.ring-num b { font-size: 44px; font-weight: 720; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ring-num > span { font-size: var(--t-sm); color: var(--ink-3); }
.ring-cap { display: grid; gap: 3px; width: 100%; }
.ring-cap strong { font-weight: 660; font-size: var(--t-md); }
.ring-cap span { font-size: var(--t-sm); color: var(--ink-2); }
.ring-cap .sk { margin: 4px auto 0; }
.streak { width: 100%; border-top: 1px solid var(--line); padding-top: var(--s4); font-size: var(--t-sm); color: var(--ink-2); }
.streak-n { font-size: var(--t-lg); font-weight: 720; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.streak p { margin: 3px 0 0; color: var(--ink-3); }
.ms-list { list-style: none; margin: 0; padding: var(--s2) var(--pad); align-self: start; }
.momentum > .ms-list:has(.sk) { padding-top: var(--pad); }
.ms { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s4) 0; border-top: 1px solid var(--line); }
.ms:first-child { border-top: 0; }
.medal { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.medal .i { width: 18px; height: 18px; }
.ms.got .medal { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line); }
.ms.got .medal circle { fill: currentColor; fill-opacity: 0.16; }
.ms-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.ms-g { font-weight: 620; font-size: var(--t-base); }
.ms-of { font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; }
.ms-next { font-size: var(--t-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-next .done { color: var(--ok); font-weight: 620; }
.meter.thin { height: 6px; margin-top: 8px; }
.meter > .grow-x { transition: none; }
.ms-val { font-size: var(--t-base); font-weight: 680; white-space: nowrap; min-width: 64px; text-align: right; }
.ms-val span { color: var(--ink-3); font-weight: 450; }
.cities { border-top: 1px solid var(--line); padding: var(--s5) var(--pad) var(--pad); }
.cities-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.cities-head span { font-size: var(--t-sm); color: var(--ink-2); }
.cities-head b { color: var(--ink); font-weight: 680; }
.city-row { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding-top: var(--s3); font-size: var(--t-sm); }
.city-row a { color: var(--ink); font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-row .meter { margin: 0; }
.city-row > span { color: var(--ink-2); white-space: nowrap; }
@media (max-width: 640px) {
  .momentum { grid-template-columns: 1fr; min-height: 0; }
  .goal-ring { padding: var(--pad); border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: auto minmax(0, 1fr); text-align: left; justify-items: start; align-items: center; column-gap: var(--s5); }
  .ring-wrap, .goal-ring > .ring { width: 124px; height: 124px; }
  .ring-num b { font-size: 34px; }
  .streak { grid-column: 1 / -1; }
  .ms-list { padding: var(--s1) var(--pad); }
  .ms-next { white-space: normal; }
  .city-row { grid-template-columns: minmax(0, 1fr) auto; }
  .city-row .meter { grid-column: 1 / -1; grid-row: 2; }
}

/* up next */
.upnext { display: flex; flex-direction: column; }
.upnext .striking { flex: 1; }
.next-art { display: grid; gap: var(--s4); align-content: start; }
.when-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.cap-k { display: block; font-size: var(--t-sm); color: var(--ink-2); }
.when-big { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.turn { margin: 0; font-size: var(--t-sm); color: var(--ink-2); }
.turn .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: var(--s2); }
.turn strong { color: var(--ink); }
.topic-next { padding: var(--s4) var(--s5); background: var(--sunken); border-radius: var(--r); }
.topic-next .title { font-weight: 640; font-size: var(--t-md); margin-top: 3px; letter-spacing: -0.01em; }
.topic-next .meta { font-size: var(--t-sm); color: var(--ink-3); margin-top: 2px; }
.next-art .hint { margin: 0; }
.striking { border-top: 1px solid var(--line); }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--pad) var(--s2); }
.rows.tight > li { padding: var(--s4) var(--pad); flex-wrap: wrap; align-items: center; }
.rows.tight > li:first-child { border-top: 1px solid var(--line); }
.add-topic { flex-basis: 100%; display: grid; gap: var(--s4); padding: var(--s5); background: var(--sunken); border-radius: var(--r); animation: open-down 240ms var(--ease) both; }
.add-topic[hidden] { display: none; }
@keyframes open-down { from { opacity: 0; transform: translateY(-6px); } }
.panel-foot.quick { justify-content: space-between; }
.jump { display: flex; gap: var(--s1) var(--s5); flex-wrap: wrap; font-size: var(--t-sm); font-weight: 580; }

/* chart shells and empty states */
.legend { display: flex; flex-wrap: wrap; gap: 8px var(--s5); padding: var(--s4) var(--pad) 0; font-size: var(--t-sm); color: var(--ink-2); }
.legend:empty { display: none; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend b { color: var(--ink); font-weight: 640; font-variant-numeric: tabular-nums; }
.chart-sk { height: 280px; border-radius: var(--r); background: var(--sunken); }
.chart-sk.tall { height: 330px; }
.nodata { margin: 0 auto; min-height: 240px; display: grid; place-items: center; text-align: center; color: var(--ink-2); font-size: var(--t-sm); max-width: 52ch; padding: var(--s5); }
.chart.traffic .nodata { min-height: 330px; }
.nodata.sm { min-height: 0; display: block; text-align: left; max-width: none; padding: 0; margin: 0; }
.striking > .nodata.sm { padding: var(--s5) var(--pad); }
.chart .pane { fill: var(--ink-2); font-size: 12.5px; font-weight: 620; font-family: var(--font); }
.chart .col > :not(.hit):not(text) { transition: opacity 150ms var(--ease); }
.chart .col:hover > :not(.hit):not(text) { opacity: 0.78; }
.chart .col .val { transition: fill 150ms var(--ease); }
.chart .col:hover .val { fill: var(--ink); }
.chart path.area.s-clicks { fill: var(--viz-1); fill-opacity: 0.1; }
.chart path.line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart path.line.s-clicks { stroke: var(--viz-1); }
.chart path.area.s-impr { fill: var(--viz-2); fill-opacity: 0.12; }
.chart path.line.s-impr { stroke: var(--viz-2); }
.chart .cursor-line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .cursor-dot { fill: var(--surface); stroke-width: 2.25; }
.chart rect.cbar { fill: var(--viz-1); }
.chart .cursor-dot.s-clicks { stroke: var(--viz-1); } .chart .cursor-dot.s-impr { stroke: var(--viz-2); }
.chart .cursor[hidden] { display: none; }
.chart.traffic { position: relative; }
.chart.traffic .hit { cursor: crosshair; }
.tip { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 2; display: grid; gap: 3px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; transition: transform 90ms var(--ease); }
.tip[hidden] { display: none; }
.tip strong { color: var(--ink); font-size: var(--t-sm); }
.tip i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.tip i.s-clicks { background: var(--viz-1); } .tip i.s-impr { background: var(--viz-2); }

/* share by vertical: actual fill, target tick */
.share { padding: var(--s5) var(--pad) var(--pad); }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s5); }
.share-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px var(--s3); }
.share-list .nm { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 620; font-size: var(--t-base); min-width: 0; white-space: nowrap; }
.share-list .nm i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.share-list .badge { height: 22px; justify-self: end; }
.share-bar { position: relative; height: 10px; border-radius: 999px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.share-bar .fill { display: block; height: 100%; border-radius: inherit; }
.share-bar .target { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.share-meta { font-size: var(--t-sm); font-weight: 640; color: var(--ink); min-width: 84px; text-align: right; white-space: nowrap; }
.share-meta span { color: var(--ink-3); font-weight: 450; }
.solo-share { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); font-size: var(--t-sm); color: var(--ink-2); padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.solo-share .nm { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 620; color: var(--ink); }
.solo-share .nm i { width: 12px; height: 12px; border-radius: 4px; }
.share-note { margin: var(--s5) 0 0; font-size: var(--t-xs); }

/* search positions: this period vs the one before */
.pos-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s4); }
.pos-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 7px; vertical-align: -1px; }
.pos-legend i.now, .pb.now span { background: var(--viz-1); }
.pos-legend i.before, .pb.before span { background: var(--viz-muted); }
.pos { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s5); }
.pos li { display: grid; grid-template-columns: 72px minmax(0, 1fr) 44px; gap: var(--s3); align-items: center; }
.pos-l strong { display: block; font-size: var(--t-base); font-weight: 620; line-height: 1.3; }
.pos-l span { font-size: var(--t-xs); color: var(--ink-3); }
.pos-bars { display: grid; gap: 4px; }
.pb { display: flex; align-items: center; gap: 7px; height: 15px; }
.pb span { flex: none; height: 13px; min-width: 2px; border-radius: 0 4px 4px 0; }
.pb b { font-size: var(--t-xs); font-weight: 640; color: var(--ink-2); }
.pos-d { text-align: right; font-size: var(--t-xs); }
.pos-note { margin: var(--s4) 0 0; font-size: var(--t-xs); }

/* index status: one bar, status colours with words */
.ix-top { display: flex; align-items: baseline; gap: var(--s2) var(--s3); flex-wrap: wrap; font-size: var(--t-sm); color: var(--ink-2); }
.ix-big { font-size: var(--t-xl); font-weight: 720; letter-spacing: -0.035em; color: var(--ink); }
.ix-bar { display: flex; gap: 2px; height: 14px; margin: var(--s4) 0; border-radius: 999px; overflow: hidden; transform-origin: left center; }
.ix-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--t-sm); color: var(--ink-2); }
.ix-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; }
.ix-legend i { width: 12px; height: 12px; border-radius: 4px; }
.ix-legend b { color: var(--ink); font-weight: 640; }
.s-ok { background: var(--ok); }
.s-warn { background: var(--warn); }
.s-warn2 { background: var(--viz-warn2); }
.s-idle { background: var(--viz-idle); }
.s-none { background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, var(--sunken) 2px 5px); box-shadow: inset 0 0 0 1px var(--line); }

@media (max-width: 1180px) {
  .ov-top, .ov-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .rows.tight > li { flex-direction: row; }
  .panel-foot.quick { flex-direction: column; align-items: flex-start; }
}

/* Settings: one side-menu item, its pages as tabs under the heading.
   The underline is one element that slides from the last tab to this one. */
.nav-sub li.sep { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line); }
.subtabs { position: relative; display: flex; gap: var(--s2); margin: calc(var(--s8) * -0.5) 0 var(--s8); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtabs a { flex: none; padding: var(--s3) var(--s4); color: var(--ink-2); font-weight: 560; font-size: var(--t-base); border-radius: var(--r-sm) var(--r-sm) 0 0; transition: color 150ms var(--ease), background-color 150ms var(--ease); }
.subtabs a:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.subtabs a[aria-current="page"] { color: var(--brand); font-weight: 640; }
.subtabs .ind { position: absolute; left: 0; bottom: 0; height: 2px; width: 1px; border-radius: 2px 2px 0 0; background: var(--brand); transform-origin: left center; transform: translateX(var(--x, 0)) scaleX(var(--w, 0)); pointer-events: none; }
.subtabs .ind.move { transition: transform 320ms var(--ease-move); }
.subtabs:not(:has(.ind)) a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--brand); } /* before the script places it */

/* ---------- motion ----------
   Content is always in the markup at its final value; these only animate from a start state, and
   only on a real visit (never on the quiet refresh while a job runs). Reduced motion: see the end. */
.view { animation: view-in 260ms var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.anim .rise { animation: rise 600ms var(--ease-expo) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
/* list rows on the list pages: a short cascade, capped in JS */
.anim .row-in { animation: row-in 420ms var(--ease-expo) both; animation-delay: calc(120ms + var(--r, 0) * 32ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
.anim:not(.settled) .grow-x { transform-origin: left center; animation: grow-x 900ms var(--ease-expo) both; animation-delay: calc(160ms + var(--i, 0) * 60ms); }
@keyframes grow-x { from { transform: scaleX(0); } }
.anim:not(.settled) :is(.spark, .checks) .grow-y, svg.play .grow-y { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y 800ms var(--ease-expo) both; animation-delay: calc(120ms + var(--i, 0) * 28ms); }
@keyframes grow-y { from { transform: scaleY(0); } }
svg.play .draw { stroke-dasharray: 1; animation: draw 1300ms var(--ease-expo) both; animation-delay: 160ms; }
/* sparklines keep a constant stroke (non-scaling), which breaks dash maths: they wipe in left to right instead */
.anim:not(.settled) .spark:has(.draw) { animation: wipe 1100ms var(--ease-expo) both; animation-delay: 160ms; }
@keyframes wipe { from { clip-path: inset(-4px 100% -4px 0); } to { clip-path: inset(-4px 0 -4px 0); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.anim:not(.settled) .spark .fade, svg.play .fade { animation: fade 800ms ease-out both; animation-delay: 560ms; }
@keyframes fade { from { opacity: 0; } }
/* the focal moment: this week's ring fills, its number counts up with it */
.anim:not(.settled) .ring-live { animation: ring-fill 1200ms var(--ease-expo) both; animation-delay: 220ms; }
.anim:not(.settled) .ring-draft { animation: fade 500ms ease-out both; animation-delay: 950ms; }
@keyframes ring-fill { from { stroke-dasharray: 0 100; } }
.anim:not(.settled) .ms.got .medal { animation: medal 520ms var(--ease-expo) both; animation-delay: calc(500ms + var(--i, 0) * 70ms); }
@keyframes medal { from { opacity: 0; transform: scale(0.8); } }

/* hover lift only where a pointer hovers */
@media (hover: hover) and (pointer: fine) {
  .table tbody tr.link:hover .avatar { transform: scale(1.04); }
  .avatar { transition: transform 180ms var(--ease); }
}

@media (prefers-reduced-motion: reduce) {
  /* No movement: views and panels crossfade, charts and rings are drawn in place, feedback stays as colour. */
  .view { animation: fade 180ms ease-out both; }
  .anim .rise, .anim .row-in { animation: fade 220ms ease-out both; animation-delay: 0ms; }
  .anim .grow-x, .anim .grow-y, svg.play .grow-y, .anim .spark, svg.play .draw, .anim .ring-live, .anim .ring-draft, .anim .medal, .anim .fade, svg.play .fade { animation: none !important; }
  .add-topic { animation: fade 150ms ease-out both; }
  .btn:active, .icon-btn:active, .days label:active span { transform: none; }
  .sc:hover .go { transform: none; }
  .subtabs .ind.move { transition: none; }
  .toast, .toast.show { transform: translate(-50%, 0); }
  .sidebar, body.nav-open .sidebar { transition-duration: 0s !important; }
  .sk { animation: none; }
  .badge.busy::before, .timeline .tick.busy { animation-duration: 2.4s; }
  .avatar { transition: none; }
}

/* ---------- sign-in screen ---------- */
body.signed-out .shell, body.signed-out .skip { display: none; }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s8) 16px; background: var(--page); }
.auth[hidden] { display: none; }
.auth-card { width: min(100%, 400px); display: grid; gap: var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--s8) var(--s7, 28px); animation: auth-in 420ms var(--ease) both; }
.auth-card h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.022em; line-height: 1.2; margin: var(--s2) 0 0; }
.auth-card .sub { margin: -8px 0 0; color: var(--ink-2); font-size: var(--t-sm); }
.auth-brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 680; font-size: var(--t-md); letter-spacing: -0.015em; color: var(--ink); }
.auth-error { margin: 0; min-height: 1.2em; color: var(--bad); font-size: var(--t-sm); font-weight: 560; }
.auth-error:empty { min-height: 0; margin-top: -8px; }
.auth-go { width: 100%; height: 46px; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }

/* signed-in person, side menu footer */
.me { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.me[hidden] { display: none; }
.me-who { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.me-name { font-weight: 600; font-size: var(--t-sm); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-mail { font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .icon-btn { width: 36px; height: 36px; flex: none; }
.me .icon-btn .i { width: 18px; height: 18px; }

/* team page */
.team-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.team-forms .panel + .panel { margin-top: 0; }
.team-forms .actions input { flex: 1 1 200px; width: auto; }
input.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
