:root {
  color-scheme: light;
  --ink: #262520;
  --muted: #706e65;
  --paper: #f4f0e6;
  --panel: #fffdf7;
  --line: #ddd5c5;
  --brand: #623f25;
  --brand-2: #8d623d;
  --safe: #255c42;
  --danger: #a4362a;
  --warning: #fff1bd;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, select, input, textarea { font: inherit; }
button, .file-button { border: 1px solid transparent; border-radius: 9px; padding: .68rem .95rem; cursor: pointer; font-weight: 650; }
button:disabled { cursor: not-allowed; opacity: .48; }
select, input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white; padding: .68rem; color: var(--ink); }
textarea { resize: vertical; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: 1.8rem; }
h2 { margin-bottom: .65rem; font-size: 1.15rem; }
h3 { margin-bottom: .55rem; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.topbar { min-height: 78px; display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: #29251f; color: white; }
.top-actions, .decision-actions, .dialog-actions { display: flex; gap: .65rem; align-items: center; }
.file-button { display: inline-block; background: var(--brand-2); color: white; }
.file-button input { display: none; }
.layout { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 1rem; padding: 1rem; max-width: 1540px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 8px #4430180a; }
.sidebar { padding: 1rem; align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.workspace { display: grid; gap: 1rem; min-width: 0; }
.review, .bulk, .workspace > .panel { padding: 1.15rem; }
.review-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.pipeline-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; margin: 1rem 0; }
.pipeline-step { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .72rem; border: 1px solid #cfc3af; border-radius: 10px; background: #f8f3e8; }
.pipeline-step div { min-width: 0; }
.pipeline-step strong, .pipeline-step small { display: block; }
.pipeline-step strong { font-size: .82rem; }
.pipeline-step small { margin-top: .15rem; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.step-number { display: grid; place-items: center; flex: 0 0 1.65rem; width: 1.65rem; height: 1.65rem; border-radius: 50%; background: var(--brand); color: white; font-size: .76rem; font-weight: 800; }
.style-policy, .context-policy { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid #b9cdbf; border-radius: 10px; background: #f1f8f3; font-size: .82rem; line-height: 1.45; }
.context-policy { margin-top: .55rem; border-color: #c7c0dc; background: #f5f3fb; }
.style-policy span:not(.badge) { color: var(--muted); }
.context-policy span:not(.badge) { color: var(--muted); }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.columns > section { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; min-width: 0; }
.stage-label { margin: 0 0 .2rem; color: var(--brand-2); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.model-meta { margin: -.1rem 0 .75rem; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.plain-note { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.audit-success { padding: .5rem .65rem; border-radius: 7px; background: #e5f3e9; color: #20563c; font-size: .78rem; font-weight: 700; }
.source-script { font-family: "Noto Serif Devanagari", "Nirmala UI", serif; font-size: 1.45rem; line-height: 1.65; }
.translation { font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.65; white-space: pre-wrap; }
.muted, .empty { color: var(--muted); }
.eyebrow { margin-bottom: .22rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; opacity: .75; }
.field-label { display: block; margin: .8rem 0 .35rem; font-size: .82rem; font-weight: 700; }
.primary { background: var(--safe); color: white; }
.secondary { background: #f4efe5; color: var(--ink); border-color: var(--line); }
.danger { background: var(--danger); color: white; }
.quiet { padding: .35rem .55rem; background: transparent; color: var(--brand); }
.full { width: 100%; margin-top: .6rem; }
.badge { border-radius: 999px; padding: .35rem .65rem; background: #eee8dc; font-size: .75rem; font-weight: 750; white-space: nowrap; }
.warning { padding: .8rem 1rem; border: 1px solid #dfb643; border-radius: 10px; background: var(--warning); }
.hidden { display: none !important; }
.review-read-only .interactive-only { display: none !important; }
.review-read-only .pipeline-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary { margin-top: .65rem; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.unit-list { display: grid; gap: .4rem; }
.unit-item { width: 100%; text-align: left; background: white; border-color: var(--line); font-weight: 500; }
.unit-item.active { border-color: var(--brand-2); box-shadow: inset 3px 0 var(--brand-2); }
.unit-item small { display: block; color: var(--muted); margin-top: .2rem; }
details { border-top: 1px solid var(--line); padding: .9rem 0; }
summary { cursor: pointer; font-weight: 700; }
.prose { margin: .7rem 0; line-height: 1.6; }
.facts { display: grid; gap: .55rem; margin-bottom: 0; }
.facts div { display: grid; grid-template-columns: 8rem 1fr; gap: .5rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.quality-hypothesis { margin-top: .75rem; padding: .65rem; border-left: 3px solid #8b6d45; background: #fbf4e7; font-size: .8rem; line-height: 1.5; }
.reference-translation { margin-top: .55rem; padding: .55rem; border: 1px solid var(--line); border-radius: 7px; background: #faf8f2; font-size: .76rem; }
.reference-translation p { margin: .35rem 0; white-space: pre-wrap; line-height: 1.5; }
.notes { display: grid; gap: .5rem; margin-top: .65rem; }
.note { padding: .65rem; border-left: 3px solid var(--brand-2); background: #faf5e9; }
.check-note { border-left-color: #b47b17; background: #fff7df; }
.editor-stage, .usage-stage, .human-stage, .openai-comparison-stage { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.editor-stage { background: #f7f3ec; }
.openai-comparison-stage { background: #f4f1f8; border-color: #cbc2d8; }
.openai-variants { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; align-items: start; }
.comparison-summary { margin: .75rem 0 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; }
.comparison-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin: .5rem 0; }
.comparison-pills span { padding: .3rem .55rem; border-radius: 999px; background: #eee7d9; font-size: .82rem; }
.openai-card { min-width: 0; padding: .85rem; border: 1px solid #d2c8dd; border-top-width: 5px; border-radius: 10px; background: white; }
.openai-card.model-luna { border-top-color: #6879a7; }
.openai-card.model-terra { border-top-color: #8b6d45; }
.openai-card.model-sol { border-top-color: #b26a35; }
.openai-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.openai-card h4 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; }
.openai-card h5 { margin: .85rem 0 .45rem; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.openai-card details { padding: .7rem 0; }
.variant-metrics { display: flex; flex-wrap: wrap; gap: .35rem; margin: .7rem 0; }
.variant-metrics span { padding: .24rem .42rem; border-radius: 6px; background: #f0edf4; color: #50475c; font-size: .68rem; font-weight: 750; }
.commented-text-box { margin: .75rem 0; padding: .7rem; border: 1px solid #c7d6ca; border-radius: 8px; background: #f5faf6; }
.iast-line, .cyrillic-line { overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.6; }
.iast-line { font-family: Georgia, serif; color: #40382d; }
.cyrillic-line { padding: .55rem; border-radius: 7px; background: #f6f1e6; font-family: Georgia, serif; }
.translation.compact { font-size: .98rem; line-height: 1.58; }
.word-table-wrap { margin-top: .55rem; max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; }
.word-table { width: 100%; border-collapse: collapse; font-size: .74rem; }
.word-table th, .word-table td { padding: .42rem; border-bottom: 1px solid #ece5d8; text-align: left; vertical-align: top; }
.word-table th { position: sticky; top: 0; background: #f1ebdf; color: var(--muted); }
.claim-list { display: grid; gap: .45rem; margin-top: .55rem; }
.claim { padding: .55rem; border-left: 3px solid #86729b; background: #f7f4fa; font-size: .76rem; line-height: 1.45; }
.claim p { margin: .35rem 0 0; }
.claim-kind, .claim-weight { display: inline-block; margin: 0 .3rem .35rem 0; padding: .18rem .36rem; border-radius: 999px; background: #e7e0ee; color: #514262; font-size: .64rem; font-weight: 800; }
.claim-weight { background: #eee8d7; color: #665425; }
.stage-heading, .editor-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.stage-heading h3 { margin-bottom: 0; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.editor-card { padding: .8rem; border: 1px solid #d9cfbd; border-radius: 9px; background: white; }
.editor-failed { border-color: #d7aaa4; background: #fff7f5; }
.editor-card-head strong, .service-name { display: block; }
.service-name { margin-bottom: .12rem; color: var(--muted); font-size: .7rem; font-weight: 750; text-transform: uppercase; }
.editor-card details { margin-top: .4rem; padding-bottom: 0; }
.editor-translation { margin: .75rem 0; font-size: 1rem; }
.comparison-badge, .count-kind { display: inline-block; border-radius: 999px; padding: .25rem .5rem; font-size: .69rem; font-weight: 800; white-space: nowrap; }
.comparison-same, .count-exact { background: #dceee3; color: #20563c; }
.comparison-format { background: #e8e5f4; color: #524681; }
.comparison-changed, .count-estimated { background: #fff0c8; color: #75520a; }
.empty-editor { grid-column: 1 / -1; padding: .85rem; border: 1px dashed #c6baa5; border-radius: 8px; background: #fffdf8; font-size: .86rem; }
.usage-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.usage-table { width: 100%; border-collapse: collapse; background: white; font-size: .8rem; }
.usage-table th, .usage-table td { padding: .58rem .65rem; border-bottom: 1px solid #ece5d8; text-align: left; white-space: nowrap; }
.usage-table th { background: #f3ede2; color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.usage-table tr:last-child td { border-bottom: 0; }
.human-stage { border-color: #b9cdbf; background: #f4faf6; }
.decision-actions { justify-content: flex-end; margin-top: .8rem; flex-wrap: wrap; }
.bulk { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(310px, 1.6fr); align-items: center; gap: 1rem; }
.bulk-controls { display: grid; grid-template-columns: minmax(145px, 1fr) auto auto; gap: .6rem; }
.audit-list { display: grid; gap: .55rem; }
.audit-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.audit-item p { margin: 0; }
dialog { max-width: 520px; border: 1px solid var(--line); border-radius: 13px; padding: 1.3rem; color: var(--ink); }
dialog::backdrop { background: #19151099; }
.check { display: flex; gap: .65rem; align-items: start; padding: .75rem; background: var(--warning); border-radius: 8px; }
.check input { width: auto; margin-top: .2rem; }
.dialog-actions { justify-content: flex-end; margin-top: 1rem; }
#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: 420px; padding: .8rem 1rem; border-radius: 9px; background: #29251f; color: white; opacity: 0; transform: translateY(12px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .columns, .bulk { grid-template-columns: 1fr; }
  .pipeline-strip { grid-template-columns: repeat(2, 1fr); }
  .openai-variants { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { align-items: flex-start; gap: 1rem; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .bulk-controls { grid-template-columns: 1fr; }
  .decision-actions { align-items: stretch; }
  .decision-actions button { width: 100%; }
  .pipeline-strip, .editor-grid { grid-template-columns: 1fr; }
}
