/*
  Switched On AI client portal: design system and components.
  Plain CSS. No build step, no external requests, no inline styles needed.
  Order: font, tokens, base, shell and nav, components, charts, screens, tones, motion, print.
  Breakpoints: 600 (dialogs, banners), 720 (wider rows and stats), 900 (tour side by side),
  960 (desktop sidebar), 1200 (aside grid).
  Documented in docs/design-system.md.
*/

/* ========== Font ========== */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/InterVariable.woff2") format("woff2");
}

/* ========== Tokens ========== */
:root {
  /* Brand */
  --navy: #13294b;
  --navy-2: #1c3a68;
  --navy-3: #2e4a78;
  --sun: #ffc531;
  --sun-2: #ffd666;
  --sun-soft: #fff1c9;
  --coral: #ff7a59;
  --coral-soft: #ffe6de;
  --main: #1d4ed8;
  --main-hover: #1e40af;
  --main-mid: #4f7cf0;
  --main-soft: #e8eefc;
  --violet: #6d28d9;
  --violet-soft: #f0e9fd;
  --sky: #0e6f8f;
  --sky-soft: #e0f2f7;

  /* Warm neutrals */
  --ink: #142033;
  --ink-2: #4b5565;
  --ink-3: #767d8c;
  --line: #e7e0d4;
  --line-2: #d6cdbd;
  --sand: #fbf8f3;
  --sand-2: #f3ede3;
  --paper: #ffffff;

  /* Traffic lights: text colour, tint, border, solid fill */
  --good: #0f6a38;
  --good-bg: #dff5e7;
  --good-line: #a8dfbd;
  --good-solid: #1a9e54;
  --look: #8a4b00;
  --look-bg: #fff1d1;
  --look-line: #f3cf85;
  --look-solid: #f5a30a;
  --act: #b42318;
  --act-bg: #fde7e4;
  --act-line: #f4b4ab;
  --act-solid: #dc3a2a;
  --star: #e8a200;
  --star-off: #d6cdbd;

  /* Tone defaults. Tone classes (.good .look .act and friends) swap these. */
  --tone: var(--ink-2);
  --tone-bg: var(--sand-2);
  --tone-line: var(--line-2);
  --tone-solid: var(--main);

  --focus: #1d4ed8;
  --focus-dark: #ffc531;

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  --fs-3xl: clamp(2.25rem, 1.8rem + 2vw, 3rem);
  --fs-4xl: clamp(2.75rem, 2rem + 3.5vw, 4rem);
  --lh-tight: 1.15;
  --lh: 1.5;
  --fw-body: 450;
  --fw-label: 600;
  --fw-strong: 700;
  --fw-heavy: 800;

  /* Space: 4px steps */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --gutter: 16px;
  --content: 1160px;
  --sidebar-w: 272px;
  --tap: 48px;
  --tabbar-h: 72px;

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadows, tinted navy so they feel warm not grey */
  --shadow-1: 0 1px 2px rgba(19, 41, 75, 0.06), 0 2px 8px rgba(19, 41, 75, 0.05);
  --shadow-2: 0 2px 4px rgba(19, 41, 75, 0.06), 0 10px 24px -6px rgba(19, 41, 75, 0.16);
  --shadow-3: 0 4px 8px rgba(19, 41, 75, 0.08), 0 24px 48px -12px rgba(19, 41, 75, 0.28);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 560ms;
  --dur-5: 900ms;
}

@media (min-width: 960px) {
  :root { --gutter: 32px; }
}
@media (min-width: 1440px) {
  :root { --content: 1200px; }
}

/* ========== Base ========== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
  scroll-padding-top: 76px;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-body);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--sand);
  font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
/* Menus never show list dots, with or without a class on the list */
nav ul, nav ol, nav li { list-style: none; }
nav ul, nav ol { padding: 0; }
h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: var(--fw-heavy);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); font-weight: var(--fw-strong); }
p { text-wrap: pretty; }
strong, b { font-weight: var(--fw-strong); }

a { color: var(--main); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:not([class]):hover { color: var(--main-hover); }

img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a, button, summary, label { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--sun); color: var(--ink); }
[hidden] { display: none !important; }

.sr-only, .visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* app.js adds class "js" to the html element */
html:not(.js) .js-only { display: none !important; }
html.js .no-js { display: none !important; }

.icon { display: inline-block; flex: none; vertical-align: middle; }
.icon-fill path, .icon-fill rect, .icon-fill circle { fill: currentColor; }

/* Small helpers */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-good { color: var(--good); }
.text-look { color: var(--look); }
.text-act { color: var(--act); }
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.lead { font-size: var(--fs-lg); color: var(--ink-2); }
.sep {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  vertical-align: middle;
}

/* Layout helpers */
.stack { display: grid; gap: var(--s-4); align-content: start; min-width: 0; }
.stack-sm { gap: var(--s-2); }
.stack-lg { gap: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.split { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.media { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.media > :last-child { flex: 1; min-width: 0; }
.grid-2, .grid-3, .grid-aside { display: grid; gap: var(--s-4); align-items: start; }
.grid-auto { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .grid-aside { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-6); }
}
.wrap { width: 100%; max-width: var(--content); margin: 0 auto; padding: var(--s-5) var(--gutter); }
.wrap-narrow { max-width: 640px; }
.section { display: grid; gap: var(--s-3); min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.section-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.section-title .icon { color: var(--main); }

/* ========== Shell ========== */
.skip {
  position: absolute;
  left: 12px;
  top: -120px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--navy);
  color: #fff;
  font-weight: var(--fw-strong);
  text-decoration: none;
}
.skip:focus { top: 12px; color: #fff; outline-color: var(--sun); }

.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.page {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}
.has-nav:not(.is-admin) .page { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-10);
  display: grid;
  gap: var(--s-5);
  align-content: start;
}
.bare-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
  min-height: calc(100vh - 36px);
  min-height: calc(100dvh - 36px);
  overflow-x: clip;
}
.main:focus, .bare-main:focus { outline: none; }

/* Example banner: striped like site tape so nobody mistakes it for real data */
.example-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 6px var(--gutter);
  background-color: var(--sun);
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0) 0 14px, rgba(255, 255, 255, 0.3) 14px 28px);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-strong);
  line-height: 1.3;
  text-align: center;
}
.dev-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 8px var(--gutter);
  background: var(--navy);
  border-bottom: 3px dashed var(--sun);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-label);
  text-align: center;
}
.dev-banner .icon { color: var(--sun); }

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: var(--fw-heavy);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--navy);
  color: var(--sun);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  transition: transform var(--dur-3) var(--ease-spring);
}
.brand-word span { color: var(--main); }
@media (hover: hover) {
  .brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
}

