/* ==========================================================================
   Tractionpost design system ("Traction")
   Graphite neutrals, hairline borders, soft layered shadows and one orange
   accent that only lights up where something matters. Shared by every page.
   Change the brand by changing --accent (and its dark-mode twin).
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL: see /fonts/*-LICENSE.txt) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens: light ---------- */
:root {
  color-scheme: light;

  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-ink: #ffffff;
  --accent-soft: #fff3ec;
  --accent-soft-ink: #9a3412;
  --accent-line: #fdd8c4;
  --accent-glow: rgb(234 88 12 / .22);
  --accent-wash: rgb(234 88 12 / .08);

  --bg: #f7f7f9;
  --bg-grid: rgb(14 15 20 / .05);
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --surface-3: #eaeaef;
  --overlay: rgb(247 247 249 / .82);
  --scrim: rgb(14 15 20 / .32);

  --text: #0e0f14;
  --text-2: #3b3d49;
  --muted: #5b5d6b;
  --faint: #6b6d7c;

  --border: rgb(14 15 20 / .09);
  --border-strong: rgb(14 15 20 / .16);
  --divider: rgb(14 15 20 / .065);
  --focus: #c2410c;

  --ok: #0d7148;     --ok-soft: #e8f6ee;     --ok-line: #bfe5d0;
  --warn: #8f5405;   --warn-soft: #fdf3e1;   --warn-line: #f1d7a3;
  --danger: #bf2f1c; --danger-soft: #fdecea; --danger-line: #f5c6be;

  --chart-1: #c2410c;
  --chart-2: #13a37a;
  --chart-area: rgb(234 88 12 / .12);
  --chart-grid: rgb(14 15 20 / .06);

  --ch-ig: #d6336c; --ch-th: #3d3d45; --ch-bs: #0a7aff; --ch-rd: #ff5a1f; --ch-seo: #1a7f64; --ch-ph: #f08c00; --ch-ga: #a86b00; --ch-ai: #5b4ef0; --ch-video: #0b7bd6;
  --ch-x: #14151a; --ch-li: #0a66c2; --ch-hn: #e8590c; --ch-pht: #da552f; --ch-ih: #1f6feb; --ch-tt: #e0245e; --ch-yt: #e03131; --ch-st: #635bff; --ch-as: #0a84ff; --ch-gp: #01875f; --ch-cf: #f38020; --ch-bing: #0c8484; --ch-more: #868e96;

  --shadow-xs: 0 1px 2px rgb(14 15 20 / .05);
  --shadow-sm: 0 1px 2px rgb(14 15 20 / .04), 0 1px 3px rgb(14 15 20 / .03);
  --shadow-md: 0 1px 2px rgb(14 15 20 / .04), 0 6px 16px -4px rgb(14 15 20 / .08);
  --shadow-lg: 0 2px 4px rgb(14 15 20 / .04), 0 16px 40px -12px rgb(14 15 20 / .18), 0 40px 80px -32px rgb(14 15 20 / .12);
  --shadow-pop: 0 0 0 1px var(--border), 0 12px 32px -8px rgb(14 15 20 / .2), 0 2px 6px rgb(14 15 20 / .06);
  --shadow-btn-primary: inset 0 1px 0 rgb(255 255 255 / .18), 0 1px 2px rgb(124 45 18 / .28);

  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
  --radius: var(--r-lg);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 280ms;

  --sidebar-w: 248px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --gutter: 16px;
}

