/* =====================================================================
   McTraining crew hub — design system (portal.css)
   Owned by the design area. Feature CSS files (pages.css, training.css,
   mcassist.css, waste.css) load after this file and should build on the
   tokens and components below instead of redefining them.

   TOKENS (:root)
     Colour   --yellow --yellow-soft --yellow-tint --gold --gold-deep
              --ink --ink-2 --muted --muted-2 --paper --surface --surface-2
              --surface-3 --line --line-strong --green --success --success-bg
              --danger --danger-bg --warning --warning-bg --info --info-bg
              --focus --focus-soft
     Shape    --radius-xs 8 · --radius-sm 12 · --radius-md 16 · --radius 24
              · --radius-lg 24 · --radius-xl 28 · --radius-pill
     Shadow   --shadow-xs --shadow-sm --shadow-md --shadow-lg --shadow-yellow
     Motion   --ease (springy) --ease-out --ease-spring --dur-1 150ms
              --dur-2 240ms --dur-3 350ms   (all off under reduced motion)
     Type     --font-body (DM Sans) --font-display (Nunito 700–900)
     Layout   --sidebar-w --topbar-h --gutter --content-max --pad-x
              --dock-offset  = space taken at the bottom of the screen by
                               the phone tab bar, safe area included (just the
                               home-indicator safe area on tablet/desktop).
                               Anything fixed to the bottom must sit above it
                               and must NOT add env(safe-area-inset-bottom):
                               bottom: calc(16px + var(--dock-offset))
              --safe-top/right/bottom/left = env(safe-area-inset-*)

   BUTTONS   .btn (primary yellow) + .dark .light .soft .danger .ghost .text
             sizes .sm .lg · .full (100% wide) · .icon-btn (44px square)
             .text-btn (inline text action)
             States (set with setButtonState(button, state) from motion.js):
               [data-state="loading"] spinner, [data-state="success"] green
               check, [data-state="error"] shake. Every .btn gets a press
               scale, hover lift and ripple automatically.
   FORMS     .field > label + input/select/textarea (auto styled)
             .input .select .textarea (standalone) · .field-grid (2 cols)
             .field-hint · .field-error · .input-affix (input + trailing
             button) · .check-row · .switch (checkbox styled as a toggle)
             Touch devices always get 16px inputs (no iOS zoom).
   SURFACES  .card (+ .soft .flat .interactive) · .card-head · .section-title
             .pill (+ .green .yellow .red .dark .blue .outline) · .avatar
             (+ .sm .lg) · .tile-icon · .eyebrow · .muted · .form-note
   TABS      .tabs / .segmented — buttons inside with .active,
             [aria-selected=true] or [aria-pressed=true]
   FEEDBACK  .error .success .warning .info (inline alerts) · .empty
             .empty-state (> .empty-icon, h3, p, .empty-actions)
             .page-loading (> .spinner + p) · .spinner (.sm .lg)
             .skeleton .skeleton-line .skeleton-title .skeleton-card
             .progress > span (animated fill on page entry)
   DIALOGS   <dialog> is styled globally: centred card on tablet/desktop,
             bottom sheet on phones, scale/slide in. Add [data-close-dialog]
             to any button to close with animation; backdrop tap and Esc close
             too. .dialog-close = top-right close button. .sheet = always a
             bottom sheet. .dialog-actions = right-aligned button row.
   TOASTS    showToast(text, "success"|"error"|"info") from motion.js, or
             kit.toast(text) / portal toast(text). Stacked, slide in.
   MOTION    [data-count-up] on an element animates its number on entry.
             [data-hover-lift] gives any element card hover elevation.
             [data-shake] (set by shake(el)) plays the error shake.
   UTILITIES .row .between .wrap .stack .grow .sr-only [hidden]
   ===================================================================== */

