/* AX Console — design tokens and components for SPOTV's AI-transformation tool console. This file is the source of truth for the look (see readme.md).
   Themes: light and dark via light-dark(); follows the system by default, forced with html[data-theme="light"|"dark"].
   Languages: English default, Korean and Japanese via html[lang]. */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');
@font-face { font-family: "Pretendard Variable"; font-weight: 45 920; font-style: normal; font-display: swap; src: url("assets/fonts/PretendardVariable.woff2") format("woff2"); }
@font-face { font-family: "Pretendard JP Variable"; font-weight: 45 920; font-style: normal; font-display: swap; src: url("assets/fonts/PretendardJPVariable.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  /* Ground — SPOTV NOW's near-black in dark; a cool off-white in light. Never pure black or white. */
  --color-bg: light-dark(#f6f6f7, #0f0f11);
  --color-surface: light-dark(#ffffff, #18181b);
  --color-surface-2: light-dark(#eeeef0, #222226);
  --color-text: light-dark(#16161a, #f2f2f3);
  --color-text-2: light-dark(#3f3f46, #cfcfd4);
  --color-text-muted: light-dark(#6f6f78, #8b8b94);
  --color-border: light-dark(#e2e2e6, #2a2a2f);
  --color-border-strong: light-dark(#c4c4cb, #4f4f57);
  --color-divider: light-dark(rgba(22,22,26,0.12), rgba(242,242,243,0.12));
  --color-hover: light-dark(rgba(22,22,26,0.05), rgba(242,242,243,0.06));
  --color-pressed: light-dark(rgba(22,22,26,0.10), rgba(242,242,243,0.12));

  /* Accent — SPOTV NOW mint #2affcc. Actions only: run, download, active menu, done. Solid fills keep dark ink in both themes. */
  --color-accent: #2affcc;
  --color-accent-hover: light-dark(#1ff0bf, #66ffd9);
  --color-accent-pressed: #17d6aa;
  --color-on-accent: #0a1f19;
  --color-on-danger: #ffffff;
  --color-tip-bg: light-dark(#16161a, #f2f2f3);
  --color-tip-text: light-dark(#f2f2f3, #16161a);
  --color-accent-text: light-dark(#0c7a61, #2affcc);
  --color-accent-tint: light-dark(#d9fff5, #0b4a3b);
  --color-accent-ink: light-dark(#0b6f58, #99ffe6);
  --color-accent-line: light-dark(#7df0d4, #129e7d);
  /* Alert — the pink of the "today" pin. Reserved for places a human must look: review cells, prototype badges. */
  --color-alert: #ff3d7f;
  --color-alert-text: light-dark(#c4285e, #ff6a9c);
  --color-alert-tint: light-dark(#ffe8f0, #451021);
  --color-alert-ink: light-dark(#a82450, #ff96b8);
  --color-alert-line: light-dark(#ff96b8, #a82450);
  /* Semantics */
  --color-success: var(--color-accent-text);
  --color-warning: light-dark(#8f5a00, #f5b73a);
  --color-warning-tint: light-dark(#fff1d6, rgba(245,183,58,0.16));
  --color-danger: light-dark(#c92f2f, #ff5a5a);
  --color-danger-tint: light-dark(#fde6e6, rgba(255,90,90,0.16));
  --color-neutral-tint: light-dark(#e9e9ec, #35353b);

  /* Tonal ramps — OKLCH on one shared lightness scale; the same step of any role has the same visual weight. */
  --color-neutral-100: #f4f4f5; --color-neutral-200: #e4e4e7; --color-neutral-300: #cfcfd4; --color-neutral-400: #b0b0b7; --color-neutral-500: #8b8b94; --color-neutral-600: #6c6c75; --color-neutral-700: #4f4f57; --color-neutral-800: #35353b; --color-neutral-900: #202024;
  --color-accent-100: #e5fff9; --color-accent-200: #bfffef; --color-accent-300: #99ffe6; --color-accent-400: #66ffd9; --color-accent-500: #2affcc; --color-accent-600: #17d6aa; --color-accent-700: #129e7d; --color-accent-800: #0e6f58; --color-accent-900: #0b4a3b;
  --color-alert-100: #ffe8f0; --color-alert-200: #ffc6d9; --color-alert-300: #ff96b8; --color-alert-400: #ff6a9c; --color-alert-500: #ff3d7f; --color-alert-600: #d92f68; --color-alert-700: #a82450; --color-alert-800: #741a38; --color-alert-900: #451021;

  /* Deck section-divider ground — a deep mint field. Slide scale only. */
  --color-section: light-dark(#0b4a3b, #0a3d32);
  --color-section-glow: light-dark(#129e7d, #125c4a);
  --color-section-ghost: light-dark(#17d6aa, #1a8268);
  --color-section-text: #f2f2f3;

  --font-heading: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-body: var(--font-heading);
  --font-ja: "Pretendard JP Variable", "Pretendard JP", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-heading-weight: 600;

  /* Spacing — density 0.85× */
  --space-1: 3px; --space-2: 7px; --space-3: 10px; --space-4: 14px; --space-6: 20px; --space-8: 28px; --space-12: 40px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-pill: 999px;

  /* Elevation — hairline edge + ambient shade. Light theme softens the shade. */
  --shadow-sm: 0 0 0 1px var(--color-border);
  --shadow-md: 0 0 0 1px var(--color-border), 0 6px 18px light-dark(rgba(20,20,30,0.10), rgba(0,0,0,0.55));
  --shadow-lg: 0 0 0 1px var(--color-border-strong), 0 16px 40px light-dark(rgba(20,20,30,0.16), rgba(0,0,0,0.65));

  --sidebar-w: 232px;
  --sidebar-w-collapsed: 60px;
  --topbar-h: 56px;
  --content-max: 1280px;
  /* Breakpoints (for reference — CSS can't read vars in @media): mobile < 640, tablet 640–1023, desktop ≥ 1024. */
  --bp-tablet: 640px; /* @kind other */
  --bp-desktop: 1024px; /* @kind other */

  /* Motion — one duration set, one easing set. */
  --dur-fast: 120ms; /* @kind other */
  --dur-base: 200ms; /* @kind other */
  --dur-slow: 320ms; /* @kind other */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); /* @kind other */ --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* @kind other */
  /* Layers */
  --z-sticky: 10; /* @kind other */ --z-drawer: 30; /* @kind other */ --z-popover: 40; /* @kind other */ --z-dialog: 50; /* @kind other */ --z-toast: 60; /* @kind other */
}
@media (prefers-reduced-motion: reduce) { :root { --dur-fast: 0ms; /* @kind other */ --dur-base: 0ms; /* @kind other */ --dur-slow: 0ms; /* @kind other */ } *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-body); font-size: 14px; line-height: 1.6; font-weight: 400; text-wrap: pretty; }
:lang(ko) { word-break: keep-all; }
:lang(ja) { font-family: var(--font-ja); line-height: 1.7; word-break: normal; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) h4, :lang(ja) .btn, :lang(ja) .card-title { font-family: var(--font-ja); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 var(--space-2); }
h1 { font-size: 32px; } h2 { font-size: 24px; } h3 { font-size: 20px; } h4 { font-size: 17px; } h5 { font-size: 15px; }
h6 { font-size: 12px; letter-spacing: 0.06em; color: var(--color-text-muted); }
.display { font-size: 40px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption, .text-muted { color: var(--color-text-muted); }
figcaption { font-size: 12px; margin-top: var(--space-1); }
.text-small { font-size: 12px; }
.mono, code, kbd, .num { font-family: var(--font-mono); font-size: 0.92em; font-feature-settings: "tnum" 1; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.lighten { mix-blend-mode: lighten; background-color: transparent; }

/* — rules — ends fade over 48px; box borders and short marks stay solid */
.hr { height: 1px; border: 0; margin: var(--space-4) 0; background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent); }

/* — buttons — primary is solid mint (SPOTV NOW's reserve button); secondary is an outline */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1.2; color: var(--color-text); background: transparent; border: 1px solid transparent; padding: 8px 14px; min-height: 36px; border-radius: var(--radius-md); white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn svg { display: block; flex: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.btn-primary:active { background: var(--color-accent-pressed); border-color: var(--color-accent-pressed); }
.btn-secondary { border-color: var(--color-border-strong); }
.btn-secondary:hover { border-color: var(--color-text-muted); background: var(--color-hover); }
.btn-secondary:active { background: var(--color-pressed); }
.btn-accent-outline { border-color: var(--color-accent-text); color: var(--color-accent-text); }
.btn-accent-outline:hover { background: var(--color-accent-tint); }
.btn-accent-outline:active { background: color-mix(in srgb, var(--color-accent) 25%, transparent); }
.btn-ghost { color: var(--color-text-muted); padding-inline: var(--space-2); }
.btn-ghost:hover { color: var(--color-text); background: var(--color-hover); }
.btn-ghost:active { background: var(--color-pressed); }
.btn-danger { border-color: var(--color-danger); color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-tint); }
.btn-pill { border-radius: var(--radius-pill); font-weight: 500; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 13px; }
.btn-lg { min-height: 44px; padding: 10px 20px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-block { width: 100%; }

/* — tags and badges — .tag: attribute chips (square outline, like 독점/무료). .badge: tool or run status. */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong); color: var(--color-text-2); white-space: nowrap; }
.tag-accent { border-color: var(--color-accent-line); color: var(--color-accent-ink); }
.tag-alert { border-color: var(--color-alert-line); color: var(--color-alert-ink); }
.tag-fill { border-color: transparent; background: var(--color-neutral-tint); color: var(--color-text); }
.tag-mono { font-family: var(--font-mono); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; line-height: 1; padding: 4px 9px 4px 7px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--color-accent-tint); color: var(--color-accent-ink); }
.badge-incubating { background: var(--color-warning-tint); color: var(--color-warning); }
.badge-proto { background: var(--color-alert-tint); color: var(--color-alert-ink); }
.badge-new { background: var(--color-neutral-tint); color: var(--color-text); }
.badge-muted { background: var(--color-surface-2); color: var(--color-text-muted); }
.badge-error { background: var(--color-danger-tint); color: var(--color-danger); }
.badge-running::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* — forms — */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.field-hint { font-size: 12px; color: var(--color-text-muted); }
.field-error .input { border-color: var(--color-danger); }
.field-error .field-hint { color: var(--color-danger); }
.input { width: 100%; min-height: 36px; padding: 7px 10px; font: inherit; font-size: 14px; color: var(--color-text); caret-color: var(--color-accent); background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.input::placeholder { color: var(--color-text-muted); opacity: 0.7; }
.input:hover { border-color: var(--color-text-muted); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.input:disabled { opacity: 0.4; }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%238b8b94'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.radio, .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .check input, .seg-opt input, .switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.radio .dot, .check .box { width: 16px; height: 16px; flex: none; border: 1.5px solid var(--color-border-strong); background: var(--color-surface); }
.radio .dot { border-radius: 50%; }
.check .box { border-radius: 4px; }
.radio:hover .dot, .check:hover .box { border-color: var(--color-accent); }
.radio input:checked + .dot { border-color: var(--color-accent); background: var(--color-accent); box-shadow: inset 0 0 0 4px var(--color-surface); }
.check input:checked + .box { border-color: var(--color-accent); background: var(--color-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%230a1f19'%3E%3Cpath d='M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / 12px no-repeat; }
.radio input:focus-visible + .dot, .check input:focus-visible + .box { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--color-text-muted); }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-border-strong); }
.seg-opt:has(input:checked) { color: var(--color-text); background: var(--color-surface-2); }
.seg-opt:not(:has(input:checked)):hover { background: var(--color-hover); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }
/* switch — SPOTV NOW's score toggle */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; position: relative; }
.switch .knob { width: 40px; height: 22px; flex: none; border-radius: var(--radius-pill); background: var(--color-border-strong); position: relative; transition: background var(--dur-fast) var(--ease-out); }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--color-surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-fast) var(--ease-out); }
.switch input:checked + .knob { background: var(--color-accent); }
.switch input:checked + .knob::after { transform: translateX(18px); background: var(--color-on-accent); }
.switch input:focus-visible + .knob { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — tabs — underline style (SPOTV NOW's league tabs) */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--color-divider); }
.tab { appearance: none; background: none; border: 0; padding: 10px 0 12px; margin-bottom: -1px; font: inherit; font-size: 14px; font-weight: 500; color: var(--color-text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-text); }
.tabs-accent .tab[aria-selected="true"] { color: var(--color-accent-text); border-bottom-color: var(--color-accent); }
.tabs-lg .tab { font-size: 18px; padding: 12px 0 14px; }

/* — cards — */
.card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.card-kicker { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); font-family: var(--font-mono); }
.card-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 16px; line-height: 1.3; }
.card-body { margin: 0; font-size: 13px; color: var(--color-text-2); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-muted); }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--color-divider); }
a.card, .card-link { cursor: pointer; color: inherit; text-decoration: none; }
a.card:hover, .card-link:hover { border-color: var(--color-border-strong); text-decoration: none; color: inherit; }
.elev-sm { box-shadow: var(--shadow-sm); } .elev-md { box-shadow: var(--shadow-md); } .elev-lg { box-shadow: var(--shadow-lg); }

/* — console shell — left sidebar + top bar + content */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--dur-base) var(--ease-out); }
.sidebar { display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-4) var(--space-3); background: var(--color-surface); border-right: 1px solid var(--color-border); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; }
/* collapsed: icon rail. Toggle with .shell.is-collapsed; automatic below 1024px (see the responsive section at the end of this file). */
.sidebar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-toggle { margin-left: auto; }
.shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.shell.is-collapsed .sidebar { padding-inline: 10px; }
.shell.is-collapsed .sidebar .lbl, .shell.is-collapsed .sidebar-label, .shell.is-collapsed .sidebar-brand .lbl, .shell.is-collapsed .sidebar-foot .lbl, .shell.is-collapsed .sidebar-item .badge, .shell.is-collapsed .sidebar-item .tag { display: none; }
.shell.is-collapsed .sidebar-item { justify-content: center; padding: 10px 0; }
.shell.is-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
.shell.is-collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 0; font-family: var(--font-heading); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.sidebar-brand .mark, .nav-brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--color-accent); display: grid; place-items: center; color: var(--color-on-accent); font-size: 11px; font-weight: 800; flex: none; }
.sidebar-brand small { font-weight: 500; color: var(--color-text-muted); font-size: 12px; }
.sidebar-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar-label { font-size: 11px; letter-spacing: 0.06em; color: var(--color-text-muted); padding: 0 8px 6px; font-weight: 500; text-transform: uppercase; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); color: var(--color-text-2); text-decoration: none; font-size: 14px; cursor: pointer; border: 0; background: none; font: inherit; text-align: left; width: 100%; }
.sidebar-item svg { flex: none; opacity: 0.7; }
.sidebar-item:hover { background: var(--color-hover); color: var(--color-text); text-decoration: none; }
.sidebar-item[aria-current="page"] { background: var(--color-surface-2); color: var(--color-text); font-weight: 500; box-shadow: inset 2px 0 0 var(--color-accent); }
.sidebar-item[aria-current="page"] svg, .sidebar-item[aria-current="page"] .ph { opacity: 1; color: var(--color-accent-text); }
.sidebar-item .ph { flex: none; font-size: 18px; opacity: 0.75; }
.sidebar-item .badge, .sidebar-item .tag { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 8px; font-size: 12px; color: var(--color-text-muted); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--color-neutral-tint); display: grid; place-items: center; font-size: 11px; color: var(--color-text); font-weight: 600; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: var(--space-3); height: var(--topbar-h); padding: 0 var(--space-8); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; background: color-mix(in srgb, var(--color-bg) 88%, transparent); backdrop-filter: blur(8px); z-index: var(--z-sticky); }
.topbar .spacer, .nav .spacer { flex: 1; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-muted); }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--color-text); text-decoration: none; }
.crumbs .cur { color: var(--color-text); font-weight: 500; }
.content { padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-8); max-width: var(--content-max); width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.page-head .desc { color: var(--color-text-muted); margin: 0; }
.page-head .row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
/* top nav (screens without a sidebar) */
.nav { display: flex; align-items: center; gap: var(--space-6); height: var(--topbar-h); padding: 0 var(--space-8); border-bottom: 1px solid var(--color-border); }
.nav-brand { font-family: var(--font-heading); font-weight: 700; font-size: 16px; margin-right: var(--space-4); display: flex; align-items: center; gap: 8px; }
.nav a { color: var(--color-text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--color-text); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--color-accent-text); }
/* theme + language pickers live in the top bar */
.picker { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.picker button { appearance: none; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 500; color: var(--color-text-muted); padding: 3px 8px; border-radius: 4px; cursor: pointer; min-height: 24px; }
.picker button:hover { color: var(--color-text); }
.picker button[aria-pressed="true"] { background: var(--color-surface-2); color: var(--color-text); }


/* — key/value meta — */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--color-text-muted); margin: 0; }
.kv dd { margin: 0; }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--color-text-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid transparent; white-space: nowrap; }
.table td { padding: var(--space-3); border-bottom: 1px solid transparent; vertical-align: middle; }
.table .num, .table .r { text-align: right; }
.table td.num { font-family: var(--font-mono); font-size: 13px; }
.table thead tr { background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.table tbody tr { background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.table tbody tr:hover { background: linear-gradient(var(--color-hover), var(--color-hover)) no-repeat 0 0 / 100% 100%, linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.table-flush th:first-child, .table-flush td:first-child { padding-left: 0; }
.table-flush th:last-child, .table-flush td:last-child { padding-right: 0; }
.table-dense td { padding: 6px var(--space-3); font-size: 13px; }
/* review table — separates cells the tool filled from cells a person must fill */
.table-review td { border-left: 1px solid var(--color-divider); }
.table-review td:first-child { border-left: 0; }
.table-review .cell-edited { color: var(--color-accent-ink); box-shadow: inset 0 -2px 0 var(--color-accent-line); }
.table-review .cell-human { background: var(--color-alert-tint); box-shadow: inset 0 0 0 1px var(--color-alert-line); color: var(--color-alert-ink); }
.table-review .cell-human.is-empty { position: relative; }
.table-review .cell-human.is-empty::after { content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center; padding: 0 6px; font-size: 12px; opacity: 0.9; pointer-events: none; }
.table-review .cell-low { color: var(--color-warning); }
.table-review .cell-input { appearance: none; background: transparent; border: 0; color: inherit; font: inherit; width: 100%; padding: 4px 6px; border-radius: 4px; }
.table-review .cell-input:hover { background: var(--color-hover); }
.table-review .cell-input:focus-visible { background: var(--color-surface-2); outline: 1px solid var(--color-accent); outline-offset: 0; }
.legend { display: flex; gap: var(--space-4); font-size: 12px; color: var(--color-text-muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .l-auto { background: var(--color-surface-2); border: 1px solid var(--color-border-strong); }
.legend .l-edited { background: var(--color-accent-line); }
.legend .l-human { background: var(--color-alert-tint); border: 1px solid var(--color-alert-line); }

/* — run flow — */
/* stepper: upload → run → review → download */
.stepper { display: flex; align-items: center; gap: var(--space-3); list-style: none; margin: 0; padding: 0; font-size: 13px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--color-text-muted); }
.step i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; font-style: normal; border: 1px solid var(--color-border-strong); flex: none; }
.step.is-done { color: var(--color-text-2); }
.step.is-done i { background: var(--color-accent-tint); border-color: var(--color-accent-line); color: var(--color-accent-ink); }
.step.is-current { color: var(--color-text); font-weight: 500; }
.step.is-current i { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.step.is-failed i { background: var(--color-danger); border-color: var(--color-danger); color: var(--color-on-danger); }
.step.is-failed { color: var(--color-danger); }
.step-line { flex: 1; height: 1px; background: var(--color-border-strong); min-width: 24px; }
.step-line.is-done { background: var(--color-accent-line); }
/* dropzone */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: var(--space-8); text-align: center; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 6%, var(--color-surface)); }
.dropzone strong { color: var(--color-text); font-weight: 500; }
.dropzone .btn { margin-top: var(--space-2); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 13px; }
.file-row .name { font-family: var(--font-mono); font-size: 12px; }
.file-row .size { color: var(--color-text-muted); margin-left: auto; font-family: var(--font-mono); font-size: 12px; }
/* run bar + progress */
.runbar { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.runbar .status { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.runbar .status strong { font-weight: 500; }
.runbar .status small { color: var(--color-text-muted); font-family: var(--font-mono); font-size: 11px; }
.progress { height: 4px; border-radius: 2px; background: var(--color-neutral-tint); overflow: hidden; width: 100%; }
.progress > i { display: block; height: 100%; background: var(--color-accent); border-radius: 2px; transition: width var(--dur-slow) var(--ease-out); }
.progress.is-indeterminate > i { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
/* log */
.log { font-family: var(--font-mono); font-size: 12px; line-height: 1.7; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-2); max-height: 220px; overflow: auto; margin: 0; white-space: pre-wrap; }
.log .t { color: var(--color-text-muted); }
.log .ok { color: var(--color-accent-text); }
.log .warn { color: var(--color-warning); }
.log .err { color: var(--color-danger); }
/* history */
.history { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.history-item .title { font-size: 14px; }
.history-item .meta { font-size: 12px; color: var(--color-text-muted); font-family: var(--font-mono); grid-column: 1; }
.history-item .side { grid-row: 1 / span 2; align-self: center; display: flex; align-items: center; gap: 8px; }
/* empty, toast, callout */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: var(--space-12) var(--space-8); color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: var(--radius-lg); }
.empty strong { color: var(--color-text); font-weight: 500; }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); font-size: 13px; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-muted); flex: none; }
.toast-success::before { background: var(--color-accent); }
.toast-error::before { background: var(--color-danger); }
.toast-warning::before { background: var(--color-warning); }
.callout { display: flex; gap: 10px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-2); }
.callout-alert { border-color: var(--color-alert-line); background: var(--color-alert-tint); color: var(--color-alert-ink); }
.callout-alert::before { content: ""; width: 3px; flex: none; border-radius: 2px; background: var(--color-alert); }

/* — dialog — */
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--space-4); background: light-dark(rgba(20,20,30,0.45), rgba(0,0,0,0.6)); z-index: var(--z-dialog); }
.dialog { width: min(460px, 100%); display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.dialog-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 18px; }
.dialog-body { font-size: 14px; color: var(--color-text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* — overlays: dropdown menu, popover, tooltip, drawer — */
/* dropdown: native <details class="dropdown"><summary class="btn …">…</summary><div class="menu">…</div></details> — no script */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; padding: 4px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); z-index: var(--z-popover); display: flex; flex-direction: column; gap: 1px; }
.menu-right { left: auto; right: 0; }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; font-size: 13px; color: var(--color-text); background: none; border: 0; font: inherit; width: 100%; text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--color-hover); text-decoration: none; color: var(--color-text); }
.menu-item[aria-checked="true"] { color: var(--color-accent-text); }
.menu-item .ph { opacity: 0.7; }
.menu-item kbd { margin-left: auto; font-size: 11px; color: var(--color-text-muted); }
.menu-item.is-danger { color: var(--color-danger); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--color-divider); }
.menu-head { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); padding: 6px 10px 2px; }
.popover { position: absolute; z-index: var(--z-popover); width: max-content; max-width: 320px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); font-size: 13px; color: var(--color-text-2); }
.popover-title { font-weight: 500; color: var(--color-text); margin-bottom: 4px; }
/* tooltip: data-tip="…" on any element; appears above on hover/focus */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 4px); padding: 5px 8px; border-radius: 4px; background: var(--color-tip-bg); color: var(--color-tip-text); font-size: 12px; line-height: 1.3; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); z-index: var(--z-popover); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
[data-tip-wrap]::after { white-space: normal; width: max-content; max-width: 240px; text-align: left; }
/* drawer: right side panel — .drawer-backdrop + .drawer; add .is-open */
.drawer-backdrop { position: fixed; inset: 0; background: light-dark(rgba(20,20,30,0.3), rgba(0,0,0,0.5)); z-index: var(--z-drawer); opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-out); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--color-surface); box-shadow: var(--shadow-lg); z-index: calc(var(--z-drawer) + 1); display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--dur-base) var(--ease-out); }
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border); min-height: var(--topbar-h); }
.drawer-head h2 { font-size: 16px; margin: 0; flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); }
.drawer-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border); }
/* search field */
.search { position: relative; display: flex; align-items: center; }
.search .ph { position: absolute; left: 10px; color: var(--color-text-muted); pointer-events: none; }
.search .input { padding-left: 32px; }
.search kbd { position: absolute; right: 8px; font-size: 11px; color: var(--color-text-muted); border: 1px solid var(--color-border); border-radius: 4px; padding: 1px 5px; }
.topbar .search { width: 280px; }
.topbar .search .input { min-height: 32px; }