/* Avatar and user chip */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--coral);
  color: var(--ink);
  font-size: 1rem;
  font-weight: var(--fw-heavy);
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.375rem; }
.user-chip { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.user-chip-text { display: grid; min-width: 0; line-height: 1.25; }
.user-chip-name { overflow: hidden; font-weight: var(--fw-strong); text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { color: #b9c6dc; font-size: var(--fs-xs); font-weight: var(--fw-label); }

/* Mobile top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 60px;
  padding: 6px var(--gutter);
  background: rgba(251, 248, 243, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-user {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  text-decoration: none;
}
.signout-top .btn { width: auto; min-height: var(--tap); padding: 8px 16px; font-size: var(--fs-sm); }

/* Mobile bottom tab bar. Only the current tab gets a highlight (the pill behind its icon). */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px -12px rgba(19, 41, 75, 0.2);
}
.tabbar ul {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px;
  list-style: none;
}
.tabbar li { list-style: none; }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 64px;
  padding: 4px 2px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-strong);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 34px;
  border-radius: var(--r-pill);
  transition: background-color var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-spring);
}
.tab:active .tab-icon { transform: scale(0.9); }
.tab[aria-current="page"] { color: var(--main); }
.tab[aria-current="page"] .tab-icon { background: var(--main-soft); }
.tab[aria-current="page"] .icon { stroke-width: 2.4; }
.tab[aria-current="page"] .icon-star path { fill: currentColor; }