/* ---------- Fonts: static files (render at the right weight in WebKit) --
   Variable Google Fonts files rendered at their default (thin) instance in
   WebKit, so headings looked light on iPad. Static per-weight files from
   Fontsource (jsDelivr, pinned) render correctly everywhere. */
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-400-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-500-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-700-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:800;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-800-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:900;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-900-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-ext-400-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,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}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-ext-500-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,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}
@font-face{font-family:"DM Sans";font-style:normal;font-display:swap;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.3.0/files/dm-sans-latin-ext-700-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,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}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:600;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-700-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:800;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-800-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:900;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-900-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:800;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-ext-800-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,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}
@font-face{font-family:"Nunito";font-style:normal;font-display:swap;font-weight:900;src:url(https://cdn.jsdelivr.net/npm/@fontsource/nunito@5.3.0/files/nunito-latin-ext-900-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,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 ---------- */
:root {
  --yellow: #ffbc0d;
  --yellow-soft: #fff1bf;
  --yellow-tint: #fff8e3;
  --gold: #e7a600;
  --gold-deep: #9a6d00;
  --ink: #252825;
  --ink-2: #3b3f39;
  --muted: #626a5c;
  --muted-2: #7c8276;
  --paper: #f5f5f0;
  --surface: #ffffff;
  --surface-2: #fafaf6;
  --surface-3: #f1f2eb;
  --line: #e7e8e0;
  --line-strong: #d8dace;
  --green: #365b40;
  --success: #2f7447;
  --success-bg: #eaf3e7;
  --danger: #b0301f;
  --danger-bg: #fdeeea;
  --warning: #7a5600;
  --warning-bg: #fff4d6;
  --info: #2c5a94;
  --info-bg: #eaf1fb;
  --focus: #2366c9;
  --focus-soft: rgba(255, 188, 13, 0.32);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius: 24px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(37, 40, 37, 0.05);
  --shadow-sm: 0 1px 2px rgba(37, 40, 37, 0.04), 0 4px 10px -4px rgba(37, 40, 37, 0.08);
  --shadow-md: 0 2px 6px -2px rgba(37, 40, 37, 0.06), 0 14px 30px -14px rgba(37, 40, 37, 0.2);
  --shadow-lg: 0 30px 80px -24px rgba(30, 32, 28, 0.35);
  --shadow-yellow: 0 12px 26px -12px rgba(214, 150, 0, 0.6);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 150ms;
  --dur-2: 240ms;
  --dur-3: 350ms;
  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Nunito", ui-rounded, "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --sidebar-w: 248px;
  --topbar-h: 72px;
  --gutter: 36px;
  --content-max: 1320px;
  --pad-x: max(var(--gutter), calc((100% - var(--content-max)) / 2));
  --dock-h: 0px;
  --dock-offset: var(--safe-bottom);
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-synthesis-weight: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--paper);
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  /* Never let the page pan sideways on phones and tablets. "clip" does not
     create a scroll container, so sticky headers keep working. */
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-x: clip;
}
html:has(dialog[open]) {
  overflow: hidden;
}
img,
svg {
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea,
label {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
label,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::selection {
  background: #ffe28a;
  color: var(--ink);
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1,
h2,
h3,
h4,
.wordmark,
.display {
  font-family: var(--font-display);
  color: var(--ink);
}
h1 {
  font-size: clamp(28px, 1.6vw + 16px, 38px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(20px, 0.8vw + 14px, 24px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
h4 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}
p {
  line-height: 1.6;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 12px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.form-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 12px 0;
}

/* ---------- Icons ---------- */
.icon {
  width: 21px;
  height: 21px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Layout utilities ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.wrap {
  flex-wrap: wrap;
}
.stack {
  display: grid;
  gap: 16px;
}
.grow {
  flex: 1;
  min-width: 0;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--yellow);
  --btn-fg: var(--ink);
  --ripple: rgba(255, 255, 255, 0.6);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  transition:
    transform var(--dur-1) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    background-color var(--dur-2) ease,
    border-color var(--dur-2) ease,
    color var(--dur-1) ease;
}
.btn .icon {
  width: 19px;
  height: 19px;
}
.btn.dark {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --ripple: rgba(255, 255, 255, 0.28);
}
.btn.light {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --ripple: rgba(37, 40, 37, 0.1);
  border-color: var(--line-strong);
}
.btn.soft {
  --btn-bg: var(--yellow-soft);
  --btn-fg: #4d3a00;
  --ripple: rgba(255, 255, 255, 0.7);
}
.btn.danger {
  --btn-bg: var(--danger-bg);
  --btn-fg: var(--danger);
  --ripple: rgba(176, 48, 31, 0.14);
}
.btn.danger.solid {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --ripple: rgba(255, 255, 255, 0.3);
}
.btn.ghost,
.btn.text {
  --btn-bg: transparent;
  --ripple: rgba(37, 40, 37, 0.08);
}
.btn.text {
  padding-inline: 10px;
}
.btn.sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 11px;
}
.btn.lg {
  min-height: 54px;
  padding: 15px 26px;
  font-size: 15px;
  border-radius: 15px;
}
.btn.full {
  width: 100%;
}
.btn:disabled {
  opacity: 0.55;
}
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
  .btn:not(.light, .ghost, .text, .danger, .dark, .soft):not(:disabled):hover {
    box-shadow: var(--shadow-yellow);
    background: #ffc629;
  }
  .btn.dark:not(:disabled):hover {
    background: #1a1c1a;
  }
  .btn.light:not(:disabled):hover {
    border-color: #c9ccbe;
  }
  .btn.ghost:not(:disabled):hover,
  .btn.text:not(:disabled):hover {
    box-shadow: none;
    background: var(--surface-3);
  }
}
.btn:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: none;
  transition-duration: 80ms;
}
/* Ripple (motion.js sets --rx/--ry/--rs and [data-ripple]) */
.btn::after,
.icon-btn::after {
  content: "";
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 50%);
  width: var(--rs, 0px);
  height: var(--rs, 0px);
  border-radius: 50%;
  background: var(--ripple, rgba(37, 40, 37, 0.1));
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.btn[data-ripple]::after,
.icon-btn[data-ripple]::after {
  animation: ripple 0.6s var(--ease-out);
}
/* Loading / success states */
.btn[data-state="loading"],
.btn[data-state="success"] {
  color: transparent !important;
  pointer-events: none;
  opacity: 1;
}
.btn[data-state="loading"] > *,
.btn[data-state="success"] > * {
  visibility: hidden;
}
.btn[data-state="loading"]::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--btn-fg);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn[data-state="success"] {
  --btn-bg: var(--success);
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px -12px rgba(47, 116, 71, 0.8);
}
.btn[data-state="success"]::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 15px;
  margin: -10px 0 0 -4px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  animation: check-pop 0.42s var(--ease-spring) both;
}
.btn[data-state="error"] {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
}
[data-shake] {
  animation: shake 0.46s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.icon-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  transition:
    transform var(--dur-1) var(--ease),
    background-color var(--dur-2) ease,
    border-color var(--dur-2) ease,
    box-shadow var(--dur-2) var(--ease);
}
.icon-btn.ghost {
  border-color: transparent;
  background: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:not(:disabled):hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
  }
}
.icon-btn:not(:disabled):active {
  transform: scale(0.93);
}
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0;
  color: var(--ink);
  border-radius: 8px;
}
.text-btn .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--dur-2) var(--ease);
}
@media (hover: hover) {
  .text-btn:hover .icon:last-child {
    transform: translateX(3px);
  }
}