/* ---------- Tokens: dark (system preference, unless the person picked light) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #ff8a4c; --accent-hover: #ffa574; --accent-ink: #0b0b12;
    --accent-soft: #2e1a10; --accent-soft-ink: #ffb48a; --accent-line: #6b3417;
    --accent-glow: rgb(255 138 76 / .2); --accent-wash: rgb(255 138 76 / .1);
    --bg: #0b0b0f; --bg-grid: rgb(255 255 255 / .045);
    --surface: #131318; --surface-2: #18181e; --surface-3: #202028;
    --overlay: rgb(11 11 15 / .8); --scrim: rgb(0 0 0 / .55);
    --text: #ededf2; --text-2: #c9cbd6; --muted: #a2a4b3; --faint: #8b8d9c;
    --border: rgb(255 255 255 / .09); --border-strong: rgb(255 255 255 / .16); --divider: rgb(255 255 255 / .06);
    --focus: #ff8a4c;
    --ok: #45d08f; --ok-soft: rgb(69 208 143 / .12); --ok-line: rgb(69 208 143 / .3);
    --warn: #f2b84b; --warn-soft: rgb(242 184 75 / .12); --warn-line: rgb(242 184 75 / .3);
    --danger: #ff7b6c; --danger-soft: rgb(255 123 108 / .12); --danger-line: rgb(255 123 108 / .32);
    --chart-1: #ff8a4c; --chart-2: #45d08f; --chart-area: rgb(255 138 76 / .16); --chart-grid: rgb(255 255 255 / .06);
    --ch-ig: #f06595; --ch-th: #c9c9d1; --ch-bs: #4da3ff; --ch-rd: #ff7a45; --ch-seo: #38c49a; --ch-ph: #ffa94d; --ch-ga: #fcc419; --ch-ai: #a49aff; --ch-video: #4dabf7; --ch-x: #e4e5ea; --ch-li: #4c9be8; --ch-hn: #ff8a3d; --ch-pht: #ff7a59; --ch-ih: #6ea8ff; --ch-tt: #ff5c8a; --ch-yt: #ff6b6b; --ch-st: #9d97ff; --ch-as: #4dabff; --ch-gp: #3ccf91; --ch-cf: #ff9a3c; --ch-bing: #3cc3c3; --ch-more: #adb5bd;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .55);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 20px 48px -12px rgb(0 0 0 / .7);
    --shadow-pop: 0 0 0 1px rgb(255 255 255 / .1), 0 16px 40px -8px rgb(0 0 0 / .7);
    --shadow-btn-primary: inset 0 1px 0 rgb(255 255 255 / .35), 0 4px 16px -6px rgb(255 138 76 / .5);
  }
}
/* The same dark values, when the person picked dark in the account menu. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #ff8a4c; --accent-hover: #ffa574; --accent-ink: #0b0b12;
  --accent-soft: #2e1a10; --accent-soft-ink: #ffb48a; --accent-line: #6b3417;
  --accent-glow: rgb(255 138 76 / .2); --accent-wash: rgb(255 138 76 / .1);
  --bg: #0b0b0f; --bg-grid: rgb(255 255 255 / .045);
  --surface: #131318; --surface-2: #18181e; --surface-3: #202028;
  --overlay: rgb(11 11 15 / .8); --scrim: rgb(0 0 0 / .55);
  --text: #ededf2; --text-2: #c9cbd6; --muted: #a2a4b3; --faint: #8b8d9c;
  --border: rgb(255 255 255 / .09); --border-strong: rgb(255 255 255 / .16); --divider: rgb(255 255 255 / .06);
  --focus: #ff8a4c;
  --ok: #45d08f; --ok-soft: rgb(69 208 143 / .12); --ok-line: rgb(69 208 143 / .3);
  --warn: #f2b84b; --warn-soft: rgb(242 184 75 / .12); --warn-line: rgb(242 184 75 / .3);
  --danger: #ff7b6c; --danger-soft: rgb(255 123 108 / .12); --danger-line: rgb(255 123 108 / .32);
  --chart-1: #ff8a4c; --chart-2: #45d08f; --chart-area: rgb(255 138 76 / .16); --chart-grid: rgb(255 255 255 / .06);
  --ch-ig: #f06595; --ch-th: #c9c9d1; --ch-bs: #4da3ff; --ch-rd: #ff7a45; --ch-seo: #38c49a; --ch-ph: #ffa94d; --ch-ga: #fcc419; --ch-ai: #a49aff; --ch-video: #4dabf7; --ch-x: #e4e5ea; --ch-li: #4c9be8; --ch-hn: #ff8a3d; --ch-pht: #ff7a59; --ch-ih: #6ea8ff; --ch-tt: #ff5c8a; --ch-yt: #ff6b6b; --ch-st: #9d97ff; --ch-as: #4dabff; --ch-gp: #3ccf91; --ch-cf: #ff9a3c; --ch-bing: #3cc3c3; --ch-more: #adb5bd;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .55);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 20px 48px -12px rgb(0 0 0 / .7);
  --shadow-pop: 0 0 0 1px rgb(255 255 255 / .1), 0 16px 40px -8px rgb(0 0 0 / .7);
  --shadow-btn-primary: inset 0 1px 0 rgb(255 255 255 / .35), 0 4px 16px -6px rgb(255 138 76 / .5);
}
@media (min-width: 640px) { :root { --gutter: 24px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5; letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
::selection { background: rgb(234 88 12 / .22); }
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { color: var(--text); font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 8px; text-wrap: balance; }
h1 { font-size: 24px; letter-spacing: -0.025em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 12px; text-wrap: pretty; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .88em; }
code { padding: 1px 5px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--divider); overflow-wrap: anywhere; }
hr { border: 0; height: 1px; background: var(--divider); margin: 20px 0; }
small { font-size: 12px; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 200; padding: 8px 12px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-weight: 600; transition: top var(--dur-2) var(--ease-out); }
.skip:focus { top: 12px; text-decoration: none; }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ok { color: var(--ok); }
.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.error:empty { margin: 0; min-height: 0; }
.note { font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--faint); margin: 6px 0 0; }
.help { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.empty { color: var(--muted); padding: 8px 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }
.overline { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
.link { color: var(--accent); font-weight: 550; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 550; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.icon { width: 16px; height: 16px; flex: none; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -0.02em; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo svg { width: 26px; height: 26px; flex: none; border-radius: 7px; box-shadow: 0 1px 2px rgb(124 45 18 / .3); }

/* ---------- Buttons ---------- */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); min-height: var(--h); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs);
  font: inherit; font-size: 14px; font-weight: 550; line-height: 1; letter-spacing: -0.006em;
  white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .65; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-btn-primary); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled:hover { background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.btn-sm { --h: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { --h: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
label.btn { margin: 0; display: inline-flex; }
.btn[aria-busy="true"] { cursor: progress; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin: 14px 0 6px; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs);
  font: inherit; font-size: 14px; line-height: 1.4;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, select:hover, textarea:hover { border-color: rgb(14 15 20 / .26); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus-visible, select:focus-visible, textarea:focus-visible,
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus, select:focus, textarea:focus {
  outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash), 0 0 0 1px var(--accent);
}
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b6d7c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px; }
input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 16px; height: 16px; display: inline-grid; place-items: center;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; vertical-align: -3px;
  transition: background var(--dur-1), border-color var(--dur-1);
}
input[type=checkbox] { border-radius: 4px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; width: 10px; height: 10px; background: var(--accent-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E") center/contain no-repeat; }
input[type=radio]:checked { border-color: var(--accent); border-width: 5px; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }
@media (forced-colors: active) { input[type=checkbox], input[type=radio] { appearance: auto; -webkit-appearance: auto; } }
input[type=file] { font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 10px; height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-weight: 450; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { margin-top: 2px; }
.field-row { display: flex; gap: 8px; }
.field-row > input { flex: 1 1 auto; min-width: 0; }
/* Toggle switch: <label class="switch"><input type="checkbox"> Label</label> */
label.switch > input[type=checkbox] { width: 34px; height: 20px; border-radius: 99px; border: 0; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); position: relative; display: inline-block; }
label.switch > input[type=checkbox]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform var(--dur-2) var(--ease-out); -webkit-mask: none; mask: none; }
label.switch > input[type=checkbox]:checked { background: var(--accent); box-shadow: none; }
label.switch > input[type=checkbox]:checked::after { transform: translateX(14px); background: #fff; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-foot { margin: 16px -20px -20px; padding: 12px 20px; border-top: 1px solid var(--divider); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
@media (max-width: 480px) { .card { padding: 16px; } .card-foot { margin: 14px -16px -16px; padding: 12px 16px; } }

/* ---------- Tags, badges, status ---------- */
.tag, .badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 550; line-height: 1; letter-spacing: 0; white-space: nowrap; vertical-align: 1px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge { height: 18px; padding: 0 6px; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; background: var(--accent-soft); color: var(--accent-soft-ink); border-color: var(--accent-line); }
.tag.draft, .tag.approved, .tag.accent { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: var(--accent-line); }
.tag.published, .tag.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag.failed, .tag.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.tag.handed_off, .tag.warn, .tag.publishing { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag.soon { background: transparent; color: var(--faint); border-style: dashed; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); white-space: nowrap; }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px var(--surface-3); }
.status.ok { color: var(--ok); } .status.ok::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.warn { color: var(--warn); } .status.warn::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.status.danger { color: var(--danger); } .status.danger::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status.accent { color: var(--accent-soft-ink); } .status.accent::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.status.live::before { animation: sp-pulse 2s var(--ease-out) infinite; }
@keyframes sp-pulse { 0% { box-shadow: 0 0 0 0 var(--ok-line); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.count.accent { background: var(--accent); color: var(--accent-ink); }

/* Channel marker: a tinted square + label. The colour is a hint; the text carries the meaning. */
.chan { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px 0 6px; border-radius: var(--r-sm); font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.chan::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--faint)); }
.chan.ig { --c: var(--ch-ig); } .chan.th { --c: var(--ch-th); } .chan.bs { --c: var(--ch-bs); } .chan.rd { --c: var(--ch-rd); } .chan.seo { --c: var(--ch-seo); } .chan.ph { --c: var(--ch-ph); } .chan.ga { --c: var(--ch-ga); } .chan.ai { --c: var(--ch-ai); }
.chan.x { --c: var(--ch-x); } .chan.li { --c: var(--ch-li); } .chan.hn { --c: var(--ch-hn); } .chan.pht { --c: var(--ch-pht); } .chan.ih { --c: var(--ch-ih); } .chan.tt { --c: var(--ch-tt); } .chan.yt { --c: var(--ch-yt); } .chan.st { --c: var(--ch-st); } .chan.more { --c: var(--ch-more); }

/* Tones set --c for icon tiles: channel colours, plus states. */
.tone-ig { --c: var(--ch-ig); } .tone-th { --c: var(--ch-th); } .tone-bs { --c: var(--ch-bs); } .tone-rd { --c: var(--ch-rd); } .tone-seo { --c: var(--ch-seo); } .tone-ph { --c: var(--ch-ph); } .tone-ga { --c: var(--ch-ga); }
.tone-x { --c: var(--ch-x); } .tone-li { --c: var(--ch-li); } .tone-hn { --c: var(--ch-hn); } .tone-pht { --c: var(--ch-pht); } .tone-ih { --c: var(--ch-ih); } .tone-tt { --c: var(--ch-tt); } .tone-yt { --c: var(--ch-yt); } .tone-st { --c: var(--ch-st); } .tone-as { --c: var(--ch-as); } .tone-gp { --c: var(--ch-gp); } .tone-cf { --c: var(--ch-cf); } .tone-bing { --c: var(--ch-bing); } .tone-more { --c: var(--ch-more); }
.tone-ai { --c: var(--ch-ai); } .tone-video { --c: var(--ch-video); } .tone-plan { --c: var(--accent); }
.tone-ok { --c: var(--ok); } .tone-warn { --c: var(--warn); } .tone-danger { --c: var(--danger); } .tone-neutral { --c: var(--muted); }
.mini-icon { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 7px; color: var(--c, var(--muted));
  background: color-mix(in srgb, var(--c, var(--muted)) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 22%, transparent); }
.mini-icon .icon { width: 14px; height: 14px; }

/* Square product / channel avatar. Set --h (hue) inline for products. */
.avatar { --h: 250; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; font-size: 13px; font-weight: 650;
  background: hsl(var(--h) 80% 94%); color: hsl(var(--h) 45% 32%); box-shadow: inset 0 0 0 1px hsl(var(--h) 40% 50% / .18); }
.avatar.sm { width: 24px; height: 24px; border-radius: 7px; font-size: 11.5px; }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 80% 82%); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 70% / .2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 80% 82%); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 70% / .2); } }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); margin: 0; }
.callout > .icon { margin-top: 1px; color: var(--faint); }
.callout b, .callout strong { color: var(--text); font-weight: 600; }
.callout.info { background: var(--accent-soft); border-color: var(--accent-line); } .callout.info > .icon { color: var(--accent); }
.callout.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--text-2); } .callout.ok > .icon { color: var(--ok); }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); } .callout.warn > .icon { color: var(--warn); }
.callout.danger { background: var(--danger-soft); border-color: var(--danger-line); } .callout.danger > .icon { color: var(--danger); }
.callout p { margin: 0; }
.callout .callout-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }

