:root {
  color-scheme: light;
  --ink: #252229;
  --ink-soft: #625d68;
  --muted: #837d88;
  --canvas: #f3f0ea;
  --paper: #fffdf9;
  --paper-2: #f8f5ef;
  --sidebar: #1d1b20;
  --sidebar-2: #262329;
  --sidebar-3: #302c33;
  --line: #ded8cf;
  --line-soft: #ebe6de;
  --line-dark: rgba(255,255,255,.1);
  --accent: #e95f3f;
  --accent-2: #c9462b;
  --accent-soft: #fff0eb;
  --mint: #46b995;
  --mint-soft: #e8f7f2;
  --amber: #d99b32;
  --amber-soft: #fff6e3;
  --red: #d94a62;
  --red-soft: #fff0f3;
  --violet: #7c6cc4;
  --shadow: 0 24px 70px rgba(55,45,35,.16);
  --shadow-soft: 0 8px 28px rgba(59,49,39,.08);
  --body: "Aptos", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --display: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 4%, rgba(233,95,63,.09), transparent 27rem),
    radial-gradient(circle at 96% 2%, rgba(70,185,149,.08), transparent 25rem),
    var(--canvas);
  font: 15px/1.5 var(--body);
  font-feature-settings: "cv01", "ss03";
}
button, input, select, textarea { font: inherit; }
h1, h2, p { margin-top: 0; }
button, input, select, textarea, summary { color: inherit; }
a { color: inherit; }

