/*
 * Apple-Minimal Design System — guide-literal tokens.
 *
 * Brand slot (Strategy 1 — gradient brand):
 *   6-stop spectrum (violet → indigo → pink → red → orange → yellow), used
 *   ONLY on the primary CTA and one earned moment per screen.
 *   ACCENT (#6366F1 indigo) reserved for state: focus rules, selection marks.
 *
 * Neutrals: warm stone (canonical light, deep dark).
 * Fonts: DM Sans (display/UI) + Lato (body).
 *
 * Tokens here are the single source of truth. Atoms below mirror the React
 * Native atom inventory in the guide (PrimaryButton, BareInput,
 * SuggestionChip, PhotoSlot, ConsentCheckbox, Skeleton, StatusPill).
 *
 * Brand budget per screen: ONE moment + the CTA gradient. Nothing else.
 */

/* ==================================================================
 * Tokens — light (canonical) and dark (.dark on <html>)
 * ================================================================== */

:root {
  /* Brand spectrum — guide §2 Strategy 1 example, 6 stops ---------- */
  --grad-1: #8B5CF6;  /* violet-500 */
  --grad-2: #6366F1;  /* indigo-500 */
  --grad-3: #EC4899;  /* pink-500 */
  --grad-4: #EF4444;  /* red-500 */
  --grad-5: #F59E0B;  /* amber-500 */
  --grad-6: #FBBF24;  /* amber-400 */

  /* Surfaces — warm stone (guide §2 table) ------------------------- */
  --bg:               #FAFAF9;
  --surface:          #F5F4F2;
  --surface-strong:   #EEECEA;

  /* Labels --------------------------------------------------------- */
  --label:            #1A1917;
  --label-secondary:  #57534E;
  --label-tertiary:   #A8A29E;

  /* Hairlines ------------------------------------------------------ */
  --border:           rgba(87, 83, 78, 0.14);
  --border-strong:    rgba(87, 83, 78, 0.28);

  /* State (guide §4 — indigo accent ladder) ------------------------ */
  --accent:           #6366F1;
  --accent-press:     #4F46E5;
  --accent-soft:      #A5B4FC;
  --accent-dim:       rgba(99, 102, 241, 0.10);
  --accent-border:    rgba(99, 102, 241, 0.30);
  --warning:          #F59E0B;
  --success:          #10B981;
  --danger:           #DC2626;

  /* Brand gradient — guide §15 / §8 / §17C; 6 stops, 0→1 diagonal -- */
  --grad-cta: linear-gradient(135deg,
    var(--grad-1) 0%,
    var(--grad-2) 20%,
    var(--grad-3) 40%,
    var(--grad-4) 60%,
    var(--grad-5) 80%,
    var(--grad-6) 100%);
  --grad-cta-h: linear-gradient(90deg,
    var(--grad-1) 0%,
    var(--grad-2) 20%,
    var(--grad-3) 40%,
    var(--grad-4) 60%,
    var(--grad-5) 80%,
    var(--grad-6) 100%);

  /* "Moment" gradient is the same brand gradient (one per screen) -- */
  --grad-moment:   var(--grad-cta);
  --grad-moment-h: var(--grad-cta-h);

  /* 4pt spacing scale — guide §3 ----------------------------------- */
  --s-xs:   4px;
  --s-sm:   8px;
  --s-md:   12px;
  --s-base: 16px;
  --s-lg:   20px;
  --s-xl:   24px;
  --s-xxl:  32px;
  --s-xxxl: 48px;

  /* Radii — guide §3 ----------------------------------------------- */
  --r-chip:   10px;
  --r-input:  12px;
  --r-button: 14px;
  --r-card:   16px;
  --r-modal:  24px;
}

html.dark {
  /* Surfaces — three-step lift so cards, tabs and tiles stand out
     against the canvas instead of melting into it. */
  --bg:               #0E0D0B;
  --surface:          #1C1B19;
  --surface-strong:   #272624;

  --label:            #FAFAF9;
  --label-secondary:  #A8A29E;
  --label-tertiary:   #78716C;

  /* Hairlines — bumped so panels and inputs read at a glance. */
  --border:           rgba(168, 162, 158, 0.18);
  --border-strong:    rgba(168, 162, 158, 0.32);

  /* Accent stays indigo; slightly brighter for low-light readability */
  --accent:           #818CF8;  /* indigo-400 */
  --accent-press:     #6366F1;
  --accent-soft:      #A5B4FC;
  --accent-dim:       rgba(129, 140, 248, 0.16);
  --accent-border:    rgba(129, 140, 248, 0.40);

  color-scheme: dark;
}

/* ==================================================================
 * Base — fonts, body, focus
 * ================================================================== */

html, body {
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--bg);
  color: var(--label);
}

h1, h2, h3, h4, h5,
.font-display {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

.font-body {
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

::selection {
  background-color: var(--accent-dim);
  color: var(--label);
}

/* ==================================================================
 * Typography ramp — direct port of T.* from the design guide
 * Use these classes instead of inline font sizes / weights.
 * ================================================================== */

.t-display {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(30px, 4.4vw, 38px);
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.1;
  color: var(--label);
}
.t-display-quiet { color: var(--label-tertiary); font-weight: 500; }

.t-heading {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: var(--label);
}

.t-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.27;
  color: var(--label);
}

.t-body {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--label);
}

.t-bodysm {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  color: var(--label-secondary);
}

.t-label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.38;
  color: var(--label);
}

.t-eyebrow {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.45;
  text-transform: uppercase;
  color: var(--label-tertiary);
}

.t-input {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.2px;
  line-height: 1.41;
}

.t-button {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.41;
}

.t-buttonsm {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  line-height: 1.33;
}

.t-chip {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  line-height: 1.29;
}

.t-micro {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1.36;
}