/* ---------- Disclosure ---------- */
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.disclosure > summary { display: flex; align-items: center; gap: 8px; font-weight: 550; color: var(--text); padding: 6px 0; user-select: none; }
.disclosure > summary::before { content: ""; flex: none; width: 14px; height: 14px; background: currentColor; color: var(--faint); transition: transform var(--dur-2) var(--ease-out);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 4 4 4-4 4'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 4 4 4-4 4'/%3E%3C/svg%3E") center/contain no-repeat; }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure > summary:hover::before { color: var(--text); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div, .progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #f59e0b)); transition: width .5s var(--ease-out); }
.progress.ok > div, .progress.ok > span { background: var(--ok); }

/* ---------- Segmented control: buttons with aria-pressed ---------- */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 2px; gap: 2px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border); }
.seg > button, .seg > a {
  height: 28px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1), box-shadow var(--dur-1);
}
.seg > button:hover, .seg > a:hover { color: var(--text); text-decoration: none; }
.seg > [aria-pressed="true"], .seg > [aria-current="true"], .seg > .active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(14 15 20 / .08); }
.seg .count { height: 17px; min-width: 17px; font-size: 10.5px; padding: 0 5px; }

/* ---------- Stats: a joined strip of numbers ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--divider); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.stats > .stat, .stats > .card { flex: 1 1 150px; background: var(--surface); border: 0; border-radius: 0; box-shadow: none; padding: 14px 16px 16px; min-width: 0; position: relative; }
.stat .label { font-size: 12.5px; font-weight: 550; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { margin-top: 6px; font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.stat .value.is-empty { color: var(--faint); }
.stat .sub { margin-top: 4px; font-size: 12px; color: var(--faint); }
.stat .sub.up { color: var(--ok); } .stat .sub.down { color: var(--danger); }

/* Product types: web, mobile or both. */
.type-picks { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.type-picks legend { font-size: 13px; font-weight: 550; color: var(--text-2); padding: 0; margin-bottom: 8px; }
.type-picks .check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* Insights: the mobile app section, one block per store. */
.app-stores { display: grid; gap: 22px; }
.app-store-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.app-store-head h3 { margin: 0; font-size: 14px; }
.app-store-head .integration-icon { width: 28px; height: 28px; }
.app-store-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .app-store-grid { grid-template-columns: 1fr; } }
.stars { display: grid; gap: 6px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stars h4 { margin: 0 0 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.stars .row { display: grid; grid-template-columns: 26px 1fr 34px; align-items: center; gap: 8px; color: var(--text-2); }
.stars .track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.stars .fill { height: 100%; border-radius: 99px; background: var(--c, var(--chart-1)); }
.stars .row span:last-child { text-align: right; color: var(--muted); }
.spark { display: block; width: 100%; height: 28px; margin-top: 10px; overflow: visible; }
.spark .line { fill: none; stroke: var(--chart-1); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--chart-area); stroke: none; }
@media (max-width: 480px) { .stats > .stat, .stats > .card { flex-basis: 40%; } .stat .value { font-size: 22px; } }

/* ---------- Bar charts ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.chart h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.chart svg { display: block; width: 100%; height: 110px; overflow: visible; }
.chart rect.bar, .chart rect.b { fill: var(--chart-1); opacity: .9; }
.chart rect.bar:not(.latest) { opacity: .42; }
.chart rect.hit { fill: transparent; cursor: crosshair; }
.chart rect.gap { fill: var(--divider); opacity: .7; }
.chart .gap-note { color: var(--faint); font-weight: 500; }
.chart rect.hit:hover + rect.bar, .chart rect.hit:hover + rect.b, .chart rect.bar:hover { fill: var(--text); opacity: 1; }
.chart .axis { font-size: 11.5px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--divider); font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
/* position: relative keeps .sr-only cells inside the scroll box, so they can't widen the page. */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--divider); color: var(--text-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
th[aria-sort] { color: var(--text-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Skeleton ---------- */
.skeleton { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%) 0 0 / 200% 100%; animation: sp-shimmer 1.4s linear infinite; color: transparent !important; }
.skeleton-line { height: 12px; margin: 10px 0; }
.skeleton-row { height: 52px; margin: 6px 0; border-radius: 10px; }
@keyframes sp-shimmer { to { background-position: -200% 0; } }
.loading { color: var(--muted); display: flex; align-items: center; gap: 10px; }

/* ---------- Empty state ---------- */
.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 36px 20px; border-radius: var(--r-lg);
  background: radial-gradient(60% 90% at 50% 0%, var(--accent-wash), transparent 70%), var(--surface); border: 1px dashed var(--border-strong); }
.empty-state .empty-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--accent); border: 1px solid var(--border); box-shadow: var(--shadow-md); margin-bottom: 6px; }
.empty-state .empty-icon .icon { width: 20px; height: 20px; }
.empty-state h3 { margin: 0; font-size: 15px; }
.empty-state p { margin: 0 0 8px; color: var(--muted); max-width: 46ch; font-size: 13.5px; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; z-index: 300; right: 16px; bottom: 16px; left: 16px; display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, 100%); padding: 10px 10px 10px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 500; line-height: 1.4;
  background: #17181f; color: #f4f4f6; box-shadow: 0 0 0 1px rgb(255 255 255 / .07), 0 16px 32px -8px rgb(0 0 0 / .4); animation: sp-toast-in var(--dur-3) var(--ease-out) both; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ff8a4c; flex: none; }
