/* Heard, Here — styles. Palette drawn from the Hear, Here street signs. */

:root {
  --accent: #e25438;          /* sign rust */
  --accent-2: #e8833a;        /* amber block */
  --accent-ink: #c2412a;
  --accent-soft: rgba(226, 84, 56, 0.10);
  --accent-ring: rgba(226, 84, 56, 0.28);

  --bg: #f5f0e8;
  --bg-2: #efe8dc;
  --surface: rgba(255, 253, 249, 0.86);
  --surface-solid: #fffdf9;
  --surface-2: #f7f2ea;
  --border: rgba(60, 44, 30, 0.10);
  --border-strong: rgba(60, 44, 30, 0.18);
  --text: #2a211b;
  --text-2: #6b5f55;
  --text-3: #9a8f85;
  --tower: #9ea2a6;
  --grid: #cfd1d3;
  --gridline: rgba(120, 110, 100, 0.07);
  --ok: #3f8f5a;
  --danger: #c2412a;

  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.06);
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 12px 40px -12px rgba(80, 50, 20, 0.18);
  --shadow-lg: 0 2px 4px rgba(60, 40, 20, 0.05), 0 30px 80px -20px rgba(80, 50, 20, 0.28);

  --radius: 22px;
  --radius-sm: 12px;

  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bree Serif", Georgia, serif;
  --font-sign: "Josefin Sans", "Futura", "Avenir Next", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #ef6a4c;
    --accent-2: #f0944e;
    --accent-ink: #ff8a6e;
    --accent-soft: rgba(239, 106, 76, 0.14);
    --accent-ring: rgba(239, 106, 76, 0.35);

    --bg: #171311;
    --bg-2: #1d1815;
    --surface: rgba(37, 31, 27, 0.78);
    --surface-solid: #241e1a;
    --surface-2: #2c2520;
    --border: rgba(255, 235, 215, 0.08);
    --border-strong: rgba(255, 235, 215, 0.15);
    --text: #f3ebe3;
    --text-2: #b4a89d;
    --text-3: #807469;
    --tower: #8b8f94;
    --grid: #4a4c50;
    --gridline: rgba(255, 240, 225, 0.035);
    --ok: #6cc28a;
    --danger: #ff8a6e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 48px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 80px -20px rgba(0, 0, 0, 0.7);

    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
svg { display: block; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Backdrop: diagonal street grid + warm glow ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 85% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(50rem 36rem at -10% 110%, rgba(232, 131, 58, 0.08), transparent 60%),
    linear-gradient(var(--bg), var(--bg-2));
}
.backdrop::before {
  content: ""; position: absolute; inset: -50%;
  background-image:
    repeating-linear-gradient(45deg, var(--gridline) 0 2px, transparent 2px 88px),
    repeating-linear-gradient(-45deg, var(--gridline) 0 2px, transparent 2px 88px);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
}

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: 0.01em;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.btn-sm { --h: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { --h: 54px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  border-color: color-mix(in srgb, var(--accent) 70%, #000);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 18px -6px var(--accent-ring), 0 2px 4px -2px rgba(0,0,0,.15);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 85%, #000)); }
.btn-primary svg { transition: transform .2s ease; }
.btn-primary:hover:not(:disabled) svg { transform: translateX(2px); }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- Login ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login-card {
  width: 100%; max-width: 420px;
  padding: 36px 32px 32px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
.login-card.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }

/* The street-sign badge */
.sign {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 18px 16px; margin-bottom: 22px;
  border-radius: 22px 22px 22px 22px / 40px 40px 22px 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent));
  color: #fff;
  box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px rgba(255,255,255,.85), 0 14px 30px -12px var(--accent-ring);
  --tower: rgba(255,255,255,.92);
  --grid: rgba(255,255,255,.4);
  --accent-2: #ffd3b0;
}
.sign .sign-mark { width: 64px; height: 64px; --accent: #fff; margin: 2px 0 2px; }
.sign-top, .sign-sub {
  font-family: var(--font-sign); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: .28em; opacity: .92;
}
.sign-word {
  font-family: var(--font-sign); font-weight: 600; text-transform: uppercase;
  font-size: 30px; letter-spacing: .14em; line-height: 1.1; margin-top: 2px;
}
.sign-sub { margin-top: 6px; letter-spacing: .22em; font-size: 10px; }
.comma { margin-left: -0.12em; }


.field {
  position: relative; display: flex; align-items: center;
  height: 52px; padding: 0 6px 0 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong); border-radius: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.field-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; }
.field input {
  flex: 1; min-width: 0; height: 100%; padding: 0 10px;
  border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; letter-spacing: .02em;
}
.field input::placeholder { color: var(--text-3); }
.field-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-3); cursor: pointer; }
.field-btn:hover { color: var(--text); background: var(--surface-2); }
.field-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.field-btn.on svg path { stroke-dasharray: 2 3; }