/* Backwards-compat aliases for older markup ---------------------- */
.display-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(30px, 4.4vw, 38px);
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.1;
  color: var(--label);
}
.display-title-quiet { color: var(--label-tertiary); font-weight: 500; }
.section-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.27;
  color: var(--label);
}
.eyebrow {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--label-tertiary);
}
.subtitle {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--label-secondary);
}

/* ==================================================================
 * Tier 1 — Primary CTA (the earned brand moment)
 * One per screen. White text on dusk gradient. No halo.
 * ================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: var(--r-button);
  border: 0;
  cursor: pointer;
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  background-image: var(--grad-cta);
  transition: opacity .15s ease, transform .12s ease;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active:not([disabled]) { transform: scale(.97); }
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn-primary:disabled,
.btn-primary[disabled],
.btn-primary[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
}
.btn-primary .material-symbols-outlined { color: inherit; font-size: 20px; }

/* Tier 2 — Ghost outline button (secondary actions) -------------- */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-button);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-ghost:hover {
  background-color: var(--surface);
  border-color: var(--label-tertiary);
}
.btn-ghost:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Destructive variant — for delete confirmations.
   Solid red, not the brand gradient (delete is not a brand moment). */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-button);
  background-color: var(--danger);
  border: 0;
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, transform .12s ease;
}
.btn-danger:hover { opacity: .92; }
.btn-danger:active { transform: scale(.97); }
.btn-danger:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 3px;
}
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }

/* Tier 3 — Quiet text (skip / cancel) ---------------------------- */
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 10px 4px;
  color: var(--label-tertiary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease;
}
.btn-quiet:hover { color: var(--label); }

/* Footer / sticky CTA cluster (§10) ----------------------------- */
.cta-cluster {
  border-top: 1px solid var(--border);
  padding: var(--s-lg) var(--s-xl);
  display: flex;
  flex-direction: column;
  gap: var(--s-md);
  background-color: var(--bg);
}

/* ==================================================================
 * Bare-line input (§6) — no chrome, hairline rule underneath
 * ================================================================== */

.input-bare {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 0 9px;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--label);
  outline: none;
  transition: border-color .15s ease, border-bottom-width .15s ease;
}
.input-bare::placeholder { color: var(--label-tertiary); }
.input-bare:focus {
  border-bottom-width: 1.5px;
  border-bottom-color: var(--accent);
  padding-bottom: 8.5px;
}
.input-bare:disabled { opacity: .5; cursor: not-allowed; }

/* Legacy alias */
.bare-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 0 9px;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 17px;
  color: var(--label);
  outline: none;
  transition: border-color .15s ease;
}
.bare-input::placeholder { color: var(--label-tertiary); }
.bare-input:focus {
  border-bottom-width: 1.5px;
  border-bottom-color: var(--accent);
  padding-bottom: 8.5px;
}

/* Input-clear `×` glyph (right side of input row) */
.input-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--label-tertiary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.input-clear:hover { color: var(--label); background-color: var(--surface); }

/* ==================================================================
 * Suggestion chip (§7) — hairline inactive, inverted solid active
 * ================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--r-chip);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--label-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.chip:hover { color: var(--label); border-color: var(--border-strong); }
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chip.is-active,
.chip[aria-pressed="true"] {
  background-color: var(--label);
  color: var(--bg);
  border-color: var(--label);
}
.chip.is-active .material-symbols-outlined,
.chip[aria-pressed="true"] .material-symbols-outlined { color: var(--bg); }
.chip .material-symbols-outlined { font-size: 16px; color: inherit; }

/* ==================================================================
 * Surface card — hairline, no fill bath, no gradient ring
 * ================================================================== */

.surface-card {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.surface-card--quiet {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}

.hairline        { border-color: var(--border) !important; }
.hairline-strong { border-color: var(--border-strong) !important; }

/* ==================================================================
 * Photo / media slot (§8) — 3 states
 * ================================================================== */

/* Wrapper */
.photo-slot {
  position: relative;
  display: block;
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  transition: opacity .15s ease;
}
.photo-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Future (idle, empty) — hairline solid (never dashed) + surface fill */
.photo-slot--future {
  background-color: var(--surface);
  border: 1px solid var(--border);
  transition: background-color .15s ease, border-color .15s ease;
}
.photo-slot--future:hover {
  background-color: var(--surface-strong);
  border-color: var(--border-strong);
}

/* Next (active add-target) — 2px gradient frame, bg fill, centered `+` */
.photo-slot--next {
  padding: 2px;
  background-image: var(--grad-moment);
  border: 0;
}
.photo-slot--next > * {
  border-radius: calc(var(--r-card) - 2px);
  background-color: var(--bg);
}

/* Filled — 2px gradient frame around the photo */
.photo-slot--filled {
  padding: 2px;
  background-image: var(--grad-moment);
  border: 0;
}
.photo-slot--filled > img,
.photo-slot--filled > video,
.photo-slot--filled > .photo-slot-content {
  border-radius: calc(var(--r-card) - 2px);
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Centered `+` glyph for next slot */
.photo-slot-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--label-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

/* Remove `×` for filled (top-right) */
.photo-slot-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.55);
  border: 0;
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
  z-index: 2;
}
.photo-slot-remove:hover { background-color: rgba(0, 0, 0, 0.75); }

/* ==================================================================
 * Upload slot — alias of photo-slot, kept for existing markup
 * ================================================================== */

.upload-slot {
  display: block;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  transition: background-color .15s ease, border-color .15s ease;
}
.upload-slot:hover {
  background-color: var(--surface-strong);
  border-color: var(--border-strong);
}
.upload-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.upload-slot[data-has-files="true"],
.upload-slot[data-has-sheet="true"] {
  background-color: var(--bg);
  border-color: var(--border-strong);
}