/* Footer */
.foot {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-8);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.foot a { font-weight: var(--fw-strong); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.foot-small { font-size: var(--fs-xs); }

/* Desktop: navy sidebar */
@media (min-width: 960px) {
  .has-nav .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-6);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: var(--s-6) var(--s-4) var(--s-4);
    background-color: var(--navy);
    background-image:
      radial-gradient(260px 180px at 0% 0%, rgba(255, 197, 49, 0.16), rgba(255, 197, 49, 0) 70%),
      linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.18) 100%);
    color: #fff;
  }
  .topbar, .tabbar { display: none; }
  .has-nav:not(.is-admin) .page { padding-bottom: 0; }
  .main { padding-top: var(--s-8); gap: var(--s-6); }
}
.sidebar :focus-visible { outline-color: var(--focus-dark); }
.sidebar .brand { padding: 0 var(--s-2); color: #fff; }
.sidebar .brand-mark { background: var(--sun); color: var(--navy); }
.sidebar .brand-word span { color: var(--sun); }
.side-nav { flex: 1 0 auto; }
.side-nav ul, .side-extra { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.side-nav li, .side-extra li { list-style: none; }
.side-nav a, .side-extra a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  color: #d9e2f2;
  font-weight: 650;
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.side-nav a:hover, .side-extra a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side-nav a[aria-current="page"] { background: #fff; color: var(--navy); box-shadow: var(--shadow-2); }
.side-nav a[aria-current="page"] .icon { color: var(--main); }
.side-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 12px;
  bottom: 12px;
  width: 5px;
  border-radius: 0 6px 6px 0;
  background: var(--sun);
}
.side-extra { padding-top: var(--s-4); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.side-extra a { min-height: var(--tap); color: #b9c6dc; font-size: var(--fs-sm); }
.side-foot {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-2) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ========== Buttons and links ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: var(--fw-strong);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-main {
  background: var(--main);
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 8px 18px -8px rgba(29, 78, 216, 0.6);
}
.btn-main:hover { background: var(--main-hover); color: #fff; }
.btn-ghost { border-color: var(--line-2); }
.btn-ghost:hover { background: var(--sand-2); border-color: var(--ink-3); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--main); padding-inline: 14px; }
.btn-quiet:hover { background: var(--main-soft); color: var(--main-hover); }
.btn-danger { border-color: var(--act-line); color: var(--act); }
.btn-danger:hover { background: var(--act-bg); color: var(--act); }
.btn-dev { border: 2px dashed var(--navy); background: var(--sun-soft); color: var(--navy); }
.btn-dev:hover { background: var(--sun-2); color: var(--navy); }
.btn-sun, .hero .btn-main {
  background: var(--sun);
  color: var(--navy);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 8px 18px -8px rgba(255, 197, 49, 0.55);
}
.btn-sun:hover, .hero .btn-main:hover { background: var(--sun-2); color: var(--navy); }
.hero .btn-ghost, .signout-dark .btn { background: transparent; border-color: rgba(255, 255, 255, 0.32); color: #fff; }
.hero .btn-ghost:hover, .signout-dark .btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.6); color: #fff; }
.btn-lg { min-height: 60px; padding: 16px 28px; border-radius: var(--r-lg); font-size: var(--fs-lg); }
.btn-sm { min-height: var(--tap); padding: 8px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.icon-btn:hover { background: var(--sand-2); color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.actions > form { display: contents; }
@media (max-width: 599px) {
  .actions > .btn, .actions > form > .btn { flex: 1 1 100%; }
}

.back, .link-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-weight: var(--fw-strong);
  text-decoration: none;
}
.back { justify-self: start; margin-left: -8px; padding: 0 12px 0 6px; border-radius: var(--r-sm); }
.back:hover { background: var(--main-soft); }
.link-go .icon { transition: transform var(--dur-2) var(--ease-out); }
.link-go:hover .icon { transform: translateX(3px); }

/* ========== Cards and panels ========== */
.card {
  position: relative;
  display: grid;
  gap: var(--s-4);
  align-content: start;
  min-width: 0;
  padding: var(--s-5);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
@media (min-width: 960px) {
  .card { padding: var(--s-6); }
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.card-title .icon { color: var(--tone-solid); }
.card-tone { background: var(--tone-bg); border-color: var(--tone-line); }
a.card {
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out), border-color var(--dur-3) var(--ease-out);
}
@media (hover: hover) {
  a.card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-2); }
}

/* Dark hero panel: the one main action, also the billing plan card */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: var(--s-4);
  align-content: start;
  min-width: 0;
  padding: var(--s-6) var(--s-5);
  border-radius: var(--r-xl);
  background-color: var(--navy);
  background-image:
    radial-gradient(420px 260px at 100% 0%, rgba(255, 197, 49, 0.24), rgba(255, 197, 49, 0) 70%),
    linear-gradient(160deg, var(--navy-2), var(--navy) 60%);
  color: #fff;
  box-shadow: var(--shadow-3);
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -70px;
  bottom: -90px;
  width: 240px;
  height: 240px;
  border: 30px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}
.hero :is(h1, h2, h3) { color: #fff; }
.hero p, .hero .muted { color: #d9e2f2; }
.hero .eyebrow { color: var(--sun-2); }
.hero a:not([class]) { color: var(--sun-2); }
.hero-title { font-size: var(--fs-2xl); }
.hero :focus-visible, .player :focus-visible, .signin-hero :focus-visible { outline-color: var(--focus-dark); }
@media (min-width: 960px) {
  .hero { padding: var(--s-8); }
}

/* Facts: icon, small label, bold value */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--s-3); }
.fact { display: flex; align-items: center; gap: var(--s-3); min-width: 0; padding: var(--s-3); border-radius: var(--r-md); background: var(--sand); }
.fact-text { display: grid; min-width: 0; line-height: 1.3; }
.fact-label { color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-label); }
.fact-value { font-weight: var(--fw-strong); overflow-wrap: anywhere; }
.hero .fact { background: rgba(255, 255, 255, 0.08); }
.hero .fact-label { color: #b9c6dc; }

/* Price, used on the plan card */
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.price-num { color: var(--sun); font-size: var(--fs-4xl); font-weight: 850; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.price-note { color: #d9e2f2; font-weight: var(--fw-label); }

/* Billing plan card bits */
.plan-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.plan-safe { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); }
.hero .plan-safe .icon { color: var(--sun); }
.row-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-amount strong { font-size: var(--fs-md); }

/* ========== Status: icon tiles, pills, tags, lights ========== */
.ico {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  background: var(--tone-bg);
  color: var(--tone);
}
.ico-lg { width: 64px; height: 64px; border-radius: var(--r-lg); }
.ico-round { border-radius: 50%; }
.ico.is-live::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid var(--tone-solid);
  border-radius: inherit;
  opacity: 0;
}

/* Pills and tags always hug their words. A fixed width stops grid and flex parents stretching them;
   inside a centred parent (like .empty) they still sit in the middle. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 12px 4px 8px;
  border: 1px solid var(--tone-line);
  border-radius: var(--r-pill);
  background: var(--tone-bg);
  color: var(--tone);
  font-size: var(--fs-sm);
  font-weight: var(--fw-strong);
  line-height: 1.2;
}
.pill-lg { min-height: 44px; padding: 8px 16px 8px 12px; font-size: var(--fs-md); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--tone-bg);
  color: var(--tone);
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.light {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tone-solid);
  box-shadow: 0 0 0 3px var(--tone-bg);
}

.status { display: flex; align-items: center; gap: var(--s-3); }
.status-word { color: var(--tone); font-size: var(--fs-lg); font-weight: var(--fw-heavy); }

/* ========== Banners and notes ========== */
/* Icon, text, then an optional button. Under 600px the button drops below the text, full width. */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--tone-line);
  border-left: 6px solid var(--tone-solid);
  border-radius: var(--r-md);
  background: var(--tone-bg);
  color: var(--ink);
}
.banner > .icon { flex: none; color: var(--tone); }
.banner-body { display: grid; flex: 1 1 0; gap: var(--s-2); min-width: 0; }
.banner-body p { font-weight: var(--fw-label); }
.banner-title { font-weight: var(--fw-heavy); }
.banner > .btn, .banner > form { flex: none; align-self: center; }
@media (max-width: 599px) {
  .banner { flex-wrap: wrap; }
  .banner > .btn, .banner > form { flex: 1 1 100%; }
  .banner > form .btn { width: 100%; }
}

/* Close button that app.js adds to flash messages */
.flash-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin: -10px -8px -10px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.flash-close:hover { background: rgba(19, 41, 75, 0.08); color: var(--ink); }

.note {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--sand-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.note > .icon { flex: none; color: var(--main); }
.note-body { display: grid; gap: var(--s-2); min-width: 0; }

.quote {
  position: relative;
  padding: var(--s-4) var(--s-4) var(--s-4) var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  font-weight: 500;
}
.quote::before {
  content: "";
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  bottom: var(--s-4);
  width: 4px;
  border-radius: 4px;
  background: var(--sun);
}

/* ========== Forms ========== */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: var(--fw-strong); }
.hint { color: var(--ink-2); font-size: var(--fs-sm); }
.error { color: var(--act); font-size: var(--fs-sm); font-weight: var(--fw-strong); }
.input,
.field :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  font-size: max(16px, var(--fs-md));
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.field textarea, textarea.input { min-height: 120px; line-height: var(--lh); resize: vertical; }
.input:hover, .field :is(input, textarea, select):hover { border-color: var(--ink-3); }
.input:focus, .field :is(input, textarea, select):focus { border-color: var(--main); box-shadow: 0 0 0 4px var(--main-soft); outline: none; }
.input[aria-invalid="true"], .field [aria-invalid="true"] { border-color: var(--act); }
::placeholder { color: var(--ink-3); opacity: 1; }

/* Search box with a leading icon */
.search { position: relative; display: flex; gap: var(--s-2); }
.search > .input, .search > input { flex: 1; padding-left: 52px; }
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  display: grid;
  color: var(--ink-3);
  pointer-events: none;
  transform: translateY(-50%);
}