/* ---------- Pills, avatars, tiles ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  background: var(--surface-3);
  color: #5a6055;
  white-space: nowrap;
}
.pill .icon {
  width: 15px;
  height: 15px;
}
.pill.green {
  background: var(--success-bg);
  color: #2f5a36;
}
.pill.yellow {
  background: #fff1c2;
  color: #634a00;
}
.pill.red {
  background: var(--danger-bg);
  color: var(--danger);
}
.pill.dark {
  background: var(--ink);
  color: #fff;
}
.pill.blue {
  background: var(--info-bg);
  color: var(--info);
}
.pill.outline {
  background: transparent;
  border: 1px solid var(--line-strong);
}
.dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: currentColor;
}
.avatar {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffe7a3, #f6d27a);
  color: #4a3800;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  flex: none;
  border: 0;
  padding: 0;
}
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}
button.avatar {
  transition:
    transform var(--dur-1) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}
button.avatar:active {
  transform: scale(0.93);
}
@media (hover: hover) {
  button.avatar:hover {
    box-shadow: 0 0 0 4px var(--yellow-soft);
  }
}
.tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--yellow-tint);
  color: #7a5a00;
  flex: none;
  font-size: 21px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card.soft {
  background: var(--surface-2);
}
.card.flat {
  box-shadow: none;
  border-color: transparent;
}
.card-head {
  margin-bottom: 18px;
}
.card,
[data-hover-lift] {
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    border-color var(--dur-2) ease;
}
@media (hover: hover) and (pointer: fine) {
  a.card:hover,
  .card.interactive:hover,
  [data-hover-lift]:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #dcd4b4;
  }
}
.section-title {
  margin: 30px 0 14px;
}
.section-title h2 {
  font-size: 21px;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  min-width: 0;
}
.field label,
fieldset legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.field input:not([type="checkbox"], [type="radio"], [type="range"]),
.field select,
.field textarea,
.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  transition:
    border-color var(--dur-1) ease,
    box-shadow var(--dur-2) var(--ease),
    background-color var(--dur-1) ease;
  -webkit-appearance: none;
  appearance: none;
}
.field input[type="date"],
.field input[type="time"],
.input[type="date"],
.input[type="time"] {
  min-height: 48px;
  line-height: 1.2;
}
.field select,
.select,
select.input {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23626a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}
.field textarea,
.textarea {
  resize: vertical;
  min-height: 104px;
}
.field input::placeholder,
.field textarea::placeholder,
.input::placeholder,
.textarea::placeholder {
  color: #9a9f93;
}
@media (hover: hover) {
  .field input:not([type="checkbox"], [type="radio"]):hover,
  .field select:hover,
  .field textarea:hover,
  .input:hover,
  .select:hover,
  .textarea:hover {
    border-color: #c5c8ba;
  }
}
.field input:not([type="checkbox"], [type="radio"]):focus,
.field select:focus,
.field textarea:focus,
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--focus-soft);
}
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid {
  border-color: #d9826f;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
}
.field-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
}
.input-affix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-affix > input {
  padding-right: 52px !important;
}
.input-affix > .affix-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--muted);
}
.input-affix > .affix-btn:hover {
  color: var(--ink);
  background: var(--surface-3);
}
.input-affix > .affix-btn .icon {
  width: 20px;
  height: 20px;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: #c08a00;
  width: 20px;
  height: 20px;
  flex: none;
  margin: 0;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  line-height: 1.55;
  padding: 13px 0;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 46px !important;
  height: 28px !important;
  border-radius: 999px;
  background: #d9dbd0;
  transition: background-color var(--dur-2) ease;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform var(--dur-2) var(--ease-spring);
}
.switch:checked {
  background: var(--gold);
}
.switch:checked::after {
  transform: translateX(18px);
}
@media (pointer: coarse) {
  /* iOS zooms into inputs smaller than 16px. */
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  .text-btn,
  .tabs button,
  .segmented button,
  .segmented a,
  .btn.sm {
    min-height: 44px;
  }
  .preview-banner button,
  .preview-banner a {
    position: relative;
  }
  .preview-banner button::after,
  .preview-banner a::after {
    content: "";
    position: absolute;
    inset: -7px -4px;
  }
}

/* ---------- Tabs / segmented control ---------- */
.tabs,
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 15px;
  max-width: 100%;
}
.tabs button,
.segmented button,
.segmented a {
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 9px 15px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition:
    background-color var(--dur-2) ease,
    color var(--dur-2) ease,
    box-shadow var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease);
}
.tabs button:hover,
.segmented button:hover,
.segmented a:hover {
  color: var(--ink);
}
.tabs button:active,
.segmented button:active {
  transform: scale(0.96);
}
.tabs button.active,
.segmented .active,
.segmented [aria-selected="true"],
.segmented [aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- Progress ---------- */
.progress {
  height: 6px;
  background: #eeeee6;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--yellow));
  border-radius: inherit;
  transform-origin: left center;
}

/* ---------- Alerts, empty, loading ---------- */
.error,
.success,
.warning,
.info {
  display: block;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 14px 0;
  animation: pop-in var(--dur-3) var(--ease-out) both;
}
.error {
  color: #8f2a1d;
  background: var(--danger-bg);
  border: 1px solid #f6d3c9;
}
.success {
  color: #2c5b37;
  background: var(--success-bg);
  border: 1px solid #d3e6cf;
}
.warning {
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid #f3dea2;
}
.info {
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid #d3e1f5;
}
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}
.empty-state .empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--yellow-tint);
  color: #7a5a00;
  margin-bottom: 6px;
}
.empty-state .empty-icon .icon {
  width: 28px;
  height: 28px;
}
.empty-state h3 {
  font-size: 18px;
}
.empty-state p {
  font-size: 14px;
  max-width: 42ch;
}
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(231, 166, 0, 0.25);
  border-top-color: var(--gold);
  animation: spin 0.75s linear infinite;
  flex: none;
}
.spinner.sm {
  width: 18px;
  height: 18px;
  border-width: 2.5px;
}
.spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}
.page-loading {
  min-height: 40vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  animation: fade-in 0.3s 0.15s both;
}
.skeleton,
.skeleton-line,
.skeleton-title,
.skeleton-card {
  display: block;
  background: linear-gradient(90deg, #ecece4 0%, #f6f6f0 40%, #ecece4 80%);
  background-size: 250% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 10px;
}
.skeleton-line {
  height: 12px;
  margin: 10px 0;
  border-radius: 6px;
}
.skeleton-line.short {
  width: 45%;
}
.skeleton-title {
  height: 26px;
  width: 60%;
  margin: 6px 0 14px;
}
.skeleton-card {
  height: 132px;
  border-radius: var(--radius);
}

/* ---------- Dialogs & sheets ---------- */
dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 28px;
  width: min(560px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: min(88dvh, 820px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog:where([open]) {
  animation: dialog-in 0.34s var(--ease-out) both;
}
dialog:where([data-closing]) {
  animation: dialog-out 0.2s ease-in both;
}
dialog:focus {
  outline: none;
}
dialog::backdrop {
  background: rgba(24, 26, 22, 0.46);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
dialog:where([open])::backdrop {
  animation: fade-in 0.25s ease both;
}
dialog:where([data-closing])::backdrop {
  animation: fade-out 0.2s ease both;
}
:where(dialog) h2 {
  margin-bottom: 10px;
  font-size: 22px;
}
:where(dialog) > p {
  color: var(--ink-2);
}
#modal .stack {
  margin-top: 18px;
  gap: 10px;
}
#modal > .btn {
  margin-top: 8px;
}
dialog .dialog-close {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.sheet-handle {
  display: none;
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: #d6d7cd;
  margin: -10px auto 14px;
}

/* ---------- Toasts ---------- */
#toast,
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--dock-offset));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  pointer-events: none;
  color: transparent;
  font-size: 0;
}
#toast.show {
  /* Legacy callers writing plain text into #toast still get a toast. */
  color: #fff;
  font-size: 14px;
  background: var(--ink);
  padding: 13px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.4s var(--ease-spring) both;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 100%;
  padding: 11px 16px 11px 11px;
  border-radius: 15px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 18px 40px -16px rgba(20, 22, 18, 0.55);
  animation: toast-in 0.42s var(--ease-spring) both;
  cursor: default;
}
.toast .icon {
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
  stroke-width: 2.4;
  background: rgba(255, 255, 255, 0.14);
}
.toast-success .icon {
  background: #4f9a63;
}
.toast-error .icon {
  background: #d4543f;
}
.toast-info .icon {
  background: rgba(255, 188, 13, 0.9);
  stroke: var(--ink);
}
.toast[data-leaving] {
  animation: toast-out 0.26s ease-in both;
}