.form-error { min-height: 1.4em; margin: 8px 2px 10px; font-size: 14px; color: var(--danger); }
.form-error:empty { min-height: 0; margin: 6px 0; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 980px) / 2));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; }
.brand-word { white-space: nowrap; font-family: var(--font-sign); font-weight: 600; text-transform: uppercase; letter-spacing: .14em; font-size: 17px; padding-top: 3px; }
.brand-word .comma { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); white-space: nowrap;
  background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-2);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.pill-ready .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.pill-loading .dot { background: var(--accent-2); animation: pulse 1.2s ease-in-out infinite; }
.pill-error .dot { background: var(--danger); }

.container { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }

.hero { padding: 56px 0 30px; text-align: center; animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.eyebrow {
  display: inline-block; margin: 0 0 16px; padding: 6px 14px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  font-family: var(--font-sign); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .2em;
}
.hero h1 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(36px, 6vw, 60px); line-height: 1.05; letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { max-width: 560px; margin: 18px auto 0; color: var(--text-2); font-size: 17px; text-wrap: pretty; }

.card {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.card + .card { margin-top: 20px; }

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 20px 30px;
  border: 2px dashed var(--border-strong); border-radius: 18px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .2s, background-color .2s, transform .2s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.dz-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 16px;
  border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -8px var(--accent-ring);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.dropzone:hover .dz-icon, .dropzone.dragging .dz-icon { transform: translateY(-4px) rotate(-4deg); }
.dz-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { margin: 0; font-size: 18px; font-weight: 600; }
.dz-title .link { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.dz-sub { margin: 6px 0 0; color: var(--text-3); font-size: 13px; letter-spacing: .02em; }

.eq { display: flex; align-items: flex-end; gap: 4px; height: 26px; margin-top: 22px; opacity: .55; }
.eq i { width: 4px; border-radius: 2px; background: var(--accent); height: 30%; animation: eq 1.4s ease-in-out infinite; }
.eq i:nth-child(3n) { background: var(--accent-2); }
.eq i:nth-child(4n) { background: var(--tower); }
.eq i:nth-child(1) { animation-delay: -.2s } .eq i:nth-child(2) { animation-delay: -.9s }
.eq i:nth-child(3) { animation-delay: -.4s } .eq i:nth-child(4) { animation-delay: -1.1s }
.eq i:nth-child(5) { animation-delay: -.6s } .eq i:nth-child(6) { animation-delay: -.1s }
.eq i:nth-child(7) { animation-delay: -.8s } .eq i:nth-child(8) { animation-delay: -.3s }
.eq i:nth-child(9) { animation-delay: -1.2s } .eq i:nth-child(10) { animation-delay: -.5s }
.eq i:nth-child(11) { animation-delay: -.7s } .eq i:nth-child(12) { animation-delay: -1s }

/* ---------- File panel ---------- */
.file-panel { animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.file-row { display: flex; align-items: center; gap: 14px; }
.file-badge {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink);
}
.file-badge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.file-meta { flex: 1; min-width: 0; }
.file-name { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }

audio { display: block; width: 100%; height: 44px; margin: 16px 0 4px; border-radius: 999px; }

.options { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 16px; margin: 18px 0 20px; }
.opt { min-width: 0; }
.opt-label { display: block; margin: 0 0 8px 2px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .1em; }

.select { position: relative; }
.select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); pointer-events: none;
}
.select select {
  appearance: none; -webkit-appearance: none; width: 100%; height: 46px; padding: 0 40px 0 14px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-solid); color: var(--text);
  font: inherit; font-size: 15px; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  height: 46px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  position: relative; z-index: 1; display: grid; place-items: center; padding: 0 8px;
  font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; border-radius: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s;
}
.segmented input:checked + label { color: var(--text); }
.segmented input:focus-visible + label { box-shadow: 0 0 0 3px var(--accent-ring); }
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: var(--surface-solid); border-radius: 9px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.segmented:has(input:nth-of-type(2):checked) .seg-thumb { transform: translateX(100%); }
.segmented-sm { height: 38px; padding: 3px; }
.segmented-sm label { font-size: 13px; padding: 0 12px; }
.segmented-sm .seg-thumb { top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); }