/* Switch: role="switch" checkbox; the track shows On or Off as a word as well as colour */
.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: var(--tap); cursor: pointer; }
.switch-text { display: grid; gap: 2px; min-width: 0; }
.switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.switch-ui {
  position: relative;
  flex: none;
  width: 80px;
  height: 42px;
  border-radius: var(--r-pill);
  background: var(--ink-2);
  transition: background-color var(--dur-3) var(--ease-out);
}
.switch-ui::before {
  content: "Off";
  position: absolute;
  top: 50%;
  right: 13px;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transform: translateY(-50%);
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(19, 41, 75, 0.3);
  transition: transform var(--dur-3) var(--ease-spring);
}
.switch input:checked + .switch-ui { background: var(--good); }
.switch input:checked + .switch-ui::before { content: "On"; right: auto; left: 15px; }
.switch input:checked + .switch-ui::after { transform: translateX(38px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Details used as an inline edit area */
.disclose > summary { list-style: none; }
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary .chev { transition: transform var(--dur-3) var(--ease-out); }
.disclose[open] > summary .chev { transform: rotate(180deg); }
.disclose-body { display: grid; gap: var(--s-3); margin-top: var(--s-3); }

/* ========== Chips (filters) ========== */
.chips {
  display: flex;
  gap: var(--s-2);
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 720px) {
  .chips { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
}
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 18px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-strong);
  text-decoration: none;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip:active { transform: scale(0.96); }
.chip[aria-current="page"], .chip[aria-current="true"], .chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--sand-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip[aria-current="page"] .chip-count, .chip[aria-current="true"] .chip-count, .chip[aria-pressed="true"] .chip-count { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* ========== Rows (tappable list cards) ========== */
.rows { display: grid; gap: var(--s-3); }
.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "ico main go" "ico end go";
  align-items: center;
  gap: 6px var(--s-3);
  width: 100%;
  min-height: 76px;
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out), border-color var(--dur-3) var(--ease-out);
}
button.row { cursor: pointer; }
.row > .ico { grid-area: ico; }
.row > .row-icon {
  grid-area: ico;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  background: var(--tone-bg);
  color: var(--tone);
}
.row-main { grid-area: main; display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: var(--fw-heavy); overflow-wrap: anywhere; }
.row-meta { color: var(--ink-2); font-size: var(--fs-sm); }
.row-end { grid-area: end; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.row-num { color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
.row-go { grid-area: go; display: grid; color: var(--ink-3); transition: transform var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
@media (hover: hover) {
  a.row:hover, button.row:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); transform: translateY(-1px); }
  a.row:hover .row-go, button.row:hover .row-go { color: var(--main); transform: translateX(3px); }
}
a.row:active, button.row:active { transform: scale(0.99); }
.row.is-soon { background: transparent; border-style: dashed; box-shadow: none; }
.row.is-soon .row-title { color: var(--ink-2); }
@media (min-width: 720px) {
  .row { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "ico main end go"; padding-right: var(--s-4); }
  .row-end { justify-content: flex-end; text-align: right; }
}

/* ========== Stat tiles ========== */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
}
.stat {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "ico chart" "num num" "label label";
  align-items: end;
  gap: 4px var(--s-2);
  padding: var(--s-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--tone-solid); }
.stat > .ico { grid-area: ico; align-self: start; }
.stat > .spark { grid-area: chart; justify-self: end; }
.stat-num { grid-area: num; margin-top: var(--s-3); font-size: var(--fs-3xl); font-weight: 850; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.stat-label { grid-area: label; color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-label); line-height: 1.3; }
/* A star row can sit where the tiny chart goes (reviews rating card) */
.stat > .stars { grid-area: chart; justify-self: end; align-self: center; }
.stat-rating .ico { color: var(--star); }

/* Three stats (reviews): rating full width on phones with two below, a row of three from 720px */
.stats-3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-3 > :first-child { grid-column: auto; }
}

/* ========== Charts (inline SVG) ========== */
/* Progress ring: circles use pathLength="100", fill amount in stroke-dasharray="57 100" */
.ring { position: relative; display: grid; place-items: center; flex: none; width: 124px; aspect-ratio: 1; }
.ring svg { display: block; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--sand-2); stroke-width: 12; }
.ring-fill {
  fill: none;
  stroke: var(--tone-solid);
  stroke-width: 12;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; line-height: 1.1; text-align: center; }
.ring-text strong { font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: -0.03em; }
.ring-text span { color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-label); }

/* Bars: rect widths in % so nothing is stretched */
.meter { display: grid; gap: var(--s-2); }
.meter-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-3); }
.meter-num { font-size: var(--fs-xl); font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.bar { display: block; width: 100%; height: 14px; overflow: visible; }
.bar-track { fill: var(--sand-2); }
.bar-fill { fill: var(--tone-solid); transform-box: fill-box; transform-origin: 0 50%; }

/* Spark: tiny week chart, one rect per day, class "now" on today */
.spark { display: block; width: 76px; height: 36px; overflow: visible; }
.spark rect { fill: var(--tone-solid); opacity: 0.35; transform-box: fill-box; transform-origin: 50% 100%; }
.spark rect.now { opacity: 1; }

/* Funnel: centred bars that narrow, one step per row */
.funnel { display: grid; gap: var(--s-4); }
.funnel-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "ico label num" "bar bar bar";
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.funnel-step > .ico { grid-area: ico; }
.funnel-label { grid-area: label; font-weight: var(--fw-strong); }
.funnel-num { grid-area: num; font-size: var(--fs-xl); font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.funnel-bar { grid-area: bar; display: block; width: 100%; height: 30px; overflow: visible; }
.funnel-bar .bar-fill { transform-origin: 50% 50%; }

/* Stars: lit stars carry class "on" (or "star-on"); the rest stay sand grey */
.stars { display: inline-flex; flex: none; align-items: center; gap: 2px; color: var(--star-off); vertical-align: middle; }
.stars .on, .stars .star-on { color: var(--star); }
.stars .icon :is(path, polygon) { fill: currentColor; }
/* Half star: the first path is the whole star (shown empty), the second fills the left half */
.stars .icon-star-half path:first-child { fill: var(--star-off); }
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
.rating-num { font-size: var(--fs-4xl); font-weight: 850; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.rating-meta { display: grid; gap: 4px; }

/* ========== Home bits ========== */
.hello { display: grid; gap: 6px; }
.hello h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: var(--fs-3xl); }
.hello-wave { display: inline-block; color: var(--star); transform-origin: 70% 80%; }

/* Calendar tile: month strip, big day, weekday. .cal-sm is the compact one used in facts. */
.cal {
  display: grid;
  flex: none;
  width: 72px;
  overflow: hidden;
  border: 2px solid var(--navy);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  line-height: 1;
  text-align: center;
}
.cal-mon { display: block; padding: 5px 0; background: var(--coral); color: var(--ink); font-size: var(--fs-xs); font-weight: var(--fw-heavy); letter-spacing: 0.08em; text-transform: uppercase; }
.cal-day { display: block; padding: 6px 0 2px; font-size: 1.75rem; font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.cal-dow { display: block; padding-bottom: 6px; color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-strong); }
.cal-sm { width: 56px; border-radius: var(--r-sm); }
.cal-sm .cal-mon { padding: 3px 0; font-size: 0.6875rem; }
.cal-sm .cal-day { padding: 4px 0 1px; font-size: 1.375rem; }
.cal-sm .cal-dow { padding-bottom: 4px; font-size: 0.6875rem; }
.hero .cal { border-color: var(--sun); }

.msg { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--s-3); }
.msg-bubble { display: grid; gap: 4px; padding: 12px 16px; border-radius: 4px 20px 20px 20px; background: var(--sun-soft); }
.msg-who { color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-label); }
.msg-text { font-weight: 500; }

