:root {
  --navy: #0b1f3a;
  --gold: #b8860b;
  --gold-text: #8a6508;
  --ink: #1c1f26;
  --muted: #5b6372;
  --line: #e3e6ee;
  --tint: #eef1f6;
  --bg: #ffffff;
  --ok: #0b7a5e;
  --bad: #b42318;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Figtree, system-ui, sans-serif; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 48px; background: var(--navy); color: #fff; border-top: 4px solid var(--gold); flex: none; }
.brand { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 18px; }
.who { font-size: 13px; opacity: 0.8; }
.shell { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }
.side { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; background: #fafbfd; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 6px; }
select, input[type='text'], input[type='search'], textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.pages { list-style: none; margin: 4px 0 0; padding: 0; overflow: auto; flex: 1; }
.pages li { padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.3; }
.pages li small { display: block; color: var(--muted); font-size: 12px; }
.pages li:hover { background: var(--tint); }
.pages li.on { background: var(--navy); color: #fff; }
.pages li.on small { color: #cfd6e3; }
.pages .dot { display: inline-block; font-size: 11px; font-weight: 700; color: var(--gold-text); background: #faf3df; border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.pages li.on .dot { background: var(--gold); color: #fff; }
.work { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.empty { margin: auto; color: var(--muted); }
.page { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 12px 16px 16px; gap: 10px; }
.page[hidden] { display: none; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar-l { min-width: 0; }
.crumb { font-family: Fraunces, Georgia, serif; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.bar-l a { font-size: 13px; color: var(--gold-text); }
.bar-r { display: flex; gap: 8px; align-items: center; }
.state { font-size: 13px; color: var(--muted); }
.state.dirty { color: var(--gold-text); font-weight: 600; }
button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 7px 14px; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
button.primary:hover { background: #142e52; }
button.ghost:hover { background: var(--tint); }
button:disabled { opacity: 0.5; cursor: default; }
.meta { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.meta summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.meta .count { text-transform: none; letter-spacing: 0; font-weight: 400; }
.meta .count.long { color: var(--bad); }
.tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tab { border: 0; border-radius: 0; padding: 6px 14px; }
.tab.on { background: var(--navy); color: #fff; }
.fmt { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.fmt button { padding: 5px 10px; font-size: 13px; }
.fmt .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.fmt.off { visibility: hidden; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.stage { flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; }
.stage iframe, .stage textarea { flex: 1; width: 100%; height: 100%; border: 0; }
.stage textarea { font: 13px/1.5 ui-monospace, Menlo, monospace; padding: 12px; resize: none; border-radius: 0; white-space: pre-wrap; }
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(720px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(11, 31, 58, 0.3); }
dialog::backdrop { background: rgba(11, 31, 58, 0.45); }
dialog h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 4px; font-size: 22px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.changes { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.chg { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.chg:last-child { border-bottom: 0; }
.chg .k { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.chg del { background: #fde8e7; color: #7a1a12; text-decoration: line-through; }
.chg ins { background: #e3f5ee; color: #0a5a45; text-decoration: none; }
.warn { margin-top: 12px; background: #fff7e0; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0 4px; font-size: 14px; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.toast a { color: #e0c068; }
.toast.err { background: var(--bad); }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .crumb { max-width: 90vw; }
}
