/*
 * kostiw.com — the shared look (single source of truth for colour, type and the k- components)
 * Docs: docs/theme.md. Wedding brand, two themes. "Festival first, wedding second": bold, editorial, dry.
 *   Dark  "Forest night"  forest-deep paper, forest cards, aubergine for the one special card, cream ink.
 *   Light "Cream stock"   cream paper, lighter cream cards, forest ink, aubergine for strong accents.
 *   Thistle is THE accent, used like a highlighter (active tab, focus, links, key highlights), never a
 *   big fill. On cream it carries text only as --thistle-deep (= --accent in light); plain thistle is for
 *   fills and strokes.
 * Theme: <html data-theme="light|dark"> set before first paint by /internal/theme/theme.js from
 *   localStorage 'kostiw-theme' (absent = System). Without it (no JS) prefers-color-scheme decides.
 *   Dark is the default.
 * Type, by reading distance:
 *   --f-display Antonio (bold, uppercase, condensed): the ONE big thing on a surface (a countdown, a total,
 *               a clock, a page title). Never tracked out; line-height >= 1.05.
 *   --f-mono    JetBrains Mono, uppercase + tracked: labels, times, refs, section heads, tabs, chips.
 *               Floor 11px (12px when it carries data); about 0.1em tracking.
 *   --f-serif   Cormorant Garamond italic: names, greetings, places, empty states. Never for UI text.
 *   --f-ui      Schibsted Grotesk: body and UI (15-16px). --f-head: card / item titles (600).
 * Islands: .k-island (and Tripp's .card-glow / .side-stub) is aubergine in BOTH themes and carries the
 *   dark token set, so everything inside it (text, badges, buttons) just works.
 * Never dim text with opacity: use --ink-2 / --ink-3 (WCAG AA on --bg, --surface and --surface-2).
 *
 * Tripp Go (tripp.html) loads this file before tripp.css and keeps only its layout tokens. Base element
 * styles below are wrapped in :where() (zero specificity) so any page's own CSS wins. Components are
 * opt-in by class (k- prefix) and never style bare elements.
 */

/* ─── Tokens: brand constants, type, metrics (both themes) ─── */
:root {
  --forest: #1f2a1f;
  --forest-deep: #151c15;
  --aubergine: #2b1b2e;
  --cream: #f0e6d2;
  --cream-dim: #d4ccb5;
  --thistle: #a894b5;
  --thistle-deep: #6e5a7e;

  --f-ui: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-head: var(--f-ui);
  --f-display: 'Antonio', 'Oswald', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --f-serif: 'Cormorant Garamond', 'Cormorant', Garamond, 'Iowan Old Style', Georgia, serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r: 22px;          /* cards */
  --r-m: 18px;        /* tiles, inner panels */
  --r-s: 14px;        /* inputs, refs, small panels */
  --r-xs: 10px;       /* icon tiles, kbd */
  --r-pill: 999px;    /* buttons, chips, badges */
  --gap: 14px;        /* between cards */
  --pad: 18px;        /* inside a card */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;
  --tap: 44px;        /* minimum touch target */
  --page-max: 1240px; /* .k-page / .k-shell content width */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(0.2, 0.75, 0.2, 1);
}