.upload-mark {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background-color: transparent;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--label-secondary);
  font-size: 22px;
  line-height: 1;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 300;
  transition: color .15s ease, border-color .15s ease;
}
.upload-slot:hover .upload-mark {
  color: var(--label);
  border-color: var(--label-tertiary);
}

/* ==================================================================
 * Consent checkbox (§9) — solid fill when checked, never gradient
 * ================================================================== */

.consent-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background-color: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .12s ease, border-color .12s ease;
}
.consent-checkbox:hover { border-color: var(--label-tertiary); }
.consent-checkbox:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.consent-checkbox.is-checked,
.consent-checkbox[aria-checked="true"] {
  background-color: var(--label);
  border-color: var(--label);
}
.consent-checkbox .material-symbols-outlined {
  font-size: 14px;
  color: var(--bg);
  font-weight: 700;
  opacity: 0;
  transition: opacity .12s ease;
}
.consent-checkbox.is-checked .material-symbols-outlined,
.consent-checkbox[aria-checked="true"] .material-symbols-outlined { opacity: 1; }

/* ==================================================================
 * Top app bar — hairline divider, no glass
 *
 * Pattern: pure chrome — utilities right-aligned, brand on mobile only.
 * Page identity lives in (a) active nav rail, (b) main display title.
 * The top-bar does NOT repeat the page name — that's redundancy the
 * guide §20 strip-down explicitly removes.
 * ================================================================== */

.top-bar {
  background-color: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  color: var(--label);
  scrollbar-gutter: stable;
}

/* Inner alignment shell — matches the main column so utility buttons
   sit flush with the page H1 below, not floating in the gutter.
   Inner inherits its own horizontal padding to mirror <main>'s box. */
.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 80rem; /* ≈ max-w-7xl, same as main */
  margin-inline: auto;
  padding: 12px 16px;
}
@media (min-width: 640px) {
  .top-bar-inner { padding: 16px 24px; }
}
@media (min-width: 768px) {
  .top-bar-inner { padding-left: calc(16rem + 16px); }
}
@media (min-width: 1024px) {
  .top-bar-inner { padding-left: calc(16rem + 24px); }
}

/* Mobile brand — never on desktop. The sidebar carries the brand on md+. */
.top-bar-brand {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--label);
  text-decoration: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--label-secondary);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover {
  background-color: var(--surface);
  color: var(--label);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.icon-btn .material-symbols-outlined { color: inherit; }

/* Back / wizard-exit nav chrome (§16) */
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--label);
  cursor: pointer;
  transition: opacity .12s ease, background-color .15s ease;
}
.back-button:hover { background-color: var(--surface); }
.back-button:active { opacity: .35; }
.back-button .material-symbols-outlined { font-size: 20px; color: inherit; }

.wizard-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--label-tertiary);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.wizard-exit:hover { background-color: var(--surface); color: var(--label); }
.wizard-exit .material-symbols-outlined { font-size: 16px; color: inherit; }

/* ==================================================================
 * Nav drawer — inverted active state (label fill, bg text)
 * ================================================================== */

.nav-drawer {
  background-color: var(--bg);
  border-right: 1px solid var(--border);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--label-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover {
  background-color: var(--surface);
  color: var(--label);
}
.nav-link.is-active {
  background-color: var(--label);
  color: var(--bg);
  font-weight: 600;
}
.nav-link.is-active .material-symbols-outlined { color: inherit; }
.nav-link .material-symbols-outlined { font-size: 22px; }

/* Mobile bottom nav */
.nav-mobile {
  background-color: color-mix(in oklch, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.nav-mobile-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  padding: 8px 4px;
  border-radius: 12px;
  color: var(--label-tertiary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: none;
  transition: color .15s ease;
}
.nav-mobile-link .material-symbols-outlined { font-size: 22px; }
.nav-mobile-link.is-active {
  color: var(--label);
}
.nav-mobile-link.is-active .material-symbols-outlined {
  color: var(--label);
  font-variation-settings: "FILL" 1;
}

/* ==================================================================
 * Bottom sheet / modal (§14)
 * ================================================================== */

/* Scrim — backdrop that covers the entire viewport. We force fixed +
   inset-0 here so the dim survives a parent with padding (which would
   otherwise inset the scrim via the padding-box and leave bright gutters
   around the viewport edges). */
.scrim {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
}

.modal-surface {
  background-color: var(--bg);
  border-radius: var(--r-modal);
  border: 1px solid var(--border);
}

.sheet-handle {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--border-strong);
  margin: 10px auto 14px;
}

/* Wizard step-progress segments */
.wizard-step-seg {
  background-color: var(--border);
  transition: background-color 0.25s ease, opacity 0.25s ease;
}
.wizard-step-seg.is-active { background-color: var(--accent); }
.wizard-step-seg.is-done   { background-color: var(--accent); opacity: 0.35; }

/* Quiet `×` close glyph (NOT xmark.circle.fill SF Symbol) */
.close-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--label-tertiary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}
.close-glyph:hover {
  background-color: var(--surface);
  color: var(--label);
}
.close-glyph:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hairline-divided list row inside a sheet — no per-row card box */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-top: 1px solid var(--border);
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  transition: background-color .15s ease;
}
.list-row:first-of-type { border-top: 0; }
.list-row:hover { background-color: var(--surface); }
.list-row .disclosure {
  margin-left: auto;
  color: var(--label-tertiary);
  font-size: 18px;
}

/* ==================================================================
 * Progress bar — 2px hairline track, gradient fill
 * ================================================================== */

.progress-track {
  height: 2px;
  background-color: var(--border);
  border-radius: 1px;
  overflow: hidden;
  width: 100%;
}
.progress-fill {
  height: 100%;
  background-image: var(--grad-moment-h);
  transition: width .3s ease;
}
.progress-track--thick { height: 6px; border-radius: 3px; }

