/* hopastudio admin. Draft, 25 Oct 2026.
   Layout, spacing, sizes and component structure copy the Cloudflare dashboard ("Kumo" design
   system), measured in api/research/cloudflare-dash/SPEC.md and TOKENS.md. Each token keeps
   Cloudflare's role and scale; the colours are hopastudio's (blue #2363E9, night #0B2E8A,
   paper #ECE6E8 / #E5E2E2, ink #111111), the font is Figtree, the mark is the Sweep hare.
   Cloudflare's neutral greys are swapped for the same steps tinted toward our warm paper. */

@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("assets/fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2318;
}
@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("assets/fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02D7-02D9, U+02DB, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =========================================================================================
   Tokens. A comment names the Cloudflare value the token replaces (TOKENS.md).
   ========================================================================================= */
:root {
  color-scheme: light;

  /* brand ramp (hopastudio) */
  --blue-50: #eef3fd;
  --blue-100: #dce7fc;
  --blue-200: #bcd0f8;
  --blue-300: #8fb1f3;
  --blue-400: #5c8ff0;
  --blue-500: #2363e9;          /* brand */
  --blue-600: #1b52c8;
  --blue-700: #1946c2;
  --blue-800: #12379b;
  --blue-900: #0b2e8a;          /* night */
  --lilac-300: #c9c2ff;

  /* the landing page's blue button (hopa-landing/src/theme.css .hopa-primary), used for primary buttons and the
     active menu item (Ovidiu, 25 Oct 2026: "white mode with the gradient we have on the landing page") */
  --hopa-gradient: linear-gradient(#3d7bff, #1f55d6);
  --hopa-gradient-line: #1a4cc4;
  --hopa-gloss: inset 1px 1px 0.25px rgb(255 255 255 / 0.35), inset 0 2px 1px rgb(255 255 255 / 0.35);
  --hopa-glow: 0 4px 12px rgb(35 99 233 / 0.3);
  --hopa-glow-hover: 0 8px 18px rgb(35 99 233 / 0.4);

  /* surfaces */
  --color-canvas: #ffffff;      /* CF #fbfbfb  page, side menu and top bar: white mode (Ovidiu, 25 Oct 2026) */
  --color-elevated: #f8f5f6;    /* CF #f8f8f8  chart cards, hint bars */
  --color-recessed: #f2eeef;    /* CF #f3f3f3  active nav item, segmented track */
  --color-base: #ffffff;        /* CF #ffffff  cards, tables, inputs */
  --color-tint: #f5f2f3;        /* CF #f5f5f5  hover fill */
  --color-control: #ffffff;     /* CF #ffffff  menus, toasts */
  --color-fill: #e5e2e2;        /* CF #e5e5e5  table lines, grey badge (our paper) */
  --color-interact: #d5cfd1;    /* CF #d4d4d4 */
  --color-contrast: #111111;    /* CF #020202 */

  /* lines and focus */
  --color-line: rgb(36 22 28 / 0.11);   /* CF rgba(10,10,10,.10) */
  --color-hairline: #ebe7e8;            /* CF #e9e9e9 */
  --color-focus: var(--blue-900);       /* CF #0b0b0b, input focus ring at 50% */

  /* text */
  --text-default: #171415;      /* CF #171717 */
  --text-strong: #111111;       /* CF #0a0a0a, our ink */
  --text-subtle: #736b6e;       /* CF #737373 */
  --text-placeholder: #a39b9e;  /* CF #a1a1a1 */
  --text-inactive: #cfc8ca;     /* CF #d4d4d4 */
  --text-inverse: #fbf9f9;      /* CF #f5f5f5 */
  --text-link: var(--blue-700); /* CF #193cb8 */

  /* brand and primary button, built the way CF builds theirs */
  --color-brand: var(--blue-500);         /* CF #056dff */
  --color-brand-hover: var(--blue-600);   /* CF #1447e6 */
  --button-primary-bg: color-mix(in oklch, var(--color-brand), white 22%);
  --button-primary-from: color-mix(in oklch, var(--color-brand), white 12%);
  --button-primary-to: var(--color-brand);
  --button-primary-ring: color-mix(in oklch, var(--color-brand), black 12%);

  /* status: text, strong fill, tint (CF hues; info moved to our blue) */
  --text-info: var(--blue-700);   --color-info: var(--blue-500);   --color-info-tint: rgb(35 99 233 / 0.09);
  --text-success: #006045;        --color-success: #009966;        --color-success-tint: oklch(96.2% 0.043 156.7 / 0.75);
  --text-warning: #a35600;        --color-warning: #fa8900;        --color-warning-tint: oklch(95% 0.07 80 / 0.7);
  --text-danger: #c10007;         --color-danger: #e7000b;         --color-danger-tint: oklch(93.6% 0.032 17.7 / 0.6);
  --text-night: var(--blue-900);  --color-night-tint: rgb(201 194 255 / 0.32);

  /* charts (CF #4290f0 series 1, grid #dddddd) */
  --chart-1: var(--blue-500);
  --chart-1-hover: var(--blue-600);
  --chart-today: var(--blue-900);
  --chart-grid: #e2dddf;

  /* type: Figtree in CF's scale. CF weights 400 / 500 / 600 map to our 450 / 550 / 650. */
  --font-sans: Figtree, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 12px;    --leading-xs: 16px;
  --text-sm: 13px;    --leading-sm: 16px;
  --text-base: 14px;  --leading-base: 21px;
  --text-lg: 16px;    --leading-lg: 24px;
  --text-xl: 20px;    --leading-xl: 25px;
  --text-2xl: 24px;   --leading-2xl: 32px;
  --text-3xl: 30px;   --leading-3xl: 36px;
  --weight-regular: 450;
  --weight-medium: 550;
  --weight-semibold: 650;
  --weight-bold: 750;
  --tracking-ui: -0.16px;
  --tracking-title: -0.02em;

  /* spacing: CF 4 px unit */
  --space-0-5: 2px;
  --space-1: 4px;
  --space-1-5: 6px;
  --space-2: 8px;
  --space-2-5: 10px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* borders and shadows (CF draws most borders as a 1 px box-shadow ring) */
  --ring: 0 0 0 1px var(--color-line);
  --shadow-xs: 0 1px 2px 0 rgb(17 17 17 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(17 17 17 / 0.1), 0 2px 4px -2px rgb(17 17 17 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(17 17 17 / 0.1), 0 4px 6px -4px rgb(17 17 17 / 0.1);
  --shadow-dialog: 0 20px 25px -5px rgb(17 17 17 / 0.06), 0 8px 10px -6px rgb(17 17 17 / 0.05);
  --shadow-card: var(--ring), var(--shadow-xs);
  --shadow-popover: var(--ring), var(--shadow-lg);
  --focus-ring: 0 0 0 2px var(--color-base), 0 0 0 4px var(--color-brand);
  --focus-ring-input: 0 0 0 1.5px color-mix(in srgb, var(--color-focus) 50%, transparent);
  --backdrop: color-mix(in srgb, var(--color-recessed) 80%, transparent);

  /* layers */
  --z-topbar: 20;
  --z-backdrop: 40;
  --z-sidebar: 50;
  --z-popover: 100;
  --z-toast: 9999;

  /* motion */
  --dur-1: 100ms;    /* default */
  --dur-2: 150ms;    /* popovers, menus, dialogs */
  --dur-3: 200ms;    /* tabs */
  --dur-4: 250ms;    /* sidebar, drawer, nav colour */
  --dur-5: 500ms;    /* toasts */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-sidebar: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-toast: cubic-bezier(0.22, 1, 0.36, 1);

  /* component sizes */
  --control-sm: 26px;
  --control-base: 36px;
  --control-lg: 40px;
  --control-topbar: 32px;
  --touch: 44px;
  --badge-h: 20px;
  --row-h: 40px;
  --table-head-h: 40px;
  --sidebar-w: 260px;
  --sidebar-w-icon: 57px;
  --sidebar-header-h: 58px;
  --sidebar-footer-h: 48px;
  --nav-item-h: 34px;
  /* side menu option C (27 Oct 2026): folding groups Ads and Socials under Marketing, footer E-mails + Settings.
     Measured values from canvas/ux-tokens/side-menu.md (Linear's sidebar, Obsidian's tree), 27 Oct 2026. */
  --nav-item-pad-x: var(--space-3);           /* ours 12. Linear 7 */
  --nav-item-icon-gap: var(--space-2-5);      /* ours 10. Linear 8 */
  --nav-item-radius: var(--radius-lg);        /* 8, as Linear */
  --nav-item-gap: 2px;                        /* Linear navItems gap */
  --nav-item-dur: var(--dur-1);               /* fill fade 100 ms, Linear quickTransition */
  --nav-hover-bg: var(--color-recessed);
  --nav-active-bg: var(--color-recessed);
  --nav-active-color: var(--text-strong);
  --nav-caret-size: 16px;
  --nav-caret-color: var(--text-placeholder);
  --nav-caret-turn: 90deg;
  --nav-caret-dur: 120ms;
  --nav-caret-ease: var(--ease-standard);
  --nav-sub-h: 28px;                          /* Linear navItem */
  --nav-sub-h-touch: 40px;                    /* phone drawer */
  --nav-sub-font: var(--text-sm);
  --nav-sub-weight: var(--weight-regular);    /* one step under the 550 parent */
  --nav-sub-color: var(--text-default);
  --nav-sub-indent: 38px;                     /* sub text lines up with the parent label: 12 + 16 + 10 */
  --nav-sub-guide: 1px solid var(--color-hairline); /* Obsidian tree guide */
  --nav-sub-guide-x: 20px;                    /* under the parent icon centre: 12 + 16 / 2 */
  --nav-sub-fill-x: 26px;                     /* ours: a sub row's fill starts right of the guide */
  --nav-sub-pad-y: var(--space-0-5);
  --nav-section-font: var(--text-xs);
  --nav-section-leading: 14px;
  --nav-section-pad: 4px 0 4px var(--space-3); /* Linear 4 0 4 6; ours keeps x 12 so labels line up with icons */
  --nav-section-gap-top: var(--space-4);      /* 16, Linear */
  --nav-section-color: var(--text-subtle);
  --nav-label-gap: 2px;
  --nav-fold-gap: 2px;
  --nav-fold-dur: var(--dur-2);               /* 150 ms */
  --nav-fold-ease: var(--ease-standard);
  --nav-dot-size: 6px;
  --nav-dot-color: var(--color-brand);
  --nav-focus-inset: inset 0 0 0 2px var(--color-brand);
  --nav-footer-pad-x: var(--space-3);
  --nav-footer-gap: var(--space-1);
  --nav-footer-pad-y: var(--space-2);
  --topbar-h: 58px;
  --page-panel-w: 400px;
  --page-gutter: 32px;
  --page-gutter-mobile: 16px;
  --section-gap: 24px;
  --content-max: 1536px;
  --palette-w: 672px;
  --dialog-sm: 384px;
  --dialog-md: 512px;
  --dialog-lg: 768px;
}

/* Dark mode on every device, Cloudflare's dark dashboard (Ovidiu, 26 Oct 2026: "make the admin page to be dark mode",
   then "like in Cloudflare, the selection of buttons, as it was there"). The values are Cloudflare's own dark tokens
   (research/cloudflare-dash/TOKENS.md, the [data-mode="dark"] block, checked against 02-desktop-dns-dark-emulated.jpg):
   neutral greys, the active menu item one step lighter than the sidebar, only the main action blue. Our brand blue
   stays the brand colour. It does not follow the system setting. To go back to white, delete this block and set the
   theme-color in index.html to #FFFFFF. On 25 Oct he had asked for white with the landing page's blue gradient. */
:root {
  color-scheme: dark;

  --color-canvas: #030303;      /* page, side menu and top bar */
  --color-elevated: #060606;    /* chart cards, hint bars, zebra rows */
  --color-recessed: #0b0b0b;    /* active and hover menu item, segmented track */
  --color-base: #0f0f0f;        /* cards, tables, inputs, secondary buttons */
  --color-tint: #262626;        /* hover fill, selected row */
  --color-control: #171717;     /* menus, toasts */
  --color-fill: #262626;        /* table lines, grey badge */
  --color-interact: #404040;
  --color-contrast: #fafafa;

  --color-line: #333333;
  --color-hairline: #262626;
  --color-focus: #e9e9e9;

  --text-default: #f5f5f5;
  --text-strong: #fafafa;
  --text-subtle: #a1a1a1;
  --text-placeholder: #737373;
  --text-inactive: #525252;
  --text-inverse: #171717;
  --text-link: #51a2ff;

  --text-info: #51a2ff;           --color-info: #2b7fff;        --color-info-tint: oklch(38% 0.145 265.5 / 0.22);
  --text-success: #a4f4cf;        --color-success: #00d492;     --color-success-tint: oklch(39.3% 0.096 152.3 / 0.2);
  --text-warning: #ff8904;        --color-warning: #db6809;     --color-warning-tint: oklch(35.3% 0.079 65 / 0.37);
  --text-danger: #ff6467;         --color-danger: #e7000b;      --color-danger-tint: oklch(42.9% 0.176 28.7 / 0.17);
  --text-night: var(--lilac-300); --color-night-tint: rgb(201 194 255 / 0.14);

  --chart-1: var(--blue-400);
  --chart-1-hover: var(--blue-300);
  --chart-today: var(--lilac-300);
  --chart-grid: #262626;

  /* Cloudflare's dark shadow: a light edge at 10% and a drop at 30% */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-dialog: 0 0 0 1px rgb(255 255 255 / 0.1), 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* =========================================================================================
   Base
   ========================================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--color-canvas);
  letter-spacing: var(--tracking-ui);
}
html.no-scroll { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-base);
  color: var(--text-default);
  background: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
::selection { background: color-mix(in srgb, var(--color-brand) 22%, transparent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { padding: var(--space-6); }

/* utilities */
.muted { color: var(--text-subtle); }
.small { font-size: var(--text-xs); line-height: var(--leading-xs); }
.strong { font-weight: var(--weight-medium); color: var(--text-strong); }
.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 40ch; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.tone-danger { color: var(--text-danger); }
.tone-warning { color: var(--text-warning); }
.tone-success { color: var(--text-success); }
.link { color: var(--text-link); display: inline-flex; align-items: center; gap: var(--space-1); overflow-wrap: anywhere; min-width: 0; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-strong { font-weight: var(--weight-medium); color: var(--text-strong); }
.link-strong:hover { color: var(--text-link); }
.icon-inline { opacity: 0.7; }
.code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0;
  background: var(--color-canvas);
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-1);
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  border: 1px solid var(--color-fill);
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  color: var(--text-subtle);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: 0;
}

/* =========================================================================================
   Boot and sign-in
   ========================================================================================= */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { border-radius: 9px; animation: pulse 1.2s var(--ease-standard) infinite alternate; }
@keyframes pulse { from { opacity: 0.35; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6) var(--page-gutter-mobile);
  padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
}
.auth-card { width: 100%; max-width: 400px; padding: var(--space-8); border-radius: var(--radius-xl); }
.auth-head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-6); }
.auth-mark { width: 48px; height: 48px; border-radius: var(--radius-xl); }
.auth-title { font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-title); color: var(--text-strong); }
.auth-text { color: var(--text-subtle); }
.auth-form, .auth-actions { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-status:not(:empty) { margin-top: var(--space-4); }
.auth-foot { display: flex; align-items: center; gap: var(--space-1-5); color: var(--text-subtle); font-size: var(--text-xs); }
@media (max-width: 639px) { .auth-card { padding: var(--space-6); } }

/* =========================================================================================
   Shell: sidebar 260 (rail 57), top bar 58, content with 32 px gutters
   ========================================================================================= */
.shell { min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--color-canvas);
  border-right: 1px solid var(--color-line);
  padding-top: env(safe-area-inset-top);
}
.main-col { margin-left: var(--sidebar-w); min-width: 0; }
@media (min-width: 768px) {
  .is-animating .sidebar { transition: width var(--dur-4) var(--ease-sidebar); }
  .is-animating .main-col { transition: margin-left var(--dur-4) var(--ease-sidebar); }
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--sidebar-header-h);
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--color-line);
  flex-shrink: 0;
}
.account {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
  height: 34px;
  padding: 0 var(--space-1-5);
  border-radius: var(--radius-lg);
  transition: background-color var(--dur-1) var(--ease-standard);
}
.account:hover { background: var(--color-recessed); }
.account-mark { width: 24px; height: 24px; border-radius: 6px; }
.account-name { font-size: var(--text-base); font-weight: var(--weight-bold); letter-spacing: -0.01em; color: var(--text-strong); white-space: nowrap; }
.account-tag {
  height: 20px;
  padding: 0 var(--space-1-5);
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px var(--color-fill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 20px;
  color: var(--text-subtle);
}
.sidebar-top .drawer-close { display: none; margin-left: auto; }

.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-3) 14px var(--space-4);
}
.sidebar-search-wrap { margin-bottom: var(--space-4); }
.sidebar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 32px;
  padding: 0 var(--space-1-5) 0 var(--space-2-5);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-base);
  box-shadow: var(--shadow-card);
  color: var(--text-placeholder);
  font-size: var(--text-sm);
  text-align: left;
}
.sidebar-search:hover { color: var(--text-subtle); }
.sidebar-search .nav-label { flex: 1; }