/* Dark "Forest night": the default, and the token set of the aubergine islands in both themes */
:root, .k-island, .card-glow, .side-stub {
  --bg: #151c15;
  --surface: #1f2a1f;
  --surface-2: #283428;
  --surface-3: #313e31;
  --side-bg: #111711;
  --line: rgba(240, 230, 210, 0.09);
  --line-2: rgba(240, 230, 210, 0.17);
  --hover: rgba(240, 230, 210, 0.05);
  --ink: #f0e6d2;
  --ink-2: #d4ccb5;
  --ink-3: #a7a892;

  --accent: #a894b5;                          /* thistle: links, active, focus, icons */
  --accent-soft: rgba(168, 148, 181, 0.17);   /* the highlighter fill (ink-coloured text on it) */
  --accent-ink: #151c15;                      /* text on a solid thistle fill */
  --accent-on-soft: #a894b5;                  /* icons on the highlighter fill */
  --accent-2: #d4ccb5;
  --ember: #a894b5;
  --hl: rgba(168, 148, 181, 0.4);             /* highlighter: selection, link underlines */
  --hl-stroke: rgba(168, 148, 181, 0.85);     /* the marker swipe under a countdown / total / active tab */
  --focus: #a894b5;
  --meter: #a894b5;
  --primary: #f0e6d2;                         /* cream on forest, aubergine ink */
  --primary-ink: #2b1b2e;
  --primary-ring: rgba(240, 230, 210, 0.22);
  --primary-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.85);

  --ok: #a9c98c;
  --ok-soft: rgba(169, 201, 140, 0.14);
  --ok-ink: #151c15;
  --warn: #e3b65a;
  --warn-soft: rgba(227, 182, 90, 0.14);
  --warn-ink: #151c15;
  --danger: #f39a86;
  --danger-soft: rgba(243, 154, 134, 0.14);
  --danger-ink: #151c15;
  --info: #86bfc2;
  --sea: #86bfc2;

  /* Journey colours (Tripp): the reception tables were Japan, Bali and Thailand */
  --city-london: #a9a396;
  --city-abudhabi: #d8b98a;
  --city-doha: #c46a78;
  --city-singapore: #5fb8a6;
  --city-bali: #9cbe6e;
  --city-sanur: #6fb0cc;
  --city-bangkok: #e9ae3f;
  --city-osaka: #ef8250;
  --city-kyoto: #e59cc6;
  --city-hakone: #7fa6e6;
  --city-tokyo: #a894b5;
  --city-none: #8f8c7c;
  --city-x1: #d8a06a;
  --city-x2: #7fb0a6;
  --city-x3: #c98aa0;
  --city-x4: #9aa86a;
  --city-x5: #8f9fd0;
  --city-x6: #d9876b;

  --glow-1: rgba(64, 38, 68, 0.55);           /* aubergine dusk at the top of the page */
  --glow-2: rgba(168, 148, 181, 0.07);
  --shadow: 0 1px 0 rgba(240, 230, 210, 0.035) inset, 0 14px 32px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --shadow-dialog: 0 40px 100px -32px rgba(0, 0, 0, 0.82), 0 1px 0 rgba(240, 230, 210, 0.04) inset;
  --scrim: rgba(7, 10, 7, 0.62);
  --grain-opacity: 0.05;
  --toast-bg: #f0e6d2;
  --toast-ink: #151c15;
  --toast-accent: #6e5a7e;

  /* Derived (declared here so each theme and island resolves them against its own values) */
  --ring: 0 0 0 3px var(--accent-soft);       /* focus ring for inputs (with border-color: --focus) */
  /* People: the ONE colour key for every planner screen (dashboard, ORBIT: rails, dots, legends, avatars).
     Alex sea · Lindsey thistle (deep thistle on cream) · both of you sage · work amber. */
  --who-alex: var(--sea);
  --who-lindsey: var(--city-tokyo);
  --who-both: var(--city-bali);
  --who-work: var(--city-bangkok);
  /* Categorical palette (calendars, tags, chart series): tuned per theme, readable as dots, bars and
     2-3px strokes on --bg and --surface. Text in these colours is for >= 18px or bold only. */
  --cat-1: var(--city-singapore);
  --cat-2: var(--city-bangkok);
  --cat-3: var(--city-kyoto);
  --cat-4: var(--city-hakone);
  --cat-5: var(--city-bali);
  --cat-6: var(--city-osaka);
  --cat-7: var(--city-tokyo);
  --cat-8: var(--city-doha);
  --cat-9: var(--city-sanur);
  --cat-10: var(--city-abudhabi);
  --cat-11: var(--city-x2);
  --cat-12: var(--city-x5);

  color-scheme: dark;
}

/* Light "Cream stock". Keep the two blocks below identical: the first is the chosen theme, the second
   the no-JS fallback for System on a light device. */