/* ==================================================================
 * Status pill (§18) — hairline, no fill, top-right
 * ================================================================== */

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--label-secondary);
  white-space: nowrap;
}
.status-pill--accent  { color: var(--accent);  border-color: var(--accent); }
.status-pill--warning { color: var(--warning); border-color: var(--warning); }
.status-pill--success { color: var(--success); border-color: var(--success); }
.status-pill--danger  { color: var(--danger);  border-color: var(--danger); }
/* Legacy alias — gold pill maps to warning amber */
.status-pill--gold    { color: var(--warning); border-color: var(--warning); }

/* ==================================================================
 * Skeleton (§17A) — neutral surface bars, no shimmer if <400ms
 * ================================================================== */

.skeleton {
  display: block;
  background-color: var(--surface);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--surface-strong) 50%,
    transparent 100%);
  /* 400ms delay: if real content lands first, the user never sees the shimmer. */
  animation: skeleton-shimmer 1.4s ease-in-out 0.4s infinite;
  transform: translateX(-100%);
}
@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}

/* ==================================================================
 * Entrance motion — one fade-down, then stillness. 60–120ms stagger.
 * ================================================================== */

@keyframes enter-down {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0,    0); }
}

.enter,
.enter-1, .enter-2, .enter-3, .enter-4, .enter-5 {
  animation: enter-down .32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.enter-2 { animation-delay: .06s; }
.enter-3 { animation-delay: .12s; }
.enter-4 { animation-delay: .18s; }
.enter-5 { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  .enter, .enter-1, .enter-2, .enter-3, .enter-4, .enter-5 {
    animation: none !important;
  }
}

/* ==================================================================
 * Spinner — inline only (inside CTAs / next to status labels)
 * Never used as a full-screen blocker.
 * ================================================================== */

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--label);
  animation: spin .9s linear infinite;
  display: inline-block;
}
.spinner--accent { border-top-color: var(--accent); }
.spinner--on-cta { border-color: rgba(255,255,255,0.35); border-top-color: #FFFFFF; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================================================================
 * Page scaffolding utilities
 * ================================================================== */

.hub-shell { position: relative; z-index: 1; }

.bg-app             { background-color: var(--bg) !important; }
.bg-surface-tok     { background-color: var(--surface) !important; }
.bg-surface-strong  { background-color: var(--surface-strong) !important; }
.text-label         { color: var(--label) !important; }
.text-label-secondary { color: var(--label-secondary) !important; }
.text-label-tertiary  { color: var(--label-tertiary) !important; }
/* Legacy aliases — map to semantic tokens */
.text-gold          { color: var(--warning); }
.text-green         { color: var(--accent); }

/* ==================================================================
 * Hub card shells (JS-built panels) — same hairline as .surface-card
 * ================================================================== */

.hub-card-shell {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background-color: var(--bg);
}
.dir-folder.hub-card-shell[open] {
  border-color: var(--border-strong);
}

/* Icon "well" used by tile builders — neutralized to pure hairline */
.hub-tile-icon-well {
  border: 1px solid var(--border);
  background-color: var(--surface);
  border-radius: var(--r-card);
  transition: border-color .15s ease, background-color .15s ease;
}

.video-play-btn:hover .hub-tile-icon-well,
.sheet-open-btn:hover .hub-tile-icon-well {
  border-color: var(--border-strong);
}
.video-play-btn:hover,
.sheet-open-btn:hover {
  background-color: var(--surface);
}
.video-play-btn:focus-visible,
.sheet-open-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sheet preview table inherits tokens */
.sheet-table-wrap table th {
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--label);
  font-weight: 600;
}
.sheet-table-wrap table td {
  border: 1px solid var(--border);
  color: var(--label);
}

/* Promoat checkout amount input */
.promoat-checkout-input {
  color: var(--label) !important;
  background-color: var(--surface) !important;
  border-color: var(--border-strong) !important;
}

/* ==================================================================
 * Tailwind CDN injects after this stylesheet. We need:
 *   1) Extended palette utilities (text-label, etc.) to keep their token values.
 *   2) JS-rendered `amber-*` utilities to map to neutrals (no ambient brand).
 * Both handled with !important here so CDN utilities don't undo the system.
 * ================================================================== */

/* Dark-mode label utility re-anchoring */
html.dark .text-label           { color: var(--label) !important; }
html.dark .text-label-secondary { color: var(--label-secondary) !important; }
html.dark .text-label-tertiary  { color: var(--label-tertiary) !important; }
html.dark .text-primary         { color: var(--accent) !important; }

html.dark select {
  color: var(--label) !important;
  background-color: var(--surface) !important;
}
html.dark input[type="text"],
html.dark input[type="number"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="search"],
html.dark input[type="url"],
html.dark input[type="tel"],
html.dark textarea {
  color: var(--label) !important;
  background-color: var(--surface-strong) !important;
}
html.dark option { background-color: var(--surface); color: var(--label); }

html.dark .subtitle           { color: var(--label-secondary) !important; }
html.dark .eyebrow            { color: var(--label-tertiary) !important; }
html.dark .text-on-surface-variant { color: var(--label-secondary) !important; }
html.dark .text-on-surface    { color: var(--label) !important; }
html.dark .section-title,
html.dark .display-title,
html.dark .t-display,
html.dark .t-heading,
html.dark .t-title { color: var(--label) !important; }

/* Strip ambient amber/gold tints from JS-rendered markup ---------- */
.bg-amber-50,
.bg-amber-100,
.bg-amber-50\/70,
.bg-amber-50\/80,
.bg-amber-50\/90    { background-color: var(--surface) !important; }
.bg-amber-500\/15,
.bg-amber-500\/20   { background-color: var(--surface-strong) !important; }