/* ---------- Result ---------- */
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.story-tag { display: flex; align-items: center; gap: 0; min-width: 0; max-width: 100%; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--accent); }
.story-tag-label {
  flex: none; padding: 7px 12px 5px; background: var(--accent); color: #fff;
  font-family: var(--font-sign); font-weight: 600; text-transform: uppercase; letter-spacing: .2em; font-size: 12px;
}
.story-tag-title {
  min-width: 0; padding: 6px 14px; font-weight: 600; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats { display: flex; flex-wrap: wrap; gap: 6px; }
.stat {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.stat b { color: var(--text); font-weight: 600; }

.progress-wrap { margin-top: 20px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.progress-label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.progress-pct { font-family: var(--font-mono); font-size: 13px; color: var(--text-3); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.progress-bar {
  position: relative; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit; transition: width .5s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.progress-bar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-100%); animation: sheen 1.6s ease-in-out infinite;
}
.progress.indeterminate .progress-bar { width: 35% !important; animation: indet 1.3s ease-in-out infinite; }
.progress.done .progress-bar::after { display: none; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 12px; }
.toolbar-actions { display: flex; gap: 8px; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 220px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2,.8,.2,1) both; transform-origin: top right;
}
.menu-list button {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer;
}
.menu-list button:hover, .menu-list button:focus-visible { background: var(--accent-soft); outline: none; }
.menu-list b { font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--accent-ink); width: 42px; }
.menu-list span { font-size: 14px; color: var(--text-2); }

.transcript {
  max-height: 62vh; min-height: 140px; overflow-y: auto;
  padding: 8px; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--border);
  scroll-behavior: smooth;
}
.transcript:empty::before {
  content: "Listening for the first words…"; display: block; padding: 40px 12px; text-align: center; color: var(--text-3); font-style: italic;
}
.seg {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: baseline;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background-color .15s;
  animation: fadein .35s ease both;
}
.seg:hover { background: var(--surface-2); }
.seg.active { background: var(--accent-soft); }
.seg.active .seg-time { color: var(--accent-ink); }
.seg-time { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-3); white-space: nowrap; padding-top: 1px; }
.seg-text { font-size: 16px; line-height: 1.6; }
.plain {
  padding: 14px 16px; margin: 0;
  font-size: 16.5px; line-height: 1.75; white-space: pre-wrap; text-wrap: pretty;
}
.error-box { padding: 28px 18px; text-align: center; color: var(--danger); }
.error-box strong { display: block; font-size: 16px; margin-bottom: 4px; }

.result-foot { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- Nav tabs (admin) ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin-right: auto; margin-left: 18px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tab {
  height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background-color .2s, color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.pill-gpu { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); color: var(--accent-ink); }
.pill-gpu .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); animation: pulse 2s ease-in-out infinite; }

.notice {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent); font-size: 14px;
}

/* ---------- Usage ---------- */
.usage { padding: 36px 0 0; animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.usage > * + * { margin-top: 18px; }
.usage .card + .card { margin-top: 18px; }
.usage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.usage-head .eyebrow { margin-bottom: 10px; }
.usage-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1; }
.usage h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.muted { margin: 0; color: var(--text-3); font-size: 14px; }
.small { font-size: 13px; }

.segmented-3 { grid-template-columns: 1fr 1fr 1fr; }
.segmented-3 .seg-thumb { width: calc(33.333% - 2px); }
.segmented-3:has(input:nth-of-type(2):checked) .seg-thumb { transform: translateX(100%); }
.segmented-3:has(input:nth-of-type(3):checked) .seg-thumb { transform: translateX(200%); }