:root[data-theme='light'] {
  --bg: #f0e6d2;
  --surface: #f8f2e5;
  --surface-2: #eae0ca;
  --surface-3: #e0d4ba;
  --side-bg: #e8ddc6;
  --line: rgba(31, 42, 31, 0.12);
  --line-2: rgba(31, 42, 31, 0.22);
  --hover: rgba(31, 42, 31, 0.055);
  --ink: #1f2a1f;
  --ink-2: #3b4739;
  --ink-3: #545c4d;
  --accent: #6e5a7e;
  --accent-soft: rgba(168, 148, 181, 0.3);
  --accent-ink: #f0e6d2;
  --accent-on-soft: #2b1b2e;
  --accent-2: #3b4739;
  --ember: #6e5a7e;
  --hl: rgba(168, 148, 181, 0.55);
  --hl-stroke: rgba(168, 148, 181, 0.9);
  --focus: #6e5a7e;
  --meter: #6e5a7e;
  --primary: #2b1b2e;
  --primary-ink: #f0e6d2;
  --primary-ring: rgba(43, 27, 46, 0.25);
  --primary-shadow: 0 14px 26px -14px rgba(43, 27, 46, 0.6);
  --ok: #335f25;
  --ok-soft: rgba(51, 95, 37, 0.11);
  --ok-ink: #f8f2e5;
  --warn: #7a5006;
  --warn-soft: rgba(122, 80, 6, 0.11);
  --warn-ink: #f8f2e5;
  --danger: #9c3226;
  --danger-soft: rgba(156, 50, 38, 0.1);
  --danger-ink: #fff8ec;
  --info: #245f63;
  --sea: #245f63;
  --city-london: #6b675d;
  --city-abudhabi: #8c6d3f;
  --city-doha: #93324a;
  --city-singapore: #1f7a6a;
  --city-bali: #55782c;
  --city-sanur: #2a7392;
  --city-bangkok: #966400;
  --city-osaka: #b04a16;
  --city-kyoto: #a2458a;
  --city-hakone: #4862a8;
  --city-tokyo: #6e5a7e;
  --city-none: #77735f;
  --city-x1: #94602c;
  --city-x2: #2f6f63;
  --city-x3: #94506a;
  --city-x4: #5a6a26;
  --city-x5: #4d5f9a;
  --city-x6: #a14a2c;
  --glow-1: rgba(168, 148, 181, 0.2);
  --glow-2: rgba(255, 251, 242, 0.7);
  --shadow: 0 1px 2px rgba(31, 42, 31, 0.06), 0 14px 30px -20px rgba(31, 42, 31, 0.3);
  --shadow-lg: 0 24px 60px -24px rgba(31, 42, 31, 0.42);
  --shadow-dialog: 0 40px 100px -36px rgba(31, 42, 31, 0.5);
  --scrim: rgba(31, 42, 31, 0.42);
  --grain-opacity: 0.045;
  --toast-bg: #1f2a1f;
  --toast-ink: #f0e6d2;
  --toast-accent: #c9b8d4;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f0e6d2;
    --surface: #f8f2e5;
    --surface-2: #eae0ca;
    --surface-3: #e0d4ba;
    --side-bg: #e8ddc6;
    --line: rgba(31, 42, 31, 0.12);
    --line-2: rgba(31, 42, 31, 0.22);
    --hover: rgba(31, 42, 31, 0.055);
    --ink: #1f2a1f;
    --ink-2: #3b4739;
    --ink-3: #545c4d;
    --accent: #6e5a7e;
    --accent-soft: rgba(168, 148, 181, 0.3);
    --accent-ink: #f0e6d2;
    --accent-on-soft: #2b1b2e;
    --accent-2: #3b4739;
    --ember: #6e5a7e;
    --hl: rgba(168, 148, 181, 0.55);
    --hl-stroke: rgba(168, 148, 181, 0.9);
    --focus: #6e5a7e;
    --meter: #6e5a7e;
    --primary: #2b1b2e;
    --primary-ink: #f0e6d2;
    --primary-ring: rgba(43, 27, 46, 0.25);
    --primary-shadow: 0 14px 26px -14px rgba(43, 27, 46, 0.6);
    --ok: #335f25;
    --ok-soft: rgba(51, 95, 37, 0.11);
    --ok-ink: #f8f2e5;
    --warn: #7a5006;
    --warn-soft: rgba(122, 80, 6, 0.11);
    --warn-ink: #f8f2e5;
    --danger: #9c3226;
    --danger-soft: rgba(156, 50, 38, 0.1);
    --danger-ink: #fff8ec;
    --info: #245f63;
    --sea: #245f63;
    --city-london: #6b675d;
    --city-abudhabi: #8c6d3f;
    --city-doha: #93324a;
    --city-singapore: #1f7a6a;
    --city-bali: #55782c;
    --city-sanur: #2a7392;
    --city-bangkok: #966400;
    --city-osaka: #b04a16;
    --city-kyoto: #a2458a;
    --city-hakone: #4862a8;
    --city-tokyo: #6e5a7e;
    --city-none: #77735f;
    --city-x1: #94602c;
    --city-x2: #2f6f63;
    --city-x3: #94506a;
    --city-x4: #5a6a26;
    --city-x5: #4d5f9a;
    --city-x6: #a14a2c;
    --glow-1: rgba(168, 148, 181, 0.2);
    --glow-2: rgba(255, 251, 242, 0.7);
    --shadow: 0 1px 2px rgba(31, 42, 31, 0.06), 0 14px 30px -20px rgba(31, 42, 31, 0.3);
    --shadow-lg: 0 24px 60px -24px rgba(31, 42, 31, 0.42);
    --shadow-dialog: 0 40px 100px -36px rgba(31, 42, 31, 0.5);
    --scrim: rgba(31, 42, 31, 0.42);
    --grain-opacity: 0.045;
    --toast-bg: #1f2a1f;
    --toast-ink: #f0e6d2;
    --toast-accent: #c9b8d4;
    color-scheme: light;
  }
}

