/*
 * Volare dashboard — foundation.
 *
 * Three systems live here and nothing overrides them elsewhere:
 *   1. Type. Ten sizes (--text-2xs … --text-5xl) and one role class per role
 *      (.t-*). No file in this app sets a font-size that is not one of those
 *      tokens; 12px is a hard floor for lowercase text and there is no
 *      viewport scaling of any kind.
 *   2. Surface. Every component surface is a solid colour. Translucency is
 *      reserved for the decorative artwork (.atmos-*, hero-art.svg,
 *      side-art.svg, sparkline fills) and for modal scrims, which cannot do
 *      their job opaque.
 *   3. Spacing. One 4px grid (--s1 … --s8) and one value per relationship:
 *      card padding, card gap, row gap, section rhythm, list row height.
 */
:root {
  /* ---------- Brand palette (Volare brand board 01) ---------- */
  --pearl: var(--dk-b-f8f7f2, #F8F7F2);
  --mist: var(--dk-b-cbd5e1, #CBD5E1);
  --sage: #A7B0A0;
  --alabaster: var(--dk-b-eae6de, #EAE6DE);
  --twilight: #717E8F;
  --ink-900: var(--dk-ink, #1F1F21);

  /* ---------- Surfaces (all opaque) ----------
     Each value is the composite the old translucent rule rendered as over its
     own ground, so the page looks the same and nothing shows through. */
  --bg: var(--dk-b-f3f2f0, #F3F2F0);          /* page ground: warm alabaster-tinted pearl (sampled from the approved design) */
  --side: var(--dk-b-f8f8f7, #F8F8F7);        /* sidebar */
  --card: var(--dk-b-fbfaf8, #FBFAF8);        /* card face: warm near-white */
  --tile: var(--dk-b-fdfcfb, #FDFCFB);        /* tile inside a card */
  --line: var(--dk-l-eaebec, #EAEBEC);        /* hairline, was rgba(31,31,33,.08) */
  --line-2: var(--dk-l-dddedf, #DDDEDF);      /* stronger hairline, was rgba(31,31,33,.14) */
  --line-side: var(--dk-l-eeeff0, #EEEFF0);   /* sidebar edge */
  --hover-side: var(--dk-b-f2f3f4, #F2F3F4);  /* hover on --side */
  --hover-bg: var(--dk-b-e5eaef, #E5EAEF);    /* hover on --bg */
  --hover-tile: var(--dk-b-f4f4f4, #F4F4F4);  /* hover on white */
  --hover-card: var(--dk-b-f6f7f9, #F6F7F9);  /* hover on --card */
  --soft: var(--dk-b-f1f2f4, #F1F2F4);        /* light button fill */
  --soft-hover: var(--dk-b-e7e9ec, #E7E9EC);
  --dashed: var(--dk-l-c6d0dc, #C6D0DC);
  --dashed-hover: #A9B7C8;
  --fill-faint: var(--dk-b-f4f8fb, #F4F8FB);  /* dashed-tile ground, was rgba(255,255,255,.28) */
  --fill-faint-hover: var(--dk-b-f8fbfd, #F8FBFD);

  /* ---------- Text colour roles ---------- */
  --ink: var(--dk-t-2a2b2f, #2A2B2F);              /* body text, icons */
  --ink-strong: var(--ink-900);/* headings */
  --muted: var(--dk-t-5e6b7d, #5E6B7D);            /* secondary text: 4.84:1 on --bg, 5.2:1 on --card (was #6A7686, 4.13:1 on --bg) */
  --faint: var(--dk-t-8a95a3, #8A95A3);            /* placeholder, disabled label (4.5:1 on white) */
  --accent: #5E6B7D;           /* links */
  --accent-soft: var(--dk-b-eef1f6, #EEF1F6);
  --positive: #5F6B57;
  --positive-soft: var(--dk-b-eef0ea, #EEF0EA);
  --button: var(--ink-900);

  /* ---------- Status tokens ----------
     Four meanings, carried identically by pill, dot, ring, row and delta. */
  /* Busy is a neutral ink tint: Classic's one accent is its ink (primary action, current selection), so no blue. */
  --st-busy: #33404F;      --st-busy-bg: var(--dk-b-e9edf1, #E9EDF1);      --st-busy-dot: #717E8F;
  --st-attn: #9A590F;      --st-attn-bg: var(--dk-b-fcefdd, #FCEFDD);      --st-attn-dot: #E08A12;
  --st-done: #2A7A4A;      --st-done-bg: var(--dk-b-e3f4e9, #E3F4E9);      --st-done-dot: #3BA061;
  --st-fail: #A34141;      --st-fail-bg: var(--dk-b-fae8e8, #FAE8E8);      --st-fail-dot: #C55A5A;
  --st-idle: #62625B;      --st-idle-bg: var(--dk-b-efefec, #EFEFEC);      --st-idle-dot: #9A9A8E;

  /* ---------- Type: one family, Geist, in both looks (landing index.html:11, styles.css:17) ---------- */
  --v-font: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-serif: var(--v-font);  /* the old serif role: Geist too, so no look has a serif title */
  --font-sans: var(--v-font);
  --serif: var(--font-serif);  /* legacy aliases */
  --sans: var(--font-sans);

  /* ---------- Type: the only font-size values permitted anywhere ----------
     The older steps are folded onto the four roles below (plus the 12px
     label and the large figure), so a rule written against any step lands
     on the scale. */
  --text-2xs: .75rem;           /* 12 — uppercase label */
  --text-xs:  var(--fs-meta);   /* 15 */
  --text-sm:  var(--fs-meta);   /* 15 */
  --text-md:  var(--fs-body);   /* 16 — body, controls, nav */
  --text-lg:  var(--fs-body);   /* 16 */
  --text-xl:  var(--fs-section);/* 22 — card title */
  --text-2xl: var(--fs-section);/* 22 */
  --text-3xl: 1.75rem;    /* 28 — page title, secondary pages */
  --text-4xl: 2.375rem;   /* 38 — home greeting */
  --text-5xl: 3rem;       /* 48 — display, brand surfaces only */

  /* line-heights */
  --lh-tight: 1.06; --lh-heading: 1.2; --lh-title: 1.3;
  --lh-ui: 1;       --lh-body: 1.5;    --lh-dense: 1.45;

  /* tracking */
  --track-display: -.038em; --track-heading: -.038em; --track-title: -.02em;   /* landing styles.css:43,46 */
  --track-none: 0;          --track-eyebrow: .14em;                           /* landing styles.css:47 */

  /* weights */
  --w-regular: 400; --w-medium: 500; --w-semibold: 600;

  /* measure */
  --measure-body: 65ch; --measure-subtitle: 60ch; --measure-heading: 30ch;

  /* numerals */
  --nums-tabular: tabular-nums;

  /* ---------- Spacing: one 4px grid ---------- */
  --s1: 0.25rem;  /* 4  */
  --s2: 0.5rem;   /* 8  */
  --s3: 0.75rem;  /* 12 */
  --s4: 1rem;     /* 16 */
  --s5: 1.25rem;  /* 22 */
  --s6: 1.5rem;   /* 24 */
  --s7: 2rem;     /* 32 */
  --s8: 2.5rem;   /* 40 */
  --s9: 3rem;     /* 48 */
  --s10: 4rem;    /* 64 */

  /* One value per relationship, used everywhere. */
  --pad-card: 1.5rem;         /* inside a card */
  --gap-card: 1.25rem;        /* card to card, row to row */
  --gap-head: var(--s4);      /* card head to card body */
  --gap-row: var(--s2);       /* list row to list row */
  --gap-inline: var(--s2);    /* button to button, chip to chip */
  --gap-stack: var(--s3);     /* paragraph to paragraph inside a block */
  --gap-section: var(--s6);   /* page section to page section */
  --row-h: 3.5rem;            /* list row height */

  /* One vertical rhythm, top to bottom of a page:
     header -> (tabs ->) cards -> card head -> card contents. */
  --rhythm-head: var(--s7);   /* page title block to the first thing under it */
  --rhythm-tabs: var(--s5);   /* tab or filter row to the cards */
  --rhythm-rows: var(--s3);   /* hairline-separated rows inside a card: padding above and below each */
  --page-gutter: var(--s6);   /* page side margin; grows at large widths (below) */
  --measure: 66ch;            /* running text never runs wider than this */

  /* ---------- Type roles: the strict scale ----------
     Three sizes and two weights do the work on a page (title, section, body);
     meta is the one small size. Shared components read these, never a raw
     step. Set once, here, for both looks; a look only sets colours. */
  --fs-title: clamp(2.125rem, 3.5vw, 3rem);   /* page title, 34-48 */
  --fs-section: 1.375rem;                     /* section and card title, 22 */
  --fs-body: 1rem;                            /* body, controls, 16 */
  --fs-meta: .9375rem;                       /* meta: timestamps, captions, hints, helper and status text, 15 */
  --fs-figure: 2.25rem;                       /* a number shown large (stat tiles), 36 */
  --fw-body: var(--w-regular);
  --fw-strong: var(--w-semibold);
  --font-title: var(--v-font);
  --type-title: 600 var(--fs-title)/1.04 var(--v-font);
  --type-section: 600 var(--fs-section)/1.25 var(--v-font);
  --type-body: var(--fw-body) var(--fs-body)/1.5 var(--font-sans);
  --type-body-strong: var(--fw-strong) var(--fs-body)/1.4 var(--font-sans);
  --type-meta: var(--fw-body) var(--fs-meta)/1.4 var(--font-sans);

  /* ---------- Motion: one short fade/translate, nothing else ---------- */
  --motion: 180ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* ---------- Halftone art (js/halftone.js motifs, the working field) ---------- */
  --ht-dot: var(--twilight);      /* the dots */
  --ht-hi: var(--ink-900);        /* the few that carry the motif's point */

  /* ---------- Shape and controls (landing styles.css:15-16, 55) ---------- */
  --r: 12px;
  --r-sm: 8px;
  --r-xs: 6px;
  --control: 2.75rem;         /* 44px — every control, both looks */
  --control-touch: 2.75rem;   /* 44px — touch-first controls */
  --page-max: 1180px;         /* content column (landing styles.css:50) */
  --shadow: 0 1px 2px rgba(31, 31, 33, 0.03), 0 0.625rem 1.875rem -1.125rem rgba(31, 31, 33, 0.12);
}
/* On phones every shared control grows to the touch size, in both looks. */
@media (max-width: 680px) { :root { --control: var(--control-touch); --page-gutter: var(--s4); } }
/* Wider page margins as the window grows. */
@media (min-width: 1280px) { :root { --page-gutter: var(--s7); } }
@media (min-width: 1680px) { :root { --page-gutter: var(--s9); } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--w-regular) var(--text-md)/var(--lh-dense) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.i { flex: none; display: block; }
[data-icon] { display: inline-flex; }
h1, h2, h3, h4, p { margin: 0; }

/* ============================================================== *
 * TYPE ROLES — components use these, never a raw font-size.
 * ============================================================== */
.t-display    { font: var(--w-regular)  var(--text-5xl)/var(--lh-tight)   var(--font-serif); letter-spacing: var(--track-display); color: var(--ink-strong); max-width: 20ch; }
.t-page       { font: var(--w-medium)   var(--text-4xl)/1.15              var(--font-serif); letter-spacing: var(--track-display); color: var(--ink-strong); max-width: 24ch; }
.t-page-sec   { font: var(--w-medium)   var(--text-3xl)/var(--lh-heading) var(--font-serif); letter-spacing: var(--track-heading); color: var(--ink-strong); max-width: var(--measure-heading); }
.t-subtitle   { font: var(--w-regular)  var(--text-md)/var(--lh-body)     var(--font-sans);  color: var(--muted); max-width: var(--measure-subtitle); }
.t-item       { font: var(--w-medium)   var(--text-2xl)/1.25              var(--font-serif); letter-spacing: var(--track-title); color: var(--ink-strong); }
.t-card       { font: var(--w-medium)   var(--text-xl)/var(--lh-title)    var(--font-serif); letter-spacing: var(--track-title); color: var(--ink-strong); }
.t-sub        { font: var(--w-semibold) var(--text-lg)/1.4                var(--font-sans);  letter-spacing: -0.005em; color: var(--ink-strong); max-width: 40ch; }
.t-body       { font: var(--w-regular)  var(--text-md)/var(--lh-body)     var(--font-sans);  color: var(--ink); max-width: var(--measure-body); }
.t-body-2     { font: var(--w-regular)  var(--text-sm)/var(--lh-dense)    var(--font-sans);  color: var(--muted); max-width: var(--measure-body); }
.t-list-title { font: var(--w-medium)   var(--text-md)/1.4                var(--font-sans);  color: var(--ink-strong); }
.t-list-desc  { font: var(--w-regular)  var(--text-sm)/var(--lh-dense)    var(--font-sans);  color: var(--muted); }
.t-caption    { font: var(--w-regular)  var(--text-xs)/1.4                var(--font-sans);  color: var(--muted); font-variant-numeric: var(--nums-tabular); }
.t-eyebrow    { font: var(--w-medium)   var(--text-2xs)/1.2               var(--font-sans);  letter-spacing: var(--track-eyebrow); text-transform: uppercase; color: var(--muted); }
.t-stat       { font: var(--w-semibold) var(--text-2xl)/1.1               var(--font-sans);  letter-spacing: var(--track-title); color: var(--ink-strong); font-variant-numeric: var(--nums-tabular); }
.t-stat-label { font: var(--w-regular)  var(--text-xs)/1.4                var(--font-sans);  color: var(--muted); }
.t-chip       { font: var(--w-medium)   var(--text-xs)/var(--lh-ui)       var(--font-sans);  font-variant-numeric: var(--nums-tabular); }
.t-button     { font: var(--w-medium)   var(--text-md)/var(--lh-ui)       var(--font-sans); }
.t-nav        { font: var(--w-regular)  var(--text-md)/var(--lh-ui)       var(--font-sans);  color: var(--ink); }
.t-step       { font: var(--w-regular)  var(--text-xs)/1.3                var(--font-sans);  color: var(--muted); }
.t-step.is-active { font-weight: var(--w-semibold); color: var(--ink-strong); }
.t-mono-num   { font-variant-numeric: var(--nums-tabular); }

.muted { color: var(--muted); }

/* The four roles of the strict scale, as classes for page code. */
.type-title   { font: var(--type-title);   letter-spacing: var(--track-display); color: var(--ink-strong); text-wrap: balance; }
.type-section { font: var(--type-section); letter-spacing: var(--track-title);   color: var(--ink-strong); }
.type-body    { font: var(--type-body);    color: var(--ink); }
.type-strong  { font: var(--type-body-strong); color: var(--ink-strong); }
.type-meta    { font: var(--type-meta);    color: var(--muted); font-variant-numeric: var(--nums-tabular); }
/* Running text keeps a readable line length wherever it sits. */
.measure { max-width: var(--measure); }
.measure--narrow { max-width: 48ch; }
/* Spacing utilities on the one scale: a vertical stack and its gaps. */
.stack { display: grid; gap: var(--gap-stack); align-content: start; }
.stack--rows { gap: 0; }
.stack--cards { gap: var(--gap-card); }
/* One state change: a short fade and 6px rise. Off under reduced motion (css/app.css). */
@keyframes ui-in { from { opacity: 0; transform: translateY(6px); } }
.ui-in { animation: ui-in var(--motion) var(--ease) both; }

/* ============================================================== *
 * SHELL
 * ============================================================== */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }

/* ---------- Atmospheric art (the one place translucency is allowed) ------- */
.atmos-slot { position: absolute; pointer-events: none; z-index: 0; }
.atmos { width: 100%; height: 100%; display: block; }
img.atmos-slot { display: block; object-fit: cover; user-select: none; }
/* The wave texture is a header-band decoration only: it starts under the top bar (search, bell, avatar stay on a plain
   ground, so their text and outlines keep full contrast) and fades out above the first card. */
.shell > .atmos-slot--hero {
  top: 3.75rem; right: 0; width: 68.75rem; max-width: 100%; height: 11rem;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 9%), linear-gradient(to bottom, transparent, #000 18%, #000 55%, transparent);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, transparent, #000 9%), linear-gradient(to bottom, transparent, #000 18%, #000 55%, transparent);
          mask-composite: intersect;
}
.atmos-slot--side {
  left: 0; bottom: 0; width: 100%; height: 29.5rem;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%);
          mask-image: linear-gradient(to bottom, transparent, #000 22%);
}

/* The sidebar is a solid surface in Classic; the scenic art stays out of the navigation. */
html[data-look="classic"] .atmos-slot--side { display: none; }

/* ---------- Sidebar ----------
   The column itself runs the full height of the page, so its surface and
   rule never stop short of a long page. Its contents and artwork sit in a
   viewport-high panel that sticks while the page scrolls. */
.sidebar {
  position: relative;
  background: var(--side);
  border-right: 1px solid var(--line-side);
}
.sidebar-inner {
  position: sticky; top: 0; height: 100vh;
  padding: var(--s4);
  overflow: hidden;
}
.logo { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s2); height: var(--control); padding-left: 0; margin-bottom: var(--s6); }
/* The lockup is one step below Home's greeting so the page title leads, and
   it is a control-high row centred on the top bar's search field. The mark is
   gapped so the wordmark's left edge lands on the nav labels' (16 + 36 + 8 = 60). */
.logo-mark { width: 2.25rem; height: auto; display: block; margin-top: -0.125rem; }
.logo span { font: var(--w-regular) var(--text-3xl)/1 var(--font-serif); letter-spacing: var(--track-display); color: var(--ink-strong); }
.nav { position: relative; z-index: 1; display: grid; gap: var(--s1); }
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  height: var(--control); padding: 0 var(--s3);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: var(--w-regular) var(--text-md)/var(--lh-ui) var(--font-sans);
}
.nav-item .i { color: var(--ink); }
.nav-item:hover { background: var(--hover-side); }
.nav-item.is-active { background: var(--dk-b-f1ece8, #F1ECE8); font-weight: var(--w-medium); }

/* ---------- Main ----------
   No zoom, no fit factor, no scale of any kind: the page reflows and, when it
   must, scrolls. One-screen is a layout target at 1440x900 and up, never a
   transform. */
.main {
  position: relative; min-width: 0;
  background: radial-gradient(34rem 11rem at 16rem 10rem, var(--dk-b-ffffffa85, rgba(255, 255, 255, .85)), var(--dk-b-ffffffa0, rgba(255, 255, 255, 0)) 70%);
  display: grid;
  align-content: start;
  row-gap: var(--gap-card);
  padding: var(--s4) var(--page-gutter) var(--s6);
}
.main > * { position: relative; z-index: 1; min-height: 0; }
.main > .hero { z-index: 3; }
.main > .atmos-slot { position: absolute; z-index: 0; }
/* The route outlet's one column never grows past the main column: a page's
   widest unbreakable line wraps or clips inside its own card instead of
   pushing the whole shell sideways. */
.outlet { grid-template-columns: minmax(0, 1fr); }

.topbar { display: flex; justify-content: flex-end; align-items: center; gap: var(--s5); height: var(--control); }
.search {
  display: flex; align-items: center; gap: var(--s2);
  width: 20rem; height: var(--control); padding: 0 var(--s3);
  background: var(--tile);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
}
.search input { border: 0; outline: 0; background: transparent; font: var(--w-regular) var(--text-md)/var(--lh-ui) var(--font-sans); color: var(--ink); width: 100%; }
.search input::placeholder { color: var(--faint); }
.search:focus-within { border-color: var(--mist); box-shadow: 0 0 0 3px rgba(113, 126, 143, 0.16); }
.icon-btn { display: grid; place-items: center; width: var(--control); height: var(--control); border-radius: 50%; color: var(--ink); }
.icon-btn:hover { background: var(--hover-bg); }
.avatar { width: var(--control); height: var(--control); border-radius: 50%; background: var(--line-2); color: var(--ink-strong); font: var(--w-semibold) var(--text-sm)/var(--lh-ui) var(--font-sans); }

/* ---------- Hero ---------- */
.hero { padding: 0 0 var(--s6) var(--s1); margin-top: 0; }
.hero h1 { font: var(--type-title); letter-spacing: var(--track-display); color: var(--ink-strong); text-wrap: balance; }
.hero-sub { margin-top: var(--s1); font: var(--type-body); color: var(--muted); max-width: var(--measure-subtitle); }
.hero-actions { display: flex; align-items: center; gap: var(--gap-inline); margin-top: var(--s5); }

/* ============================================================== *
 * BUTTONS — one system. Every button in the app is .btn plus one
 * variant. Nothing else defines a button's height, padding or font.
 * ============================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2);
  height: var(--control);
  padding: 0 var(--s4);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: var(--w-medium) var(--text-md)/var(--lh-ui) var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), color var(--motion), box-shadow var(--motion);
}
.btn .i { flex: none; }
.btn:focus-visible { outline: 2px solid var(--ink-900); outline-offset: 2px; }
/* Every other focusable control gets the same ring as a button unless it draws its own. */
:where(a, button, [tabindex]:not([tabindex="-1"]), summary, .nav-item, .icon-btn, .avatar):focus-visible { outline: 2px solid var(--ink-900); outline-offset: 2px; }

/* primary — one per content column */
.btn--primary { background: var(--button); color: #fff; border-color: var(--button); box-shadow: 0 0.25rem 0.75rem -0.375rem rgba(31, 31, 33, 0.35); }
.btn--primary:hover { background: #3A3B40; border-color: var(--dk-l-3a3b40, #3A3B40); }
.btn--primary:active { background: #17171A; border-color: var(--dk-l-17171a, #17171A); }

/* secondary / outline */
.btn--outline { background: var(--tile); color: var(--ink); border-color: var(--line-2); }
.btn--outline:hover { background: var(--hover-tile); border-color: var(--dk-l-b7c2d1, #B7C2D1); }
.btn--outline:active { background: var(--soft-hover); }

/* light — a filled quiet button with no border */
.btn--light { background: var(--soft); color: var(--ink-strong); border-color: var(--soft); }
.btn--light:hover { background: var(--soft-hover); border-color: var(--soft-hover); }
.btn--light:active { background: var(--dk-b-dde0e4, #DDE0E4); border-color: var(--dk-l-dde0e4, #DDE0E4); }

/* ghost — no surface until hover */
.btn--ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn--ghost:hover { background: var(--hover-bg); }
.btn--ghost:active { background: var(--hover-card); }

/* danger */
.btn--danger { background: #8C3A3A; color: #fff; border-color: var(--dk-l-8c3a3a, #8C3A3A); }
.btn--danger:hover { background: #7A3131; border-color: var(--dk-l-7a3131, #7A3131); }

/* icon-only — square, still 40px */
.btn--icon, .btn--square { width: var(--control); padding: 0; }
.btn--icon { background: var(--tile); border-color: var(--line-2); color: var(--ink); }
.btn--icon:hover { background: var(--hover-tile); border-color: var(--dk-l-b7c2d1, #B7C2D1); }

/* touch-first size, used where a control is the main target of a card */
.btn--touch { height: var(--control-touch); padding: 0 var(--s5); }
/* a leading button gets a little more room on the trailing side for its label */
.btn--lead { padding: 0 var(--s5) 0 var(--s4); }

.btn--danger:active { background: #6B2B2B; border-color: var(--dk-l-6b2b2b, #6B2B2B); }
.btn--icon:active { background: var(--soft-hover); }

/* Disabled keeps its variant colour at half strength, the same rule in both looks. */
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; box-shadow: none; cursor: not-allowed; pointer-events: none;
}

/* Busy: the label stays, a spinner leads it, and a second press does nothing. */
.btn.is-busy, .btn[aria-busy="true"] { pointer-events: none; cursor: progress; }
.btn.is-busy::before, .btn[aria-busy="true"]::before {
  content: ''; flex: none; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: btn-spin .7s linear infinite;
}
/* An icon-only button swaps its icon for the spinner rather than growing. */
.btn--icon.is-busy, .btn--icon[aria-busy="true"] { font-size: 0; }
.btn--icon.is-busy > *, .btn--icon[aria-busy="true"] > * { display: none; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::before, .btn[aria-busy="true"]::before { animation-duration: 2s; } }

/* ---------- Loading: one skeleton for every page ---------- */
/* A grey block that holds the space its content will fill; the shimmer stops under reduced motion. */
.skel {
  display: block; min-height: 0.875rem; border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--line) 0%, var(--line-2) 50%, var(--line) 100%) 0 0 / 200% 100%;
  animation: skel-shimmer 2.6s ease-in-out infinite;
}
.skel--line { height: 0.875rem; width: 100%; }
.skel--line + .skel--line { margin-top: var(--s2); }
.skel--short { width: 60%; }
.skel--block { height: 6rem; border-radius: var(--r-sm); }
@keyframes skel-shimmer { to { background-position: -200% 0; } }
/* A skeleton holds back 200ms before it shows (css/states.css), so a fast answer never flashes one. */
@keyframes skel-appear { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
:root[data-motion="reduce"] .skel { animation: none; }

/* ---------- Scrollbars and selection ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--mist); }
::selection { background: var(--hover-bg); color: var(--ink-strong); }

/* Link: a button's quiet sibling, at the surrounding size. */
.link { display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--text-sm); font-weight: var(--w-medium); color: var(--dk-tx-accent, var(--accent)); white-space: nowrap; }
.link:hover { color: var(--ink-strong); }
.link:focus-visible { outline: 2px solid var(--dk-tx-accent, var(--accent)); outline-offset: 2px; border-radius: var(--r-xs); }

/* ---------- Start-from menu ---------- */
.start-from { position: relative; }
.menu {
  position: absolute; left: calc(100% + var(--s3)); top: 50%;
  width: 12rem; padding: var(--s2) var(--s1);
  display: grid;
  background: var(--tile);
  border-radius: var(--r-sm);
  box-shadow: 0 1px 2px rgba(31, 31, 33, 0.06), 0 1rem 2.5rem -0.75rem rgba(31, 31, 33, 0.24);
  z-index: 5;
  opacity: 0; visibility: hidden; transform: translate(-0.375rem, -50%);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.menu::before {
  content: ''; position: absolute; left: -0.375rem; top: calc(50% - 0.375rem);
  width: 0.75rem; height: 0.75rem; background: var(--tile); transform: rotate(45deg);
}
.menu::after { content: ''; position: absolute; left: -1rem; top: 0; width: 1rem; height: 100%; }
.start-from:hover .menu, .start-from:focus-within .menu, .menu-open .menu {
  opacity: 1; visibility: visible; transform: translate(0, -50%);
  transition: opacity .16s ease, transform .16s ease;
}
.menu a { position: relative; display: flex; align-items: center; gap: var(--s3); height: var(--control); padding: 0 var(--s3); border-radius: var(--r-xs); font-size: var(--text-md); color: var(--ink); }
.menu a .i { color: var(--ink); }
.menu a:hover, .menu a:focus-visible { background: var(--accent-soft); outline: none; }

/* ============================================================== *
 * CARDS
 * ============================================================== */
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: var(--pad-card);
  min-height: 0;
}
.card-title { font: var(--type-section); letter-spacing: var(--track-title); color: var(--ink-strong); display: flex; align-items: center; gap: var(--s2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 1.75rem; }
.card-body { flex: 1; min-height: 0; margin-top: var(--gap-head); }

.row { display: grid; gap: var(--gap-card); min-height: 0; align-items: start; }
.row > .card { min-width: 0; }
.row--2 { grid-template-columns: minmax(0, 743fr) minmax(0, 612fr); }
.row--3 { grid-template-columns: minmax(0, 420fr) minmax(0, 480fr) minmax(0, 440fr); }

/* ---------- Current video ---------- */
/* One card: the artwork, what the video is and what to do, and where the edit
   stands. The progress panel is a filled tile that takes the card's full
   height, so the row never leaves a hole beside a shorter column. */
.current-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(16rem, 22rem); gap: var(--s5); align-items: stretch; margin-top: var(--gap-head); }
.current-grid > .thumb--lg { align-self: start; }
.current-main { min-width: 0; display: flex; flex-direction: column; }
.cur-progress {
  min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: var(--s4);
  /* One surface per region: the progress column is set off by a single
     hairline and space, not by a panel of its own. */
  padding: var(--s2) 0 var(--s2) var(--s5);
  border-left: 1px solid var(--line-2);
}
/* Below the desktop width the progress panel runs full width under the video. */
@media (max-width: 1279px) {
  .current-grid { grid-template-columns: auto minmax(0, 1fr); }
  .cur-progress { grid-column: 1 / -1; padding: var(--s4) 0 0; border-left: 0; border-top: 1px solid var(--line-2); }
}
@media (max-width: 680px) {
  .current-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .current-grid > .thumb--lg { width: 100%; }
}
.thumb { position: relative; overflow: hidden; background: var(--alabaster); }
.thumb svg { display: block; width: 100%; height: 100%; }
.thumb--lg { flex: 0 0 auto; width: 17.5rem; aspect-ratio: 16 / 9; border-radius: var(--r-sm); }
.thumb-art { position: absolute; inset: 0; }
.duration {
  position: absolute; right: var(--s2); bottom: var(--s2);
  padding: 0.125rem 0.375rem; border-radius: 0.375rem;
  background: #33404F; color: #fff;
  font: var(--w-medium) var(--text-xs)/var(--lh-ui) var(--font-sans);
  font-variant-numeric: var(--nums-tabular);
}
.current-info { min-width: 0; display: flex; flex-direction: column; gap: var(--s2); }
.current-info h3 { font: var(--type-section); color: var(--ink-strong); letter-spacing: var(--track-title); }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: var(--text-xs); }
.meta > .t-caption { font-variant-numeric: var(--nums-tabular); }
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 1.5rem; padding: 0 var(--s2) 0 0.625rem; border-radius: 0.75rem;
  background: var(--accent-soft); color: var(--ink);
  font: var(--w-medium) var(--text-xs)/var(--lh-ui) var(--font-sans);
}
.pip { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--twilight); }
.status-line { font-size: var(--text-md); line-height: var(--lh-body); color: var(--ink); max-width: var(--measure-body); }
.actions { display: flex; gap: var(--gap-inline); margin-top: var(--s2); }

/* ---------- Stepper ---------- */
.stepper { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s2); font: var(--w-regular) var(--text-xs)/1.3 var(--font-sans); color: var(--muted); text-align: center; }
.step::before { content: ''; position: absolute; top: 1rem; left: -50%; width: 100%; height: 2px; margin-top: -1px; background: var(--mist); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.active::before { background: var(--twilight); }
.dot {
  position: relative; z-index: 1;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tile); border: 1.5px solid var(--mist); color: var(--twilight);
}
.step.done .dot { background: var(--twilight); border-color: var(--twilight); color: var(--dk-oninv, #fff); }
.step.active .dot {
  background: var(--ink-900); border: 2px solid var(--dk-l-e3e8ef, #E3E8EF); color: var(--dk-oninv, #fff);
  box-shadow: 0 0 0 4px var(--dk-l-dde4ec, #DDE4EC), 0 0 0.875rem 0.3rem var(--dk-l-dfe4ea, #DFE4EA);
}
.step.active .label { color: var(--ink-strong); font-weight: var(--w-semibold); }
/* A stopped step keeps its place and says so rather than pulsing. */
.step.stopped::before { background: var(--twilight); }
.step.stopped .dot { background: var(--st-fail-bg); border-color: var(--dk-l-d9b4b4, #D9B4B4); color: var(--dk-tx-st-fail, var(--st-fail)); }
.step.stopped .label { color: var(--dk-tx-st-fail, var(--st-fail)); font-weight: var(--w-semibold); }
/* Nothing running: real colour, never a blanket opacity. */
.stepper--idle .step { color: var(--faint); }
.stepper--idle .dot { border-color: var(--dk-l-dce2e9, #DCE2E9); color: #9AA5B1; }

/* ---------- Attention ---------- */
.badge { display: inline-grid; place-items: center; min-width: 1.375rem; height: 1.375rem; padding: 0 0.375rem; border-radius: 0.6875rem; background: var(--st-attn-bg); color: var(--dk-tx-st-attn, var(--st-attn)); font: var(--w-semibold) var(--text-xs)/var(--lh-ui) var(--font-sans); font-variant-numeric: var(--nums-tabular); }
.head-chev { color: var(--ink); }
/* Rows in a card are separated by one hairline and their own padding; they
   carry no border, fill or radius of their own. The hover fill bleeds a
   little past the text so the row reads as one target. */
.attn-list { display: grid; align-content: start; gap: 0; }
.attn {
  position: relative;
  display: grid; grid-template-columns: 1.25rem minmax(0, 1fr) auto 1rem; align-items: center; gap: var(--s3);
  min-height: var(--row-h); padding: var(--rhythm-rows) var(--s2); margin: 0 calc(-1 * var(--s2));
  border-radius: var(--r-xs);
  color: var(--twilight);
}
.attn + .attn::before, .project + .project::before {
  content: ''; position: absolute; left: var(--s2); right: var(--s2); top: 0; height: 1px; background: var(--line);
}
.attn > .i:last-child { color: var(--ink); }
.attn:hover { background: var(--hover-card); }
.attn:focus-visible { outline: 2px solid var(--dk-tx-accent, var(--accent)); outline-offset: 2px; }
.attn span { min-width: 0; }
.attn strong { display: block; font: var(--w-medium) var(--text-md)/1.4 var(--font-sans); color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn small { display: block; margin-top: 0.125rem; font: var(--w-regular) var(--text-sm)/var(--lh-dense) var(--font-sans); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The row's own age, in the same caption type as every other timestamp. */
.attn-age { flex: none; font: var(--w-regular) var(--text-xs)/1.4 var(--font-sans); color: var(--muted); font-variant-numeric: var(--nums-tabular); white-space: nowrap; }

/* ---------- Recent videos ---------- */
.projects { display: grid; gap: 0; align-content: start; }
.project {
  position: relative;
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center; gap: var(--s3);
  min-height: var(--row-h); padding: var(--rhythm-rows) var(--s2); margin: 0 calc(-1 * var(--s2));
  border-radius: var(--r-xs);
}
.thumb--sm { width: 4.5rem; aspect-ratio: 16 / 9; border-radius: var(--r-xs); }
.project-meta { min-width: 0; display: grid; gap: 0.125rem; }
.project h4 { font: var(--w-medium) var(--text-md)/1.4 var(--font-sans); color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-sub { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.state { font: var(--w-regular) var(--text-xs)/1.4 var(--font-sans); color: var(--ink); display: flex; align-items: center; gap: 0.375rem; white-space: nowrap; }
.state::before { content: ''; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--st-idle-dot); flex: none; }
.state--editing::before { background: var(--st-busy-dot); }
.state--review::before  { background: var(--st-attn-dot); }
.state--failed::before  { background: var(--st-fail-dot); }
.state--done::before    { background: var(--st-done-dot); }
.state--draft::before   { background: var(--st-idle-dot); }
.when { font: var(--w-regular) var(--text-xs)/1.4 var(--font-sans); color: var(--muted); font-variant-numeric: var(--nums-tabular); white-space: nowrap; }
.thumb-more {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: var(--control); height: var(--control);
  border-radius: var(--r-xs); color: var(--muted);
}
.thumb-more:hover { background: var(--hover-tile); color: var(--ink-strong); }

/* ---------- Performance ---------- */
.stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); }
/* A figure and its label on the card's own surface; a hairline between neighbours. */
.stat { position: relative; display: flex; flex-direction: column; min-width: 0; }
.stat + .stat::before { content: ''; position: absolute; left: calc(-0.5 * var(--s5)); top: 0; bottom: 0; width: 1px; background: var(--line); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.stat-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--dk-tx-accent, var(--accent)); }
.stat strong { font: var(--w-semibold) var(--fs-figure)/1.1 var(--font-sans); letter-spacing: var(--track-title); color: var(--ink-strong); font-variant-numeric: var(--nums-tabular); }
.stat small { margin-top: 0.125rem; font: var(--w-regular) var(--text-xs)/1.4 var(--font-sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Direction is carried by colour and by the word, never by the arrow alone. */
.delta { display: inline-flex; align-items: center; gap: 0.125rem; height: 1.375rem; padding: 0 0.4375rem; border-radius: 0.6875rem; background: var(--st-done-bg); font: var(--w-medium) var(--text-xs)/var(--lh-ui) var(--font-sans); color: var(--dk-tx-st-done, var(--st-done)); font-variant-numeric: var(--nums-tabular); }
.delta--down { background: var(--st-fail-bg); color: var(--dk-tx-st-fail, var(--st-fail)); }
.delta--down .i { transform: rotate(180deg); }
.delta--flat { background: var(--st-idle-bg); color: var(--dk-tx-st-idle, var(--st-idle)); }
.delta { white-space: nowrap; flex: none; }
.spark { display: block; width: 100%; height: 1.5rem; margin-top: auto; padding-top: 0.375rem; overflow: visible; }
.spark-line { fill: none; stroke: var(--twilight); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
/* Decorative wash under the line — the one allowed translucency in a card. */
.spark-fill { fill: var(--mist); opacity: 0.35; }
.spark-range { display: flex; justify-content: space-between; margin-top: 0.125rem; font: var(--w-regular) var(--text-xs)/1.2 var(--font-sans); color: var(--faint); font-variant-numeric: var(--nums-tabular); }

/* ---------- Assistant ---------- */
.assistant {
  flex-direction: row; align-items: center; gap: var(--s6);
  padding: var(--s4) var(--s5);
}
.assistant-title { flex: none; font: var(--type-section); letter-spacing: var(--track-title); color: var(--ink-strong); }
.sep { flex: none; width: 1px; align-self: stretch; background: var(--line-2); }
.assistant-learned, .assistant-rec > div { min-width: 0; }
.assistant-learned h3, .assistant-rec h3 { font: var(--w-medium) var(--text-md)/1.4 var(--font-sans); color: var(--ink-strong); }
.assistant-learned p, .assistant-rec p { margin-top: 0.125rem; font: var(--w-regular) var(--text-sm)/var(--lh-dense) var(--font-sans); color: var(--muted); }
.assistant-learned p { display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--s3); }
.bullet { display: inline-block; flex: none; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--ink); margin-right: -0.25rem; }
.assistant-rec { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s3); }
.rec-icon { color: var(--twilight); }
.rec-actions { flex: none; display: flex; gap: var(--gap-inline); }
/* Stacked on a phone, the assistant is one column; a wrapping column would
   size itself to the longest unbroken line and run off the screen. */
/* Below the desktop width the recommendation takes its own line, whole,
   rather than being squeezed into an ellipsis. */
@media (max-width: 1279px) {
  .card.assistant { flex-wrap: wrap; row-gap: var(--s3); }
  .card.assistant .assistant-learned { flex: 1 1 0; }
  .card.assistant .assistant-learned + .sep { display: none; }
  .card.assistant .sep + .assistant-rec { flex: 1 0 100%; padding-top: var(--s3); border-top: 1px solid var(--line-2); }
  .card.assistant .assistant-rec p, .card.assistant .assistant-rec h3 { white-space: normal; }
}
@media (max-width: 680px) {
  .card.assistant { flex-wrap: nowrap; }
  .card.assistant .sep + .assistant-rec { flex: none; }
}

/* ============================================================== *
 * RESPONSIVE — layout only. No rule below changes a font-size.
 * ============================================================== */
@media (max-width: 1439px) {
  .row--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row--3 > .perf { grid-column: 1 / -1; }
}
@media (max-width: 1280px) {
  .shell { grid-template-columns: 13.5rem minmax(0, 1fr); }
  .search { width: 16rem; }
}
@media (max-width: 1019px) {
  .shell { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .logo span, .nav-item span { display: none; }
  .logo { padding-left: 0; justify-content: center; }
  .nav-item { justify-content: center; padding: 0; }
  .row--2 { grid-template-columns: 1fr; }
  .row--3 { grid-template-columns: 1fr 1fr; }
  .perf { grid-column: 1 / -1; }
  .assistant { flex-wrap: wrap; }
  .sep { display: none; }
  .menu { left: 0; top: calc(100% + var(--s2)); transform: translateY(-0.375rem); }
  .menu::before { display: none; }
  .start-from:hover .menu, .start-from:focus-within .menu { transform: none; }
}
@media (max-width: 680px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; align-items: center; padding: var(--s3) var(--s4); }
  .sidebar .atmos-slot { display: none; }
  .logo { margin: 0; }
  .nav { display: flex; gap: 0; margin-left: auto; }
  .nav-item { width: var(--control); }
  .main { padding: var(--s3) var(--s4) var(--s6); }
  .search { width: auto; flex: 1; }
  .row--3 { grid-template-columns: 1fr; }
  .thumb--lg { width: 100%; height: auto; max-height: none; }
  .assistant { flex-direction: column; align-items: stretch; gap: var(--s4); }
  .rec-actions .btn { flex: 1; }
}

/* One screen is a layout target at 1440x900 and above. Home holds it by
   giving up spacing in two tiers — never a type step, never a scale factor —
   and below 1440x900 it simply scrolls, which is a deliberate outcome and not
   an overflow. */
@media (min-width: 1020px) and (max-height: 1100px) {
  .main { row-gap: var(--s3); padding-top: var(--s3); }
  .outlet { padding-bottom: var(--s3); }
  .card { padding: var(--s4); }
  .hero { padding-bottom: var(--s4); margin-top: calc(-1 * var(--s3)); }
  .hero-actions { margin-top: var(--s4); }
  .row { gap: var(--s3); }
  .thumb--lg { width: 15rem; }
  .card-body { margin-top: var(--s3); }
  .current-extra { margin-top: var(--s3); gap: var(--s2); }
  .current .actions { padding-top: var(--s3); }
  .assistant { padding: var(--s3) var(--s4); }
  .estate--card { padding: var(--s3) var(--s2); gap: var(--s2); }
  .estate--card .estate-art { width: 4.5rem; }
}
@media (min-width: 1020px) and (max-height: 960px) {
  .main { row-gap: var(--s2); padding-top: var(--s2); padding-bottom: var(--s4); }
  .outlet { padding-bottom: 0; }
  .card { padding: var(--s3) var(--s4); }
  .hero { padding-bottom: var(--s2); }
  .hero-actions { margin-top: var(--s3); }
  .row { gap: var(--s2); }
  .card-body { margin-top: var(--s2); }
  .current-extra { margin-top: var(--s2); gap: var(--s1); }
  .current .actions { padding-top: var(--s2); }
  .assistant { padding: var(--s2) var(--s4); gap: var(--s4); }
  .uprog { gap: var(--s1); }
  .hero { margin-top: calc(-1 * var(--s4)); }
  .attn { min-height: 3rem; padding: var(--s2) var(--s2); }
  .project { min-height: 3rem; padding: var(--s2) var(--s2); }
  body.app .main { padding-bottom: var(--s3); }
  .page-banner { padding: var(--s2) var(--s4); }
  .stat-top { margin-bottom: var(--s1); }
  .spark { height: 1.25rem; }
}