/* — tables: sort, sticky header, row selection, bulk bar, pagination — */
.th-sort { cursor: pointer; user-select: none; }
.th-sort .ph { font-size: 12px; margin-left: 4px; opacity: 0.4; vertical-align: -1px; }
.th-sort[aria-sort="ascending"], .th-sort[aria-sort="descending"] { color: var(--color-text); }
.th-sort[aria-sort] .ph { opacity: 1; color: var(--color-accent-text); }
.th-sort:hover { color: var(--color-text); }
.table-sticky { position: relative; }
.table-sticky thead th { position: sticky; top: 0; background: var(--color-bg); z-index: 1; box-shadow: inset 0 -1px 0 var(--color-divider); }
.table-scroll { max-height: 360px; overflow: auto; border-radius: var(--radius-md); }
.table .sel { width: 36px; padding-right: 0; }
.table .sel .check { vertical-align: middle; }
.table tbody tr.is-selected { background: linear-gradient(var(--color-accent-tint), var(--color-accent-tint)) no-repeat 0 0 / 100% 100%, linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table tbody tr .row-actions { opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.table tbody tr:hover .row-actions, .table tbody tr:focus-within .row-actions { opacity: 1; }
.bulkbar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-accent-tint); color: var(--color-accent-ink); font-size: 13px; font-weight: 500; }
.bulkbar .spacer { flex: 1; }
.pagination { display: flex; align-items: center; gap: var(--space-4); font-size: 13px; color: var(--color-text-muted); }
.pagination .pages { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.page-btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--radius-md); border: 1px solid transparent; background: none; font: inherit; font-size: 13px; color: var(--color-text-2); cursor: pointer; display: inline-grid; place-items: center; font-family: var(--font-mono); }
.page-btn:hover { background: var(--color-hover); color: var(--color-text); }
.page-btn[aria-current="page"] { border-color: var(--color-border-strong); color: var(--color-text); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .per { display: flex; align-items: center; gap: 6px; }
.pagination .per .input { min-height: 30px; width: auto; padding: 3px 26px 3px 8px; font-size: 13px; }

/* — skeleton — */
.skel { position: relative; overflow: hidden; background: var(--color-neutral-tint); border-radius: 4px; color: transparent !important; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, light-dark(rgba(255,255,255,0.6), rgba(255,255,255,0.06)), transparent); transform: translateX(-100%); animation: shimmer 1.4s var(--ease-in-out) infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-text { height: 12px; margin: 4px 0; }
.skel-title { height: 18px; width: 40%; }
.skel-row { height: 36px; border-radius: var(--radius-md); }
.skel-card { height: 120px; border-radius: var(--radius-lg); }
.skel-circle { border-radius: 50%; }

/* — week / date pickers — */
/* datestrip: SPOTV NOW's date strip — arrows, 7 days, the selected day white, today pinned in pink */
.datestrip { display: flex; align-items: center; gap: var(--space-2); }
.datestrip .days { display: flex; flex: 1; justify-content: space-between; }
.dateopt { appearance: none; background: none; border: 0; font: inherit; font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--color-text-muted); padding: 8px 10px 18px; position: relative; cursor: pointer; border-radius: var(--radius-md); }
.dateopt:hover { color: var(--color-text); }
.dateopt[aria-pressed="true"] { color: var(--color-text); font-weight: 700; }
.dateopt.is-today::after { content: attr(data-today); position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-family: var(--font-body); font-size: 10px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: var(--radius-pill); border: 1px solid var(--color-alert); color: var(--color-alert-text); }
.dateopt.is-today::before { content: ""; position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); border: 3px solid transparent; border-bottom-color: var(--color-alert); }
.weekpicker { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); padding: 2px; }
.weekpicker .btn-icon { width: 30px; height: 30px; }
.weekpicker .wk { font-family: var(--font-mono); font-size: 13px; padding: 0 8px; min-width: 128px; text-align: center; }
.weekpicker .wk small { display: block; font-family: var(--font-body); font-size: 11px; color: var(--color-text-muted); }
input[type="date"].input, input[type="week"].input { width: auto; font-family: var(--font-mono); font-size: 13px; }
input[type="date"].input::-webkit-calendar-picker-indicator, input[type="week"].input::-webkit-calendar-picker-indicator { filter: light-dark(none, invert(0.7)); cursor: pointer; }