/* Aubergine islands (after both themes, so they win on their own element). Text stays cream. */
.k-island, .card-glow, .side-stub {
  --bg: #2b1b2e;
  --surface: #2b1b2e;
  --surface-2: #372539;
  --surface-3: #432f46;
  --line: rgba(240, 230, 210, 0.11);
  --line-2: rgba(240, 230, 210, 0.2);
  --hover: rgba(240, 230, 210, 0.06);
  --ink-3: #bbaabb;
  --accent-soft: rgba(168, 148, 181, 0.2);
  --shadow: 0 1px 0 rgba(240, 230, 210, 0.05) inset, 0 18px 36px -20px rgba(20, 8, 22, 0.75);
  color: var(--ink);
}

/* ─── Base (zero specificity: a page's own rules always win) ─── */
:where(html) {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}
:where(body) {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:where(a) { color: var(--accent); }
:where(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--hl); color: var(--ink); }
[hidden]:not([hidden='until-found']) { display: none !important; }

/* Atmosphere for a page's <body class="k-atmos">: aubergine dusk / paper wash + print grain. Never content.
   <html> carries --bg, so the body goes transparent and the glow sits under the content (z-index -1)
   without the page having to position anything. */
.k-atmos { background: transparent; }
.k-atmos::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 70vh;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 50% -22%, var(--glow-1), transparent 64%),
    radial-gradient(70% 50% at 105% 0%, var(--glow-2), transparent 70%);
}
.k-atmos::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 1.4 -0.2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ─── Type helpers ─── */
.k-display { font: 700 clamp(56px, 12vw, 112px)/1.05 var(--f-display); text-transform: uppercase; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.k-title { font: 600 34px/1.05 var(--f-display); text-transform: uppercase; letter-spacing: 0; margin: 0; }
.k-serif { font-family: var(--f-serif); font-style: italic; font-weight: 500; letter-spacing: -0.005em; }
.k-mono { font-family: var(--f-mono); }
.k-num { font-variant-numeric: tabular-nums; }
.k-muted { color: var(--ink-3); }
.k-small { font-size: 14px; }
.k-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font: 500 11.5px/1.25 var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.k-eyebrow svg { color: var(--accent); flex: none; }
.k-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 2px 8px;
  font: 500 12px/1.2 var(--f-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.k-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--hl);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}
/* Highlighter behind a word or phrase at reading sizes */
.k-hl {
  background: linear-gradient(transparent 62%, var(--hl) 62%, var(--hl) 90%, transparent 90%);
  padding: 0 0.08em;
  margin: 0 -0.04em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* The marker stroke under THE big number (Tripp's countdown): <span class="k-display k-marker">80</span>.
   It sits wholly below the digits at line-height 1.05, so it underlines rather than strikes through. */
.k-marker { position: relative; isolation: isolate; display: inline-block; }
.k-marker::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: -0.03em;
  right: -0.07em;
  bottom: -0.085em;
  height: 0.07em;
  border-radius: 0.04em 0.07em 0.05em 0.08em;
  background: var(--hl-stroke);
  transform: rotate(-1.2deg) skewX(-16deg);
  transform-origin: left center;
}
/* A themed thin scrollbar for an inner scroll area (the page's own follows color-scheme natively) */
.k-scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.k-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.k-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 500 11px/1 var(--f-mono);
}