/* ========== Call detail ========== */
.caller { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.caller-name { font-size: var(--fs-2xl); }
.caller-num { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: var(--fs-lg); font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; text-decoration: none; }

/* Audio player: native audio without JS; app.js adds .is-enhanced and swaps in the custom UI */
.player { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); background: var(--navy); color: #fff; box-shadow: var(--shadow-2); }
.player audio { display: block; width: 100%; }
.player.is-ready audio, .player:not(.is-ready) .player-ui { display: none; }
.player.is-enhanced audio { display: none; }
.player.is-enhanced .player-ui { display: grid; }
.player-ui { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s-4); }
.player-play {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sun);
  color: var(--navy);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14), 0 10px 22px -10px rgba(255, 197, 49, 0.7);
  transition: transform var(--dur-2) var(--ease-spring), background-color var(--dur-2) var(--ease-out);
}
.player-play:hover { background: var(--sun-2); transform: scale(1.05); }
.player-play:active { transform: scale(0.94); }
.player-play .when-playing, .player.is-playing .player-play .when-paused { display: none; }
.player.is-playing .player-play .when-playing { display: block; }
.player.is-error .player-play { opacity: 0.5; cursor: not-allowed; transform: none; }
.player-body { display: grid; gap: var(--s-2); min-width: 0; }
.wave { display: block; width: 100%; height: 56px; border-radius: 8px; cursor: pointer; touch-action: none; }
.wave rect { fill: rgba(255, 255, 255, 0.3); transition: fill var(--dur-2) var(--ease-out); }
.wave rect.on, .wave rect.is-played { fill: var(--sun); }
.player.is-loading .wave rect { opacity: 0.45; }
.player-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.player-time { color: #d9e2f2; font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
.speed { display: inline-flex; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.1); }
.speed button {
  min-width: 52px;
  min-height: var(--tap);
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: #d9e2f2;
  font-weight: var(--fw-heavy);
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.speed button[aria-pressed="true"] { background: #fff; color: var(--navy); }
.player-dl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--r-pill);
  color: #fff;
  font-weight: var(--fw-strong);
  text-decoration: none;
}
.player-dl:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* Transcript as chat bubbles: .us is the AI receptionist, .them is the caller */
.transcript { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); background: var(--sand-2); }
.bubble { display: grid; gap: 4px; max-width: min(88%, 560px); padding: 12px 16px; border-radius: 20px; line-height: 1.45; }
.bubble.them { justify-self: start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.us { justify-self: end; background: var(--main); color: #fff; border-bottom-right-radius: 6px; }
.bubble-who { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-heavy); letter-spacing: 0.05em; text-transform: uppercase; }
.bubble-time { justify-self: end; color: var(--ink-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.bubble.us .bubble-who { color: #dbe5ff; }
.bubble.us .bubble-time { color: #c7d5fb; }

/* ========== Reviews ========== */
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.review-who { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.review .quote { font-size: var(--fs-lg); }
.reply { display: grid; gap: var(--s-2); padding: var(--s-4); border: 1px dashed var(--line-2); border-radius: var(--r-md); background: var(--sand); }
.reply.good, .reply.look, .reply.act, .reply.info { border-style: solid; border-color: var(--tone-line); background: var(--tone-bg); }
.reply-label { display: flex; align-items: center; gap: 6px; color: var(--tone); font-size: var(--fs-sm); font-weight: var(--fw-heavy); }

/* ========== Dialog ========== */
.dialog {
  width: min(100% - 32px, 520px);
  max-width: 100%;
  max-height: min(90dvh, 760px);
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog::backdrop { background: rgba(19, 41, 75, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog-inner { display: grid; gap: var(--s-4); padding: var(--s-6) var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom)); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.dialog-head .icon-btn { margin: -8px -8px 0 0; }
.dialog-actions { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: var(--s-3); }
@media (max-width: 599px) {
  .dialog { width: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .dialog-actions .btn { flex: 1 1 100%; }
}

/* ========== Empty, 404, skeleton ========== */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-10) var(--s-5);
  border: 2px dashed var(--line-2);
  border-radius: var(--r-xl);
  background: var(--paper);
  text-align: center;
}
.empty p { max-width: 38ch; color: var(--ink-2); }
.empty-art { display: grid; place-items: center; width: 116px; height: 116px; margin-bottom: var(--s-2); border-radius: 50%; background: var(--sun-soft); color: var(--navy); }
.empty-art > svg { width: 62%; height: auto; }
.empty-icon { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: var(--sun-soft); color: var(--navy); }
.empty-page { min-height: 55vh; align-content: center; border: 0; background: transparent; }
.big-code { color: var(--navy); font-size: clamp(5rem, 3rem + 10vw, 9rem); font-weight: 900; letter-spacing: -0.06em; line-height: 0.9; text-shadow: 6px 6px 0 var(--sun); }

.skeleton {
  display: block;
  border-radius: var(--r-sm);
  background-color: var(--sand-2);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.75) 50%, rgba(255, 255, 255, 0) 70%);
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: 100% 0;
}
.sk-line { height: 14px; }
.sk-short { width: 55%; }
.sk-title { width: 60%; height: 30px; border-radius: 8px; }
.sk-circle { width: var(--tap); height: var(--tap); border-radius: 50%; }
.sk-block { height: 128px; border-radius: var(--r-lg); }

/* Page loading: app.js adds .is-loading to main while the next page loads */
.main.is-loading { cursor: progress; }
.main.is-loading > * { opacity: 0.5; transition: opacity var(--dur-2) var(--ease-out); }
.main.is-loading::before {
  content: "";
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-image: linear-gradient(90deg, var(--sun), var(--main), var(--sun));
  background-size: 200% 100%;
}

/* ========== Tour ========== */
/* The page itself never scrolls sideways. Only the track scrolls, inside its own snap container.
   Phones: picture capped at about a quarter of the screen so title, text, Next and dots fit.
   900px and wider: picture left, words right. */
.tour {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s-3) var(--gutter) var(--s-6);
  overflow-x: hidden;
  overflow-x: clip;
}
.tour-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); min-width: 0; }
.tour-top { min-width: 0; }
.tour-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-md); }
.tour-skip { min-height: var(--tap); padding: 8px 20px; }
.tour-intro { display: grid; gap: 4px; min-width: 0; }
.tour-intro h1 { font-size: var(--fs-xl); }
.tour-intro .lead { font-size: var(--fs-md); }
.tour-track {
  display: grid;
  grid-auto-columns: 100%;
  grid-auto-flow: column;
  gap: var(--s-4);
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--r-xl);
}
.tour-track::-webkit-scrollbar { display: none; }
.tour-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-3) var(--s-3) var(--s-5);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  text-align: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.tour-art {
  display: grid;
  place-items: center;
  flex: none;
  height: clamp(124px, 24vh, 220px);
  height: clamp(124px, 24svh, 220px);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--main-soft);
}
.tour-card:nth-child(2) .tour-art { background: var(--sun-soft); }
.tour-card:nth-child(3) .tour-art { background: var(--good-bg); }
.tour-card:nth-child(4) .tour-art { background: var(--sand-2); }
.tour-card:nth-child(5) .tour-art { background: var(--violet-soft); }
.tour-art > svg { display: block; width: auto; height: 88%; max-width: 94%; }
.tour-text { display: grid; gap: 6px; min-width: 0; padding: 0 var(--s-2); }
.tour-text h2 { font-size: var(--fs-xl); }
.tour-text .lead { font-size: var(--fs-md); }
.tour-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-2); }
.legend-item {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 10px 4px;
  border: 1px solid var(--tone-line);
  border-radius: var(--r-md);
  background: var(--tone-bg);
  color: var(--tone);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  line-height: 1.25;
  text-align: center;
}
.legend-item .icon { margin-bottom: 2px; }
.legend-item strong { font-size: var(--fs-sm); font-weight: var(--fw-heavy); }
.tour-actions { display: flex; align-items: center; gap: var(--s-3); margin-top: auto; padding: var(--s-1) var(--s-2) 0; }
.tour-actions .btn { flex: 0 0 auto; }
.tour-actions .btn-main { flex: 1 1 auto; }
.tour-spacer { display: none; }
html:not(.js) .tour .dots { display: none; }
.tour-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.tour-nav .dots { grid-column: 1 / -1; }
.dots { display: flex; justify-content: center; }
.dot { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: 50%; background: transparent; }
.dot::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--line-2);
  transition: width var(--dur-3) var(--ease-out), background-color var(--dur-3) var(--ease-out);
}
.dot:hover::before { background: var(--ink-3); }
.dot[aria-current="true"]::before { width: 32px; background: var(--main); }