.nav-group + .nav-group { margin-top: var(--nav-section-gap-top); }
.nav-group-label {
  padding: var(--nav-section-pad);
  margin-bottom: var(--nav-label-gap);
  font-size: var(--nav-section-font);
  line-height: var(--nav-section-leading);
  font-weight: var(--weight-medium);
  color: var(--nav-section-color);
  white-space: nowrap;
  overflow: hidden;
}
.nav-list { display: flex; flex-direction: column; gap: var(--nav-item-gap); }
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--nav-item-icon-gap);
  width: 100%;
  min-height: var(--nav-item-h);
  padding: 0 var(--nav-item-pad-x);
  border: 0;
  border-radius: var(--nav-item-radius);
  background: transparent;
  color: var(--text-default);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  font-weight: var(--weight-medium);
  text-align: left;
  white-space: nowrap;
  transition: background-color var(--nav-item-dur) var(--ease-standard), color var(--nav-item-dur) var(--ease-standard);
}
.nav-item:hover { background: var(--nav-hover-bg); }
/* Cloudflare's active item: the hover fill, same text colour and weight, no bar, no blue (26 Oct 2026) */
.nav-item.is-active { background: var(--nav-active-bg); color: var(--nav-active-color); }
.nav-icon { color: var(--text-subtle); }
.nav-item.is-active .nav-icon { color: var(--text-default); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-info-tint);
  color: var(--text-info);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* folding groups (option C): the head is a button row like an item, the caret right after its label (Linear);
   the rows below are 28 px, indented, with no icon and a hairline guide. The body opens with a grid-rows transition;
   closed, it is hidden from tab order and screen readers. */