.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 1000;
  padding: 10px 14px; border-radius: 8px; color: #fff;
  background: var(--accent); text-decoration: none; transform: translateY(-160%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.app-shell {
  width: min(1680px, calc(100% - 32px));
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid rgba(76,63,51,.16);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.app-bar {
  display: flex; min-height: 68px; padding: 0 18px;
  align-items: center; justify-content: space-between; gap: 24px;
  color: #f8f5f0; background: #171519;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-lockup, .app-bar-actions, .app-state, .report-button, .block-heading,
.editor-legend, .status-bar, .export-copy { display: flex; align-items: center; }
.brand-lockup { gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; grid-template-columns: auto auto auto; width: 46px; height: 38px;
  place-content: center; gap: 2px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px; color: #8f8993; background: rgba(255,255,255,.04);
  font: 700 12px/1 var(--mono);
}
.brand-mark b { color: #ff7656; font-size: 17px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font: 600 .94rem/1.2 var(--display); letter-spacing: -.01em; }
.brand-lockup > div > span {
  margin-top: 3px; color: #827c87; font: 600 9px/1.2 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
}
.app-bar-actions { gap: 10px; }
.app-state { gap: 8px; color: #98919d; font-size: .72rem; }
.state-light { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(70,185,149,.1); }
.report-button {
  min-height: 42px; padding: 5px 9px 5px 6px; gap: 8px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
  background: rgba(255,255,255,.035); text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.report-button:hover { border-color: rgba(255,118,86,.55); background: rgba(255,255,255,.06); transform: translateY(-1px); }
.report-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 7px; color: #fff; background: var(--accent); font: 800 13px/1 var(--mono); }
.report-button strong, .report-button small { display: block; }
.report-button strong { font-size: .72rem; font-weight: 600; }
.report-button small { color: #87818a; font: 600 8px/1.35 var(--mono); }
.external-arrow { color: #ff7656; font-size: .9rem; }

.studio-layout { display: grid; grid-template-columns: minmax(320px, 360px) minmax(0, 1fr); min-height: calc(100vh - 100px); }
.setup-sidebar {
  position: relative; padding: 28px 18px 34px 42px; color: #eee9e2;
  background:
    radial-gradient(circle at 20% 0, rgba(233,95,63,.13), transparent 26rem),
    var(--sidebar);
  border-right: 1px solid rgba(19,17,20,.45);
}
.sidebar-heading { padding: 0 5px 23px; }
.kicker { margin: 0 0 7px; color: var(--accent); font: 700 9px/1.3 var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.setup-sidebar .kicker { color: #ff876c; }
.sidebar-heading h1 { margin-bottom: 9px; font: 600 1.7rem/1.05 var(--display); letter-spacing: -.045em; }
.sidebar-heading > p:last-child { max-width: 285px; margin: 0; color: #9f98a3; font-size: .78rem; line-height: 1.55; }
.event-rail { position: absolute; top: 166px; bottom: 38px; left: 20px; width: 1px; background: linear-gradient(to bottom, var(--accent), rgba(255,255,255,.1) 20%, rgba(255,255,255,.1) 84%, transparent); }
.rail-node { position: absolute; left: -4px; width: 9px; height: 9px; border: 2px solid var(--sidebar); border-radius: 50%; background: #5a555e; box-shadow: 0 0 0 1px #5a555e; }
.rail-node:nth-child(1) { top: 14px; } .rail-node:nth-child(2) { top: 33%; } .rail-node:nth-child(3) { top: 61%; } .rail-node:nth-child(4) { top: 88%; }
.rail-node.active { background: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 15px rgba(233,95,63,.4); }
.side-stack, .provider-stack { display: grid; gap: 10px; }
.setup-block {
  position: relative; padding: 15px; border: 1px solid rgba(255,255,255,.085);
  border-radius: 10px; background: rgba(255,255,255,.028);
  transition: border-color .18s ease, background .18s ease;
}
.setup-block:hover { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.04); }
.setup-block::before { position: absolute; top: 24px; left: -22px; width: 14px; height: 1px; background: rgba(255,255,255,.12); content: ""; }
.block-heading { gap: 10px; margin-bottom: 12px; }
.step-badge { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 7px; color: #ff8c72; background: #18161a; font: 700 10px/1 var(--mono); }
.block-heading span:not(.step-badge) { display: block; margin-bottom: 3px; color: #766f7a; font: 700 8px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.block-heading h2 { margin: 0; font: 600 .94rem/1.1 var(--display); letter-spacing: -.02em; }

.drop-zone {
  display: grid; min-height: 184px; padding: 20px 16px; place-items: center; text-align: center;
  border: 1px dashed #514b55; border-radius: 9px; background: rgba(0,0,0,.16); cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.drop-zone:hover, .drop-zone.dragging { border-color: #ff8368; background: rgba(233,95,63,.06); transform: translateY(-1px); }
.file-illustration { position: relative; width: 72px; height: 55px; margin-bottom: 9px; }
.file-sheet { position: absolute; left: 8px; top: 0; display: grid; width: 44px; height: 52px; place-items: center; border: 1px solid #625b66; border-radius: 7px; color: #cbc5ce; background: #29262c; box-shadow: 7px 7px 0 rgba(233,95,63,.12); }
.file-sheet::after { position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-left: 1px solid #625b66; border-bottom: 1px solid #625b66; background: var(--sidebar); content: ""; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.file-sheet i { font: 700 8px/1 var(--mono); font-style: normal; letter-spacing: .04em; }
.upload-arrow { position: absolute; right: 0; bottom: 2px; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-weight: 800; box-shadow: 0 5px 15px rgba(233,95,63,.25); }
.drop-zone > strong { margin-bottom: 3px; font-size: .86rem; font-weight: 600; }
.drop-zone > p { max-width: 250px; margin: 0 0 13px; color: #918a95; font-size: .69rem; }

.button { display: inline-flex; min-height: 40px; padding: 8px 13px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(50,40,30,.04); transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease; }
.button:hover:not(:disabled) { border-color: #b8ada0; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(50,40,30,.08); }
.button.primary { border-color: var(--accent); color: #fff; background: var(--accent); box-shadow: 0 6px 18px rgba(233,95,63,.2); }
.button.primary:hover:not(:disabled) { border-color: var(--accent-2); background: var(--accent-2); box-shadow: 0 8px 20px rgba(201,70,43,.24); }
.button.ghost { background: transparent; }
.setup-sidebar .button.ghost { color: #eee9e2; border-color: #4b454f; background: transparent; }
.button.danger { color: #fff; border-color: var(--red); background: var(--red); }
.button.small { min-height: 35px; padding: 6px 10px; font-size: .73rem; }
:disabled { cursor: not-allowed; opacity: .42; }
.file-card { margin-top: 10px; padding: 11px 12px; border: 1px solid #48424c; border-radius: 8px; background: rgba(0,0,0,.16); }
.file-card p { margin: 3px 0 7px; color: #918a95; font-size: .68rem; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 3px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-soft); background: #f8f5ef; font: 700 8px/1.25 var(--mono); letter-spacing: .035em; text-transform: uppercase; }
.setup-sidebar .chip { border-color: #49434c; color: #b5aeb8; background: rgba(255,255,255,.035); }
.chip.safe { color: #15795e; border-color: rgba(70,185,149,.4); background: var(--mint-soft); }
.chip.risk { color: #9d6611; border-color: rgba(217,155,50,.4); background: var(--amber-soft); }
.chip.error { color: #ab3048; border-color: rgba(217,74,98,.35); background: var(--red-soft); }
.chip.machine { color: #6254a6; border-color: rgba(124,108,196,.35); background: #f1eefb; }

.field { display: grid; gap: 5px; color: var(--ink-soft); font-size: .69rem; font-weight: 600; }
.setup-sidebar .field { color: #aaa3ad; }
.field input, .field select, .toolbar input, .toolbar select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fffdfa; }
.setup-sidebar .field input, .setup-sidebar .field select, .setup-sidebar details summary, .setup-sidebar textarea { color: #eee9e2; border-color: #4b454f; background: #242127; }
.language-pair { display: grid; grid-template-columns: minmax(0,1fr) 20px minmax(0,1fr); gap: 6px; align-items: end; }
.direction-arrow { display: grid; min-height: 40px; place-items: center; color: #ff876c; font: 700 16px/1 var(--mono); }
.control-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.scope-list { display: grid; gap: 3px; }
.check { display: grid; grid-template-columns: 17px 1fr; gap: 8px; padding: 7px 8px; align-items: start; border: 1px solid transparent; border-radius: 7px; color: #b3acb6; font-size: .72rem; transition: border-color .16s ease, background .16s ease; }
.check:hover { border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.03); }
.check input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--accent); }
.check strong { display: block; color: #eee9e2; font-weight: 600; }
.check small { display: block; margin-top: 1px; color: #7f7883; line-height: 1.35; }
.risk-check { background: rgba(217,155,50,.025); }
.risk-check input { accent-color: var(--amber); }
.scope-divider { display: flex; margin: 7px 0 1px; align-items: center; gap: 8px; color: #bd8730; font: 700 8px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.scope-divider::after { height: 1px; flex: 1; background: rgba(217,155,50,.18); content: ""; }
.consent { margin-top: 7px; border-color: rgba(217,155,50,.16); }
.notice { padding: 9px 10px; border: 1px solid rgba(217,155,50,.3); border-radius: 7px; color: #8e5d17; background: var(--amber-soft); font-size: .69rem; }
.setup-sidebar .notice { color: #dec48f; background: rgba(217,155,50,.055); }
.notice.compact { margin-top: 4px; }
.notice.info { color: #23745f; border-color: rgba(70,185,149,.3); background: var(--mint-soft); }
.setup-sidebar .notice.info { color: #a7ddd0; }
details summary { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-weight: 600; }
.prompt { width: 100%; min-height: 220px; margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; font: 10px/1.5 var(--mono); resize: vertical; }

.editor-stage { min-width: 0; padding: 36px clamp(24px,3.4vw,54px) 44px; background: var(--canvas); }
.editor-heading { display: flex; min-height: 92px; margin-bottom: 19px; align-items: flex-end; justify-content: space-between; gap: 28px; }
.editor-heading h2 { margin: 0 0 8px; font: 600 clamp(2.2rem,3.5vw,3.8rem)/.94 var(--display); letter-spacing: -.065em; }
.editor-heading > div:first-child > p:last-child { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: .8rem; }
.editor-legend { gap: 13px; padding-bottom: 4px; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.editor-legend span { display: flex; align-items: center; gap: 6px; }
.editor-legend i { width: 7px; height: 7px; border-radius: 50%; }
.safe-dot { background: var(--mint); } .risk-dot { background: var(--amber); }
.status-bar { position: sticky; top: 8px; z-index: 15; min-height: 46px; margin-bottom: 13px; padding: 9px 12px; gap: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: rgba(255,253,249,.94); box-shadow: var(--shadow-soft); backdrop-filter: blur(10px); }
.status-bar::after { margin-left: auto; color: #aaa29a; content: "SESSION"; font: 700 8px/1 var(--mono); letter-spacing: .11em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #aaa39a; box-shadow: 0 0 0 4px rgba(131,125,136,.08); }
.status-bar.success { border-color: rgba(70,185,149,.38); } .status-bar.success .status-dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(70,185,149,.1); }
.status-bar.warn { border-color: rgba(217,155,50,.4); } .status-bar.warn .status-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(217,155,50,.1); }
.status-bar.error { border-color: rgba(217,74,98,.4); } .status-bar.error .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(217,74,98,.1); }

.document-board { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-soft); }
.document-summary { display: grid; grid-template-columns: minmax(165px,.8fr) minmax(0,2fr); border-bottom: 1px solid var(--line-soft); }
.document-label { padding: 18px 19px; background: #242127; }
.document-label span, .document-label strong { display: block; }
.document-label span { margin-bottom: 6px; color: #817a85; font: 700 8px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.document-label strong { color: #f4f0ea; font-size: .86rem; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); background: var(--paper); }
.stats div { position: relative; padding: 15px; border-left: 1px solid var(--line-soft); }
.stats div::after { position: absolute; left: 15px; bottom: 0; width: 22px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); content: ""; }
.stats div:nth-child(2)::after { background: var(--violet); } .stats div:nth-child(3)::after { background: var(--mint); } .stats div:nth-child(4)::after { background: var(--red); }
.stats b { display: block; overflow: hidden; font: 600 clamp(1.45rem,2.1vw,2rem)/1 var(--display); letter-spacing: -.04em; text-overflow: ellipsis; }
.stats span { color: var(--muted); font: 700 8px/1.4 var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.toolbar { display: grid; grid-template-columns: minmax(220px,1fr) 150px 135px auto; gap: 8px; padding: 11px; border-bottom: 1px solid var(--line-soft); background: var(--paper-2); }
.search-box { position: relative; }
.search-box::before { position: absolute; top: 12px; left: 13px; width: 10px; height: 10px; border: 1.5px solid #9d958d; border-radius: 50%; content: ""; pointer-events: none; }
.search-box::after { position: absolute; top: 23px; left: 23px; width: 6px; height: 1.5px; background: #9d958d; content: ""; transform: rotate(45deg); pointer-events: none; }
.search-box input { padding-left: 36px; }
.toolbar-actions { display: flex; gap: 6px; }
.progress-wrap { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); background: #fff9f6; }
.progress-wrap > div { display: flex; justify-content: space-between; color: var(--ink-soft); font: 600 .69rem/1.3 var(--mono); }
.progress-track { display: block; width: 100%; height: 7px; margin-top: 8px; overflow: hidden; border: 0; border-radius: 99px; background: #e8e1d9; accent-color: var(--accent); }
.progress-track::-webkit-progress-bar { background: #e8e1d9; } .progress-track::-webkit-progress-value { background: var(--accent); } .progress-track::-moz-progress-bar { background: var(--accent); }

.empty-state { display: grid; min-height: 510px; padding: 60px 28px; align-content: center; justify-items: center; text-align: center; color: var(--ink-soft); background: var(--paper); }
.empty-scene { position: relative; width: 148px; height: 104px; margin-bottom: 22px; }
.dialog-window { position: absolute; inset: 12px 9px 0 0; display: flex; padding: 18px; align-items: flex-end; gap: 6px; border: 1.5px solid #39343b; border-radius: 10px; background: #fffdf9; box-shadow: 9px 9px 0 var(--accent-soft); }
.dialog-window::after { position: absolute; right: 22px; bottom: -11px; width: 20px; height: 20px; border-right: 1.5px solid #39343b; border-bottom: 1.5px solid #39343b; background: #fffdf9; content: ""; transform: rotate(45deg); }
.dialog-window i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); } .dialog-window i:nth-child(2) { background: var(--accent); }
.dialog-window b { margin-left: auto; color: #aaa39a; font: 800 20px/1 var(--mono); }
.cursor-spark { position: absolute; top: 0; right: 0; color: var(--amber); font-size: 27px; filter: drop-shadow(0 5px 10px rgba(217,155,50,.2)); }
.empty-state strong { margin-bottom: 6px; color: var(--ink); font: 600 1.25rem/1.2 var(--display); letter-spacing: -.025em; }
.empty-state p { max-width: 410px; margin: 0; font-size: .79rem; }

.translation-list { background: var(--paper); }
.translation-row { position: relative; display: grid; grid-template-columns: 40px minmax(0,1fr) minmax(0,1fr); gap: 12px; padding: 16px 15px 17px; border-bottom: 1px solid var(--line-soft); background: var(--paper); transition: background .16s ease; }
.translation-row:hover { background: #fffcf8; }
.translation-row::before { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--mint); content: ""; }
.translation-row.risk { background: #fffcf5; } .translation-row.risk::before { background: var(--amber); }
.translation-row.error { background: #fff8f9; } .translation-row.error::before { background: var(--red); }
.row-select { display: grid; padding-top: 27px; justify-items: center; align-content: start; gap: 8px; color: #9b938b; font: 700 8px/1 var(--mono); }
.row-select input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.cell { min-width: 0; }
.cell-head { display: flex; min-height: 23px; margin-bottom: 6px; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font: 700 8px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.cell textarea { display: block; width: 100%; min-height: 112px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; line-height: 1.5; resize: vertical; transition: border-color .16s ease, box-shadow .16s ease; }
.cell textarea.source { color: #625d68; background: #f5f1eb; }
.cell.target textarea { border-color: #dcc9c0; background: #fffdfb; box-shadow: inset 2px 0 var(--accent-soft); }
.cell.target textarea:focus { border-color: rgba(233,95,63,.65); }
.context { margin-top: 7px; color: #989087; font: 9px/1.45 var(--mono); overflow-wrap: anywhere; }
.context::before { margin-right: 6px; color: var(--violet); content: "PATH"; font-size: 7px; font-weight: 800; }
.inline-error { min-height: 17px; margin-top: 5px; color: var(--red); font-size: .68rem; }
.pagination { display: flex; padding: 12px 14px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); color: var(--muted); font: 700 .68rem/1 var(--mono); }

.export-dock { display: grid; grid-template-columns: minmax(230px,.8fr) minmax(300px,1fr); gap: 16px 26px; margin-top: 14px; padding: 17px; align-items: end; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-soft); }
.export-copy { gap: 12px; }
.export-mark { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: #fff; background: var(--mint); font-weight: 800; box-shadow: 0 6px 16px rgba(70,185,149,.18); }
.export-copy h2 { margin: 0 0 3px; font: 600 1.08rem/1.1 var(--display); letter-spacing: -.025em; }
.export-copy p:last-child { margin: 0; color: var(--muted); font-size: .69rem; }
.export-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.export-dock > .notice { grid-column: 1 / -1; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(233,95,63,.2); outline-offset: 2px; }
[hidden] { display: none !important; }

@media (max-width: 1280px) {
  .studio-layout { grid-template-columns: 340px minmax(0,1fr); }
  .toolbar { grid-template-columns: minmax(190px,1fr) 1fr 1fr; }
  .toolbar-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .document-summary { grid-template-columns: 150px minmax(0,1fr); }
}
@media (max-width: 1000px) {
  .app-shell { width: calc(100% - 18px); margin: 9px auto; border-radius: 14px; }
  .studio-layout { grid-template-columns: 1fr; }
  .setup-sidebar { padding: 27px 22px 29px 45px; }
  .event-rail { top: 164px; }
  .side-stack { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .upload-block, .provider-block { grid-column: 1 / -1; }
  .editor-stage { padding-top: 28px; }
}
@media (max-width: 720px) {
  .app-bar { min-height: 62px; padding: 8px 11px; }
  .brand-lockup > div > span, .app-state { display: none; }
  .brand-mark { width: 41px; height: 35px; }
  .report-button { min-height: 40px; }
  .report-button small, .external-arrow { display: none; }
  .studio-layout { min-height: 0; }
  .setup-sidebar { padding: 24px 12px 25px; }
  .sidebar-heading { padding: 0 3px 19px; }
  .event-rail, .setup-block::before { display: none; }
  .side-stack { grid-template-columns: 1fr; }
  .upload-block, .provider-block { grid-column: auto; }
  .editor-stage { padding: 24px 9px 29px; }
  .editor-heading { display: block; min-height: 0; margin: 0 4px 18px; }
  .editor-heading h2 { font-size: 2.4rem; }
  .editor-legend { margin-top: 12px; }
  .status-bar::after { display: none; }
  .document-summary { grid-template-columns: 1fr; }
  .document-label { padding: 13px 14px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats div:nth-child(3), .stats div:nth-child(4) { border-top: 1px solid var(--line-soft); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-box, .toolbar-actions { grid-column: 1 / -1; }
  .toolbar-actions { flex-wrap: wrap; justify-content: stretch; }
  .toolbar-actions .button { flex: 1 1 auto; }
  .translation-row { grid-template-columns: 32px minmax(0,1fr); gap: 9px; padding: 14px 10px 16px; }
  .translation-row .target { grid-column: 2; }
  .row-select { grid-row: 1 / span 2; }
  .empty-state { min-height: 410px; }
  .export-dock { grid-template-columns: 1fr; }
  .export-controls { grid-template-columns: 1fr; }
  .export-dock > .notice { grid-column: auto; }
  .language-pair { grid-template-columns: 1fr; }
  .direction-arrow { min-height: 18px; transform: rotate(90deg); }
}
@media (max-width: 460px) {
  .brand-lockup strong { max-width: 155px; font-size: .82rem; }
  .report-button { padding-right: 8px; }
  .report-button strong { font-size: .69rem; }
  .control-grid, .toolbar { grid-template-columns: 1fr; }
  .search-box, .toolbar-actions { grid-column: auto; }
  .stats b { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Unified dark workspace — avoids a harsh dark-to-white transition. */
:root {
  color-scheme: dark;
  --ink: #f0ece7;
  --ink-soft: #bbb4be;
  --muted: #8f8894;
  --canvas: #151317;
  --paper: #1d1a1f;
  --paper-2: #221f24;
  --line: #39343d;
  --line-soft: #302c34;
  --accent-soft: rgba(233,95,63,.11);
  --mint-soft: rgba(70,185,149,.11);
  --amber-soft: rgba(217,155,50,.11);
  --red-soft: rgba(217,74,98,.11);
  --shadow: 0 24px 70px rgba(0,0,0,.34);
  --shadow-soft: 0 8px 28px rgba(0,0,0,.2);
}

html,
body {
  background: #121014;
}
body {
  background:
    radial-gradient(circle at 6% 0, rgba(233,95,63,.07), transparent 28rem),
    radial-gradient(circle at 96% 0, rgba(70,185,149,.055), transparent 26rem),
    #121014;
}
.app-shell {
  border-color: rgba(255,255,255,.09);
  background: var(--paper);
}
.app-bar { background: #100e11; }
.editor-stage {
  background:
    linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
}
.button {
  border-color: #454049;
  color: var(--ink);
  background: #29252c;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.button:hover:not(:disabled) {
  border-color: #625a68;
  background: #302b33;
  box-shadow: 0 6px 16px rgba(0,0,0,.22);
}
.button.primary { border-color: var(--accent); background: var(--accent); }
.button.primary:hover:not(:disabled) { border-color: var(--accent-2); background: var(--accent-2); }
.field input,
.field select,
.toolbar input,
.toolbar select {
  border-color: #403a44;
  color: var(--ink);
  background: #262229;
}
.field input::placeholder,
.toolbar input::placeholder,
.cell textarea::placeholder { color: #77707c; }
.status-bar {
  border-color: #3c3740;
  color: var(--ink-soft);
  background: rgba(29,26,31,.94);
}
.status-bar::after { color: #706975; }
.document-board,
.export-dock {
  border-color: #39343d;
  background: var(--paper);
}
.document-label { background: #18151a; }
.stats,
.translation-list,
.translation-row,
.empty-state { background: var(--paper); }
.stats div { border-left-color: var(--line-soft); }
.toolbar { background: #211e23; }
.search-box::before { border-color: #77707c; }
.search-box::after { background: #77707c; }
.empty-state { color: var(--ink-soft); }
.dialog-window {
  border-color: #716a75;
  background: #242027;
  box-shadow: 9px 9px 0 rgba(233,95,63,.1);
}
.dialog-window::after {
  border-color: #716a75;
  background: #242027;
}
.dialog-window b { color: #77707c; }
.translation-row:hover { background: #211e23; }
.translation-row.risk { background: rgba(217,155,50,.035); }
.translation-row.error { background: rgba(217,74,98,.045); }
.cell textarea {
  border-color: #403a44;
  color: var(--ink);
  background: #242127;
}
.cell textarea.source {
  color: #b8b1bc;
  background: #201d22;
}
.cell.target textarea {
  border-color: #4b3c3c;
  background: #262127;
  box-shadow: inset 2px 0 rgba(233,95,63,.12);
}
.chip {
  border-color: #454049;
  color: #aaa3ad;
  background: #29252c;
}
.chip.safe { color: #72d3b5; border-color: rgba(70,185,149,.35); background: rgba(70,185,149,.09); }
.chip.risk { color: #e7b65d; border-color: rgba(217,155,50,.35); background: rgba(217,155,50,.09); }
.chip.error { color: #ee8093; border-color: rgba(217,74,98,.32); background: rgba(217,74,98,.09); }
.chip.machine { color: #aa9be9; border-color: rgba(124,108,196,.35); background: rgba(124,108,196,.1); }
.notice { color: #e0b667; background: rgba(217,155,50,.08); }
.notice.info { color: #8ed9c4; background: rgba(70,185,149,.08); }
.progress-wrap { background: rgba(233,95,63,.04); }
.progress-track,
.progress-track::-webkit-progress-bar { background: #37323a; }
.pagination { border-color: var(--line-soft); }