.border-amber-200\/35,
.border-amber-300\/50,
.border-amber-400\/40,
.border-amber-500\/20 { border-color: var(--border) !important; }

.ring-amber-200\/60,
.ring-amber-400\/70,
.ring-amber-400\/80,
.ring-amber-500,
.ring-amber-500\/30,
.ring-amber-500\/70 { --tw-ring-color: var(--border-strong) !important; }

/* Neutralize amber text utilities — no ambient brand text. */
.text-amber-200 { color: var(--label-tertiary) !important; }
.text-amber-300 { color: var(--label-secondary) !important; }
.text-amber-400 { color: var(--label-secondary) !important; }
.text-amber-700 { color: var(--label-secondary) !important; }
.text-amber-800 { color: var(--label-secondary) !important; }
.text-amber-900 { color: var(--label) !important; }

/* Neutralize amber gradient backgrounds (`from-amber-* to-amber-*`) */
.from-amber-100 { --tw-gradient-from: var(--surface) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, transparent); }
.to-amber-50    { --tw-gradient-to: var(--bg) !important; }

/* "secondary" Tailwind keyword (legacy mapping) */
.text-secondary { color: var(--label-secondary); }

/* Global focus-visible ring uses accent */
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  --tw-ring-color: var(--accent);
}

/* ==================================================================
 * Legacy compatibility shims — keep existing markup working while
 * page bodies are still being rewritten. Drop these after the
 * dashboard/videos/pending/sheets HTML stops using them.
 * ================================================================== */

/* Was a tile of Islamic stars at 0.11 opacity behind every page —
   ambient brand decoration the guide §11 forbids. Hide the orphan div. */
.ramadan-geometry-bg { display: none !important; }

/* Inset panel (wizard pick-lists, JSON pre): just a quiet surface card. */
.hub-gradient-ring {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background-color: var(--surface);
}

/* Brand gradient fill utility.
   Reserved use ONLY: primary CTAs (.btn-primary) and the one earned "moment"
   per screen (e.g. photo-slot frame, hero mockup border). Never on progress
   bars, meters, badges, status pills, surface tints, or text fills — that
   blows the brand-color budget (§11). */
.brand-gradient   { background-image: var(--grad-moment); }
.brand-gradient-h { background-image: var(--grad-moment-h); }

/* "Green tint" success banner — drop the fill; rely on the hairline border. */
.bg-green-tint    { background-color: transparent; }
.bg-gold-tint     { background-color: transparent; }

/* Typography aliases the JS still emits */
.font-noto-serif  {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}
.font-manrope     {
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

/* Page-scope hooks the markup still carries — keep them inert. */
.dashboard-page,
.hub-page-surface-cards-gradient { /* no-op now; layout lives on shared classes */ }

/* ==================================================================
 * Notifications dropdown (top-bar bell → panel of hairline rows).
 * Apple-minimal pattern: no per-row icon tile, hairline dividers,
 * quiet `×` close, neutral surface.
 * ================================================================== */

.hub-notifications-wrap {
  position: relative;
  z-index: 80;
}

.hub-notifications-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  width: min(100vw - 32px, 360px);
  max-width: 360px;
  z-index: 90;
  text-align: left;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.hub-notifications-dropdown:not(.is-open) {
  display: none !important;
  pointer-events: none;
  visibility: hidden;
}
.hub-notifications-dropdown.is-open {
  display: block !important;
  pointer-events: auto;
  visibility: visible;
}

/* Quiet pointer toward the bell */
.hub-notifications-caret {
  position: absolute;
  top: 2px;
  right: 14px;
  width: 11px;
  height: 11px;
  background-color: var(--bg);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
  z-index: 2;
  pointer-events: none;
  box-sizing: border-box;
}

.hub-notifications-panel {
  position: relative;
  margin-top: 8px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background-color: var(--bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
html.dark .hub-notifications-panel {
  background-color: var(--surface);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
}

.hub-notifications-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.hub-notifications-header p:first-child {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--label);
  letter-spacing: -0.2px;
}
.hub-notifications-header p + p {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
}

.hub-notifications-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--label-tertiary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease, color .15s ease;
}
.hub-notifications-close:hover {
  background-color: var(--surface);
  color: var(--label);
}

.hub-notifications-item {
  display: flex;
  width: 100%;
  text-align: left;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--label);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .12s ease;
}
.hub-notifications-item:first-of-type { border-top: 0; }
.hub-notifications-item:hover,
.hub-notifications-item:focus-visible {
  background-color: var(--surface);
}

/* No tinted icon tile — quiet monochrome glyph in label-secondary (§14). */
.hub-notifications-item-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--label-secondary);
}
.hub-notifications-item-icon .material-symbols-outlined {
  font-size: 20px;
  color: inherit;
}

.hub-notifications-item-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hub-notifications-item-kicker {
  font-size: 11px;
  font-weight: 500;
  color: var(--label-tertiary);
  letter-spacing: 0;
}

.hub-notifications-item-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  color: var(--label);
}

.hub-notifications-item-desc {
  font-size: 13px;
  color: var(--label-secondary);
  line-height: 1.4;
}

.hub-notifications-item-meta,
.hub-notifications-item-time {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
}

#hub-notifications-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(60vh, 360px);
  overflow-y: auto;
}