.nav-fold + .nav-fold { margin-top: var(--nav-fold-gap); }
.nav-fold-head .nav-label { flex: 0 1 auto; }
.nav-fold-chevron {
  width: var(--nav-caret-size);
  height: var(--nav-caret-size);
  margin-left: calc(var(--nav-item-icon-gap) * -0.5);
  color: var(--nav-caret-color);
  transition: transform var(--nav-caret-dur) var(--nav-caret-ease);
}
.nav-fold.is-open .nav-fold-chevron { transform: rotate(var(--nav-caret-turn)); }
.nav-fold-dot { margin-left: auto; width: var(--nav-dot-size); height: var(--nav-dot-size); border-radius: var(--radius-full); background: var(--nav-dot-color); flex-shrink: 0; }
.nav-fold.is-open .nav-fold-dot { display: none; }
.nav-fold-body {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows var(--nav-fold-dur) var(--nav-fold-ease), visibility 0s linear var(--nav-fold-dur);
}
.nav-fold.is-open .nav-fold-body {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows var(--nav-fold-dur) var(--nav-fold-ease), visibility 0s;
}
.nav-fold-list { position: relative; min-height: 0; overflow: hidden; padding: var(--nav-sub-pad-y) 0; }
.nav-fold-list::before {
  content: "";
  position: absolute;
  left: var(--nav-sub-guide-x);
  top: var(--nav-sub-pad-y);
  bottom: var(--nav-sub-pad-y);
  border-left: var(--nav-sub-guide);
  pointer-events: none;
}
/* the list clips an outside ring, so a child row shows its focus ring inside */
.nav-fold-list .nav-item:focus-visible { box-shadow: var(--nav-focus-inset); }
.nav-sub {
  width: auto;
  min-height: var(--nav-sub-h);
  margin-left: var(--nav-sub-fill-x);
  padding-left: calc(var(--nav-sub-indent) - var(--nav-sub-fill-x));
  font-size: var(--nav-sub-font);
  font-weight: var(--nav-sub-weight);
  color: var(--nav-sub-color);
}
.nav-sub.is-active { color: var(--nav-active-color); }
.nav-sub .nav-icon { display: none; }

/* footer: the account pages as normal rows (any number fits), the rail toggle at the right of the last row */
.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: var(--nav-footer-gap);
  min-height: var(--sidebar-footer-h);
  padding: var(--nav-footer-pad-y) var(--nav-footer-pad-x);
  padding-bottom: calc(var(--nav-footer-pad-y) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-line);
}
.sidebar-footer .nav-group { flex: 1; min-width: 0; }
.sidebar-footer .nav-list { flex-direction: column; }
.sidebar-footer .nav-item { width: 100%; min-width: 0; }
.sidebar-footer .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.collapse-toggle {
  flex-shrink: 0;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-subtle);
  transition: background-color var(--dur-1) var(--ease-standard);
}
.collapse-toggle:hover { background: var(--color-recessed); color: var(--text-default); }

/* icon rail (desktop only; the drawer below 768 px always shows labels) */
@media (min-width: 768px) {
  .is-collapsed { --sidebar-w: var(--sidebar-w-icon); }
  .is-collapsed .account-name, .is-collapsed .account-tag, .is-collapsed .nav-label,
  .is-collapsed .nav-group-label, .is-collapsed .sidebar-search .kbd { display: none; }
  .is-collapsed .sidebar-top { padding: 0 var(--space-2); justify-content: center; }
  .is-collapsed .account { flex: 0 0 auto; padding: 0 5px; }
  .is-collapsed .sidebar-body { padding: var(--space-3) var(--space-2); }
  .is-collapsed .sidebar-search { justify-content: center; padding: 0; }
  .is-collapsed .nav-item { justify-content: center; padding: 0; position: relative; }
  .is-collapsed .nav-badge { position: absolute; top: 5px; right: 6px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; background: var(--color-brand); }
  .is-collapsed .nav-group + .nav-group { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-hairline); }
  .is-collapsed .sidebar-footer { flex-direction: column; align-items: stretch; padding: var(--space-2); }
  .is-collapsed .sidebar-footer .nav-list { flex-direction: column; }
  .is-collapsed .sidebar-footer .nav-item { width: 100%; }
  .is-collapsed .collapse-toggle { margin: 0 auto; }
  /* the rail shows every page of every fold, with its icon, and no fold heads */
  .is-collapsed .nav-fold-head { display: none; }
  .is-collapsed .nav-fold-body { grid-template-rows: 1fr; visibility: visible; transition: none; }
  .is-collapsed .nav-sub { margin-left: 0; min-height: var(--nav-item-h); }
  .is-collapsed .nav-sub .nav-icon { display: block; }
  .is-collapsed .nav-fold-list::before { display: none; }
  .is-collapsed .nav-fold + .nav-fold { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-hairline); }
  .is-collapsed .collapse-toggle .icon { transform: scaleX(-1); }
}

/* top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-line);
}
.menu-toggle, .topbar-brand, .topbar-search { display: none !important; }
.breadcrumbs { flex: 1; min-width: 0; }
.breadcrumbs ol { display: flex; align-items: center; gap: var(--space-0-5); min-width: 0; font-size: var(--text-base); }
.breadcrumbs li { display: flex; align-items: center; gap: var(--space-0-5); min-width: 0; }
.breadcrumbs a, .breadcrumbs span { display: inline-flex; align-items: center; gap: var(--space-1-5); white-space: nowrap; }
.breadcrumbs a { color: var(--text-subtle); border-radius: var(--radius-md); padding: 2px var(--space-1-5); }
.breadcrumbs a:hover { color: var(--text-default); background: var(--color-recessed); }
.breadcrumbs .is-current { min-width: 0; }
.breadcrumbs .is-current span { font-weight: var(--weight-medium); color: var(--text-default); padding: 2px var(--space-1-5); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.breadcrumbs .is-current:not(:first-child) .crumb-icon { display: none; }
.crumb-icon { color: var(--text-subtle); }
.crumb-sep { color: var(--text-inactive); width: 20px; height: 20px; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
.topbar .btn { height: var(--control-topbar); }
.topbar-link { padding: 0 var(--space-3) 0 var(--space-2-5); font-size: var(--text-sm); }
.user-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
}
.user-btn:hover { background: var(--color-recessed); }
.user-btn .avatar { border-radius: var(--radius-md); width: 26px; height: 26px; }

/* content */
.content {
  container: content / inline-size;
  max-width: calc(var(--content-max) + 2 * var(--page-gutter));
  padding: var(--space-8) var(--page-gutter) var(--space-12);
}
.page { display: flex; flex-direction: column; gap: var(--section-gap); }