@media (min-width: 600px) {
  .tour { padding-top: var(--s-5); }
  .tour-intro h1 { font-size: var(--fs-2xl); }
  .tour-intro .lead, .tour-text .lead { font-size: var(--fs-lg); }
  .tour-card { padding: var(--s-4) var(--s-4) var(--s-6); }
  .tour-art { height: clamp(160px, 30vh, 280px); }
  .tour-text h2 { font-size: var(--fs-2xl); }
}
@media (min-width: 900px) {
  .tour { max-width: 1000px; padding-top: var(--s-6); }
  .tour-form { gap: var(--s-4); }
  .tour-card {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "art text" "art actions";
    gap: var(--s-5) var(--s-8);
    padding: var(--s-6);
    text-align: left;
  }
  .tour-art { grid-area: art; height: clamp(260px, 44vh, 360px); }
  .tour-text { grid-area: text; align-self: end; padding: 0; }
  .tour-actions { grid-area: actions; align-self: start; margin: 0; padding: 0; }
  .tour-actions .btn-main { flex: 0 1 auto; min-width: 180px; }
}

/* ========== Sign in ========== */
.signin {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s-5);
  min-height: calc(100dvh - 36px);
  padding: var(--s-6) var(--gutter) var(--s-8);
  background:
    radial-gradient(600px 420px at 0% 0%, rgba(255, 197, 49, 0.28), rgba(255, 197, 49, 0) 65%),
    radial-gradient(520px 420px at 100% 100%, rgba(29, 78, 216, 0.12), rgba(29, 78, 216, 0) 65%);
}
.signin-card { display: grid; width: 100%; max-width: 460px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--paper); box-shadow: var(--shadow-3); }
.signin-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: start;
  gap: var(--s-3);
  padding: var(--s-6);
  background: linear-gradient(160deg, var(--navy-2), var(--navy) 65%);
  color: #fff;
}
.signin-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -50px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 197, 49, 0.45), rgba(255, 197, 49, 0) 70%);
}
.signin-hero h1, .signin-hero .brand { color: #fff; }
.signin-hero p { color: #d9e2f2; }
.signin-hero .brand-mark { background: var(--sun); color: var(--navy); }
.signin-hero .brand-word span { color: var(--sun); }
.signin-art { justify-self: center; width: 100%; max-width: 240px; }
.signin-art > svg { display: block; width: 100%; height: auto; }
.signin-body { display: grid; gap: var(--s-4); padding: var(--s-6); }
.signin-foot { display: grid; gap: 4px; max-width: 460px; color: var(--ink-2); font-size: var(--fs-sm); text-align: center; }
.signin-foot a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: var(--fw-strong); }

/* ========== Page head ========== */
/* The page icon is a small rounded tile. Best inside the h1; as a sibling it lines up with the title line. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-4); }
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-head h1 .icon { color: var(--main); }
.page-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--main-soft);
  color: var(--main);
  box-shadow: inset 0 -3px 0 rgba(29, 78, 216, 0.12);
}
.page-icon > .icon { width: 28px; height: 28px; }
.page-head > .page-icon { align-self: flex-start; margin-top: calc((var(--fs-2xl) * 1.15 - 48px) / 2); }
.page-head > .page-icon + * { flex: 1 1 14rem; min-width: 0; }
.page-head .lead { margin-top: 4px; }
.page-sub { margin-top: 6px; color: var(--ink-2); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ========== Tables and prose ========== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: var(--sand); color: var(--ink-2); font-size: var(--fs-xs); font-weight: var(--fw-heavy); letter-spacing: 0.06em; text-transform: uppercase; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }

.prose { display: grid; gap: var(--s-4); max-width: 68ch; }
.prose h2 { margin-top: var(--s-4); }
.prose ul { display: grid; gap: 6px; padding-left: 1.25em; }

/* ========== Printable invoice ========== */
.invoice {
  display: grid;
  gap: var(--s-6);
  width: min(100% - 2 * var(--gutter), 820px);
  margin: var(--s-6) auto var(--s-6);
  padding: var(--s-6) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-2);
}
@media (min-width: 720px) {
  .invoice { padding: var(--s-10) var(--s-12); }
}
.invoice-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding-bottom: var(--s-5); border-bottom: 3px solid var(--navy); }
.invoice-meta { display: grid; gap: 2px; font-size: var(--fs-sm); }
.invoice-meta strong { font-size: var(--fs-xl); }
.invoice-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-4); font-size: var(--fs-sm); }
.invoice-total { display: flex; align-items: baseline; justify-content: flex-end; gap: var(--s-6); padding-top: var(--s-4); border-top: 2px solid var(--line); font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.print-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); padding: 0 var(--gutter) var(--s-8); }