/* — review aids — */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 2fr); gap: var(--space-6); align-items: start; }
.preview-pane { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); display: flex; flex-direction: column; gap: var(--space-2); }
.preview-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--color-text-muted); }
.preview-page { aspect-ratio: 210 / 297; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface) repeating-linear-gradient(135deg, transparent 0 10px, var(--color-hover) 10px 11px); display: grid; place-items: center; color: var(--color-text-muted); font-family: var(--font-mono); font-size: 11px; text-align: center; padding: var(--space-4); }
.preview-page .hl { position: absolute; border: 1px solid var(--color-accent); background: color-mix(in srgb, var(--color-accent) 12%, transparent); border-radius: 2px; }
.preview-page { position: relative; }
.table-review .cell-edited .orig { display: block; font-size: 11px; color: var(--color-text-muted); text-decoration: line-through; padding: 0 6px; }
.table-review tr.is-focus td { background: var(--color-hover); }
.table-review td.is-source { box-shadow: inset 0 0 0 1px var(--color-accent-line); }

/* — stats — */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.stat-label { font-size: 12px; color: var(--color-text-muted); }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; font-feature-settings: "tnum" 1; }
.stat-delta { font-size: 12px; font-family: var(--font-mono); color: var(--color-text-muted); }
.stat-delta.is-up { color: var(--color-accent-text); }
.stat-delta.is-down { color: var(--color-danger); }
.stat-value .unit { font-size: 13px; color: var(--color-text-muted); margin-left: 3px; font-family: var(--font-body); }
.stat-inline { flex-direction: row; align-items: baseline; gap: 10px; padding: var(--space-2) var(--space-3); }