/* ==================================================================
 * Sidebar v2 — owns notifications + theme toggle + brand.
 * No top app-bar on desktop; on mobile, a small floating menu pill
 * opens the drawer and shows the brand.
 * ================================================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  border-right: 1px solid var(--border);
}
html.dark .sidebar { border-right-color: var(--border-strong); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  text-decoration: none;
  color: var(--label);
}
.sidebar-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background-image: var(--grad-cta);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.sidebar-brand-name {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: var(--label);
}

.sidebar-section-label {
  padding: 0 20px;
  margin: 14px 0 6px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--label-tertiary);
}

.sidebar-nav {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--label-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.1px;
  text-decoration: none;
  position: relative;
  transition: background-color .12s ease, color .12s ease;
}
.sidebar-link:hover {
  background-color: var(--surface);
  color: var(--label);
}
.sidebar-link.is-active {
  background-color: var(--label);
  color: var(--bg);
  font-weight: 600;
}
html.dark .sidebar-link.is-active {
  background-color: var(--surface-strong);
  color: var(--label);
  box-shadow: inset 2px 0 0 var(--accent);
}
html.dark .sidebar-link:hover { background-color: var(--surface-strong); }
.sidebar-link.is-active .material-symbols-outlined { color: inherit; }
.sidebar-link .material-symbols-outlined { font-size: 20px; }
.sidebar-link-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  font-family: "DM Sans", system-ui, sans-serif;
  background-color: var(--surface-strong);
  color: var(--label-secondary);
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  letter-spacing: 0;
}
.sidebar-link.is-active .sidebar-link-badge {
  background-color: var(--bg);
  color: var(--label);
}
html.dark .sidebar-link.is-active .sidebar-link-badge {
  background-color: var(--accent-dim);
  color: var(--label);
}
.sidebar-link-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background-color: var(--accent);
  margin-left: auto;
}

.sidebar-footer {
  padding: 12px 16px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sidebar-footer .icon-btn { width: 36px; height: 36px; }

/* Floating top-left button on mobile only — replaces the old top bar. */
.mobile-menu-fab {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.1px;
  cursor: pointer;
}
.mobile-menu-fab .material-symbols-outlined { font-size: 20px; }
.mobile-menu-fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The notifications dropdown anchors to a different button in the sidebar now.
   Re-position it to open to the right of the rail. */
.sidebar-footer .hub-notifications-wrap { position: relative; }
.sidebar-footer .hub-notifications-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  top: auto;
  left: 0;
  right: auto;
  width: min(100vw - 32px, 360px);
}
.sidebar-footer .hub-notifications-caret {
  top: auto;
  bottom: 2px;
  left: 14px;
  right: auto;
  transform: rotate(225deg);
}
.sidebar-footer .hub-notifications-panel {
  margin-top: 0;
  margin-bottom: 8px;
}

/* ==================================================================
 * Page shell v2 — used by every page, hugs the sidebar on desktop,
 * scrolls on mobile.
 * ================================================================== */

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px 20px 96px;
}
@media (min-width: 768px) {
  .page-shell {
    padding: 32px 32px 48px;
    padding-left: calc(16rem + 32px);
  }
}
@media (min-width: 1024px) {
  .page-shell {
    padding-left: calc(16rem + 40px);
    padding-right: 40px;
  }
}
.page-inner { max-width: 80rem; margin-inline: auto; }
.page-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.page-header h1 {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: clamp(26px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.1;
  color: var(--label);
  margin: 0;
}
.page-header p {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--label-tertiary);
  margin: 0;
}

.page-mobile-spacer {
  height: 56px;
}
@media (min-width: 768px) {
  .page-mobile-spacer { display: none; }
}

/* ==================================================================
 * List toolbar: search + sort + per-page + action buttons in one row
 * ================================================================== */

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.list-search {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}
.list-search .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--label-tertiary);
  pointer-events: none;
}
.list-search input {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  padding: 0 36px 0 36px;
  font-size: 14px;
  color: var(--label);
  font-family: "Lato", system-ui, sans-serif;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.list-search input::placeholder { color: var(--label-tertiary); }
.list-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
html.dark .list-search input { background-color: var(--surface); }
.list-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--label-tertiary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.list-search-clear:hover { color: var(--label); background-color: var(--surface); }

.list-toolbar select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  padding: 0 28px 0 12px;
  font-size: 13px;
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-tertiary) 50%),
    linear-gradient(135deg, var(--label-tertiary) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
}
.list-toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
html.dark .list-toolbar select { background-color: var(--surface); }

.list-toolbar-spacer { flex: 1; }

.btn-primary--sm, .btn-ghost--sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-primary--sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  background-image: var(--grad-cta);
  transition: opacity .15s ease, transform .12s ease;
}
.btn-primary--sm:hover { opacity: .92; }
.btn-ghost--sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-ghost--sm:hover { background-color: var(--surface); border-color: var(--border-strong); }
html.dark .btn-ghost--sm { background-color: var(--surface); }

/* ==================================================================
 * Data table (used for sheets list, generated list, etc.)
 * ================================================================== */

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background-color: var(--bg);
  overflow: hidden;
}
html.dark .data-table-wrap { background-color: var(--surface); }

.data-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 14px;
  color: var(--label);
  min-width: 640px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background-color: var(--bg);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label-tertiary);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
html.dark .data-table thead th { background-color: var(--surface); }
.data-table thead th[data-sortable="1"] { cursor: pointer; }
.data-table thead th[data-sortable="1"]:hover { color: var(--label); }
.data-table thead th .sort-glyph {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  width: 10px;
  color: var(--label-tertiary);
}
.data-table thead th[data-sort-dir="asc"] .sort-glyph::before { content: "▲"; color: var(--label); }
.data-table thead th[data-sort-dir="desc"] .sort-glyph::before { content: "▼"; color: var(--label); }
.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.is-selected td { background-color: var(--accent-dim); }
.data-table tbody tr:hover td { background-color: var(--surface); }
.data-table tbody tr.is-selected:hover td { background-color: var(--accent-dim); }

.data-table .cell-meta {
  display: block;
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
}