.toast.ok::before { background: #45d08f; } .toast.danger::before { background: #ff7b6c; } .toast.warn::before { background: #f2b84b; }
.toast .toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button { border: 0; background: rgb(255 255 255 / .1); color: #fff; font: inherit; font-size: 13px; font-weight: 600; height: 30px; padding: 0 10px; border-radius: 7px; cursor: pointer; flex: none; }
.toast button:hover { background: rgb(255 255 255 / .18); }
.toast button.toast-close { background: transparent; color: #b4b6c4; width: 30px; padding: 0; font-size: 16px; }
.toast[data-leaving] { animation: sp-toast-out var(--dur-2) ease-in both; }
:root[data-theme="dark"] .toast { background: #26262f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #26262f; } }
@keyframes sp-toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sp-toast-out { to { opacity: 0; transform: translateY(4px); } }
@media (max-width: 640px) { .toast-region { justify-items: stretch; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); } }

/* ---------- Menus & dialogs ---------- */
.menu { position: absolute; z-index: 80; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); }
.menu-label { margin: 6px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.menu-sep { height: 1px; background: var(--divider); margin: 6px 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .icon { color: var(--faint); }
.modal { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 4px 20px 20px; }
.modal[open] { animation: sp-pop-in var(--dur-3) var(--ease-out); }
@keyframes sp-pop-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* ==========================================================================
   App shell: sidebar on desktop; top bar, drawer and tab bar on small screens
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 40px 96px; min-width: 0; flex: 1; }
.main:focus { outline: none; }
.main.narrow { max-width: 920px; }

.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 12px; border-right: 1px solid var(--border); background: var(--bg); overflow-y: auto; overscroll-behavior: contain; z-index: 40; }
.sidebar .logo { padding: 4px 8px 14px; }
.sb-section { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.nav { display: grid; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: var(--r-md); color: var(--muted); font-size: 13.5px; font-weight: 550; text-decoration: none; border: 1px solid transparent; transition: background var(--dur-1), color var(--dur-1); }
.nav-item .icon { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.nav-item[aria-current="page"] .icon { color: var(--accent); opacity: 1; }
.nav-item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.nav-group.is-open { color: var(--text); }
.nav-group.is-open .icon { color: var(--accent); opacity: 1; }
.nav-sub { display: grid; gap: 1px; margin: 1px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub[hidden] { display: none; }
.nav-sub .nav-item { min-height: 30px; font-size: 13px; font-weight: 500; }
.nav-sub .nav-item .icon { width: 15px; height: 15px; }
.nav-item .count { margin-left: auto; }
.nav-item .dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.sb-spacer { flex: 1; min-height: 16px; }
.sb-foot { display: grid; gap: 1px; padding-top: 8px; border-top: 1px solid var(--divider); }

/* Product switcher */
.switcher { position: relative; margin-bottom: 6px; }
.switcher-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.switcher-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.switcher-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.switcher-text b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-text small { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-btn > .icon { color: var(--faint); }
.switcher .menu { left: 0; right: 0; top: calc(100% + 6px); }
.products { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.products button, .products a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none; }
.products button:hover, .products a:hover { background: var(--surface-2); text-decoration: none; }
.products [aria-current="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; }
.products .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.products .avatar .icon { width: 13px; height: 13px; }
.products .ws-role { font-size: 11.5px; color: var(--faint); font-weight: 500; }

/* Account */
.account { position: relative; }
.account-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 8px; border: 0; border-radius: var(--r-md); background: none; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.account-btn:hover { background: var(--surface-3); }
.account-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .menu { left: 0; right: 0; bottom: calc(100% + 6px); }
.theme-seg { display: flex; margin: 2px 4px 6px; }
.theme-seg > button { flex: 1; justify-content: center; }

/* Icon-only button (menus, close) */
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r-md); background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn .icon { width: 18px; height: 18px; }

/* Top bar and tab bar (small screens) */
.topbar { display: none; }
.tabbar { display: none; }
.scrim { display: none; }

/* This week (Today): last week's numbers and the Monday review */
.week-card [data-week] { display: grid; gap: 12px; margin-top: 4px; }
.week-stats { box-shadow: none; }
.week-stats > .stat { flex-basis: 120px; padding: 12px 14px 13px; }
.week-stats .stat .value { font-size: 22px; }
.week-headline { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text); text-wrap: pretty; }
.week-ask { margin: 6px 0 0; font-weight: 600; color: var(--text); }

/* Goals: a target with its progress bar and where it should be by now */
.progress.warn > div, .progress.warn > span { background: var(--warn); }
.progress.danger > div, .progress.danger > span { background: var(--danger); }
.goal-sum { margin: 2px 0 0; font-weight: 600; color: var(--text); font-size: 15px; line-height: 1.4; text-wrap: pretty; }
.goal-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.gt { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--divider); }
.gt:first-child { border-top: 0; }
.gt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.gt-top b { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 650; white-space: nowrap; }
.gt-top b small { color: var(--muted); font-weight: 500; font-size: 12px; }
.gt-bar { position: relative; }
.gt-bar .pace { position: absolute; top: -3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--text-2); opacity: .55; }
.gt-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.gt-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.gt.compact { padding: 9px 0; }
.weeks { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; vertical-align: middle; }
.weeks i { width: 6px; border-radius: 1.5px; background: var(--accent-line); min-height: 2px; }
.weeks i:last-child { background: var(--accent); }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 2px 0 0; font-size: 26px; font-weight: 650; letter-spacing: -0.028em; overflow-wrap: anywhere; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 70ch; overflow-wrap: anywhere; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.layout-rail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1200px) { .rail.sticky { position: sticky; top: 24px; } }
@media (max-width: 1199px) { .layout-rail { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 20px var(--gutter) 64px; }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: var(--topbar-h); padding: 0 calc(var(--gutter) - 6px); background: var(--overlay); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--border); }
  .topbar-product { display: flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 8px; border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
  .topbar-product span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-product .icon { color: var(--faint); }
  .topbar .spacer { flex: 1; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn .icon { width: 20px; height: 20px; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: auto; z-index: 90; background: var(--surface); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(-102%); visibility: hidden; transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3); padding-top: 12px; }
  .drawer-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease-out), visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 85; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-3); }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-item, .account-btn, .menu-item, .products button, .products a { min-height: 44px; }
  .page-head h1 { font-size: 23px; }
}
@media (max-width: 640px) {
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  /* Keyboard focus and in-page jumps stop above the fixed tab bar, not under it. */
  html:has(body.has-tabbar) { scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }
  a.link { min-height: 40px; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); background: var(--overlay); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--border); }
  .tab { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; border: 0; border-radius: 10px; background: none; color: var(--faint); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; position: relative; }
  .tab .icon { width: 21px; height: 21px; }
  .tab:hover { text-decoration: none; color: var(--text); }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab .count { position: absolute; top: 4px; left: calc(50% + 6px); height: 17px; min-width: 17px; font-size: 10px; padding: 0 4px; }
  .btn { --h: 42px; }
  .btn-sm { --h: 40px; }
  .seg > button, .seg > a { height: 40px; }
  /* 16px text stops iOS zooming into a field; it has to beat page rules that set smaller text, hence !important. */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea { font-size: 16px !important; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select { min-height: 44px; }
  summary { min-height: 40px; }
  .disclosure > summary { padding: 8px 0; }
  .check, .linkbtn { min-height: 40px; }
  .topbar .logo { min-height: 40px; }
  .skip { min-height: 40px; display: inline-flex; align-items: center; }
  .main { padding-bottom: 32px; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Get started: the way back from a step's page ---------- */
.setup-return { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: calc(100% - 80px); max-width: 1120px; margin: 20px auto -8px; padding: 10px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text-2); font-size: 13px; }
@media (max-width: 760px) { .setup-return { width: calc(100% - 32px); } }

/* Who does a step or task: a compact picker in the item's meta row. */
.assignee-wrap { display: inline-flex; align-items: center; }
.assignee-wrap select.assignee { height: 24px; min-height: 0; line-height: 1; box-shadow: none; padding: 0 22px 0 9px; font-size: 11.5px; font-weight: 600; border-radius: 99px; width: auto; min-width: 0; max-width: 160px;
  color: var(--text-2); background-color: var(--surface-2); border: 1px solid var(--border); background-position: right 6px center; background-size: 10px; }
.assignee-wrap.is-me select.assignee { background-color: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-soft-ink); }

/* Insights: visitors as each connected analytics tool counts them */
.by-tool { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin: -4px 2px 0; font-size: 13px; color: var(--muted); cursor: help; }
.by-tool-label { font-weight: 600; color: var(--text-2); }
.by-tool-item b { color: var(--text); font-weight: 600; }