/* =====================================================================
   App shell
   ===================================================================== */
#app > .boot,
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
/* Hidden for the first 0.6 s: moving between pages paints from the tab's
   cache well within that, so the splash never flashes up in between. */
#app > .boot {
  animation: fade-in 0.4s 0.6s both;
}
.boot img {
  border-radius: 18px;
  box-shadow: var(--shadow-yellow);
  animation: boot-pulse 1.6s var(--ease) infinite;
}
.boot p {
  font-size: 14px;
  font-weight: 600;
}
.boot-bar {
  width: 120px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent) #ecece3;
  background-size: 60% 100%;
  background-repeat: no-repeat;
  animation: boot-bar 1.2s ease-in-out infinite;
}
/* Start-up problems: connection (retry), account set-up or deactivated. */
.boot-card {
  width: min(460px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 30px 26px 26px;
  text-align: center;
  color: var(--ink);
  animation: rise 0.45s var(--ease-out) both;
}
.boot-card h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}
.boot-card .form-note {
  max-width: 36ch;
  margin: 0 0 8px;
}
.boot-card .btn {
  min-width: 180px;
}
.boot-card-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 18px;
  background: var(--yellow-soft);
  color: var(--gold-deep);
}
.boot-card-icon .icon {
  width: 28px;
  height: 28px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-areas: "side main";
  min-height: 100vh;
  min-height: 100dvh;
  /* Paint the sidebar column all the way down (long pages, iOS overscroll). */
  background: linear-gradient(
    90deg,
    var(--surface) calc(var(--sidebar-w) - 1px),
    var(--line) calc(var(--sidebar-w) - 1px) var(--sidebar-w),
    transparent var(--sidebar-w)
  );
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border-radius: 14px;
}
.brand img {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  transition: transform var(--dur-3) var(--ease-spring);
}
@media (hover: hover) {
  .brand:hover img {
    transform: rotate(-6deg) scale(1.05);
  }
}
.wordmark {
  font-weight: 900;
  font-size: 21px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  white-space: nowrap;
}
.wordmark span {
  color: #b48100;
}
.brand small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
  margin-top: 2px;
  color: var(--muted);
  white-space: nowrap;
}

/* Sidebar */
.sidebar {
  grid-area: side;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 16px 16px;
  padding-left: max(16px, var(--safe-left));
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.sidebar > .brand {
  padding: 2px 8px;
}
.side-nav {
  position: relative;
  display: grid;
  gap: 3px;
  margin-top: 28px;
}
.nav-label {
  margin: 0 14px 8px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted-2);
  letter-spacing: 0.16em;
}
.side-nav a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  color: #5d6359;
  transition:
    color var(--dur-2) ease,
    background-color var(--dur-2) ease;
}
.side-nav a .icon {
  transition:
    stroke var(--dur-2) ease,
    transform var(--dur-2) var(--ease-spring);
}
@media (hover: hover) {
  .side-nav a:not(.active):hover {
    background: var(--surface-3);
    color: var(--ink);
  }
  .side-nav a:hover .icon {
    transform: scale(1.08);
  }
}
.side-nav a:active {
  transform: scale(0.98);
}
.side-nav a.active {
  color: var(--ink);
  font-weight: 700;
  background: var(--yellow-soft);
}
.side-nav a.active .icon {
  stroke: var(--gold-deep);
}
.side-nav .nav-short {
  display: none;
}
/* Sliding indicator (motion.js sets --ind-*) */
.side-nav::before,
.mobile-nav::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--ind-w, 0px);
  height: var(--ind-h, 0px);
  transform: translate3d(var(--ind-x, 0px), var(--ind-y, 0px), 0);
  background: var(--yellow-soft);
  border-radius: 14px;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}