:root { --series-gpu: #e25438; --series-local: #3b78c4; }
@media (prefers-color-scheme: dark) { :root { --series-gpu: #e4603f; --series-local: #4c8ad6; } }
.swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.swatch-gpu { background: var(--series-gpu); }
.swatch-local { background: var(--series-local); }

.machines { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.machine {
  padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.machine-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.machine-name { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.machine-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.machine-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.machine-status.is-on .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.machine-status.is-wait .dot { background: var(--accent-2); animation: pulse 1.2s ease-in-out infinite; }
.machine-status.is-error .dot { background: var(--danger); }
.machine-line { margin: 2px 0 0; font-size: 13.5px; color: var(--text-2); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.tile-label { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.tile-value { margin: 6px 0 2px; font-family: var(--font-display); font-size: 34px; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.tile-sub { margin: 0; font-size: 13px; color: var(--text-3); }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .tick { fill: var(--text-3); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .bar-gpu { fill: var(--series-gpu); }
.chart .bar-local { fill: var(--series-local); }
.chart .hover-band { fill: transparent; transition: fill .12s; }
.chart .hover-band.on { fill: var(--surface-2); }
.chart-empty { position: absolute; inset: 0 0 26px 40px; display: grid; place-items: center; margin: 0; color: var(--text-3); font-size: 14px; }

.chart-tip {
  position: fixed; left: 0; top: 0; z-index: 60; min-width: 190px; padding: 10px 12px; pointer-events: none;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 13px;
}
.tip-title { margin: 0 0 6px; font-weight: 700; }
.tip-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.tip-row b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.tip-foot { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text-3); }

.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.usage-grid .card + .card { margin-top: 0; }
.bar-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.bar-row-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 14px; }
.bar-row-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.bar-row-value { color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar-fill-neutral { background: var(--text-3); }
.bar-fill-gpu { background: var(--series-gpu); }
.bar-fill-local { background: var(--series-local); }

.table-wrap { margin-top: 10px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 8px 10px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .mono { font-family: var(--font-mono); font-size: 12.5px; }
.table .nowrap { white-space: nowrap; }
.table .file-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.table .empty { padding: 28px; text-align: center; color: var(--text-3); }
.machine-tag { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status-tag { white-space: nowrap; font-weight: 600; font-size: 13px; }
.status-tag.ok { color: var(--ok); }
.status-tag.bad { color: var(--danger); cursor: help; }

/* ---------- Footer & toast ---------- */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-3);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  padding: 11px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toast .25s cubic-bezier(.2,.8,.2,1) both;
}

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes sheen { to { transform: translateX(100%); } }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .hero { padding: 36px 0 22px; }
  .lede { font-size: 16px; }
  .card { padding: 16px; border-radius: 18px; }
  .login-card { padding: 28px 20px 22px; }
  .options { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .btn-ghost.btn-sm:has(.hide-sm) { padding: 0 10px; }
  .seg { grid-template-columns: 1fr; gap: 2px; }
  .brand-word { font-size: 15px; }
  .pill { padding: 0 10px; }
  .dropzone { padding: 36px 16px 24px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions > *, .toolbar-actions .menu .btn { flex: 1; }
  .toolbar-actions .menu { display: flex; }
  .topbar { gap: 8px; }
  .topbar-right { gap: 6px; }
  .tabs { margin-left: 4px; padding: 3px; }
  .tab { height: 28px; padding: 0 9px; font-size: 13px; }
  .brand-mark { width: 32px; height: 32px; }
  .topbar:has(.tabs:not([hidden])) .brand-word { display: none; }
  .machines, .usage-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 28px; }
  .usage-head h2 { font-size: 32px; }
}

@media (max-width: 400px) {
  .topbar:has(.tabs:not([hidden])) #model-pill-text { display: none; }
}

@media (min-width: 641px) and (max-width: 860px) {
  .options { grid-template-columns: 1fr 1fr; }
  .options .opt:last-child { grid-column: 1 / -1; }
  .tiles { grid-template-columns: 1fr 1fr; }
}