/* drawer below 768 px (CF md) */
.scrim { display: none; }
@media (max-width: 767px) {
  .sidebar {
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-101%);
    visibility: hidden;
    transition: transform var(--dur-4) var(--ease-sidebar), box-shadow var(--dur-4) var(--ease-sidebar), visibility 0s linear var(--dur-4);
  }
  .drawer-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform var(--dur-4) var(--ease-sidebar), box-shadow var(--dur-4) var(--ease-sidebar); }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-backdrop);
    background: var(--backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-4) var(--ease-sidebar);
  }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .main-col { margin-left: 0; }
  .sidebar-top .drawer-close { display: inline-flex; }
  /* the drawer keeps E-mails and Settings; only the rail toggle goes */
  .sidebar-footer .collapse-toggle { display: none; }
  .nav-sub { min-height: var(--nav-sub-h-touch); }
  .nav-item { min-height: var(--touch); font-size: var(--text-base); }
  .sidebar-search { height: var(--touch); font-size: var(--text-base); }
  .sidebar-search .kbd { display: none; }
  .topbar {
    height: 56px;
    gap: var(--space-1);
    padding: 0 max(var(--space-2), env(safe-area-inset-right)) 0 max(var(--space-2), env(safe-area-inset-left));
  }
  .menu-toggle, .topbar-search { display: inline-flex !important; }
  .topbar-brand { display: inline-flex !important; align-items: center; padding: 0 var(--space-1); }
  .topbar-brand img { border-radius: 6px; }
  .topbar-link { display: none !important; }
  .topbar .btn-icon, .user-btn { width: var(--touch); height: var(--touch); }
  .breadcrumbs li:not(:last-child) { display: none; }
  .breadcrumbs .crumb-icon { display: none; }
  .content { padding: var(--space-5) var(--page-gutter-mobile) max(var(--space-12), env(safe-area-inset-bottom)); }
  .page { gap: var(--space-4); }
}

/* =========================================================================================
   Page header (list variant: title 30/36, subtitle 14/21 8 px under, 36 px to the content)
   ========================================================================================= */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.page-heading { min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.page-title { font-size: var(--text-3xl); line-height: var(--leading-3xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-title); color: var(--text-strong); overflow-wrap: anywhere; }
.page-subtitle { color: var(--text-subtle); }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
@media (max-width: 767px) {
  .page-header { margin-bottom: 0; }
  .page-title { font-size: var(--text-2xl); line-height: var(--leading-2xl); }
}

/* =========================================================================================
   Buttons: sm 26, base 36, lg 40; radius 8 (sm 6)
   ========================================================================================= */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  height: var(--control-base);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard), box-shadow var(--dur-1) var(--ease-standard), filter var(--dur-1) var(--ease-standard);
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn-sm { height: var(--control-sm); padding: 0 var(--space-2); gap: var(--space-1); border-radius: var(--radius-md); font-size: var(--text-xs); }
.btn-lg { height: var(--control-lg); padding: 0 var(--space-4); gap: var(--space-2); }
.btn-block { width: 100%; }
.btn-icon { width: var(--control-base); padding: 0; }
.btn-icon.btn-sm { width: var(--control-sm); }
/* Cloudflare's primary button: brand with 12% white down to brand, a ring 12% darker, no glow and no lift (26 Oct 2026) */
.btn-primary {
  color: #fff;
  background-color: var(--button-primary-bg);
  background-image: linear-gradient(180deg, var(--button-primary-from), var(--button-primary-to));
  box-shadow: 0 0 0 1px var(--button-primary-ring), var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) { filter: brightness(0.95); }
.btn-primary:active:not(:disabled) { filter: brightness(0.9); }
.btn-primary:focus-visible { box-shadow: 0 0 0 1px var(--button-primary-ring), var(--focus-ring); }
.btn-secondary { background: var(--color-base); color: var(--text-default); box-shadow: var(--shadow-card); }
.btn-secondary:hover:not(:disabled) { background: var(--color-tint); }
.btn-secondary:focus-visible { box-shadow: var(--ring), var(--focus-ring); }
.btn-ghost { background: transparent; color: var(--text-default); }
.btn-ghost:hover:not(:disabled) { background: var(--color-tint); }
.btn-danger {
  color: #fff;
  background-color: color-mix(in oklch, var(--color-danger), white 18%);
  background-image: linear-gradient(180deg, color-mix(in oklch, var(--color-danger), white 10%), var(--color-danger));
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--color-danger), black 12%), var(--shadow-xs);
}
.btn-danger:hover:not(:disabled) { filter: brightness(0.95); }
.btn-danger-ghost { background: var(--color-base); color: var(--text-danger); box-shadow: var(--shadow-card); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--color-danger-tint); }
.btn.is-busy { cursor: progress; }
.btn.is-busy .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* 26 Oct 2026: the Showed up / No show mark on the Bookings page. */
.outcome { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.outcome .button-row { flex-wrap: nowrap; gap: var(--space-1); }
@media (pointer: coarse), (max-width: 767px) {
  .btn { height: var(--touch); padding: 0 var(--space-4); }
  .btn-sm { height: 36px; padding: 0 var(--space-3); font-size: var(--text-sm); }
  .btn-icon { width: var(--touch); padding: 0; }
  .btn-icon.btn-sm { width: 36px; }
}

/* =========================================================================================
   Badges (20 px pill, 12/550, tint fill and status text), chips, avatar
   ========================================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--badge-h);
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--badge-bg, var(--color-fill));
  color: var(--badge-fg, var(--text-default));
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  vertical-align: middle;
  letter-spacing: 0;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { --badge-fg: var(--text-default); --badge-bg: var(--color-recessed); box-shadow: inset 0 0 0 1px var(--color-fill); }
.badge-neutral .badge-dot { background: var(--text-subtle); }
.badge-success { --badge-fg: var(--text-success); --badge-bg: var(--color-success-tint); }
.badge-warning { --badge-fg: var(--text-warning); --badge-bg: var(--color-warning-tint); }
.badge-danger { --badge-fg: var(--text-danger); --badge-bg: var(--color-danger-tint); }
.badge-info { --badge-fg: var(--text-info); --badge-bg: var(--color-info-tint); }
.badge-accent { --badge-fg: var(--text-night); --badge-bg: var(--color-night-tint); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin-top: var(--space-1); }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-subtle); }
.avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--blue-900) 0%, var(--blue-500) 55%, var(--lilac-300) 100%);
  color: #fff;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }

/* =========================================================================================
   Cards: white, radius 8, 1 px ring and xs shadow; header bar on the canvas, title 14/550
   ========================================================================================= */
.card {
  background: var(--color-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  padding: var(--space-1-5) var(--space-4);
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-heading { min-width: 0; }
.card-title { font-size: var(--text-base); line-height: var(--leading-base); font-weight: var(--weight-medium); color: var(--text-strong); }
.card-subtitle { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); }
.card-actions { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.card-body { padding: var(--space-4); }
.card-flush > .card-body { padding: 0; }
.card-table { overflow: hidden; }
.card-toolbar { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-fill); display: flex; align-items: center; gap: var(--space-3); overflow-x: auto; }

/* stat cards: label 12/16 subtle, value 24/32 semibold */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
.stats-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.stat-link { transition: box-shadow var(--dur-1) var(--ease-standard); }
.stat-link:hover { box-shadow: var(--ring), var(--shadow-md); }
.stat-label { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); font-weight: var(--weight-medium); }
.stat-value { font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-semibold); color: var(--text-strong); letter-spacing: var(--tracking-title); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value.tone-danger { color: var(--text-danger); }
.stat-value.tone-warning { color: var(--text-warning); }
.stat-hint { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); }
@media (max-width: 639px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: var(--space-3); }
}

.grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@container content (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container content (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.section + .section { margin-top: var(--space-4); }
.section-title { margin-bottom: var(--space-2); font-size: var(--text-sm); line-height: var(--leading-sm); font-weight: var(--weight-medium); color: var(--text-subtle); }

/* =========================================================================================
   Chart and bar lists
   ========================================================================================= */
.card-chart { background: var(--color-elevated); }
.card-chart > .card-header { background: transparent; border-bottom: 0; padding-top: var(--space-3); }
.card-chart > .card-body { padding-top: 0; }
.chart { display: flex; flex-direction: column; gap: var(--space-2); }
.chart-readout { font-size: var(--text-sm); color: var(--text-subtle); min-height: 20px; }
.chart-readout strong { color: var(--text-strong); font-weight: var(--weight-semibold); }
.chart-frame { display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--space-2); height: 168px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--text-subtle); text-align: right; font-variant-numeric: tabular-nums; margin: -7px 0; }
.chart-plot { position: relative; min-width: 0; min-height: 0; }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-axis { stroke: var(--chart-grid); stroke-width: 1; }
.chart-bar { fill: var(--chart-1); transition: fill var(--dur-1) var(--ease-standard); }
.chart-bar.is-today { fill: var(--chart-today); }
.chart-hit { fill: transparent; }
.chart-col { outline: none; }
.chart-col:hover .chart-bar, .chart-col:focus .chart-bar { fill: var(--chart-1-hover); }
.chart-col:hover .chart-hit, .chart-col:focus .chart-hit { fill: color-mix(in srgb, var(--color-brand) 7%, transparent); }
.chart-x { display: flex; justify-content: space-between; padding-left: 30px; font-size: 11px; color: var(--text-subtle); }