.side-nav::before {
  box-shadow: inset 3px 0 0 var(--gold);
}
.side-nav[data-ind]::before,
.mobile-nav[data-ind]::before {
  opacity: 1;
}
.side-nav[data-ind="ready"]::before,
.mobile-nav[data-ind="ready"]::before {
  transition:
    transform 0.42s var(--ease-out),
    width 0.42s var(--ease-out),
    height 0.42s var(--ease-out);
}
.side-nav[data-ind] a.active {
  background: transparent;
}
.side-help {
  margin-top: auto;
  background: linear-gradient(160deg, #fff8e2, #f7f5ea);
  border: 1px solid #f1e6c3;
  border-radius: 18px;
  padding: 16px;
  font-size: 12.5px;
}
.side-help .icon {
  color: #8c6a00;
}
.side-help h4 {
  font-size: 14px;
}
.side-help p {
  color: var(--muted);
  margin: 6px 0 2px;
  font-size: 12.5px;
  line-height: 1.5;
}
.side-profile {
  padding: 16px 4px 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.side-profile .row {
  gap: 10px;
}
.side-profile b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-profile small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
}

/* Workspace + topbar */
.workspace {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  background: var(--ink);
  color: #f3f3ee;
  font-size: 13px;
  line-height: 1.4;
  padding: 9px var(--gutter);
  padding-top: max(9px, var(--safe-top));
  text-align: center;
}
.preview-banner b {
  font-weight: 700;
}
.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 188, 13, 0.2);
  /* A few pulses on arrival, then still: no endless loops on app pages. */
  animation: pulse-dot 2s ease-in-out 3;
}
.preview-banner button,
.preview-banner a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--dur-2) ease;
}
.preview-banner button {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}
.preview-banner a:hover {
  background: rgba(255, 255, 255, 0.14);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 0 var(--pad-x);
  /* Opaque: scrolled content must never read through the bar. */
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.mobile-brand {
  display: none;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}
.breadcrumb .crumb-sep {
  color: #b9bcb0;
}
.breadcrumb b {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.top-date {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.store-pill {
  background: var(--surface);
  border: 1px solid var(--line);
}
#profileButton {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
.data-warning {
  font-size: 13px;
  background: var(--warning-bg);
  border: 1px solid #ecd28f;
  color: #5c4300;
  border-radius: 14px;
  padding: 12px 16px;
  margin: 18px var(--pad-x) 0;
}
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 28px var(--pad-x) 0;
}
.content {
  min-width: 0;
}
.rail {
  display: none;
  gap: 18px;
  min-width: 0;
}
@media (min-width: 1360px) {
  .app-shell[data-page="home"] .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .app-shell[data-page="home"] .rail {
    display: grid;
    position: sticky;
    top: calc(var(--topbar-h) + 28px);
  }
}
.notice-card {
  background: linear-gradient(160deg, #edf3e8, #e4eddd);
  border-color: #dbe6d3;
}
.notice-card h3 {
  font-size: 18px;
  margin: 12px 0 8px;
}
.notice-card p {
  font-size: 13px;
  color: #53634a;
}
.notice-card .icon {
  color: var(--green);
}
.rail-tip .icon {
  color: #a57800;
}
.rail-tip h4 {
  font-size: 15px;
}
.rail-tip p {
  font-size: 12.5px;
  margin-top: 3px;
}
.footer {
  margin-top: 36px;
  padding: 20px var(--pad-x) calc(22px + var(--dock-offset));
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  border-top: 1px solid var(--line);
}

/* Mobile tab bar + More sheet (phones only) */
.mobile-nav {
  display: none;
}
.tab-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: 99px;
  transition: background-color var(--dur-2) ease;
}
.mobile-nav .icon {
  width: 22px;
  height: 22px;
  transition:
    transform var(--dur-2) var(--ease-spring),
    stroke var(--dur-2) ease;
}
.more-dot {
  position: absolute;
  top: 5px;
  right: calc(50% - 20px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px #fff;
}
dialog.sheet {
  width: min(560px, 100%);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sheet-head h2 {
  margin: 0;
}
.sheet-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff6d6, #fffbef);
  border: 1px solid #f3e4b5;
}
.sheet-profile b {
  display: block;
  font-size: 15px;
}
.sheet-profile small {
  display: block;
  font-size: 12.5px;
  margin-top: 1px;
}
.sheet-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.sheet-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  transition:
    transform var(--dur-1) var(--ease),
    border-color var(--dur-2) ease,
    background-color var(--dur-2) ease;
}
.sheet-nav a small {
  display: block;
  font-weight: 500;
  font-size: 11.5px;
  margin-top: 2px;
}
.sheet-nav a .tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.sheet-nav a .icon {
  width: 20px;
  height: 20px;
}
.sheet-nav a:active {
  transform: scale(0.97);
}
.sheet-nav a.active {
  border-color: #efc95a;
  background: var(--yellow-tint);
}
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sheet-actions .btn {
  margin: 0;
}
dialog.sheet:where([open]) .sheet-nav a {
  animation: rise 0.42s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 35ms + 60ms);
}

/* =====================================================================
   Core pages (home, schedule, planner, availability, team, rewards)
   ===================================================================== */
.page-heading {
  margin-bottom: 24px;
}
.page-heading .eyebrow {
  color: #8a6a00;
}
.page-heading p {
  font-size: 15px;
  color: var(--muted);
  margin-top: 8px;
  max-width: 62ch;
}
/* Date tile (sign-in "next shift" card) */
.date-tile b {
  font-family: var(--font-display);
  display: block;
  font-size: 40px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.date-tile span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tabs + *,
.between.wrap {
  row-gap: 12px;
}

/* =====================================================================
   Sign in / sign up
   ===================================================================== */
.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 20px;
  padding-left: max(20px, var(--safe-left));
  padding-right: max(20px, var(--safe-right));
  gap: 20px;
}
.auth-layout[data-leaving] {
  animation: page-leave 0.28s ease-in both;
}
.auth-art {
  position: sticky;
  top: 20px;
  height: calc(100dvh - 40px);
  min-height: 560px;
  background:
    radial-gradient(90% 70% at 100% 0%, #ffd653 0%, rgba(255, 214, 83, 0) 60%),
    radial-gradient(70% 60% at 0% 100%, #ffb000 0%, rgba(255, 176, 0, 0) 70%),
    var(--yellow);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-art:after {
  content: "m";
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: 620px;
  line-height: 1;
  color: #fff;
  opacity: 0.14;
  position: absolute;
  bottom: -190px;
  right: -70px;
  pointer-events: none;
  z-index: -1;
}
.auth-shapes {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.auth-shapes span {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.auth-shapes span:nth-child(1) {
  width: 340px;
  height: 340px;
  left: -120px;
  top: -110px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
  animation: drift-a 16s ease-in-out infinite;
}
.auth-shapes span:nth-child(2) {
  width: 220px;
  height: 220px;
  right: 8%;
  top: 30%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 150, 0, 0.35), rgba(255, 150, 0, 0) 70%);
  animation: drift-b 19s ease-in-out infinite;
}
.auth-shapes span:nth-child(3) {
  width: 120px;
  height: 120px;
  left: 42%;
  bottom: 12%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 70%);
  animation: drift-c 13s ease-in-out infinite;
}
.auth-art .eyebrow {
  color: #4f3b06;
  margin-top: 28px;
}
.auth-art h1 {
  font-size: clamp(44px, 4.8vw, 72px);
  letter-spacing: -0.045em;
  line-height: 1.02;
  max-width: 560px;
  margin: 20px 0 18px;
}
.auth-art h1 em {
  font-style: normal;
  color: #fff;
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 0 rgba(122, 88, 0, 0.12);
}
.auth-art .auth-lead {
  max-width: 420px;
  font-size: 16px;
  color: #5b460e;
}
.auth-stage {
  position: relative;
  margin: 30px 0 10px;
  max-width: 420px;
  min-height: 190px;
}
.auth-shift {
  position: relative;
  background: #fffef9;
  border-radius: 22px;
  padding: 18px 20px;
  max-width: 360px;
  box-shadow: 0 30px 60px -28px rgba(110, 76, 0, 0.55);
  transform: rotate(-3deg);
  animation: float-card 7s ease-in-out infinite;
}
.auth-shift-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #6f7566;
}
.auth-shift-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.auth-shift .date-tile {
  border-right: 1px solid var(--line);
  padding-right: 16px;
  text-align: center;
}
.auth-shift .date-tile b {
  font-size: 34px;
}
.auth-shift h3 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.auth-shift p {
  font-size: 13px;
  color: var(--muted);
}
.auth-chip {
  position: absolute;
  right: -6px;
  bottom: -2px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
  transform: rotate(2.5deg);
  animation: float-chip 6s ease-in-out 0.8s infinite;
}
.auth-chip .chip-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #4f9a63;
}
.auth-chip .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2.6;
}
.auth-chip small {
  display: block;
  color: #b9bdb2;
  font-size: 11px;
  font-weight: 600;
}
.auth-bottom {
  font-size: 12px;
  color: #5b460e;
}
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  min-width: 0;
}
.auth-form {
  width: 100%;
  max-width: 400px;
}
.auth-form h2 {
  font-size: clamp(28px, 2.4vw, 34px);
  letter-spacing: -0.03em;
}
.auth-form > p {
  color: var(--muted);
  font-size: 15px;
  margin: 10px 0 26px;
}
.auth-form .pill {
  margin-bottom: 20px;
}
.auth-form .field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.auth-form .field input {
  min-height: 52px;
  font-size: 15px;
  border-radius: 14px;
}
.auth-form form {
  display: block;
}
.auth-form form[data-shake] {
  animation: shake 0.46s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.auth-form .field {
  position: relative;
}
/* Sits on the label row so showing / hiding it never moves the form. */
.caps-hint {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--warning);
  animation: pop-in 0.25s var(--ease-out) both;
}
.caps-hint .icon {
  width: 15px;
  height: 15px;
}
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 12px;
}
.auth-form .btn.full {
  width: 100%;
  min-height: 54px;
  font-size: 15px;
  border-radius: 15px;
  margin-top: 6px;
}
.auth-form .btn.full .icon {
  transition: transform var(--dur-2) var(--ease);
}
@media (hover: hover) {
  .auth-form .btn.full:hover .icon {
    transform: translateX(4px);
  }
}
.auth-divider {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  margin: 26px 0 18px;
}
.auth-divider:before,
.auth-divider:after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}
.auth-alt {
  display: grid;
  gap: 10px;
}
.auth-alt .btn {
  width: 100%;
}
.auth-foot {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  margin-top: 14px;
}
.auth-foot a {
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(37, 40, 37, 0.3);
  text-underline-offset: 3px;
}
.auth-foot a:hover {
  text-decoration-color: var(--gold);
}
.auth-legal {
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
  margin-top: 26px;
}
/* Entrance: staggered rise. authPage() marks the layout [data-settled] once
   it has played, so later changes (shake, role picker) never replay it. */
