:root {
  --bg: #F3F1EE; --surface: #FFFFFF; --sand: #FBF1E3; --ink: #1E1B18; --muted: #625C55; --line: #E0D9D0;
  --brand: #7A1F2B; --brand-ink: #FFFFFF; --brand-soft: #F6E6E7; --accent: #D9821A; --accent-soft: #FBEBD5;
  --good: #256B43; --good-soft: #E2F1E6; --warn: #8F5600; --warn-soft: #FBEDD7; --bad: #A6231B; --bad-soft: #F9E3E0;
  --wave: #3B3631; --wave-dim: #CFC7BE;
  --ui: "Segoe UI", "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", system-ui, -apple-system, sans-serif;
  --deva: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", var(--ui);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--ui); }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: .2rem 0 .3rem; }
code { background: var(--sand); border-radius: 5px; padding: 0 .3rem; font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.deva { font-family: var(--deva); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.clip { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi { display: inline-flex; flex-direction: column; line-height: 1.25; }
.bi .deva { font-size: .82em; opacity: .85; font-weight: 500; }

/* ---------- header ---------- */
header.top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface);
  border-bottom: 3px solid var(--accent); padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 5; }
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: baseline; gap: .4rem; margin-right: auto; }
.brand .deva { color: var(--brand); font-size: 1.3rem; font-weight: 700; }
.brand small { color: var(--muted); }
nav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--ink); padding: .4rem .7rem; border-radius: 8px; font-weight: 600; }
nav a:hover { background: var(--sand); }
nav a.on { background: var(--brand-soft); color: var(--brand); }
nav a .deva { font-size: .8rem; color: var(--muted); font-weight: 500; }
nav .who { color: var(--muted); padding: 0 .4rem 0 1rem; }
nav a.quiet, a.quiet { font-weight: 500; color: var(--muted); }
form.inline { display: inline; }
.linkish { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: .4rem .5rem; }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
main.narrow { max-width: 560px; }
main.task { max-width: 820px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.warn { border-color: var(--accent); background: var(--accent-soft); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.head h1, .head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid2.wide-left { grid-template-columns: 1.7fr 1fr; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }
.spaced { margin-top: 1.1rem; }
.flash { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.note { background: var(--sand); border-radius: 10px; padding: .7rem 1rem; color: var(--ink); }

/* ---------- numbers ---------- */
.stats { display: flex; flex-wrap: wrap; gap: .8rem 2rem; margin: .2rem 0 1rem; }
.stats > div { min-width: 7rem; }
.stats b { display: block; font-size: 1.8rem; color: var(--brand); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: .9rem; }
.stats.big b { font-size: 2.4rem; }
.overall { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; color: var(--muted); }
.overall progress { flex: 1; max-width: 520px; }
progress { appearance: none; -webkit-appearance: none; width: 100%; min-width: 80px; height: 10px; border: 0; border-radius: 99px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--good); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--good); border-radius: 99px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
td { padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
table.compact td { padding: .35rem .5rem; font-size: .93rem; }
tr.off td { opacity: .55; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 99px; padding: .05rem .55rem; white-space: nowrap; text-transform: lowercase; }
.s-pending { background: var(--sand); color: var(--muted); }
.s-submitted { background: var(--accent-soft); color: var(--warn); }
.s-approved { background: var(--good-soft); color: var(--good); }
.s-flagged { background: var(--bad-soft); color: var(--bad); }
.s-cancelled { background: #ECEAE7; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 1rem; justify-content: center; margin-top: 1rem; color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin-bottom: .8rem; }
label small { font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 .4rem 0 0; accent-color: var(--brand); transform: scale(1.15); }
input[type=file] { padding: .5rem; background: var(--sand); }
input.short { max-width: 9rem; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem .4rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .3rem; color: var(--brand); }
label.choice { font-weight: 500; display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; margin-bottom: .5rem; }
label.choice .muted { width: 100%; padding-left: 1.6rem; }
.inline-choice { display: inline-flex !important; justify-content: center; text-align: center; max-width: 30rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.indent { margin: -.2rem 0 .8rem 1.6rem; width: calc(100% - 1.6rem); }
.vol-list { max-height: 26rem; overflow-y: auto; }
.filters { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.filters label { margin: 0; min-width: 12rem; }
form.upload { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
form.upload:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
form.upload input[type=file] { margin-bottom: .6rem; }
dl.secret { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; background: var(--sand); padding: 1rem; border-radius: 10px; font-size: 1.1rem; }
dl.secret dt { color: var(--muted); }
dl.secret dd { margin: 0; font-weight: 700; }
.login h1 { margin-bottom: .3rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; font: inherit; font-weight: 600;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem 1rem; cursor: pointer; }
.btn:hover { background: var(--sand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--sand); color: var(--ink); }
.btn.small { padding: .3rem .65rem; font-size: .88rem; }
.btn.big { font-size: 1.12rem; padding: .85rem 1.4rem; border-radius: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
td .actions form, .actions form { display: inline; }

/* ---------- review ---------- */
.review-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; }
.big-text { font-size: 1.3rem; margin: .4rem 0; }
.review-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.review-actions input { flex: 1 1 18rem; margin: 0; }
audio { max-width: 100%; vertical-align: middle; }

/* ---------- volunteer pages ---------- */
.project-card progress { margin: .3rem 0 1rem; height: 12px; }
.start { display: flex; gap: .7rem; flex-wrap: wrap; }
.progline { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); margin-bottom: .8rem; align-items: center; }
.progline a { text-decoration: none; }
.prompt { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem; text-align: center; margin-bottom: 1.2rem; }
.prompt .label { color: var(--muted); }
.sentence { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.6; margin: .6rem 0 .2rem; }
.recorder { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.recbtn { width: 128px; height: 128px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 8px 22px rgba(122, 31, 43, .28); }
.recbtn svg { width: 52px; height: 52px; fill: currentColor; }
.recbtn.recording { background: var(--accent); box-shadow: 0 0 0 12px var(--accent-soft); }
.recstate { font-size: 1.05rem; font-weight: 600; text-align: center; display: flex; flex-direction: column; align-items: center; }
.recstate .bi { align-items: center; }
.timer { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
meter { width: min(340px, 90%); height: 14px; }
.after { width: 100%; display: flex; justify-content: center; }
.verdict { border-radius: 14px; padding: .85rem 1rem; width: min(560px, 100%); text-align: center; font-weight: 700; display: flex; flex-direction: column; align-items: center; }
.verdict .why { font-weight: 500; font-size: .95rem; margin-top: .2rem; }
.verdict.good { background: var(--good-soft); color: var(--good); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.subactions { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; margin-top: 1.4rem; align-items: flex-start; }
.subactions details summary { list-style: none; }
.subactions details summary::-webkit-details-marker { display: none; }
form.flag { display: flex; gap: .5rem; margin-top: .5rem; }
form.flag select { margin: 0; }
.player { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
#clipPos { max-width: 480px; margin: 0 auto; display: block; }
form.transcribe textarea { font-size: 1.5rem; line-height: 1.6; min-height: 8rem; }

@media (max-width: 860px) {
  .grid2, .grid2.wide-left { grid-template-columns: 1fr; }
  header.top { padding: .5rem .8rem; }
  nav .who { display: none; }
  main { padding: 1rem .8rem 2.5rem; }
  .clip { max-width: 12rem; }
  table { font-size: .92rem; }
}

/* ---------- check clips (Clip check for one clip) ---------- */
main.wide-task { max-width: 980px; }
.cc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; margin-bottom: .6rem; }
.cc canvas { display: block; width: 100%; height: 170px; background: var(--sand); border-radius: 10px; touch-action: none; cursor: crosshair; }
.cc-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; margin-top: .8rem; align-items: center; }
.cc-play, .cc-edges { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.edge { display: flex; align-items: center; gap: .25rem; }
.edge-label { font-weight: 700; margin-right: .3rem; }
.edge output { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; }
kbd { font: 600 .72rem/1 ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .12rem .3rem; background: var(--surface); color: var(--muted); }
.btn.primary kbd { background: transparent; color: inherit; border-color: rgba(255,255,255,.5); }
.cc-form textarea { font-size: 1.45rem; line-height: 1.6; }
.orig { margin: .4rem 0 0; }
.decisions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.reject-panel { margin-top: 1rem; }
.reject-panel input[name=note] { margin: .3rem 0 .8rem; }
.keys { margin-top: 1rem; }
.diff-old { text-decoration: line-through; color: var(--muted); }