/* ─── Page frame ─── */
.k-page {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-5) max(16px, var(--safe-r)) calc(var(--sp-8) + var(--safe-b)) max(16px, var(--safe-l));
}
@media (min-width: 768px) { .k-page { padding-left: 32px; padding-right: 32px; } }
/* Wide screens (27" at 2560, ultrawide at 3440): the page grows with the window instead of sitting in a 1240px
   strip. Each app decides how to use the room (more columns, side panes); reading text keeps a sensible measure.
   Tiers: laptop ≤1679 unchanged · 1680+ · 2200+ (27") · 2900+ (ultrawide). --wide is 0/1/2/3 for app CSS. */
:root { --wide: 0; }
@media (min-width: 1680px) { :root { --page-max: 1560px; --wide: 1; } }
@media (min-width: 2200px) { :root { --page-max: 2080px; --wide: 2; } .k-page { padding-left: 48px; padding-right: 48px; } }
@media (min-width: 2900px) { :root { --page-max: 2760px; --wide: 3; } }
.k-stack { display: flex; flex-direction: column; gap: var(--gap); }

/* ─── Shell: the header bar every app shares ───
   <header class="k-shell"> home link (chevron + AK monogram, back to the dashboard) · app name ·
   actions (page buttons, then the theme toggle). theme.js fills an empty [data-k-theme="cycle"]. */