/* Column-checkbox column tightener */
.data-table .col-check { width: 36px; padding-right: 0; }
.data-table .col-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.data-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.data-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--label-tertiary);
  font-size: 14px;
}
.data-empty-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background-color: var(--surface);
  color: var(--label-tertiary);
  margin-bottom: 12px;
}
.data-empty-mark .material-symbols-outlined { font-size: 26px; }
.data-empty-title {
  display: block;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--label);
  margin-bottom: 4px;
}

/* ==================================================================
 * Pagination
 * ================================================================== */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background-color: var(--bg);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 13px;
  color: var(--label-secondary);
}
html.dark .pagination { background-color: var(--surface); }
.pagination-info { font-variant-numeric: tabular-nums; }
.pagination-controls { display: inline-flex; align-items: center; gap: 4px; }
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
html.dark .pagination-btn { background-color: var(--surface); }
.pagination-btn:hover:not(:disabled) { background-color: var(--surface); border-color: var(--border-strong); }
.pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-btn.is-active {
  background-color: var(--label);
  color: var(--bg);
  border-color: var(--label);
}
html.dark .pagination-btn.is-active {
  background-color: var(--surface-strong);
  color: var(--label);
  border-color: var(--accent);
}
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--label-tertiary);
  font-size: 14px;
}

/* ==================================================================
 * Bulk action bar — appears when at least one row is selected
 * ================================================================== */

.bulk-bar {
  position: sticky;
  bottom: 16px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background-color: var(--label);
  color: var(--bg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  z-index: 20;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  max-width: 100%;
}
.bulk-bar-count { font-variant-numeric: tabular-nums; }
.bulk-bar .btn-primary,
.bulk-bar .btn-ghost,
.bulk-bar .btn-quiet {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
.bulk-bar .btn-primary {
  background-image: none;
  background-color: #FFFFFF;
  color: var(--label);
}
.bulk-bar .btn-ghost {
  color: var(--bg);
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.35);
}
.bulk-bar .btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.7);
}
.bulk-bar .btn-quiet { color: rgba(255, 255, 255, 0.78); }
.bulk-bar .btn-quiet:hover { color: #FFFFFF; }

/* ==================================================================
 * Mini progress strip (parallel-run summary)
 * ================================================================== */

.runs-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.run-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
html.dark .run-card { background-color: var(--surface); }
.run-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--label);
}
.run-card-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.run-card-status {
  font-size: 12px;
  color: var(--label-secondary);
  font-family: "Lato", system-ui, sans-serif;
  line-height: 1.4;
}
.run-card-meta {
  font-size: 11px;
  color: var(--label-tertiary);
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}
.run-card-bar {
  height: 4px;
  border-radius: 999px;
  background-color: var(--border);
  overflow: hidden;
}
.run-card-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background-image: var(--grad-cta-h);
}
.run-card-bar:not(.run-card-bar--indeterminate) > span {
  transition: width .4s ease;
}

/* Indeterminate: gradient segment sweeps the full track (parallel-run cards). */
.run-card-bar--indeterminate {
  position: relative;
}
.run-card-bar--indeterminate > span {
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  transform: translateX(-100%);
  animation: run-card-bar-sweep 1.75s linear infinite;
  will-change: transform;
}
@keyframes run-card-bar-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    /* Span is 42% of track; +242% of self ≈ one full track width past the right edge. */
    transform: translateX(242%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .run-card-bar--indeterminate > span {
    animation: none;
    width: 100%;
    transform: none;
    opacity: 0.55;
  }
}

/* ==================================================================
 * Sidebar drawer mobile transitions
 * ================================================================== */
@media (max-width: 767px) {
  #nav-drawer.sidebar {
    transform: translate3d(-100%, 0, 0);
    transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #nav-drawer.sidebar[data-open="true"] { transform: translate3d(0, 0, 0); }
}

/* ==================================================================
 * Quick stat row (Home)
 * ================================================================== */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 640px) {
  .quick-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.quick-stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background-color: var(--bg);
}
html.dark .quick-stat { background-color: var(--surface); }
.quick-stat-label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label-tertiary);
}
.quick-stat-value {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--label);
  margin-top: 4px;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}
.quick-stat-hint {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
}
.quick-stat-trend--ok { color: var(--success); }
.quick-stat-trend--warn { color: var(--warning); }

/* ==================================================================
 * Pipeline activity card (Home)
 * ================================================================== */
.pipeline-card {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px 22px;
  background-color: var(--bg);
}
html.dark .pipeline-card { background-color: var(--surface); }
.pipeline-card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.pipeline-card h3 {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--label);
  margin: 0;
}
.pipeline-card-sub {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 13px;
  color: var(--label-tertiary);
  margin-top: 2px;
}
.pipeline-stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 540px) {
  .pipeline-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pipeline-step {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
html.dark .pipeline-step { background-color: var(--bg); }
.pipeline-step-label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--label-tertiary);
}
.pipeline-step-value {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--label);
  letter-spacing: -0.4px;
}
.pipeline-step-hint {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 12px;
  color: var(--label-tertiary);
}
.pipeline-step.is-attention {
  border-color: var(--accent-border);
  background-color: var(--accent-dim);
}
.pipeline-step.is-attention .pipeline-step-value { color: var(--accent); }
.pipeline-step.is-attention .pipeline-step-label { color: var(--accent); }
.pipeline-step-action {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-top: 2px;
}
.pipeline-step-action:hover { text-decoration: underline; }

/* ==================================================================
 * Tab bar (pill-shaped, used across upload + generated pages)
 * ================================================================== */