.bar-list { display: flex; flex-direction: column; gap: var(--space-0-5); }
.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label count" "track track";
  gap: var(--space-1) var(--space-2);
  padding: var(--space-1-5) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
  min-height: 40px;
}
a.bar-row { transition: background-color var(--dur-1) var(--ease-standard); }
a.bar-row:hover { background: var(--color-tint); }
.bar-label { grid-area: label; font-size: var(--text-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-count { grid-area: count; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.bar-track { grid-area: track; height: 4px; border-radius: var(--radius-full); background: var(--color-recessed); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--chart-1); min-width: 2px; }

/* =========================================================================================
   Lists inside cards (rows split by 1 px lines)
   ========================================================================================= */
.list { display: flex; flex-direction: column; }
.list-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: var(--space-2-5) var(--space-4);
  border-bottom: 1px solid var(--color-fill);
}
.list-row:last-child { border-bottom: 0; }
.list-when, .list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-main { align-items: flex-start; }
.list-side { display: flex; align-items: center; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.grid-3 .list-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when side" "main main"; row-gap: var(--space-1); }
.grid-3 .list-when { grid-area: when; }
.grid-3 .list-main { grid-area: main; }
.grid-3 .list-side { grid-area: side; }
@container content (max-width: 639px) {
  .list-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when side" "main main"; }
  .list-when { grid-area: when; }
  .list-main { grid-area: main; }
  .list-side { grid-area: side; }
}
.load-more { display: flex; justify-content: center; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-fill); }

/* =========================================================================================
   Inputs: 36 px, radius 8, 1 px ring; focus adds a 1.5 px ring of the focus colour at 50%
   ========================================================================================= */
.field { display: flex; flex-direction: column; gap: var(--space-1-5); min-width: 0; }
.field-label { font-size: var(--text-sm); line-height: var(--leading-sm); font-weight: var(--weight-medium); color: var(--text-default); }
.field-hint { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); }
.input, .select, .textarea {
  width: 100%;
  height: var(--control-base);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-lg);
  background-color: var(--color-base);
  box-shadow: var(--ring);
  color: var(--text-default);
  font-size: var(--text-base);
  min-width: 0;
  transition: box-shadow var(--dur-1) var(--ease-standard);
}
.input::placeholder, .textarea::placeholder { color: var(--text-placeholder); }
.input:hover, .select:hover, .textarea:hover { box-shadow: 0 0 0 1px var(--color-interact); }
.input:focus, .select:focus, .textarea:focus,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: var(--ring), var(--focus-ring-input); }
.textarea { height: auto; min-height: 84px; padding: var(--space-2) var(--space-3); line-height: var(--leading-base); resize: vertical; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("assets/select-chevron.svg");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.select-sm { height: var(--control-sm); border-radius: var(--radius-md); padding: 0 26px 0 var(--space-2); font-size: var(--text-xs); width: auto; background-position: right 8px center; }
.input-affix { display: flex; align-items: stretch; box-shadow: var(--ring); border-radius: var(--radius-lg); background: var(--color-base); }
.input-affix:focus-within { box-shadow: var(--ring), var(--focus-ring-input); }
.input-affix .affix { display: grid; place-items: center; padding: 0 var(--space-3); background: var(--color-canvas); border-right: 1px solid var(--color-line); border-radius: var(--radius-lg) 0 0 var(--radius-lg); color: var(--text-subtle); }
.input-affix .input, .input-affix .input:hover, .input-affix .input:focus { box-shadow: none; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.form-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.form-status { flex: 1; min-width: 0; }
.inline-form { display: flex; flex-direction: column; gap: var(--space-3); max-width: 480px; }
.inline-error { display: flex; align-items: flex-start; gap: var(--space-1-5); color: var(--text-danger); font-size: var(--text-sm); line-height: 18px; }
.inline-error .icon { margin-top: 1px; }
@media (pointer: coarse), (max-width: 767px) {
  .input, .select { height: var(--touch); font-size: var(--text-lg); }
  .textarea { font-size: var(--text-lg); }
  .select-sm { height: 36px; font-size: var(--text-lg); }
}
@container content (max-width: 479px) { .form-row { grid-template-columns: 1fr; } }

/* =========================================================================================
   Toolbar above a table (CF: search up to 500 px, then controls 8 px apart)
   ========================================================================================= */
.toolbar, .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.page > .toolbar, .page > .filter-bar { margin-bottom: calc(-1 * var(--space-2)); }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.toolbar-right { margin-left: auto; }
.filter-search { position: relative; flex: 1 1 280px; max-width: 500px; margin-right: var(--space-1); }
.filter-search .input-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.input-search { padding-left: 34px; }
.filter-fields { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.filter-fields .select { width: auto; min-width: 132px; }
.filter-source .input { width: 150px; }
.filter-dates { display: flex; align-items: center; gap: var(--space-1-5); }
.filter-dates .input { width: 150px; }
@media (max-width: 767px) {
  .filter-search { flex-basis: 100%; max-width: none; margin-right: 0; }
  .filter-fields { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filter-fields .select, .filter-source .input { width: 100%; min-width: 0; }
  .filter-dates { grid-column: 1 / -1; }
  .filter-dates .input { flex: 1; width: auto; }
  .filter-fields > .btn { grid-column: 1 / -1; }
}

/* =========================================================================================
   Tables: head 40 (white, 14/650), rows 40, cell padding 0 12, 1 px lines, hover canvas
   ========================================================================================= */
.results { position: relative; transition: opacity var(--dur-2) var(--ease-standard); }
.results.is-loading { opacity: 0.55; pointer-events: none; }
.results > .loading { padding: var(--space-4); }
.results > .empty { padding: var(--space-10) var(--space-6); }
.table-summary {
  display: flex;
  align-items: center;
  min-height: 37px;
  padding: var(--space-2) var(--space-4);
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  color: var(--text-subtle);
  font-size: var(--text-base);
}
.table-summary:empty, .table-summary:has(> :empty:only-child) { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-base); }
.table th {
  height: var(--table-head-h);
  padding: 0 var(--space-3);
  background: var(--color-base);
  border-bottom: 1px solid var(--color-fill);
  color: var(--text-strong);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  text-align: left;
  white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: var(--space-4); }
.table th:last-child, .table td:last-child { padding-right: var(--space-4); }
.table td {
  height: var(--row-h);
  padding: var(--space-1-5) var(--space-3);
  border-bottom: 1px solid var(--color-fill);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-1) var(--ease-standard); }
.table tbody tr:hover { background: var(--color-canvas); }
.table .row-link { cursor: pointer; }
.table .align-end { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; }
.table .col-name { min-width: 240px; }
.name-cell { display: flex; align-items: center; gap: var(--space-2-5); min-width: 0; }
.name-text { min-width: 0; max-width: 300px; }
.person-cell { min-width: 0; max-width: 300px; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-fill);
  font-size: var(--text-sm);
}
.pagination-count { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.pagination-controls { display: flex; align-items: center; gap: var(--space-4); }
.pagination-size { display: flex; align-items: center; gap: var(--space-2); color: var(--text-subtle); }
.pager { display: inline-flex; align-items: stretch; height: 32px; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); background: var(--color-base); }
.pager-btn { display: grid; place-items: center; width: 36px; padding: 0; border: 0; border-right: 1px solid var(--color-line); background: transparent; color: var(--text-default); }
.pager-btn:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.pager-btn:last-child { border-right: 0; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.pager-btn:hover:not(:disabled) { background: var(--color-tint); }
.pager-btn:disabled { background: var(--color-canvas); color: var(--text-inactive); cursor: not-allowed; }
.pager-btn:focus-visible { position: relative; z-index: 1; }
.pager-page { display: grid; place-items: center; min-width: 54px; padding: 0 var(--space-2); border-right: 1px solid var(--color-line); font-variant-numeric: tabular-nums; color: var(--text-default); font-size: var(--text-sm); }

/* Under 720 px of content a row becomes a card: the first cell is the title, the rest label and value. */
@container content (max-width: 719px) {
  .table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tr { display: flex; flex-direction: column; gap: var(--space-1-5); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-fill); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); height: auto; min-height: 24px; padding: 0 !important; border: 0; min-width: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--text-subtle); font-size: var(--text-sm); text-align: left; flex-shrink: 0; }
  .table td > * { min-width: 0; }
  .table td.cell-primary { justify-content: flex-start; text-align: left; margin-bottom: var(--space-1); }
  .table td.cell-primary::before { display: none; }
  .table td.col-actions { width: auto; justify-content: flex-end; }
  .table td.col-actions::before { display: none; }
  .table td.hide-mobile { display: none; }
  .table td:empty { display: none; }
  .table .col-name { min-width: 0; }
  .name-text, .person-cell { max-width: none; }
  .table-footer { justify-content: center; }
  .pagination-count { width: 100%; text-align: center; }
  .pagination-size { display: none; }
}
@media (pointer: coarse), (max-width: 767px) {
  .pager { height: var(--touch); }
  .pager-btn { width: var(--touch); }
}