.k-shell {
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(60px + var(--safe-t));
  padding: calc(var(--safe-t) + 8px) max(12px, var(--safe-r), calc((100% - var(--page-max)) / 2 + 12px)) 8px max(10px, var(--safe-l), calc((100% - var(--page-max)) / 2 + 10px));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.k-shell-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap);
  padding: 0 6px 0 2px;
  margin-right: 2px;
  border-radius: 12px;
  color: var(--ink-3);
  text-decoration: none;
  flex: none;
}
.k-shell-home svg { flex: none; transition: transform 0.2s var(--ease); }
.k-monogram {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font: 700 17px/1 var(--f-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--aubergine);
  box-shadow: 0 0 0 1px rgba(168, 148, 181, 0.55) inset, 0 8px 18px -10px rgba(0, 0, 0, 0.6);
}
.k-shell-app { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.k-shell-name {
  font: 700 24px/1.05 var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.k-shell-sub {
  margin-top: 3px;
  font: 500 11px/1.3 var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.k-shell-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
/* London · New York · Mexico City (theme/clocks.js): on the left by the app name and date, each city's
   name over its time, like the name over its sub-line. No room on phones. */
.k-shell-has-clocks .k-shell-app { flex: 0 1 auto; }
.k-shell-clocks {
  display: grid;
  grid-template-rows: auto auto;
  grid-auto-flow: column;
  gap: 3px 18px;
  flex: none;
  margin-right: auto;
  padding: 2px 0 2px 16px;
  border-left: 1px solid var(--line);
  font: 500 11px/1.3 var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-3);
}
.k-shell-clocks > span { display: contents; }
.k-shell-clocks b { font: 600 14px/1.1 var(--f-mono); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
@media (max-width: 719px) {
  .k-shell-clocks { display: none; }
  .k-shell-has-clocks .k-shell-app { flex: 1; }
}

/* Theme toggle: the icon follows <html data-theme-mode> (system | light | dark) */
.k-theme-toggle .k-ic-system,
.k-theme-toggle .k-ic-light,
.k-theme-toggle .k-ic-dark { display: none; }
:root:not([data-theme-mode]) .k-theme-toggle .k-ic-system,
[data-theme-mode='system'] .k-theme-toggle .k-ic-system,
[data-theme-mode='light'] .k-theme-toggle .k-ic-light,
[data-theme-mode='dark'] .k-theme-toggle .k-ic-dark { display: block; }

/* ─── Icon button ─── */
.k-icon-btn {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border-radius: var(--r-pill);
  border: 0;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.k-icon-btn:active { background: var(--surface-2); }
.k-icon-btn[aria-pressed='true'], .k-icon-btn[aria-current='page'] { color: var(--ink); background: var(--accent-soft); }

/* ─── Cards ─── */
.k-card {
  box-sizing: border-box;
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.k-card-tight { padding: 6px 0; }
.k-card-tight > .k-card-head { padding: 12px var(--pad) 4px; }
.k-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.k-card-title { margin: 0; font: 600 19px/1.25 var(--f-head); letter-spacing: -0.012em; }
.k-card-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
/* Clickable card: <a class="k-card k-card-link"> */
a.k-card, .k-card-link { text-decoration: none; cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s; }
a.k-card:active, .k-card-link:active { transform: scale(0.99); }
/* The one special card: <div class="k-card k-island"> (aubergine in both themes, with a thistle glow) */
.k-card.k-island { overflow: hidden; border-color: rgba(168, 148, 181, 0.24); }
.k-card.k-island::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(168, 148, 181, 0.2), transparent 55%),
    radial-gradient(80% 60% at 0% 100%, rgba(10, 4, 12, 0.35), transparent 70%);
}
.k-card.k-island > * { position: relative; }
.k-card-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: linear-gradient(180deg, var(--warn-soft), transparent 70%), var(--surface); }

/* ─── Lists and rows ─── */
.k-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.k-row {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px var(--pad);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
}
.k-row + .k-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--pad);
  right: var(--pad);
  height: 1px;
  background: var(--line);
}
button.k-row, a.k-row { cursor: pointer; }
button.k-row:active, a.k-row:active { background: var(--surface-2); }
.k-row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.k-row-icon.is-accent { background: var(--accent-soft); color: var(--accent-on-soft); }
.k-row-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.k-row-icon.is-warn { background: var(--warn-soft); color: var(--warn); }
.k-row-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.k-row-main { flex: 1; min-width: 0; }
.k-row-title { display: block; font-weight: 500; line-height: 1.32; overflow-wrap: anywhere; }
.k-row-sub { display: block; margin-top: 2px; font-size: 14px; line-height: 1.35; color: var(--ink-3); overflow-wrap: anywhere; }
.k-row-time { flex: none; min-width: 52px; font: 500 15px/1.2 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.k-row-end { flex: none; display: flex; align-items: center; gap: 6px; color: var(--ink-3); }

/* ─── Buttons ─── */
.k-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  font: 600 15px/1 var(--f-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.k-btn:active { transform: scale(0.97); }
.k-btn:disabled, .k-btn[aria-disabled='true'] { opacity: 0.5; cursor: default; transform: none; }
.k-btn svg { flex: none; }
.k-btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
  box-shadow: 0 0 0 1px var(--primary-ring) inset;
}
.k-btn-ghost { background: none; }
.k-btn-danger { background: var(--danger); color: var(--danger-ink); border-color: transparent; }
.k-btn-quiet-danger { background: none; border-color: transparent; color: var(--danger); }
.k-btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.k-btn-block { width: 100%; min-height: 52px; font-size: 16px; }
.k-btn-icon { width: var(--tap); padding: 0; }
.k-btn-icon.k-btn-sm { width: 36px; }
/* Busy: <button class="k-btn" aria-busy="true"> keeps its size, shows a spinner */
.k-btn[aria-busy='true'] { position: relative; color: transparent !important; pointer-events: none; }
.k-btn[aria-busy='true']::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid;
  border-color: var(--ink) transparent var(--ink) transparent;
  animation: k-spin 0.8s linear infinite;
}
.k-btn-primary[aria-busy='true']::after { border-color: var(--primary-ink) transparent var(--primary-ink) transparent; }
.k-btn-danger[aria-busy='true']::after { border-color: var(--danger-ink) transparent var(--danger-ink) transparent; }

/* ─── Chips (filters, toggles) and the segmented control ─── */
.k-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.k-chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding: 2px 0; }
.k-chips-scroll::-webkit-scrollbar { display: none; }
.k-chip {
  box-sizing: border-box;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 500 12.5px/1 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.k-chip[aria-pressed='true'], .k-chip[aria-selected='true'], .k-chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}