/* ========== Tones (after components so they win) ========== */
.good { --tone: var(--good); --tone-bg: var(--good-bg); --tone-line: var(--good-line); --tone-solid: var(--good-solid); }
.look { --tone: var(--look); --tone-bg: var(--look-bg); --tone-line: var(--look-line); --tone-solid: var(--look-solid); }
.act { --tone: var(--act); --tone-bg: var(--act-bg); --tone-line: var(--act-line); --tone-solid: var(--act-solid); }
.info { --tone: var(--main); --tone-bg: var(--main-soft); --tone-line: #bccdf6; --tone-solid: var(--main); }
.plain { --tone: var(--ink-2); --tone-bg: var(--sand-2); --tone-line: var(--line-2); --tone-solid: var(--ink-3); }
.violet { --tone: var(--violet); --tone-bg: var(--violet-soft); --tone-line: #d9c8f7; --tone-solid: var(--violet); }
.sky { --tone: var(--sky); --tone-bg: var(--sky-soft); --tone-line: #a9d9e6; --tone-solid: var(--sky); }
.coral { --tone: #a3391f; --tone-bg: var(--coral-soft); --tone-line: #ffc2b0; --tone-solid: var(--coral); }
.sun { --tone: var(--navy); --tone-bg: var(--sun-soft); --tone-line: var(--sun-2); --tone-solid: var(--sun); }

/* ========== Motion ========== */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes sheet { from { opacity: 0; transform: translateY(48px); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes draw { from { stroke-dasharray: 0 100; } }
@keyframes pulse { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes shimmer { to { background-position: 0 0; } }
@keyframes slide-bg { from { background-position: 200% 0; } to { background-position: 0 0; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes wave-hand { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: no-preference) {
  .main > *, .bare-main > * { animation: rise var(--dur-4) var(--ease-out) both; }
  .main > :nth-child(2) { animation-delay: 50ms; }
  .main > :nth-child(3) { animation-delay: 100ms; }
  .main > :nth-child(4) { animation-delay: 150ms; }
  .main > :nth-child(5) { animation-delay: 200ms; }
  .main > :nth-child(n + 6) { animation-delay: 250ms; }
  .flash { animation: pop var(--dur-3) var(--ease-spring) both; }

  .stats > *, .rows > * { animation: rise var(--dur-4) var(--ease-out) both; }
  .stats > :nth-child(2), .rows > :nth-child(2) { animation-delay: 60ms; }
  .stats > :nth-child(3), .rows > :nth-child(3) { animation-delay: 120ms; }
  .stats > :nth-child(4), .rows > :nth-child(4) { animation-delay: 180ms; }
  .rows > :nth-child(n + 5) { animation-delay: 240ms; }

  .spark rect { animation: grow-y var(--dur-4) var(--ease-out) 200ms both; }
  .spark rect:nth-of-type(2) { animation-delay: 240ms; }
  .spark rect:nth-of-type(3) { animation-delay: 280ms; }
  .spark rect:nth-of-type(4) { animation-delay: 320ms; }
  .spark rect:nth-of-type(5) { animation-delay: 360ms; }
  .spark rect:nth-of-type(6) { animation-delay: 400ms; }
  .spark rect:nth-of-type(n + 7) { animation-delay: 440ms; }
  .ring-fill { animation: draw var(--dur-5) var(--ease-out) 200ms both; }
  .bar-fill { animation: grow-x var(--dur-5) var(--ease-out) 150ms both; }
  .funnel-step:nth-child(2) .bar-fill { animation-delay: 300ms; }
  .funnel-step:nth-child(3) .bar-fill { animation-delay: 450ms; }

  .ico.is-live::after { animation: pulse 2.4s var(--ease-out) infinite; }
  .hello-wave { animation: wave-hand 1.8s var(--ease-in-out) 400ms both; }
  .dialog[open] { animation: pop var(--dur-3) var(--ease-out); }
  .dialog[open]::backdrop { animation: fade var(--dur-3) var(--ease-out); }
  .skeleton { animation: shimmer 1.4s linear infinite; }
  .main.is-loading::before { animation: slide-bg 1.1s linear infinite; }
  .tour-track { scroll-behavior: smooth; }
  .tour-card.is-active .tour-art > svg { animation: float 5s var(--ease-in-out) infinite; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 599px) {
  .dialog[open] { animation-name: sheet; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== High contrast ========== */
@media (forced-colors: active) {
  .pill, .tag, .chip, .banner, .row, .stat, .card, .ico, .switch-ui, .reply, .legend-item, .page-icon, .cal { border: 1px solid CanvasText; }
  .chip[aria-current="page"], .chip[aria-current="true"], .switch input:checked + .switch-ui, .dot[aria-current="true"]::before { background: Highlight; }
  .ring-fill { stroke: Highlight; }
  .bar-fill, .spark rect, .wave rect.on, .wave rect.is-played { fill: Highlight; }
}

/* ========== Print ========== */
@media print {
  @page { size: A4; margin: 16mm; }
  body { background: #fff; font-size: 11pt; }
  .skip, .sidebar, .topbar, .tabbar, .foot, .dev-banner, .print-actions, .no-print, .btn { display: none !important; }
  .example-banner { background: none; border: 2px solid #000; color: #000; }
  .page, .bare-main { min-height: 0; padding: 0; }
  .invoice, .card { margin: 0; border-color: #999; box-shadow: none; }
  .invoice { width: 100%; padding: 0; border: 0; }
  .hero { background: none; color: #000; box-shadow: none; border: 2px solid #000; }
  .hero :is(h1, h2, h3, p) { color: #000; }
  a { color: inherit; text-decoration: none; }
  *, *::before, *::after { animation: none !important; }
}

/* QA round 1 overrides (Claude, build-16) */
/*
  QA round 1 overrides. Appended to the end of app.css, so these rules win.
  1. Desktop sidebar runs the full page height and stays sticky.
  2. Home: status card, hero, week chart, attention rows, booking calendar tile, set-up ring.
  3. Mobile: room under the page so the bottom tab bar never covers the last row.
*/

/* ---------- 1. Desktop sidebar ---------- */
@media (min-width: 960px) {
  /* The shell paints the navy column too, so it reaches the bottom of long pages
     (and full page screenshots) while the sidebar itself stays sticky. */
  .has-nav .shell {
    min-height: 100vh;
    min-height: 100dvh;
    background-image: linear-gradient(var(--navy), var(--navy));
    background-repeat: no-repeat;
    background-size: var(--sidebar-w) 100%;
    background-position: left top;
  }
  .has-nav .sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    background-color: var(--navy);
    background-image: radial-gradient(260px 180px at 0% 0%, rgba(255, 197, 49, 0.16), rgba(255, 197, 49, 0) 70%);
  }
}

/* ---------- 3. Mobile: keep content clear of the fixed tab bar ---------- */
@media (max-width: 959px) {
  body.has-nav:not(.is-admin) .page {
    padding-bottom: calc(var(--tabbar-h) + 1px + env(safe-area-inset-bottom, 0px) + var(--s-6));
  }
  html { scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--s-4)); }
}

/* ---------- Home: head and receptionist status ---------- */
.home-head { align-items: center; }
.home-head .hello { flex: 1 1 18rem; min-width: 0; }
.status-card {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5) var(--s-3) var(--s-3);
  border-color: var(--tone-line);
  border-radius: var(--r-xl);
}
@media (max-width: 719px) {
  .home-head .status-card { flex: 1 1 100%; }
}
.traffic { display: block; flex: none; width: 34px; height: 68px; }
.status-card .status { gap: var(--s-2); }
.status-card .status > .icon { color: var(--tone); }
.status-card .status-word { font-size: var(--fs-md); line-height: 1.3; }

/* ---------- Home: the one main action ---------- */
.hero-do { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s-4) var(--s-5); }
.hero-do > .btn { grid-column: 1 / -1; }
.hero-do > .ico { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08); }
.hero-do .hero-title { font-size: var(--fs-2xl); }
@media (min-width: 720px) {
  .hero-do { grid-template-columns: auto minmax(0, 1fr) auto; }
  .hero-do > .btn { grid-column: auto; }
}

/* ---------- Home: this week ---------- */
.week-body { display: grid; gap: var(--s-4); }
@media (min-width: 1100px) {
  .week-body { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: var(--s-6); }
  .week-body .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Week chart: 7 solid bars, value above, day under. Today underlined, days still to come dashed. */
.week-chart {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: var(--s-4) var(--s-3) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--sand);
}
.week-chart svg { display: block; width: 100%; height: auto; min-height: 120px; max-height: 230px; overflow: visible; }
.week-chart figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 0 var(--s-1);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-label);
}
.wc-key { display: inline-flex; align-items: center; gap: 6px; }
.wc-key-mark { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--main); }
.wc-bar { fill: var(--main); }
.wc-zero { fill: var(--line-2); }
.wc-soon { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 3; }
.wc-base { stroke: var(--line-2); stroke-width: 2; stroke-linecap: round; }
.wc-val { fill: var(--ink); font-variant-numeric: tabular-nums; }
.wc-val.is-zero { fill: var(--ink-3); }
.wc-day { fill: var(--ink-2); }
.wc-day.is-today { fill: var(--main); }
.wc-today { fill: var(--main); }

/* ---------- Home: attention rows (whole row taps; pill and action on their own lines) ---------- */
.att-row {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "ico main";
  align-items: start;
  padding: var(--s-4);
}
.att-row > .row-icon { margin-top: 2px; }
.att-row .row-main { gap: var(--s-2); justify-items: start; }
.att-row .row-title { line-height: 1.3; }
.att-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 12px 0 18px;
  border-radius: var(--r-pill);
  background: var(--main-soft);
  color: var(--main);
  font-size: var(--fs-sm);
  font-weight: var(--fw-strong);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.att-go .icon { transition: transform var(--dur-2) var(--ease-out); }
@media (hover: hover) {
  a.att-row:hover .att-go { background: var(--main); color: #fff; }
  a.att-row:hover .att-go .icon { transform: translateX(3px); }
}

/* ---------- Home: next booking ---------- */
.booking { align-items: center; }
.booking-time { font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.booking-job { font-size: var(--fs-lg); font-weight: var(--fw-strong); line-height: 1.3; }
.fact > .icon { color: var(--main); }

/* ---------- Home: set-up ---------- */
.setup-big { font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: -0.02em; }
.disclose > summary.btn { justify-self: start; }
.checklist { display: grid; }
.checklist li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  font-weight: 550;
}
.checklist li:last-child { border-bottom: 0; }
.checklist .is-done .icon { color: var(--good-solid); }
.checklist .is-todo { color: var(--ink-2); }
.checklist .is-todo .icon { color: var(--ink-3); }
.checklist-word { margin-left: auto; font-size: var(--fs-xs); font-weight: var(--fw-heavy); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.checklist .is-done .checklist-word { color: var(--good); }
.checklist .is-todo .checklist-word { color: var(--ink-3); }

/* ---------- Motion (only when people are happy with it) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .wc-bar, .wc-zero { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y var(--dur-4) var(--ease-out) 150ms both; }
  .wc-val { animation: fade var(--dur-3) var(--ease-out) 500ms both; }
  .wc-col:nth-of-type(2) .wc-bar { animation-delay: 190ms; }
  .wc-col:nth-of-type(3) .wc-bar { animation-delay: 230ms; }
  .wc-col:nth-of-type(4) .wc-bar { animation-delay: 270ms; }
  .wc-col:nth-of-type(5) .wc-bar { animation-delay: 310ms; }
  .wc-col:nth-of-type(6) .wc-bar { animation-delay: 350ms; }
  .wc-col:nth-of-type(7) .wc-bar { animation-delay: 390ms; }
}

/* ---------- High contrast and print ---------- */
@media (forced-colors: active) {
  .wc-bar, .wc-today { fill: Highlight; }
  .status-card, .att-go { border: 1px solid CanvasText; }
}
@media print {
  .has-nav .shell { display: block; background: none; }
}