/* =========================================================================================
   Segmented tabs: track 36 (recessed, radius 8, padding 0 2), items 32 (radius 6, 14/550)
   ========================================================================================= */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 2px;
  border-radius: var(--radius-lg);
  background: var(--color-recessed);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-fill) 70%, transparent);
  flex-shrink: 0;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  height: 32px;
  padding: 0 var(--space-2-5);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-subtle);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: background-color var(--dur-3) var(--ease-standard), color var(--dur-3) var(--ease-standard), box-shadow var(--dur-3) var(--ease-standard);
}
.tab:hover { color: var(--text-default); }
.tab.is-active { background: var(--color-base); color: var(--text-strong); box-shadow: var(--ring), var(--shadow-xs); }
.tab-count { font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
@media (pointer: coarse), (max-width: 767px) {
  .tabs { height: var(--touch); }
  .tab { height: 40px; padding: 0 var(--space-3); }
}

/* =========================================================================================
   States: empty (title 16/650, text 14 subtle), error, skeleton
   ========================================================================================= */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); }
.page > .empty { background: var(--color-control); box-shadow: var(--ring); border-radius: var(--radius-xl); padding: var(--space-16) var(--space-10); }
.empty-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: var(--space-1); border-radius: var(--radius-lg); background: var(--color-recessed); color: var(--text-subtle); }
.empty-title { font-size: var(--text-lg); line-height: var(--leading-lg); font-weight: var(--weight-semibold); color: var(--text-strong); }
.empty-text { color: var(--text-subtle); max-width: 560px; overflow-wrap: anywhere; text-wrap: balance; }
.empty .btn { margin-top: var(--space-2); }
.empty-error .empty-icon { color: var(--text-danger); background: var(--color-danger-tint); }
.loading { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) 0; }
.skeleton { height: 14px; width: 72%; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--color-recessed) 0%, var(--color-fill) 50%, var(--color-recessed) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton-wide { width: 38%; height: 24px; }
.skeleton:nth-child(3n) { width: 56%; }
.skeleton:nth-child(4n) { width: 86%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* key-value list: label subtle, value beside it, rows split by 1 px lines */
.kv { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-fill); }
.kv-row:first-child { padding-top: 0; }
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--text-subtle); font-weight: var(--weight-medium); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.block + .block { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.block-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }

/* =========================================================================================
   Person page: main column and a 400 px panel when the content is 880 px or wider
   ========================================================================================= */
.person-header { align-items: flex-start; }
.person-id { display: flex; gap: var(--space-4); min-width: 0; flex: 1; }
.person-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.contact-list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.contact-list li { display: flex; align-items: center; gap: var(--space-1-5); min-width: 0; color: var(--text-subtle); }
.contact-list .link { min-height: 28px; }
.detail-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.detail-main, .detail-side { display: contents; }
.card-deal { order: 1; }
.detail-main > :nth-child(1) { order: 2; }
.card-notes { order: 3; }
.detail-main > :nth-child(2) { order: 4; }
.detail-main > :nth-child(3) { order: 5; }
.detail-main > :nth-child(n + 4) { order: 6; }
.detail-side > :last-child { order: 7; }
@container content (min-width: 880px) {
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--page-panel-w); gap: var(--section-gap); align-items: start; }
  .detail-main, .detail-side { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
}
@container content (max-width: 639px) {
  .person-id { gap: var(--space-3); }
  .person-header .page-actions { width: 100%; }
  .person-header .page-actions .btn { flex: 1; }
}
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); position: relative; padding-bottom: var(--space-4); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px; width: 1px; background: var(--color-fill); }
.timeline-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-canvas); box-shadow: var(--ring); color: var(--text-subtle); }
.timeline-body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; min-width: 0; }
.timeline-title { font-weight: var(--weight-medium); color: var(--text-strong); }
.notes { display: flex; flex-direction: column; margin-top: var(--space-4); }
.note { padding: var(--space-3) 0; border-top: 1px solid var(--color-fill); }
.note:last-child { padding-bottom: 0; }
.note-body { color: var(--text-default); }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-1); }

/* free videos */
.requests { display: flex; flex-direction: column; }
.request { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--color-fill); }
.request:last-child { border-bottom: 0; }
.request-who, .request-when { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; align-items: flex-start; }
.request-action { min-width: 0; }
.send-form { display: flex; flex-direction: column; gap: var(--space-2); }
@container content (min-width: 880px) { .request { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1.4fr); gap: var(--space-4); } }

/* =========================================================================================
   Overlays: dialog (radius 12, 384 / 512 / 768), palette (672, top 89), menu (pad 6), toast
   ========================================================================================= */
dialog { color: var(--text-default); }
.modal {
  width: min(var(--dialog-md), calc(100vw - 32px));
  max-height: calc(100dvh - 128px);
  margin: 64px auto auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--color-base);
  box-shadow: var(--ring), var(--shadow-dialog);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal:not([open]) { display: none; }
.modal-sm { width: min(var(--dialog-sm), calc(100vw - 32px)); }
.modal-lg { width: min(var(--dialog-lg), calc(100vw - 32px)); height: calc(100dvh - 128px); }
.modal::backdrop, .palette::backdrop { background: var(--backdrop); }
.palette::backdrop { background: color-mix(in srgb, var(--color-canvas) 80%, transparent); }
.modal[open], .palette[open] { animation: pop var(--dur-2) var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); }
.modal-title { font-size: var(--text-lg); line-height: var(--leading-lg); font-weight: var(--weight-semibold); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 0 var(--space-5) var(--space-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); flex: 1; min-height: 0; }
.modal-body > p { color: var(--text-subtle); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-line); background: var(--color-canvas); }
.modal-lg .modal-header { border-bottom: 1px solid var(--color-line); }
.modal-lg .modal-body { padding: 0; }
.preview-frame { width: 100%; height: 100%; min-height: 360px; border: 0; background: #fff; display: block; }
@media (max-width: 639px) {
  .modal, .modal-sm, .modal-lg { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-lg { height: 92dvh; }
  .modal-footer { padding-bottom: max(var(--space-3), env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }
}

.palette {
  width: min(var(--palette-w), calc(100vw - 32px));
  margin: 89px auto auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-base);
  box-shadow: var(--ring), var(--shadow-lg);
  overflow: hidden;
}
.palette-field { display: flex; align-items: center; gap: var(--space-3); height: 47px; padding: 0 var(--space-4); border-bottom: 1px solid var(--color-line); color: var(--text-subtle); }
.palette-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: var(--text-base); color: var(--text-default); }
.palette-input::placeholder { color: var(--text-placeholder); }
.palette-input:focus, .palette-input:focus-visible { box-shadow: none; }
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-list { max-height: min(440px, 56dvh); overflow-y: auto; padding: var(--space-2); }
.palette-group { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); font-weight: var(--weight-semibold); }
.palette-group:not(:first-child) { margin-top: var(--space-2); }
.palette-item { display: flex; align-items: center; gap: var(--space-3); min-height: 36px; padding: var(--space-1-5) var(--space-2); border-radius: var(--radius-lg); cursor: pointer; color: var(--text-subtle); }
.palette-item.is-active { background: var(--color-recessed); }
.palette-label { color: var(--text-default); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { flex: 1; font-size: var(--text-sm); color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: var(--space-6); text-align: center; color: var(--text-subtle); }
.palette-foot { display: flex; align-items: center; gap: var(--space-4); height: 44px; padding: 0 var(--space-4); border-top: 1px solid var(--color-line); background: var(--color-elevated); font-size: var(--text-xs); color: var(--text-subtle); }
.palette-foot span { display: inline-flex; align-items: center; gap: var(--space-1); }
@media (max-width: 639px) {
  .palette { margin-top: var(--space-4); }
  .palette-input { font-size: var(--text-lg); }
  .palette-item { min-height: var(--touch); }
  .palette-foot { display: none; }
}

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  z-index: var(--z-popover);
  min-width: 220px;
  padding: var(--space-1-5);
  border-radius: var(--radius-lg);
  background: var(--color-control);
  box-shadow: var(--shadow-popover);
  animation: pop var(--dur-2) var(--ease-out);
  transform-origin: top right;
}
.menu-end { right: 0; }
.menu-start { left: 0; transform-origin: top left; }
.menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 33px; padding: var(--space-1-5) var(--space-2); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-default); font-size: var(--text-base); text-align: left; }
.menu-item .icon { color: var(--text-subtle); }
.menu-item:hover, .menu-item:focus-visible { background: var(--color-tint); box-shadow: none; }
.menu-item.tone-danger, .menu-item.tone-danger .icon { color: var(--text-danger); }
.menu-divider { height: 1px; margin: var(--space-1) calc(-1 * var(--space-1-5)); background: var(--color-hairline); }
@media (pointer: coarse), (max-width: 767px) { .menu-item { min-height: var(--touch); } }

.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-control);
  color: var(--text-default);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-popover);
  animation: toast-in var(--dur-5) var(--ease-toast);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(150%); } to { opacity: 1; transform: none; } }
