:root {
  --bg: #f2f4f1; --surface: #ffffff; --ink: #17201c; --muted: #5e6b65; --line: #dce1dc;
  --pine: #1f6f5c; --pine-ink: #ffffff; --pine-soft: #e3f0ec;
  --slate: #34507a; --slate-soft: #e6ecf5;
  --warn: #8a5a00; --warn-soft: #fbf0d8; --bad: #a3322b; --bad-soft: #fbe6e4;
  --radius: 12px; --shadow: 0 1px 2px rgba(23, 32, 28, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a201d; --ink: #e7ece8; --muted: #9aa8a0; --line: #2a322e;
  --pine: #4fb79c; --pine-ink: #0b1511; --pine-soft: #1b2e29;
  --slate: #8ea8d4; --slate-soft: #1c2638;
  --warn: #e5b857; --warn-soft: #2e2512; --bad: #ef8a82; --bad-soft: #35201e; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #121614; --surface: #1a201d; --ink: #e7ece8; --muted: #9aa8a0; --line: #2a322e;
    --pine: #4fb79c; --pine-ink: #0b1511; --pine-soft: #1b2e29;
    --slate: #8ea8d4; --slate-soft: #1c2638;
    --warn: #e5b857; --warn-soft: #2e2512; --bad: #ef8a82; --bad-soft: #35201e; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; margin-bottom: 1rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; } a { color: var(--pine); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .55rem; font: 600 1.15rem var(--serif); color: var(--ink); text-decoration: none; }
.brand-mark { width: 22px; height: 12px; border: 2.5px solid var(--pine); border-bottom: 0; border-radius: 22px 22px 0 0; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: -3px; right: -3px; bottom: -3px; height: 2.5px; background: var(--slate); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: .5rem .7rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.side nav a:hover { background: var(--bg); }
.side nav a.on { background: var(--pine-soft); color: var(--pine); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .35rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: .5rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.content { padding: 1.5rem 1.25rem 3rem; width: 100%; max-width: 1100px; margin: 0 auto; }
.grow { flex: 1; } .menu-btn { display: none; }

/* primitives */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 520px; margin: 4rem auto; }
a.card.link { display: block; color: inherit; text-decoration: none; } a.card.link:hover { border-color: var(--pine); }
a.card.link.row { display: flex; }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; } .row.wrap, .wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .8rem; } .stack.tight { gap: .5rem; margin-top: .8rem; }
.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--pine); }
.btn.primary { background: var(--pine); color: var(--pine-ink); border-color: var(--pine); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); } .btn.danger:hover { border-color: var(--bad); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; } .btn.big { padding: .75rem 1.3rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .92rem; font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; } label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; width: 100%; }
label.inline select, .row select, .row input:not(.grow) { width: auto; } input.grow { width: auto; min-width: 0; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 5rem; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .78rem; background: var(--slate-soft); color: var(--slate); border: 1px solid transparent; white-space: nowrap; }
.pill.good { background: var(--pine-soft); color: var(--pine); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.notice { padding: .7rem .9rem; border-radius: 9px; margin-bottom: 1rem; background: var(--pine-soft); color: var(--ink); border: 1px solid var(--line); }
.notice.err { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: .5rem 0; border-top: 1px solid var(--line); } ul.plain li:first-child { border-top: 0; }
.empty { text-align: left; } .empty h2 { margin-bottom: .25rem; }
.meter { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); margin-bottom: .6rem; }
.meter-fill { height: 100%; width: 0; background: var(--pine); transition: width .5s ease; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; } .tabs a.on { color: var(--ink); border-color: var(--pine); font-weight: 600; }
.stat .num { font: 600 1.9rem var(--serif); }
.tablewrap { overflow-x: auto; margin-bottom: 1rem; } table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; } th { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* translation workspace */
.workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.pane { margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--bg); border-radius: 10px; border: 1px solid var(--line); margin-bottom: .8rem; }
.seg button { flex: 1; font: inherit; padding: .4rem .6rem; border: 0; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
#input { min-height: 13rem; }
.opts { display: flex; flex-wrap: wrap; gap: .6rem; margin: .7rem 0; } .opts label { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; } .opts select { width: auto; }
.out { border-left: 4px solid var(--pine); } .out.tech { border-left-color: var(--slate); }
.output { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin-bottom: 1rem; }
.output h2, .output h3 { font-size: 1.02rem; margin: 1rem 0 .3rem; } .output ul { margin: .2rem 0 .6rem; padding-left: 1.2rem; } .output p { margin: 0 0 .6rem; }
.output li.todo { list-style: none; margin-left: -1.2rem; } .output li.todo::before { content: "\2610\00a0"; }
.output .qa { padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 9px; margin-bottom: .5rem; background: var(--bg); } .output .qa .why { color: var(--muted); font-size: .88rem; }
.actions .btn { font-size: .9rem; padding: .35rem .7rem; }
.loading { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.dots { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--pine); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#editor { margin-bottom: 1rem; }
.items { list-style: none; padding: 0; margin: 0; } .items li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .5rem 0; border-top: 1px solid var(--line); } .items li:first-child { border-top: 0; }
.item-body { flex: 1; min-width: 12rem; overflow-wrap: anywhere; } .item-actions { display: flex; gap: .3rem; }
details.hist summary { cursor: pointer; } details.hist[open] summary { margin-bottom: .5rem; }

/* shared summary document */
.doc .sec { margin-top: 1.1rem; } .doc .sec h3 { margin: 0 0 .25rem; color: var(--slate); font-size: .95rem; }
.doc ul { margin: .2rem 0; padding-left: 1.2rem; } .doc ul.checks { list-style: none; padding-left: 0; } .doc ul.checks li::before { content: "\2610\00a0"; }

/* auth + landing */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; } .auth .card { width: 100%; max-width: 420px; display: block; } .auth .brand { margin-bottom: 1rem; }
.share { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.landing { max-width: 980px; margin: 0 auto; padding: 1rem 1.25rem 4rem; } .land-top { display: flex; align-items: center; gap: .5rem; padding: .5rem 0 1.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); max-width: 18ch; letter-spacing: -.01em; margin-top: 2.5rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.bridge { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: stretch; margin: 2.5rem 0; }
.bridge-side { padding: 1.2rem 1.3rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.bridge-side p { margin: .4rem 0 0; font-size: 1.05rem; }
.bridge-side .tag { font-size: .85rem; font-weight: 600; }
.bridge-side.tech { border-top: 4px solid var(--slate); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; } .bridge-side.tech .tag { color: var(--slate); font-family: var(--sans); }
.bridge-side.plain { border-top: 4px solid var(--pine); } .bridge-side.plain .tag { color: var(--pine); }
.bridge-mid { align-self: center; height: 30px; border: 3px solid var(--muted); border-bottom: 0; border-radius: 40px 40px 0 0; opacity: .6; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-flex; } .hide-sm { display: none; }
  .workspace, .grid2, .grid3 { grid-template-columns: 1fr; }
  .bridge { grid-template-columns: 1fr; gap: .6rem; } .bridge-mid { display: none; }
  .content { padding: 1rem .9rem 3rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
