/* Essay contest judging portal — no build step, no external assets. */

:root {
  --ink: #14233f;
  --ink-soft: #3d4a63;
  --muted: #6c7689;
  --line: #e2ded4;
  --line-strong: #cfc9bb;
  --paper: #f6f4ee;
  --card: #ffffff;
  --navy: #12284c;
  --navy-deep: #0c1c37;
  --accent: #2f6fb3;
  --accent-soft: #e6eff9;
  --ok: #2c7a57;
  --ok-soft: #e3f2ea;
  --warn: #a8690f;
  --warn-soft: #fbf0d9;
  --danger: #b0302a;
  --danger-soft: #fae6e4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 63, 0.06), 0 4px 16px rgba(20, 35, 63, 0.05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "SimSun",
    "Noto Serif CJK SC", serif;
  --header-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font: 600 26px/1.2 var(--serif); letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 0.8em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 7px; overflow: hidden;
  background: #fff;
}
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand-name { font: 600 15px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 2px; margin-left: 8px; }
.topnav a {
  color: #c9d5ea; padding: 7px 12px; border-radius: 7px; font-weight: 500; white-space: nowrap;
}
.topnav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.topnav a.active { background: rgba(255, 255, 255, 0.14); color: #fff; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang-switch { display: flex; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 7px; overflow: hidden; }
.lang-switch button {
  background: none; border: 0; color: #c9d5ea; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.lang-switch button.active { background: #fff; color: var(--navy); font-weight: 600; }
.user-chip { color: #fff; font-size: 14px; white-space: nowrap; }
.user-chip:hover { text-decoration: underline; }
.link-button {
  background: none; border: 0; padding: 0; color: #c9d5ea; font: inherit; cursor: pointer; white-space: nowrap;
}
.link-button:hover { color: #fff; text-decoration: underline; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: calc(100vh - var(--header-h)); }
.sidebar {
  flex: none; width: 216px; padding: 18px 12px;
  background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: var(--header-h); align-self: flex-start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.sidebar h4 {
  margin: 16px 10px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: 7px; color: var(--ink-soft); font-weight: 500;
}
.sidebar a:hover { background: var(--paper); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--navy); font-weight: 600; }
.count {
  min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--warn); color: #fff; font-size: 12px; font-weight: 600; text-align: center;
}
.main { flex: 1; min-width: 0; padding: 28px 32px 64px; }
.container { max-width: 1120px; margin: 0 auto; }
.container.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: #fcfbf8; border-radius: 0 0 var(--radius) var(--radius); }

.stat { padding: 16px 18px; }
.stat-label { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.stat-value { font: 600 30px/1.1 var(--serif); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat.attention { border-color: #e4c98e; background: #fffaf0; }
.stat.attention .stat-value { color: var(--warn); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; background: #fcfbf8; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font: 600 13.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; white-space: nowrap; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #eeece6; color: var(--ink-soft);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-muted { background: #eeece6; color: var(--muted); }
.badge-gold { background: #f6e7b8; color: #7a5a06; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font: 600 14px/1.2 var(--sans); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f8f6f1; text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-danger { color: var(--danger); border-color: #e3b9b6; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: auto; }
.field { margin-bottom: 14px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .error, .errorlist { color: var(--danger); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; }
.check input { margin-top: 3px; flex: none; width: 16px; height: 16px; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list label, #id_conflict_prompts label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; }
#id_conflict_prompts { list-style: none; margin: 0; padding: 0; }
#id_conflict_prompts input { margin-top: 3px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- Messages ---------- */
.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.messages li, .notice {
  padding: 11px 14px; border-radius: 8px; margin-bottom: 8px;
  background: var(--accent-soft); color: #1e4a7a; border: 1px solid #c9dcf1;
}
.messages li.success, .notice.ok { background: var(--ok-soft); color: #1d5a3f; border-color: #bfdfcf; }
.messages li.warning, .notice.warn { background: var(--warn-soft); color: #7a4c08; border-color: #edd7a6; }
.messages li.error, .notice.danger { background: var(--danger-soft); color: #8a221d; border-color: #f0c4c1; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
textarea.draft { margin-top: 8px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #fff; }
.copy-box { display: flex; gap: 8px; margin-top: 8px; }
.copy-box input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 999px; background: #e9e6de; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.bar.thin { height: 6px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .bar { flex: 1; }

/* ---------- Auth pages ---------- */
/* The title lives inside the navy block itself, so it stays legible whatever
   the window height, zoom level or length of the contest name. */
.auth-page { min-height: 100vh; background: var(--paper); }
.auth-hero { background: var(--navy); padding: 52px 24px 88px; }
.auth-title { color: #fff; text-align: center; max-width: 560px; margin: 0 auto; }
.auth-title .brand-mark { margin: 0 auto 14px; width: 76px; height: 76px; border-radius: 14px; }
.auth-title h1 { font-size: 21px; color: #fff; }
.auth-title p { color: #c9d5ea; margin: 6px 0 0; }
.auth-card { width: calc(100% - 32px); max-width: 420px; margin: -56px auto 0; padding-bottom: 40px; }
.auth-card .card-body { padding: 28px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 16px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
p.error { color: var(--danger); }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; }
.auth-lang { display: flex; justify-content: center; margin-top: 18px; }
.auth-lang .lang-switch { border-color: var(--line-strong); }
.auth-lang .lang-switch button { color: var(--muted); }
.auth-lang .lang-switch button.active { background: var(--navy); color: #fff; }

/* ---------- Judge: essay list ---------- */
.essay-list { list-style: none; margin: 0; padding: 0; }
.essay-list li { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.essay-list li:last-child { border-bottom: 0; }
.essay-list .meta { flex: 1; min-width: 0; }
.essay-list .meta .small { color: var(--muted); }

/* ---------- Judge: reading and scoring ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); height: calc(100vh - var(--header-h)); }
.reader { overflow: auto; padding: 32px 40px 80px; background: #fffefb; border-right: 1px solid var(--line); }
.reader-inner { max-width: 900px; margin: 0 auto; }
.reader-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.reader-prompt { border-left: 3px solid var(--accent); padding: 8px 14px; margin: 14px 0 26px; background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 14px; }
.reader-tools { display: flex; gap: 6px; margin-left: auto; }
.scorer { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.scorer-scroll { flex: 1; overflow-y: auto; padding: 20px 20px 32px; }
.criterion { margin-bottom: 14px; }
.criterion .card-head { padding: 12px 16px; }
.criterion .card-body { padding: 14px 16px; }
.criterion select { width: 92px; font-weight: 600; font-size: 16px; text-align: center; }
.address { margin: 0 0 10px; padding-left: 18px; color: var(--ink-soft); font-size: 13.5px; }
.address li { margin-bottom: 2px; }
details.levels { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcfbf8; }
details.levels summary { cursor: pointer; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.level { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
.level-range { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.level ul { margin: 0; padding-left: 16px; }
.level .example { margin-top: 6px; color: var(--muted); font-style: italic; }
.level.current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.wordcount { display: flex; justify-content: flex-end; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.sheet-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.sheet-summary div { padding: 10px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sheet-summary b { display: block; font: 600 20px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.sheet-summary span { font-size: 12px; color: var(--muted); }
.sheet-summary .short b { color: var(--warn); }
.sheet-summary .met b { color: var(--ok); }
.savebar {
  flex: none; padding: 12px 20px;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-top: 1px solid var(--line-strong); box-shadow: 0 -4px 16px rgba(20, 35, 63, 0.07);
}
.savebar .status { flex: 1; font-size: 13px; color: var(--muted); }
.readonly-text { white-space: pre-wrap; background: #fcfbf8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; font: inherit; overflow-wrap: anywhere; }
.big-score { font: 600 22px/1 var(--serif); font-variant-numeric: tabular-nums; }

/* ---------- Rubric page ---------- */
.rubric-section h2 { font: 600 19px/1.3 var(--serif); margin: 26px 0 10px; }
.rubric-section ul { padding-left: 20px; }
.rubric-section li { margin-bottom: 6px; }
.rubric-table th:first-child, .rubric-table td:first-child { width: 70px; white-space: nowrap; font-weight: 700; color: var(--navy); }
.rubric-table td ul { margin: 0; padding-left: 18px; }
.rubric-table td.example { color: var(--ink-soft); font-style: italic; width: 32%; }

/* ---------- Anonymization review ---------- */
.container.wide { max-width: 1320px; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.review-side { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; display: grid; gap: 14px; padding-bottom: 4px; }
.review-side .btn { width: 100%; }
.review-side .copy-box .btn { width: auto; }
.rpage { margin-bottom: 22px; }
.rpage > header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rpage > header .btn { margin-left: auto; }
.rpage-out { display: none; }
.rpage.dropped .rpage-out { display: inline-block; }
.rpage-canvas { position: relative; line-height: 0; background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow); max-width: 900px; user-select: none; }
.rpage-canvas img { width: 100%; height: auto; min-height: 240px; display: block; }
.rpage.dropped .rpage-canvas { opacity: 0.25; }
.rpage-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.rpage.dropped .rpage-layer { cursor: not-allowed; }
.rbox { position: absolute; box-sizing: content-box; padding: 1px 2px; margin: -1px -2px; cursor: pointer; }
.rbox.on { background: #000; }
.rbox.on:hover { opacity: 0.3; outline: 2px solid var(--danger); }
.rbox.off { background: rgba(255, 196, 0, 0.28); outline: 2px dashed #b7791f; }
.rbox.off:hover { background: rgba(255, 196, 0, 0.5); }
.rbox.band { background: rgba(47, 111, 179, 0.25); outline: 2px solid var(--accent); pointer-events: none; }
.review-counts { display: flex; gap: 14px; flex-wrap: wrap; }
.swatch { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; border-radius: 2px; }
.swatch.on { background: #000; }
.swatch.off { background: rgba(255, 196, 0, 0.4); outline: 2px dashed #b7791f; outline-offset: -2px; }
.plain-page { margin: 0; padding: 14px 18px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tabs { display: flex; gap: 2px; }
.tabs button, .tabs a { background: none; border: 0; padding: 6px 12px; border-radius: 7px; font: 600 13.5px/1.2 var(--sans); color: var(--muted); cursor: pointer; }
.tabs button.active, .tabs a.active { background: var(--accent-soft); color: var(--navy); }
.tabs a:hover { text-decoration: none; }
.flag-list { list-style: none; margin: 0; padding: 0; }
.flag-list li { padding: 9px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 13.5px; }
.flag-list li:last-child { border-bottom: 0; }
.flag-list .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--ok); }
.flag-list li.check .dot { background: var(--warn); }
.identity dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.identity dt { color: var(--muted); font-size: 13px; }
.identity dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Essay pages (judges, and the admin preview) ---------- */
.essay-pages { margin: 0 auto; }
.essay-pages figure { margin: 0 0 18px; }
.essay-pages img { width: 100%; height: auto; min-height: 240px; display: block; background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.essay-pages figcaption { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Upload ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 30px 18px; text-align: center; background: #fcfbf8; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-list { list-style: none; margin: 14px 0 0; padding: 0; max-height: 340px; overflow-y: auto; }
.upload-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.upload-list .name { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload-list .msg { color: var(--muted); }
.upload-list li.created .msg { color: var(--ok); }
.upload-list li.error .msg, .upload-list li.failed .msg { color: var(--danger); }
.upload-list li.duplicate .msg, .upload-list li.created_unmatched .msg { color: var(--warn); }

/* ---------- Misc ---------- */
.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 34px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.spread-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 2px 8px; border-radius: 6px; background: #eeece6; font-size: 13px; font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.error-page b { font: 600 64px/1 var(--serif); color: var(--line-strong); display: block; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .reader, .scorer-scroll { overflow: visible; }
  .savebar { position: sticky; bottom: 0; }
  .reader { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 20px 40px; }
  .review-layout, .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; }
  .review-side { position: static; max-height: none; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { position: static; width: 100%; height: auto; display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar h4 { display: none; }
  .sidebar a { white-space: nowrap; }
  .shell { flex-direction: column; }
  .main { padding: 20px 16px 48px; }
  .brand-name { display: none; }
}
@media (max-width: 640px) {
  .form-row, .form-row.three, .grid.four { grid-template-columns: 1fr; }
  .topbar { gap: 8px; padding: 0 12px; }
  .user-chip { display: none; }
}
@media print {
  .topbar, .sidebar, .savebar, .actions { display: none !important; }
  .workspace { display: block; height: auto; }
}