.k-chip-sm { min-height: 32px; padding: 0 12px; font-size: 11.5px; }
.k-chip .k-dot { width: 8px; height: 8px; }
.k-chip-count { font: 500 11px/1 var(--f-mono); color: var(--ink-3); }

.k-seg { display: flex; gap: 6px; padding: 4px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.k-seg > .k-chip, .k-seg > button {
  flex: 1;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-color: transparent;
  background: none;
}
.k-seg > [aria-pressed='true'], .k-seg > [aria-selected='true'] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--ink);
}

/* ─── Tabs: <nav class="k-tabs" role="tablist"><button class="k-tab" role="tab" aria-selected="true"> ─── */
.k-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.k-tabs::-webkit-scrollbar { display: none; }
.k-tab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font: 500 12px/1 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.k-tab::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: var(--hl-stroke);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease);
}
.k-tab[aria-selected='true'], .k-tab[aria-current='page'], .k-tab.is-active { color: var(--ink); }
.k-tab[aria-selected='true']::after, .k-tab[aria-current='page']::after, .k-tab.is-active::after { transform: none; }
.k-tab .k-badge { padding: 3px 7px; }

/* ─── Badges and status dots ─── */
.k-badge {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 500 11px/1.15 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.k-badge-accent { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.k-badge-ok { background: var(--ok-soft); color: var(--ok); }
.k-badge-warn { background: var(--warn-soft); color: var(--warn); }
.k-badge-danger { background: var(--danger-soft); color: var(--danger); }
.k-badge-solid { background: var(--primary); color: var(--primary-ink); }
.k-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); vertical-align: middle; }
.k-dot.is-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.k-dot.is-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.k-dot.is-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.k-dot.is-accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.k-dot.is-live { background: var(--accent); animation: k-pulse 1.1s ease-in-out infinite; }

/* Who: <span class="k-who k-who-alex">A</span> · Alex sea, Lindsey thistle, both sage, work amber */
.k-who {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  font: 600 11px/1 var(--f-mono);
}
.k-who-alex { background: color-mix(in srgb, var(--who-alex) 34%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--who-alex) 55%, transparent); }
.k-who-lindsey { background: color-mix(in srgb, var(--who-lindsey) 38%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--who-lindsey) 70%, transparent); }
.k-who-both { background: color-mix(in srgb, var(--who-both) 34%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--who-both) 60%, transparent); }
.k-who-work { background: color-mix(in srgb, var(--who-work) 30%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--who-work) 58%, transparent); }
.k-who-lg { width: 36px; height: 36px; font-size: 14px; }

/* ─── Forms ─── */
.k-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.k-label { font: 500 11.5px/1.25 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.k-hint { font-size: 13px; color: var(--ink-3); }
.k-input, .k-select {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  font: 400 16px/1.35 var(--f-ui);   /* 16px: no iOS zoom on focus */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.k-input::placeholder { color: var(--ink-3); opacity: 1; }
.k-input:focus, .k-select:focus { outline: none; border-color: var(--focus); box-shadow: var(--ring); }
.k-input:disabled, .k-select:disabled { opacity: 0.6; cursor: not-allowed; }
textarea.k-input { min-height: 96px; resize: vertical; }
input[type='date'].k-input, input[type='time'].k-input, input[type='datetime-local'].k-input, .k-input.k-mono { font-family: var(--f-mono); letter-spacing: 0.02em; min-width: 0; }
.k-select {
  padding-right: 40px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.k-select option { background: var(--surface); color: var(--ink); }
.k-field.is-invalid .k-input, .k-field.is-invalid .k-select, .k-input[aria-invalid='true'], .k-select[aria-invalid='true'] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.k-field.is-invalid .k-label { color: var(--danger); }
.k-error { font-size: 14px; color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: var(--r-xs); }
.k-switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.2s;
}
.k-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.22s var(--ease); }
.k-switch:checked { background: var(--accent); border-color: transparent; }
.k-switch:checked::after { transform: translateX(20px); background: var(--accent-ink); }
.k-check { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ─── Progress ─── */
.k-progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.k-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--meter); transition: width 0.6s var(--ease); }