.hub-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--bg);
}
html.dark .hub-tabs { background-color: var(--surface); }
.hub-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  color: var(--label-secondary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.hub-tab:hover { color: var(--label); }
.hub-tab.is-active {
  background-color: var(--label);
  color: var(--bg);
}
html.dark .hub-tab.is-active {
  background-color: var(--surface-strong);
  color: var(--label);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.hub-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--label-tertiary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
html.dark .hub-tab-count { background-color: var(--bg); }
.hub-tab.is-active .hub-tab-count {
  background-color: rgba(255,255,255,0.18);
  color: var(--bg);
}
html.dark .hub-tab.is-active .hub-tab-count {
  background-color: var(--surface);
  color: var(--label);
}

/* ==================================================================
 * Generated card grid (replaces flat tile flow)
 * ================================================================== */
.generated-grid {
  display: grid;
  /* Smaller min keeps the 9:16 thumb readable but not phone-sized. */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.generated-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
html.dark .generated-card { background-color: var(--surface); }
.generated-card:hover { border-color: var(--border-strong); }
.generated-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.generated-card-thumb {
  aspect-ratio: 9 / 16;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 0;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--label-secondary);
}
.generated-card-thumb .material-symbols-outlined { font-size: 36px; }
/* Selection checkbox — always visible so users know cards are selectable.
   Unchecked: hairline-bordered white pill. Checked: solid accent fill. */
.generated-card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.generated-card-check:hover {
  border-color: var(--label);
}
.generated-card.is-selected .generated-card-check {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.generated-card-check .material-symbols-outlined { font-size: 16px; }
.generated-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.generated-card-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.generated-card-meta {
  font-size: 11px;
  color: var(--label-tertiary);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.generated-card-status {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: rgba(0,0,0,0.6);
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ==================================================================
 * Wizard polish: rich tile rows w/ icon + title + caption + chevron
 * ================================================================== */
.wizard-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--label);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}
html.dark .wizard-tile { background-color: var(--surface); }
.wizard-tile:hover {
  border-color: var(--border-strong);
  background-color: var(--surface);
}
html.dark .wizard-tile:hover { background-color: var(--surface-strong); }
.wizard-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--surface-strong);
  color: var(--label);
  flex-shrink: 0;
}
html.dark .wizard-tile-icon { background-color: var(--bg); }
.wizard-tile-icon .material-symbols-outlined { font-size: 22px; }
.wizard-tile-body { flex: 1; min-width: 0; }
.wizard-tile-title {
  display: block;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--label);
  letter-spacing: -0.1px;
}
.wizard-tile-caption {
  display: block;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
  font-weight: 400;
}
.wizard-tile-chevron {
  flex-shrink: 0;
  color: var(--label-tertiary);
  font-size: 20px;
}

.wizard-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.wizard-summary-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background-color: var(--surface);
}
html.dark .wizard-summary-row { background-color: var(--bg); }
.wizard-summary-row .label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label-tertiary);
}
.wizard-summary-row .value {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
}
.wizard-summary-row .hint {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 12px;
  color: var(--label-tertiary);
}
.wizard-summary-cost {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.wizard-summary-cost .total {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--label);
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

/* ==================================================================
 * Sheet preview modal — tools bar (search + paginate)
 * ================================================================== */
.sheet-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
}
html.dark .sheet-tools { background-color: var(--surface); }
.sheet-tools .list-search { flex: 1 1 200px; max-width: 320px; }
.sheet-tools .pagination-info { font-size: 12px; }

/* ==================================================================
 * Tile grids (uploaded videos, sheets) — let them scroll inside a
 * fixed-height wrapper so 200 sheets don't blow out the page.
 * ================================================================== */
.tile-grid-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--r-card);
}

/* small helper used inline */
.hide-when-empty:empty { display: none; }

/* ==================================================================
 * Wizard sheet picker — flat hairline list, custom indigo radio,
 * upload affordance lives in the same list as the last row.
 * One screen, one decision, one CTA at the bottom.
 * ================================================================== */
.sheet-list-frame {
  border-top: 1px solid var(--border);
}
.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(46vh, 320px);
  overflow-y: auto;
}
.sheet-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-align: start;
  transition: background-color .15s ease;
  user-select: none;
}
.sheet-row:hover { background-color: var(--surface); }
.sheet-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 8px;
}
.sheet-row-radio {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease;
}
.sheet-row-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent);
  transform: scale(0);
  transition: transform .15s ease;
}
.sheet-row[aria-checked="true"] .sheet-row-radio {
  border-color: var(--accent);
}
.sheet-row[aria-checked="true"] .sheet-row-radio::after {
  transform: scale(1);
}
.sheet-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sheet-row-title {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-row-caption {
  font-family: "Lato", system-ui, sans-serif;
  font-size: 12px;
  color: var(--label-tertiary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Checkbox variant — rounded square mark, used for multi-select (videos) */
.sheet-row-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease, border-color .15s ease;
}
.sheet-row-check .material-symbols-outlined {
  font-size: 14px;
  font-variation-settings: 'wght' 700;
  color: transparent;
  transition: color .15s ease;
}
.sheet-row[aria-checked="true"] .sheet-row-check {
  background-color: var(--accent);
  border-color: var(--accent);
}
.sheet-row[aria-checked="true"] .sheet-row-check .material-symbols-outlined {
  color: #fff;
}

.sheet-empty {
  padding: 28px 4px 18px;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 14px;
  color: var(--label-tertiary);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.sheet-empty-link {
  color: var(--label);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 600;
  transition: text-decoration-color .15s ease;
}
.sheet-empty-link:hover { text-decoration-color: var(--accent); }

/* Search input above the pick list. Bare-line input, leading magnifying glass. */
.pick-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.pick-search-glyph {
  flex-shrink: 0;
  color: var(--label-tertiary);
  font-size: 20px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pick-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  padding: 6px 0;
  font-family: "Lato", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--label);
}
.pick-search-input::placeholder { color: var(--label-tertiary); }
.pick-search-input:focus { outline: none; }
.pick-search:focus-within { border-bottom-color: var(--accent); }
/* native search-clear quirk: hide WebKit's "x" so we stay in style */
.pick-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