/* — connection status (settings) — */
.conn { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.conn .ph { font-size: 22px; color: var(--color-text-2); }
.conn-name { font-weight: 500; }
.conn-meta { font-size: 12px; color: var(--color-text-muted); font-family: var(--font-mono); }

/* — auth card — */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-8); background: radial-gradient(60% 50% at 50% 0%, var(--color-accent-tint), transparent 70%), var(--color-bg); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-8); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-md); }
.auth-card .sidebar-brand { padding: 0; font-size: 18px; }
.auth-foot { font-size: 12px; color: var(--color-text-muted); text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════
   Responsive & input-mode overrides — MUST stay the last section of this
   file: they share specificity with the component rules above and win by
   source order. Add new components above this line, never below.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .lbl, .sidebar-label, .sidebar-item .badge, .sidebar-item .tag, .sidebar-toggle { display: none; }
  .sidebar-item, .sidebar-brand { justify-content: center; padding-inline: 0; }
  .content, .topbar { padding-inline: var(--space-6); }
  .topbar .search { width: 200px; }
}
/* mobile: the sidebar leaves the grid and becomes an off-canvas panel opened from the top bar's .nav-toggle (.shell.is-nav-open) */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 639px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: calc(var(--z-drawer) + 1); transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-out); padding-inline: var(--space-3); box-shadow: var(--shadow-lg); }
  .sidebar .lbl, .sidebar-label, .sidebar-item .badge, .sidebar-item .tag { display: revert; }
  .sidebar-item { justify-content: flex-start; padding: 12px 8px; }
  .sidebar-brand { justify-content: flex-start; padding-inline: 8px; }
  .shell.is-nav-open .sidebar { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: light-dark(rgba(20,20,30,0.3), rgba(0,0,0,0.5)); z-index: var(--z-drawer); opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-out); }
  .shell.is-nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding-inline: var(--space-4); gap: var(--space-2); }
  .topbar .search, .topbar .text-small, .crumbs a, .crumbs a + span { display: none; }
  .content { padding: var(--space-4); gap: var(--space-6); }
  .page-head h1 { font-size: 20px; }
  .picker button { padding: 3px 6px; }
  .stepper { gap: var(--space-2); }
  .step:not(.is-current) { font-size: 0; gap: 0; }
  .step:not(.is-current) i { font-size: 11px; }
  .step-line { min-width: 12px; }
  .dialog-backdrop { align-items: end; padding: 0; }
  .dialog { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
  .datestrip .days { overflow-x: auto; justify-content: flex-start; gap: 4px; scrollbar-width: none; }
  .dateopt { flex: none; }
  .pagination { flex-wrap: wrap; gap: var(--space-2); }
  .pagination .pages { margin-left: 0; width: 100%; justify-content: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input, select.input, textarea.input { font-size: 16px; } /* prevents iOS zoom on focus */
}
/* touch: 44px targets */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .btn-icon { width: 44px; height: 44px; }
  .btn-icon.btn-sm { width: 40px; height: 40px; }
  .tab { padding: 12px 0 14px; }
  .menu-item { padding: 11px 12px; }
  .page-btn { min-width: 40px; height: 40px; }
  .switch .knob { width: 46px; height: 26px; }
  .switch .knob::after { width: 22px; height: 22px; }
  .switch input:checked + .knob::after { transform: translateX(20px); }
}
/* tables: horizontal scroll wrapper by default; .table-cards turns rows into stacked cards on mobile (cells need data-th) */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-responsive > .table { min-width: 560px; }
@media (max-width: 639px) {
  .table-responsive > .table-cards { min-width: 0; }
  .table-cards thead { display: none; }
  .table-cards tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: var(--space-3); margin-bottom: var(--space-2); border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
  .table-cards tbody tr:hover { background: var(--color-surface); }
  .table-cards td { display: block; padding: 0; border: 0; text-align: left; }
  .table-cards td::before { content: attr(data-th); display: block; font-size: 11px; color: var(--color-text-muted); }
  .table-cards td.sel, .table-cards td.actions { grid-column: 1 / -1; }
  .table-cards td.sel::before, .table-cards td.actions::before { content: none; }
  .table-cards td.actions .row-actions { opacity: 1; }
}@media (max-width: 1023px) { .split { grid-template-columns: 1fr; } .preview-pane { position: static; } }
@media (max-width: 639px) { .auth { padding: var(--space-4); align-items: end; } .auth-card { padding: var(--space-6); } }