/* ─── Empty state: <div class="k-empty"><svg/><p class="k-empty-title">…</p><p class="k-empty-body">…</p></div> ─── */
.k-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-3);
}
.k-empty > svg { color: var(--accent); }
.k-empty-title { margin: 0; font: italic 500 24px/1.2 var(--f-serif); color: var(--ink-2); }
.k-empty-body { margin: 0; font-size: 15px; max-width: 34ch; }
.k-empty .k-btn { margin-top: 8px; }

/* ─── Toasts: <div class="k-toasts" aria-live="polite"> holds <div class="k-toast"> ─── */
.k-toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 24px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.k-toast {
  box-sizing: border-box;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 520px;
  min-height: 48px;
  padding: 6px 16px;
  border-radius: 16px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font: 500 15px/1.3 var(--f-ui);
  box-shadow: var(--shadow-lg);
  animation: k-rise 0.28s var(--ease) both;
}
.k-toast:has(.k-toast-btn) { padding-right: 6px; }
.k-toast.is-out { animation: k-drop 0.2s ease both; }
.k-toast-error { background: var(--danger); color: var(--danger-ink); }
.k-toast-msg { flex: 1; padding: 6px 0; }
.k-toast-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--toast-accent);
  font: 600 12px/1 var(--f-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.k-toast-error .k-toast-btn { color: var(--danger-ink); text-decoration: underline; }

/* ─── Skeleton: <div class="k-skeleton" style="height:120px"> or .k-skeleton-line ─── */
.k-skeleton {
  display: block;
  min-height: 1em;
  border-radius: var(--r-s);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: k-shimmer 1.6s ease-in-out infinite;
}
.k-skeleton-line { height: 12px; min-height: 0; border-radius: 6px; margin: 6px 0; }
.k-skeleton-line.is-short { width: 45%; }
.k-skeleton-card { height: 140px; border-radius: var(--r); }
.k-card .k-skeleton { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 300% 100%; }

/* ─── Hover (mouse and trackpad only, so a tap never leaves a sticky hover on a phone) ─── */
@media (hover: hover) {
  .k-link:hover { text-decoration-color: var(--accent); }
  .k-shell-home:hover { color: var(--ink); }
  .k-shell-home:hover svg { transform: translateX(-2px); }
  .k-icon-btn:hover { background: var(--hover); color: var(--ink); }
  a.k-card:hover, .k-card-link:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--surface) 92%, var(--ink)); }
  .k-card.k-island:is(a, .k-card-link):hover { border-color: rgba(168, 148, 181, 0.45); }
  button.k-row:hover, a.k-row:hover { background: var(--hover); }
  .k-btn:not(:disabled, [aria-disabled='true']):hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
  .k-btn-primary:not(:disabled, [aria-disabled='true']):hover { background: color-mix(in srgb, var(--primary) 86%, var(--thistle)); border-color: transparent; box-shadow: 0 0 0 1px var(--primary-ring) inset, var(--primary-shadow); }
  .k-btn-ghost:not(:disabled, [aria-disabled='true']):hover { background: var(--hover); }
  .k-btn-danger:not(:disabled, [aria-disabled='true']):hover { background: color-mix(in srgb, var(--danger) 88%, var(--ink)); border-color: transparent; }
  .k-btn-quiet-danger:not(:disabled, [aria-disabled='true']):hover { background: var(--danger-soft); border-color: transparent; }
  .k-chip:not([aria-pressed='true'], [aria-selected='true'], .is-on):hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); }
  .k-tab:hover { color: var(--ink); }
  .k-input:not(:disabled, :focus, [aria-invalid='true']):hover, .k-select:not(:disabled, :focus, [aria-invalid='true']):hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); }
}

/* ─── Motion ─── */
.k-rise > * { animation: k-rise 0.42s var(--ease) both; }
.k-rise > *:nth-child(2) { animation-delay: 0.04s; }
.k-rise > *:nth-child(3) { animation-delay: 0.08s; }
.k-rise > *:nth-child(4) { animation-delay: 0.12s; }
.k-rise > *:nth-child(5) { animation-delay: 0.16s; }
.k-rise > *:nth-child(n + 6) { animation-delay: 0.2s; }

@keyframes k-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes k-drop { to { opacity: 0; transform: translateY(24px); } }
@keyframes k-spin { to { transform: rotate(360deg); } }
@keyframes k-pulse { 50% { opacity: 0.35; } }
@keyframes k-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
