:root {
  --ink: #191814;
  --muted: #706c62;
  --paper: #fbf7ef;
  --panel: #fffdf7;
  --line: #dfd6c8;
  --accent: #c94b32;
  --accent-dark: #8f2e1f;
  --blue: #245efe;
  --green: #146b4c;
  --amber: #9a6400;
  --red: #a42f23;
  --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 10% 0%, rgba(36, 94, 254, 0.13), transparent 24rem),
    radial-gradient(circle at 92% 8%, rgba(201, 75, 50, 0.16), transparent 28rem),
    linear-gradient(135deg, #fffaf0 0%, #f4eadb 48%, #fff7ec 100%);
}
main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 60px; }
.topbar, .hero, .workspace, .case-view, .empty-state, .language-tabs {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.86);
  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 img { width: 44px; height: 44px; border-radius: 14px; background: #fff; padding: 7px; border: 1px solid var(--line); }
.brand strong, .brand small { display: block; }
.brand small, .eyebrow, .metrics small, .rater-field span, .search-field span { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; }
.top-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
input, textarea, button, select { font: inherit; }
input, textarea, select { width: 100%; border: 1px solid var(--line); background: #fffaf2; border-radius: 14px; padding: 12px 14px; color: var(--ink); }
.rater-field span, .search-field span { display: block; font-weight: 900; margin-bottom: 5px; }
.rater-field input { width: 230px; }
.button { border: 0; border-radius: 999px; padding: 12px 16px; cursor: pointer; font-weight: 900; }
.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: 700px; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: 10px; }
.metrics span { border: 1px solid var(--line); background: #fffaf2; border-radius: 22px; padding: 16px; }
.metrics strong { display: block; font-size: 2rem; }
.language-tabs { margin-top: 20px; border-radius: 999px; padding: 10px; display: flex; gap: 8px; overflow-x: auto; }
.language-tabs button { border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 12px 16px; cursor: pointer; font-weight: 900; white-space: nowrap; color: var(--muted); }
.language-tabs button.active { background: var(--ink); color: white; border-color: var(--ink); }
.workspace { margin-top: 20px; border-radius: 34px; padding: 16px; display: grid; grid-template-columns: 370px 1fr; gap: 16px; align-items: start; }
.rail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 10px; }
.rail-controls { display: grid; gap: 10px; }
.check-field { display: flex; gap: 10px; align-items: center; font-weight: 900; color: var(--muted); }
.check-field input { width: auto; }
.language-progress { margin: 14px 0; display: grid; gap: 8px; }
.progress-pill { border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; background: #fffaf2; display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; }
.case-list { display: grid; gap: 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; font-size: 0.98rem; }
.case-item span { color: var(--muted); font-size: 0.82rem; display: block; margin-top: 3px; }
.case-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.case-item.approved::after, .case-item.needs_edit::after, .case-item.reject::after { display: inline-block; margin-top: 8px; font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.case-item.approved::after { content: "approved"; color: var(--green); }
.case-item.needs_edit::after { content: "needs edit"; color: var(--amber); }
.case-item.reject::after { content: "reject"; color: var(--red); }
.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.4rem); letter-spacing: -0.06em; line-height: 0.98; }
.badges { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.badges span, .audio-meta span { color: var(--muted); background: #efe6d8; padding: 9px 13px; border-radius: 999px; font-weight: 900; }
.transcript, .player-card, .ratings, .notes, .verdict { 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.25rem, 2.25vw, 2.15rem); line-height: 1.45; }
audio { width: 100%; }
.audio-meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; font-family: "DM Mono", monospace; font-size: 0.86rem; }
.verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.verdict button { border: 1px solid var(--line); background: white; border-radius: 18px; min-height: 58px; cursor: pointer; font-weight: 900; }
.verdict button.selected[data-verdict="approved"] { background: var(--green); color: white; border-color: var(--green); }
.verdict button.selected[data-verdict="needs_edit"] { background: var(--amber); color: white; border-color: var(--amber); }
.verdict button.selected[data-verdict="reject"] { background: var(--red); color: white; border-color: var(--red); }
.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: 210px 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: 120px; 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: 900; }
#saveStatus.cloud-ok { color: var(--green); }
#saveStatus.cloud-error { color: var(--red); }
.not-found { min-height: 100vh; display: grid; place-content: center; text-align: center; }
@media (max-width: 980px) {
  main { width: min(100% - 24px, 780px); }
  .topbar, .hero { align-items: stretch; flex-direction: column; }
  .metrics { grid-template-columns: repeat(4, minmax(80px, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
  .rail { position: static; max-height: 360px; }
  .rating-row, .verdict { grid-template-columns: 1fr; }
  .rater-field input { width: 100%; }
}
@media (max-width: 620px) {
  main { width: min(100% - 18px, 520px); padding-top: 12px; }
  .hero, .case-view, .empty-state { padding: 20px; }
  h1 { font-size: clamp(2.55rem, 17vw, 4.6rem); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .case-meta { flex-direction: column; }
}
