:root {
  --ink: #191814;
  --muted: #706c62;
  --paper: #fbf7ef;
  --panel: #fffdf7;
  --line: #dfd6c8;
  --accent: #c94b32;
  --accent-dark: #8f2e1f;
  --green: #166d4d;
  --shadow: 0 24px 70px rgba(52, 38, 20, 0.13);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Manrope, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(201, 75, 50, 0.16), transparent 30rem),
    linear-gradient(135deg, #fffaf0 0%, #f5eddf 48%, #fff7ec 100%);
}
main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 60px; }
.topbar, .hero, .workspace, .case-view, .empty-state {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; border-radius: 28px; padding: 16px 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; background: var(--ink); color: var(--paper); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small, .eyebrow, .label, .metrics small { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.top-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.rater-field span { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; margin-bottom: 5px; }
input, textarea, button { font: inherit; }
input, textarea { width: 100%; border: 1px solid var(--line); background: #fffaf2; border-radius: 14px; padding: 12px 14px; color: var(--ink); }
.rater-field input { width: 220px; }
.button { border: 0; border-radius: 999px; padding: 12px 16px; cursor: pointer; font-weight: 800; }
.button.ghost { background: #efe6d8; color: var(--ink); }
.button.primary { background: var(--accent); color: white; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.hero { margin-top: 20px; border-radius: 34px; padding: 38px; display: flex; justify-content: space-between; gap: 28px; align-items: end; }
h1 { margin: 0; font-size: clamp(3rem, 7vw, 6.7rem); line-height: 0.94; letter-spacing: -0.075em; }
h1 em { font-family: Georgia, serif; color: var(--accent); font-weight: 400; }
.hero p:not(.eyebrow) { max-width: 650px; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.metrics { display: flex; gap: 10px; flex-wrap: wrap; }
.metrics span { min-width: 110px; border: 1px solid var(--line); background: #fffaf2; border-radius: 22px; padding: 16px; }
.metrics strong { display: block; font-size: 2rem; }
.workspace { margin-top: 20px; border-radius: 34px; padding: 16px; display: grid; grid-template-columns: 310px 1fr; gap: 16px; align-items: start; }
.rail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 10px; }
.check-field { display: flex; gap: 10px; align-items: center; padding: 10px; font-weight: 800; color: var(--muted); }
.check-field input { width: auto; }
.case-list { display: grid; gap: 8px; margin-top: 8px; }
.case-item { width: 100%; text-align: left; border: 1px solid var(--line); background: #fffaf2; border-radius: 18px; padding: 12px; cursor: pointer; }
.case-item strong { display: block; }
.case-item span { color: var(--muted); font-size: 0.86rem; }
.case-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.case-item.reviewed::after { content: "saved"; color: var(--green); font-size: 0.76rem; font-weight: 900; text-transform: uppercase; }
.stage { min-width: 0; }
.empty-state, .case-view { border-radius: 28px; padding: 28px; }
.hidden { display: none !important; }
.loader { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.case-meta { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.case-meta h2 { margin: 5px 0 0; font-size: clamp(2rem, 4vw, 4.5rem); letter-spacing: -0.06em; }
#sourceLabel { color: var(--muted); background: #efe6d8; padding: 9px 13px; border-radius: 999px; font-weight: 800; }
.transcript, .player-card, .ratings, .notes { display: block; margin-top: 20px; border: 1px solid var(--line); background: #fffaf2; border-radius: 24px; padding: 22px; }
.transcript span, .notes span { display: block; color: var(--accent-dark); font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; margin-bottom: 10px; }
.transcript p { margin: 0; font-size: clamp(1.3rem, 2.6vw, 2.5rem); line-height: 1.42; }
audio { width: 100%; }
.audio-meta { display: flex; gap: 12px; margin-top: 10px; color: var(--muted); font-family: "DM Mono", monospace; }
.rating-scale { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); margin-bottom: 18px; }
.rating-scale strong { color: var(--ink); }
.rating-row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.rating-row > span { font-weight: 900; }
.rating-row div { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-row button { width: 48px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: white; cursor: pointer; font-weight: 900; }
.rating-row button.selected { background: var(--ink); color: white; border-color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.case-navigation { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
#saveStatus { color: var(--muted); font-weight: 800; }
#saveStatus.cloud-ok { color: var(--green); }
#saveStatus.cloud-error { color: var(--accent-dark); }
@media (max-width: 900px) {
  main { width: min(100% - 24px, 760px); }
  .topbar, .hero { align-items: stretch; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .rail { position: static; max-height: 280px; }
  .rating-row { grid-template-columns: 1fr; }
  .rater-field input { width: 100%; }
}