.toast .icon { color: var(--text-subtle); }
.toast-success .icon { color: var(--color-success); }
.toast-danger .icon { color: var(--color-danger); }
.toast-warning .icon { color: var(--color-warning); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-4) var(--ease-in), transform var(--dur-4) var(--ease-in); }
@media (max-width: 639px) { .toasts { left: var(--space-4); right: var(--space-4); max-width: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* deal card: the stage hint and its reset link */
.stage-hint { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin-top: calc(-1 * var(--space-1)); }
.stage-hint .btn { margin-left: calc(-1 * var(--space-2)); }

/* forms that sit inside a card body: the button stays at the left, under the fields */
.inline-form .form-actions { justify-content: flex-start; }
.inline-form .form-actions .btn { order: -1; }
.kv + .button-row { margin-top: var(--space-4); }

/* the page title takes focus after each route change, for screen readers; it needs no visible ring */
.page-title:focus, .page-title:focus-visible { box-shadow: none; outline: none; }

/* =========================================================================================
   A/B test (modules/ab-test.js, 26 Oct 2026): one table per ad, a number per row, A and B side by side. Three
   columns, so it stays a table on a phone (the card rows of .table are for wide tables).
   ========================================================================================= */
.ab-howto { color: var(--text-subtle); font-size: var(--text-sm); max-width: 760px; }
.ab-summary:empty { display: none; }
.ab-summary p { font-size: var(--text-sm); }
.ab-results { display: flex; flex-direction: column; gap: var(--section-gap); }
.ab-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ab-grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: var(--text-base); }
.ab-grid .ab-col-label { width: 46%; }
.ab-grid .ab-col-arm { width: 27%; }
.ab-grid th, .ab-grid td { padding: var(--space-1-5) var(--space-3); border-bottom: 1px solid var(--color-fill); vertical-align: middle; }
.ab-grid th:first-child { padding-left: var(--space-4); }
.ab-grid th:last-child, .ab-grid td:last-child { padding-right: var(--space-4); }
.ab-grid thead th { height: var(--table-head-h); background: var(--color-base); color: var(--text-strong); font-weight: var(--weight-semibold); text-align: right; }
.ab-grid thead th .badge { vertical-align: middle; }
.ab-page { display: block; margin-top: var(--space-0-5); color: var(--text-subtle); font-size: var(--text-xs); font-weight: var(--weight-regular); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-grid tbody th { text-align: left; font-weight: var(--weight-regular); color: var(--text-default); overflow-wrap: anywhere; }
.ab-grid td { text-align: right; font-variant-numeric: tabular-nums; }
.ab-grid tbody tr:last-child th, .ab-grid tbody tr:last-child td { border-bottom: 0; }
.ab-grid .ab-group th { padding-top: var(--space-3); background: var(--color-canvas); color: var(--text-subtle); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.ab-grid .ab-sub th { padding-left: var(--space-8); color: var(--text-subtle); font-size: var(--text-sm); }
.ab-grid .ab-strong th, .ab-grid .ab-strong .ab-value { font-weight: var(--weight-semibold); color: var(--text-strong); }
.ab-value { display: block; color: var(--text-strong); }
.ab-raw { display: block; color: var(--text-subtle); font-size: var(--text-xs); white-space: nowrap; }
@container content (max-width: 479px) {
  .ab-grid .ab-col-label { width: 42%; }
  .ab-grid .ab-col-arm { width: 29%; }
  .ab-grid th, .ab-grid td { padding-left: var(--space-2); padding-right: var(--space-2); }
  .ab-grid th:first-child { padding-left: var(--space-3); }
  .ab-grid th:last-child, .ab-grid td:last-child { padding-right: var(--space-3); }
  .ab-grid .ab-sub th { padding-left: var(--space-5); }
}

/* =========================================================================================
   Lead page (modules/lead.js, 26 Oct 2026), after "Sam's lead page" in the show-up design: a top card with who and
   the stage pills, the to-dos to send now first, the steps as a compact checklist, the rest folded. On a phone the
   to-dos come first, then the steps, then what they told us and the contact.
   ========================================================================================= */
.lead-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.lead-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lead-who .muted { overflow-wrap: anywhere; }
.lead-name { font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-bold); }
.lead-pills { display: flex; flex-wrap: wrap; gap: var(--space-1-5); align-items: flex-start; }
.lead-grid .detail-side > :first-child { order: 6; }
.lead-grid .detail-side > :last-child { order: 7; }
.lead-now { display: flex; flex-direction: column; gap: var(--space-4); }
.checks { display: flex; flex-direction: column; }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--space-2); align-items: baseline; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-fill); }
.check:first-child { padding-top: 0; }
.check:last-child { border-bottom: 0; padding-bottom: 0; }
.check-mark { font-weight: var(--weight-bold); text-align: center; color: var(--text-subtle); }
.check-done .check-mark { color: var(--text-success); }
.check-open .check-mark { color: var(--text-info); }
.check-failed .check-mark { color: var(--text-danger); }
.check-missed .check-mark { color: var(--text-warning); }
.check-skipped .strong, .check-stopped .strong, .check-missed .strong { color: var(--text-subtle); }
.check-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.check-when { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.check-open .check-when { color: var(--text-info); }
/* 27 Oct 2026: the small Preview button under a step, and under a person's timeline item, that has an e-mail. Its
   icon lines up with the text above, as in .stage-hint. */
.preview-btn { align-self: flex-start; margin-left: calc(-1 * var(--space-2)); }
.todo-card { overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + var(--space-4)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-brand) 45%, var(--color-line)), var(--shadow-xs); }
.todo-card.is-overdue { box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-danger) 55%, var(--color-line)), var(--shadow-xs); }
.todo-card.is-target { box-shadow: 0 0 0 2px var(--color-brand), var(--shadow-md); }
.todo-planned, .todo-done, .todo-skipped, .todo-missed, .todo-stopped { box-shadow: var(--shadow-card); }
.todo-push { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--space-2-5); align-items: center; padding: var(--space-2-5) var(--space-4); background: var(--color-canvas); border-bottom: 1px solid var(--color-line); }
.todo-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--color-info-tint); color: var(--text-info); }
.todo-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-in { display: flex; flex-direction: column; gap: var(--space-2-5); padding: var(--space-4); }
.todo-to { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); overflow-wrap: anywhere; }
.todo-ready { padding: var(--space-2-5) var(--space-3); border: 1px dashed var(--color-line); border-radius: var(--radius-lg); background: var(--color-elevated); color: var(--text-strong); overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.todo-ready:focus-visible { outline: none; box-shadow: var(--focus-ring-input); }
.todo-subject { font-weight: var(--weight-medium); }
.todo-done .todo-ready, .todo-skipped .todo-ready, .todo-missed .todo-ready, .todo-stopped .todo-ready { color: var(--text-subtle); }
.lead-more { overflow: hidden; }
.lead-more-summary { display: flex; align-items: center; min-height: 40px; padding: var(--space-1-5) var(--space-4); cursor: pointer; font-weight: var(--weight-medium); color: var(--text-strong); background: var(--color-canvas); }
.lead-more[open] > .lead-more-summary { border-bottom: 1px solid var(--color-line); }
.lead-more-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); }
.lead-phone { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.select-all { -webkit-user-select: all; user-select: all; font-variant-numeric: tabular-nums; }
@container content (max-width: 639px) {
  .lead-top { padding: var(--space-4); }
  .todo-push { padding: var(--space-2-5) var(--space-3); }
  .todo-in { padding: var(--space-3); }
}

/* =========================================================================================
   Date range picker (lib/date-range.js, 27 Oct 2026), after Cloudflare's time range control: one button with the
   range, a short list of presets, two date boxes only for a custom range, a muted hint with the days. Used on the
   A/B test and People pages. .dr-chip: the quick picks under one date box (Tomorrow, Next Monday).
   ========================================================================================= */
.dr { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.dr-trigger .dr-chevron { color: var(--text-subtle); }
.dr-prefix { color: var(--text-subtle); font-weight: var(--weight-regular); }
.dr-menu .menu { min-width: 208px; }
.dr-menu .menu-item .icon { visibility: hidden; color: var(--text-strong); }
.dr-menu .menu-item[aria-checked="true"] { color: var(--text-strong); font-weight: var(--weight-medium); }
.dr-menu .menu-item[aria-checked="true"] .icon { visibility: visible; }
.dr-custom { display: flex; align-items: center; gap: var(--space-1-5); }
.dr-custom .input { width: 150px; }
.dr-hint { font-size: var(--text-sm); line-height: var(--leading-sm); color: var(--text-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dr-chips { display: flex; flex-wrap: wrap; gap: var(--space-1-5); margin-top: var(--space-1-5); }
.dr-chip {
  height: var(--control-sm);
  padding: 0 var(--space-2-5);
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-base);
  box-shadow: inset 0 0 0 1px var(--color-line);
  color: var(--text-default);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-standard);
}
.dr-chip:hover { background: var(--color-tint); }
.dr-chip[aria-pressed="true"] { background: var(--color-info-tint); color: var(--text-info); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-info) 55%, transparent); }
.dr-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (pointer: coarse) { .dr-chip { height: 36px; padding: 0 var(--space-3); } }
@media (max-width: 767px) {
  .filter-fields > .dr { grid-column: 1 / -1; }
  .dr-custom { flex: 1 1 100%; }
  .dr-custom .input { flex: 1; width: auto; min-width: 0; }
}