.auth-layout:not([data-settled]) .auth-art > *,
.auth-layout:not([data-settled]) .auth-form > :not(form),
.auth-layout:not([data-settled]) .auth-form form > * {
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 70ms + 80ms);
}
.auth-layout:not([data-settled]) .auth-art {
  animation: art-in 0.8s var(--ease-out) both;
}
/* The ambient drift is the only looping decoration and lives on the sign-in
   pages. It stops while the tab is hidden (motion.js sets [data-page-hidden])
   and entirely under reduced motion (see the end of this file). */
html[data-page-hidden] .auth-shapes span,
html[data-page-hidden] .auth-shift,
html[data-page-hidden] .auth-chip {
  animation-play-state: paused;
}
/* Signup role picker (enhanceSignup) */
.v2-role-picker {
  margin: 4px 0 18px;
  border: 0;
  padding: 0;
  min-width: 0;
}
.v2-role-picker > legend,
.v2-role-picker > label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 8px;
  padding: 0;
}
.v2-role-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.v2-role-option {
  position: relative;
  display: block;
  cursor: pointer;
}
.v2-role-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.v2-role-option .role-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 12px;
  min-height: 64px;
  border: 1.5px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  transition:
    border-color var(--dur-2) ease,
    background-color var(--dur-2) ease,
    box-shadow var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease);
}
.v2-role-option:hover .role-card {
  border-color: #cfc59c;
}
.v2-role-option:active .role-card {
  transform: scale(0.985);
}
.role-card .role-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: #5f655b;
  transition:
    background-color var(--dur-2) ease,
    color var(--dur-2) ease,
    transform var(--dur-3) var(--ease-spring);
}
.role-card b {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.role-card small {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 1px;
}
.role-card .role-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition:
    background-color var(--dur-2) ease,
    border-color var(--dur-2) ease;
}
.role-card .role-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  transform: scale(0);
  transition: transform var(--dur-3) var(--ease-spring);
}
.v2-role-option input:checked + .role-card {
  border-color: var(--gold);
  background: var(--yellow-tint);
  box-shadow: 0 0 0 3px rgba(255, 188, 13, 0.2);
}
.v2-role-option input:checked + .role-card .role-icon {
  background: var(--yellow);
  color: var(--ink);
  transform: rotate(-6deg) scale(1.05);
}
.v2-role-option input:checked + .role-card .role-check {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.v2-role-option input:checked + .role-card .role-check .icon {
  transform: scale(1);
}
.v2-role-option input:focus-visible + .role-card {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.v2-role-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 10px;
}
.v2-role-note.is-pending {
  color: var(--warning);
}

/* =====================================================================
   Motion (page entry, progress, keyframes)
   ===================================================================== */
html[data-entering] .content > * {
  animation: rise 0.5s var(--ease-out) backwards;
}
html[data-entering] .content > :nth-child(2) {
  animation-delay: 50ms;
}
html[data-entering] .content > :nth-child(3) {
  animation-delay: 100ms;
}
html[data-entering] .content > :nth-child(4) {
  animation-delay: 150ms;
}
html[data-entering] .content > :nth-child(5) {
  animation-delay: 200ms;
}
html[data-entering] .content > :nth-child(n + 6) {
  animation-delay: 240ms;
}
html[data-entering] .pg-kpis > * {
  animation: rise 0.5s var(--ease-out) 0.12s backwards;
}
html[data-entering] .pg-kpis > :nth-child(2) {
  animation-delay: 170ms;
}
html[data-entering] .pg-kpis > :nth-child(3) {
  animation-delay: 220ms;
}
html[data-entering] .pg-kpis > :nth-child(n + 4) {
  animation-delay: 270ms;
}
html[data-entering] :is(.progress, .pg-bar, [role="progressbar"]) > span {
  animation: fill-x 0.9s var(--ease-out) 0.2s backwards;
}
html[data-entering] .rail > * {
  animation: rise 0.5s var(--ease-out) 0.2s backwards;
}
/* After the entrance (motion.js swaps [data-entering] for [data-entered]) the
   entered elements keep still instead of restarting their own animation. */
html[data-entered] .content > *,
html[data-entered] .pg-kpis > *,
html[data-entered] :is(.progress, .pg-bar, [role="progressbar"]) > span,
html[data-entered] .pg-tl-bar,
html[data-entered] .rail > * {
  animation: none;
}
/* Feature-page placeholders stay invisible for a moment: with the tab's
   cached data the real page replaces them first, so they never flash. */
html:not([data-entering]) .content > :is(.tr-skeleton, .mca-skeleton, .page-loading) {
  animation: fade-in 0.3s 0.45s both;
}
/* Pages opened later in a visit start settled (motion.js plays the entrance
   once per visit): the feature pages' own entrances stay still too. */
html[data-entered]:not([data-entering]) :is(.content :is(.tr-animate :is(.tr-hero, .tr-tabs, .tr-next, .tr-recs, .tr-badges, .tr-activity, .tr-ring-value, .tr-xpbar > span, .tr-bar > span), .tr-module.tr-in, .mca-page :is(.mca-hero, .mca-library, .mca-panel-page)), .topbar .pg-bell-dot) {
  animation: none;
}
/* A live update repaints #content in place (portal.js sets [data-live] after
   the first paint): the entrance plays once, not again for every update. */
html[data-entering] .content[data-live] > *,
html[data-entering] .content[data-live] .pg-kpis > *,
html[data-entering] .content[data-live] :is(.progress, .pg-bar, [role="progressbar"]) > span {
  animation: none;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes art-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
@keyframes fill-x {
  from {
    transform: scaleX(0);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}
@keyframes check-pop {
  0% {
    transform: rotate(45deg) scale(0);
    opacity: 0;
  }
  100% {
    transform: rotate(45deg) scale(1);
    opacity: 1;
  }
}
@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-7px);
  }
  40%,
  60% {
    transform: translateX(7px);
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}
@keyframes dialog-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}
@keyframes page-leave {
  to {
    opacity: 0;
    transform: scale(0.985);
  }
}
@keyframes float-card {
  0%,
  100% {
    transform: rotate(-3deg) translateY(0);
  }
  50% {
    transform: rotate(-1.6deg) translateY(-10px);
  }
}
@keyframes float-chip {
  0%,
  100% {
    transform: rotate(2.5deg) translateY(0);
  }
  50% {
    transform: rotate(1deg) translateY(-7px);
  }
}
@keyframes drift-a {
  50% {
    transform: translate(60px, 40px) scale(1.08);
  }
}
@keyframes drift-b {
  50% {
    transform: translate(-50px, 30px) scale(0.92);
  }
}
@keyframes drift-c {
  50% {
    transform: translate(24px, -30px) scale(1.12);
  }
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
@keyframes boot-pulse {
  50% {
    transform: scale(0.94);
  }
}
@keyframes boot-bar {
  from {
    background-position: -60% 0;
  }
  to {
    background-position: 160% 0;
  }
}
@keyframes pulse-dot {
  50% {
    box-shadow: 0 0 0 7px rgba(255, 188, 13, 0.05);
  }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (min-width: 1500px) {
  :root {
    --gutter: 44px;
  }
}
@media (max-height: 860px) and (min-width: 1200px) {
  .side-help {
    display: none;
  }
  .side-profile {
    margin-top: auto;
  }
  .side-nav {
    margin-top: 22px;
  }
}
@media (max-width: 1199px) {
  .top-date {
    display: none;
  }
}
/* Tablet + small laptop: compact navigation rail with labels */
@media (min-width: 761px) and (max-width: 1199px) {
  :root {
    --sidebar-w: 96px;
    --gutter: 28px;
    --topbar-h: 68px;
  }
  .sidebar {
    align-items: stretch;
    padding: 18px 10px 14px;
    padding-left: max(10px, var(--safe-left));
  }
  .sidebar > .brand {
    justify-content: center;
    padding: 0;
  }
  .sidebar > .brand > div {
    display: none;
  }
  .sidebar > .brand img {
    width: 46px;
    height: 46px;
  }
  .side-nav {
    margin-top: 18px;
    gap: 2px;
  }
  .nav-label {
    display: none;
  }
  .side-nav a {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-height: 62px;
    padding: 9px 2px 8px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    letter-spacing: -0.01em;
  }
  .side-nav a .icon {
    width: 23px;
    height: 23px;
  }
  .side-nav .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .side-nav .nav-short {
    display: block;
  }
  .side-nav::before {
    box-shadow: none;
    border-radius: 16px;
  }
  .side-help {
    display: none;
  }
  .side-profile {
    margin-top: auto;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0 0;
  }
  .side-profile > .row > div {
    display: none;
  }
  .auth-art {
    padding: 34px;
  }
  .auth-art h1 {
    font-size: clamp(40px, 5.4vw, 56px);
  }
  .auth-chip {
    right: -2px;
  }
}
/* Phones */
@media (max-width: 760px) {
  :root {
    --gutter: 16px;
    --topbar-h: 60px;
    --dock-h: 64px;
    --dock-offset: calc(var(--dock-h) + var(--safe-bottom));
  }
  .app-shell {
    display: block;
    background: none;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    min-height: 100dvh;
  }
  .layout,
  .topbar,
  .footer {
    padding-left: max(var(--gutter), var(--safe-left));
    padding-right: max(var(--gutter), var(--safe-right));
  }
  .topbar {
    min-height: calc(var(--topbar-h) + var(--safe-top));
    padding-top: var(--safe-top);
    gap: 10px;
  }
  .preview-banner + .topbar,
  .preview-banner ~ .topbar {
    padding-top: 0;
    min-height: var(--topbar-h);
  }
  .breadcrumb,
  .topbar .store-pill {
    display: none;
  }
  .mobile-brand {
    display: flex;
    min-width: 0;
  }
  .mobile-brand .brand img {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }
  .mobile-brand .wordmark {
    font-size: 19px;
  }
  .mobile-brand .brand small {
    display: none;
  }
  .topbar-actions {
    gap: 8px;
  }
  .topbar .icon-btn,
  #profileButton {
    width: 42px;
    height: 42px;
  }
  .preview-banner {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    font-size: 12px;
    padding: 7px max(12px, var(--safe-right)) 7px max(12px, var(--safe-left));
    padding-top: max(7px, var(--safe-top));
    text-align: left;
  }
  .preview-banner .preview-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .preview-banner .preview-extra {
    display: none;
  }
  .preview-banner button,
  .preview-banner a {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12px;
    flex: none;
  }
  .layout {
    padding-top: 20px;
    gap: 20px;
  }
  .footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 11.5px;
    margin-top: 28px;
    padding-bottom: calc(18px + var(--dock-offset));
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    min-height: var(--dock-offset);
    padding: 6px max(6px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(6px, var(--safe-left));
    /* Opaque: scrolled content must never read through the tab bar. */
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px -20px rgba(37, 40, 37, 0.25);
  }
  .mobile-nav > a,
  .mobile-nav > button {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 2px 0 0;
    border: 0;
    background: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: #686e64;
    border-radius: 14px;
  }
  .mobile-nav > a:active .icon,
  .mobile-nav > button:active .icon {
    transform: scale(0.88);
  }
  .mobile-nav .active {
    color: var(--ink);
  }
  .mobile-nav .active .icon {
    stroke: #7d5800;
  }
  .mobile-nav:not([data-ind]) .active .tab-icon {
    background: #ffe9a6;
  }
  .mobile-nav::before {
    background: #ffe9a6;
    border-radius: 99px;
  }
  .mobile-more[aria-expanded="true"] .tab-icon {
    background: var(--surface-3);
  }
  /* Dialogs become bottom sheets */
  dialog,
  dialog:where(.sheet) {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: calc(100dvh - 40px - var(--safe-top));
    border-radius: 26px 26px 0 0;
    padding: 26px max(18px, var(--safe-right)) calc(20px + var(--safe-bottom)) max(18px, var(--safe-left));
    transform: translateY(var(--drag, 0px));
  }
  dialog:where([open]) {
    animation: sheet-in 0.42s var(--ease-out) both;
  }
  dialog:where([data-closing]) {
    animation: sheet-out 0.24s ease-in both;
  }
  dialog:where([data-dragging]) {
    transition: none;
  }
  dialog:where(:not([data-dragging])) {
    transition: transform 0.25s var(--ease-out);
  }
  .sheet-handle {
    display: block;
  }
  #modal > .btn,
  #modal .stack > .btn {
    width: 100%;
  }
  dialog .dialog-actions .btn {
    flex: 1;
  }
  /* Page pieces */
  h1 {
    letter-spacing: -0.03em;
  }
  .page-heading h1 {
    font-size: 30px;
  }
  .page-heading p {
    font-size: 14px;
  }
  .date-tile b {
    font-size: 34px;
  }
  .card {
    padding: 20px;
    border-radius: 22px;
  }
  .section-title {
    margin-top: 26px;
  }
  .tabs,
  .segmented {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
  }
  .tabs button,
  .segmented button {
    flex: 1;
    padding-inline: 8px;
    min-height: 42px;
  }
  .field-grid {
    gap: 10px;
  }
  /* Auth */
  .auth-layout {
    display: block;
    padding: 0;
  }
  .auth-art {
    position: relative;
    top: 0;
    height: auto;
    min-height: 0;
    padding: calc(22px + var(--safe-top)) max(24px, var(--safe-right)) 30px max(24px, var(--safe-left));
    border-radius: 0 0 30px 30px;
    display: block;
  }
  .auth-art .eyebrow {
    margin-top: 24px;
  }
  .auth-art h1 {
    font-size: clamp(34px, 10vw, 42px);
    margin: 10px 0 10px;
    letter-spacing: -0.04em;
    max-width: 340px;
  }
  .auth-art .auth-lead {
    font-size: 14px;
    max-width: 340px;
  }
  .auth-stage,
  .auth-bottom {
    display: none;
  }
  .auth-art:after {
    font-size: 330px;
    bottom: -70px;
    right: -40px;
  }
  .auth-form-wrap {
    padding: 28px max(22px, var(--safe-right)) calc(32px + var(--safe-bottom)) max(22px, var(--safe-left));
  }
  .auth-form {
    max-width: 460px;
    margin: 0 auto;
  }
  .auth-form > p {
    margin-bottom: 22px;
  }
}
@media (max-width: 520px) {  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sheet-nav a {
    min-height: 60px;
    padding: 10px;
    gap: 10px;
    font-size: 13.5px;
  }
  .sheet-nav a small {
    display: none;
  }
}
@media (max-width: 380px) {
  .mobile-brand .wordmark {
    font-size: 17px;
  }
  .sheet-nav {
    gap: 8px;
  }
  .sheet-nav a {
    gap: 9px;
    padding: 9px;
    font-size: 13px;
    min-height: 58px;
  }
  .sheet-nav a .tile-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .preview-banner a {
    display: none;
  }
  .tab-icon {
    width: 50px;
  }
}

/* =====================================================================
   Reduced motion: no transforms, loops or slides. Keep this last.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
  .btn[data-state="loading"]::before {
    animation: spin 1.4s linear infinite !important;
  }
  .spinner {
    animation: spin 1.4s linear infinite !important;
  }
}