/* =========================================================================================
   A/B test, redesign of 27 Oct 2026 (modules/ab-test.js): a verdict with a sample meter, metric tiles with A and B in
   one tile, a funnel and a daily chart in two colours, a by-page list, every number folded. Arm colours checked with
   the dataviz validator on the dark card (#0f0f0f): blue #3c79f0 and orchid #c170bb pass lightness, chroma, colour
   blind separation (protan 9.5) and contrast; every bar also carries its A or B letter.
   ========================================================================================= */
.ab-results { --ab-a: #3c79f0; --ab-b: #c170bb; }
.ab-key { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-semibold); color: var(--text-strong); white-space: nowrap; }
.ab-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--ab-a); flex-shrink: 0; }
.ab-key-b .ab-swatch { background: var(--ab-b); }
.ab-legend { display: flex; align-items: center; gap: var(--space-3); }
.ab-track { display: block; height: 6px; border-radius: var(--radius-full); background: var(--color-fill); overflow: hidden; min-width: 0; }
.ab-fill { display: block; height: 100%; border-radius: inherit; background: var(--ab-a); transition: width var(--dur-4) var(--ease-standard); }
.ab-fill-b { background: var(--ab-b); }

/* verdict: what to do now, then the meter to 300 first visits per arm, then the test in one muted line */
.ab-verdict { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 400px); gap: var(--space-4) var(--space-8); align-items: center; padding: var(--space-4) var(--space-5); }
.ab-verdict-main { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
.ab-verdict-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-lg); background: var(--color-tint); color: var(--text-subtle); }
.ab-verdict-success .ab-verdict-icon { background: var(--color-success-tint); color: var(--text-success); }
.ab-verdict-title { font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-title); color: var(--text-strong); }
.ab-verdict-line { margin-top: var(--space-0-5); font-size: var(--text-sm); line-height: var(--leading-sm); color: var(--text-subtle); }
.ab-meter { display: flex; flex-direction: column; gap: var(--space-2); }
.ab-meter-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 76px; align-items: center; gap: var(--space-2-5); }
.ab-meter .ab-track { height: 8px; }
.ab-meter-count { font-size: var(--text-sm); color: var(--text-subtle); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ab-meter-count strong { color: var(--text-strong); font-weight: var(--weight-semibold); }
.ab-method { grid-column: 1 / -1; padding-top: var(--space-3); border-top: 1px solid var(--color-fill); font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); }

/* tiles: Cloudflare's KPI cards, a label, then A and B side by side with a big number, a thin bar and the count */
.ab-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.ab-tile { display: flex; flex-direction: column; gap: var(--space-2-5); min-width: 0; padding: var(--space-3) var(--space-4) var(--space-4); }
.ab-tile-label { font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-medium); color: var(--text-subtle); cursor: help; }
.ab-tile-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.ab-tile-arm { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ab-tile-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); min-height: 20px; }
.ab-tile-value { font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-title); color: var(--text-strong); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ab-tile .ab-track { height: 4px; }
.ab-tile-sub { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* the funnel and the daily chart sit side by side on a wide screen, the same height */
.ab-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@container content (min-width: 960px) { .ab-charts { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.ab-card.card-chart { display: flex; flex-direction: column; }
.ab-card.card-chart > .card-body { flex: 1; display: flex; flex-direction: column; }
.ab-funnel { display: flex; flex-direction: column; }
.ab-step { display: grid; grid-template-columns: 148px minmax(0, 1fr); align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-fill); }
.ab-step:last-child { border-bottom: 0; padding-bottom: 0; }
.ab-step:first-child { padding-top: 0; }
.ab-step-label { font-size: var(--text-sm); line-height: var(--leading-sm); color: var(--text-default); cursor: help; }
.ab-step-arms { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ab-step-arm { display: grid; grid-template-columns: 22px minmax(0, 1fr) 44px 32px; align-items: center; gap: var(--space-2); }
.ab-step-arm .ab-track { height: 8px; border-radius: var(--radius-sm); }
.ab-step-pct { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-strong); text-align: right; font-variant-numeric: tabular-nums; }
.ab-step-n { font-size: var(--text-xs); color: var(--text-subtle); text-align: right; font-variant-numeric: tabular-nums; }
.ab-daily { flex: 1; }
.ab-daily-plot { position: relative; flex: 1; min-height: 168px; }
.ab-daily-svg { position: absolute; inset: 0; display: block; overflow: visible; }
.ab-axis-text { fill: var(--text-subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.ab-bar-a { fill: var(--ab-a); }
.ab-bar-b { fill: var(--ab-b); }
.ab-day { outline: none; }
.ab-day:hover .chart-hit, .ab-day:focus .chart-hit { fill: color-mix(in srgb, var(--color-brand) 8%, transparent); }
@container content (max-width: 479px) {
  .ab-step { grid-template-columns: minmax(0, 1fr); gap: var(--space-1-5); }
  .ab-verdict { padding: var(--space-4); }
}
@container content (max-width: 719px) { .ab-verdict { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }

/* by page: one row per ad page, the split of first visits as one two-colour bar, then A / B numbers */
.ab-pages { display: flex; flex-direction: column; }
.ab-pages-head, .ab-page-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) minmax(90px, 1fr) repeat(3, 96px); align-items: center; gap: var(--space-4); padding: 0 var(--space-4); }
.ab-pages-head { height: var(--table-head-h); border-bottom: 1px solid var(--color-fill); font-weight: var(--weight-semibold); color: var(--text-strong); }
.ab-pages-head > :nth-child(n + 3) { text-align: right; }
.ab-page-row { width: 100%; min-height: 48px; border: 0; border-bottom: 1px solid var(--color-fill); background: transparent; color: var(--text-default); font: inherit; text-align: left; cursor: pointer; transition: background-color var(--dur-1) var(--ease-standard); }
.ab-page-row:last-child { border-bottom: 0; }
.ab-page-row:hover { background: var(--color-canvas); }
.ab-page-row:focus-visible { outline: none; box-shadow: inset var(--focus-ring-input); }
.ab-page-name { font-weight: var(--weight-medium); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-split { display: flex; gap: 2px; height: 8px; border-radius: var(--radius-full); background: var(--color-fill); overflow: hidden; }
.ab-split .ab-fill { flex: 0 1 0; border-radius: 0; }
.ab-page-cell { display: flex; flex-direction: column; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-page-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@container content (max-width: 639px) {
  .ab-pages-head { display: none; }
  .ab-page-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1-5) var(--space-3); padding: var(--space-3); }
  .ab-page-name, .ab-split { grid-column: 1 / -1; }
  .ab-page-cell { text-align: left; }
  .ab-page-head { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: var(--text-xs); color: var(--text-subtle); }
}

/* all numbers, folded */
.ab-more { overflow: hidden; }
.ab-more-summary { display: flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: var(--space-1-5) var(--space-4); list-style: none; cursor: pointer; font-weight: var(--weight-medium); color: var(--text-strong); background: var(--color-canvas); }
.ab-more-summary::-webkit-details-marker { display: none; }
.ab-more-summary:focus-visible { outline: none; box-shadow: inset var(--focus-ring-input); }
.ab-more-chevron { color: var(--text-subtle); transition: transform var(--dur-2) var(--ease-standard); }
.ab-more[open] .ab-more-chevron { transform: rotate(90deg); }
.ab-more[open] > .ab-more-summary { border-bottom: 1px solid var(--color-line); }
.ab-more-body { display: flex; flex-direction: column; }
.ab-mismatch { display: flex; align-items: center; gap: var(--space-1-5); padding: var(--space-2-5) var(--space-4); border-bottom: 1px solid var(--color-fill); font-size: var(--text-sm); color: var(--text-warning); }
.ab-defs { padding: var(--space-4); border-top: 1px solid var(--color-line); }
.ab-grid thead .ab-key { vertical-align: middle; }
@container content (max-width: 559px) {
  .ab-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .ab-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ab-tile { padding: var(--space-3); gap: var(--space-2); }
  .ab-tile-pair { gap: var(--space-2-5); }
  .ab-tile-value { font-size: var(--text-xl); line-height: var(--leading-xl); }
  .ab-tile-sub { white-space: normal; }
}
@media (max-width: 767px) { .ab-filters .filter-fields > .select { grid-column: 1 / -1; width: 100%; } }
