:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d2320; --muted: #66706b; --line: #e3e1da;
  --accent: #116149; --accent-ink: #ffffff; --accent-soft: #e3f1ea;
  --warn: #9a5b00; --warn-soft: #fff4df; --bad: #b42318; --bad-soft: #fdecea;
  --mt: #6a5acd; --mt-soft: #efedfc; --rv: #116149; --hu: #4fae86; --mtbar: #c9c3f3;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816; --card: #1c2220; --ink: #e8ece9; --muted: #9aa5a0; --line: #2d3532;
    --accent: #4fc59a; --accent-ink: #0d1f18; --accent-soft: #1d3a2f;
    --warn: #f0b45a; --warn-soft: #3a2d17; --bad: #ff8a80; --bad-soft: #3d1d1b;
    --mt: #b2a8ff; --mt-soft: #2a2645; --rv: #4fc59a; --hu: #2f8a66; --mtbar: #4b4480;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Noto Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2em 0 .3em; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .8em; }
code, kbd { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.lead { font-size: 1.1rem; }

.topbar { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: .35rem .7rem; border-radius: 8px; }
.topbar nav a.on, .topbar nav a:hover { background: var(--accent-soft); color: var(--accent); }
.who { margin-left: auto; display: flex; gap: .6rem; align-items: center; color: var(--muted); font-size: .9rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.wide { max-width: 1400px; margin: 0 auto; padding: 16px 16px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: .6rem; }
.row-head h2 { margin: 0; }
.crumb { margin: 0; font-size: .9rem; }
.crumb a { text-decoration: none; }

.btn { display: inline-flex; align-items: center; gap: .3em; font: inherit; font-size: .95rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .5rem 1rem; border-radius: 8px; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { font-size: .85rem; padding: .35rem .7rem; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

label { display: block; margin: 0 0 .8rem; font-size: .9rem; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; font: inherit; font-size: 1rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); }
label.check input { width: auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 .8rem; } legend { font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
.stack > * { margin-bottom: .8rem; }
.inline-form { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: .6rem; }
.inline-form label { margin: 0; flex: 1 1 180px; } .inline-form select, .inline-form input { margin-top: .25rem; }
.inline-form > select, .inline-form > input { flex: 1 1 160px; width: auto; margin: 0; }
form.inline { display: inline; }
details > summary { cursor: pointer; color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.flash { background: var(--accent-soft); color: var(--ink); border: 1px solid var(--line); padding: .7rem 1rem; border-radius: 8px; margin-bottom: 16px; }
.flash.bad { background: var(--bad-soft); }
.bad-text { color: var(--bad); }
.linkbox .copy, .copy { display: flex; gap: .5rem; margin-top: .3rem; }
.copy input { margin: 0; font-size: .85rem; }

.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.pill.ok, .pill.status-completed, .pill.status-sent, .pill.st-reviewed { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.bad, .pill.status-failed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.mt, .pill.st-mt { background: var(--mt-soft); color: var(--mt); border-color: transparent; }
.pill.review { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.status-submitted { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.st-translated { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.bar.big { height: 12px; }
.stack-bar { display: flex; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 100px; }
.stack-bar .rv, .legend .rv { background: var(--rv); } .stack-bar .hu, .legend .hu { background: var(--hu); } .stack-bar .mt, .legend .mt { background: var(--mtbar); }
.legend { font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.legend span { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: .6rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: .85rem; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--line); padding: .4rem .5rem; }
.table td { border-bottom: 1px solid var(--line); padding: .6rem .5rem; vertical-align: top; }
.table.compact td { padding: .4rem .5rem; }
.table tr.total td { font-weight: 600; border-bottom: 0; }
.table tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table tr.inactive { opacity: .5; }
.table td.clip { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { overflow-x: auto; }

.events { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.events li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.events .when { color: var(--muted); font-size: .8rem; margin-right: .4rem; font-variant-numeric: tabular-nums; }
.diff { margin: .3rem 0 0; } .diff p { margin: .2rem 0; padding: .3rem .5rem; border-radius: 6px; font-size: .85rem; }
.diff .old { background: var(--bad-soft); text-decoration: line-through; text-decoration-color: var(--bad); }
.diff .new { background: var(--accent-soft); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile h2 { margin: .5rem 0 .8rem; font-size: 1.1rem; }
.tile-top { display: flex; gap: .4rem; }
.tile.completed, .tile.submitted { opacity: .75; }

/* editor */
.editor-head { display: grid; grid-template-columns: 1fr minmax(240px, 320px); gap: 24px; align-items: start; margin-bottom: 8px; }
.head-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 64px; }
.head-side p { margin: .5rem 0; }
.head-side .btn { width: 100%; justify-content: center; margin-top: .6rem; }
.note-box { background: var(--warn-soft); border-radius: 8px; padding: .6rem .8rem; white-space: pre-wrap; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tabs button { flex: 1; font: inherit; font-size: .85rem; background: transparent; color: var(--muted); border: 0; padding: .4rem; cursor: pointer; }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.help { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin: 0 0 16px; }
.help summary { margin: 0; } .help ul { margin: .6rem 0 0; padding-left: 1.2rem; font-size: .92rem; }
.help li { margin-bottom: .3rem; }

.segments { list-style: none; margin: 0; padding: 0; }
.seg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.seg.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.seg-meta { display: flex; gap: .6rem; align-items: center; padding: .5rem 1rem; border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.seg-meta .num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); min-width: 1.6em; }
.seg-meta .label { flex: 1; }
.seg .done-flag { display: none; }
.seg.is-done .done-flag { display: inline-block; }
.seg.is-done { border-left: 4px solid var(--accent); }
.seg-body { display: grid; grid-template-columns: 1fr 1fr; }
.src { padding: 1rem; border-right: 1px solid var(--line); }
.src-text { font-size: 1.02rem; }
.src-text.heading { font-weight: 700; }
.tgt { padding: 1rem; }
.tgt textarea { margin: 0; font-size: 1.05rem; line-height: 1.55; resize: vertical; min-height: 5.5em; }
.seg.is-done .tgt textarea { background: var(--bg); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; }
.actions .saved { margin-left: auto; font-size: .8rem; color: var(--muted); }
.actions .saved.dirty { color: var(--warn); }
.seg [data-act="reopen"] { display: none; }
.seg.is-done [data-act="reopen"] { display: inline-flex; }
.seg.is-done [data-act="done"] { display: none; }
.warn { list-style: none; margin: .4rem 0 0; padding: 0; }
.warn li { font-size: .85rem; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: .25rem .6rem; margin-top: .3rem; }
.warn li::before { content: "⚠ "; }
sup.fn { font-size: .7em; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 .25em; margin: 0 .05em; }
.ctx { margin-top: .8rem; } .ctx-text { font-size: .9rem; color: var(--muted); margin: .2rem 0 .6rem; border-left: 3px solid var(--line); padding-left: .6rem; }
.notes { margin-top: .6rem; } .notes ul { list-style: none; padding: 0; margin: 0 0 .5rem; font-size: .9rem; }
.notes li { background: var(--bg); border-radius: 6px; padding: .4rem .6rem; margin-bottom: .3rem; }
.note-form { display: flex; gap: .4rem; } .note-form input { margin: 0; font-size: .9rem; padding: .35rem .6rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

.assign-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.preview .big-num { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.preview .sample { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: .6rem; margin: .5rem 0; }

@media (max-width: 900px) {
  .two, .assign-grid, .editor-head { grid-template-columns: 1fr; }
  .head-side { position: static; }
  .seg-body { grid-template-columns: 1fr; }
  .src { border-right: 0; border-bottom: 1px solid var(--line); }
  .who span { display: none; }
  .wide { padding-top: 8px; }
  .editor-head h1 { font-size: 1.25rem; }
  .editor-head { gap: 10px; }
  .note-box { font-size: .9rem; padding: .4rem .6rem; }
  .topbar { padding: .5rem 16px; gap: .6rem; }
}

/* ---------- editor v2 */
.ed-top h1 { margin-bottom: .1rem; }
.ed-top .note-box { margin: .4rem 0 .6rem; }
.ed-bar { position: sticky; top: 49px; z-index: 6; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0 12px; box-shadow: var(--shadow); }
.ed-progress { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); }
.ed-progress strong { color: var(--ink); }
.ed-bar .tabs { flex: 0 0 auto; }
.ed-bar .tabs button { padding: .4rem .7rem; }
.ed-bar #find { width: 220px; margin: 0; padding: .4rem .6rem; font-size: .9rem; }
.help-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.keys { list-style: none; padding: 0 !important; } .keys li { margin-bottom: .35rem; font-size: .88rem; }
.ed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.ed-panel { position: sticky; top: 118px; max-height: calc(100vh - 130px); display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.panel-close { display: none; font-size: 1.1rem; }
.ptabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ptabs button { flex: 1; font: inherit; font-size: .82rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: .55rem .4rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ptabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pbody { overflow-y: auto; padding: .8rem .9rem 1.2rem; font-size: .93rem; }
.pbody h4 { margin: 1rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pbody h4:first-child { margin-top: 0; }
.pbody input { font-size: .9rem; padding: .4rem .6rem; }
.small-form > * { margin-bottom: .4rem; }
.loading::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .4em; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.term { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; margin-bottom: .6rem; }
.term p { margin: .3rem 0; }
.term-head strong { font-size: 1rem; }
.explained .term { border-color: var(--accent); background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
.chip { font: inherit; font-size: .85rem; background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; border-radius: 99px; padding: .15rem .6rem; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.sugg { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin-bottom: .5rem; }
.sugg p { margin: .3rem 0; }
.sugg-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.sugg-head .small { flex: 1; }
.kbd-n { font-size: .7rem; font-weight: 700; color: var(--muted); min-width: 1em; }
mark { background: #ffe58a; color: inherit; border-radius: 2px; }
.gl-list { list-style: none; padding: 0; margin: 0; } .gl-list li { padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.hist { padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.gl { text-decoration: underline dotted var(--accent); text-underline-offset: 3px; cursor: help; }
sup.fn { cursor: pointer; }
.diff-box { margin-top: .5rem; background: var(--bg); border-radius: 8px; padding: .5rem .7rem; font-size: .92rem; }
.diff-text { margin: .2rem 0 .5rem; line-height: 1.6; }
del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; border-radius: 3px; }
ins { background: var(--accent-soft); color: var(--accent); text-decoration: none; border-radius: 3px; }
.feedback { margin-top: .5rem; border-left: 3px solid var(--warn); padding-left: .6rem; }
.feedback .diff-box { margin-top: .2rem; }
.issues { list-style: none; margin: .4rem 0 0; padding: 0; }
.issues li { font-size: .88rem; border-radius: 6px; padding: .35rem .6rem; margin-top: .3rem; background: var(--bad-soft); }
.issues li.sev-minor { background: var(--warn-soft); }
.issue-form { margin-top: .6rem; padding: .6rem; border: 1px dashed var(--line); border-radius: 8px; }
.issue-form > * { margin-bottom: .5rem; } .issue-form select, .issue-form input { margin-top: 0; font-size: .9rem; padding: .4rem .6rem; }
.pill.sev-critical { background: var(--bad); color: #fff; border-color: transparent; }
.pill.sev-major { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.sev-minor { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.mtpe { background: var(--mt-soft); color: var(--mt); border-color: transparent; }
.pill.translate { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.explain-pop { position: absolute; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,.18); background: var(--ink); color: var(--bg); border-color: var(--ink); }
.help-fab { display: none; }
.seg.restored .saved { color: var(--warn); }

/* share page / people / assign */
.share-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.share-actions .copy { flex: 1 1 280px; margin: 0; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; font-weight: 600; }
.btn.wa:hover { filter: brightness(1.06); }
.msg { background: var(--bg); padding: .5rem .7rem; border-radius: 8px; }
.person-edit { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .2rem; }
.person-edit input { width: auto; flex: 1 1 140px; margin: 0; padding: .3rem .5rem; font-size: .9rem; }
.gl-row input { flex: 1 1 160px; width: auto; margin: 0; }
.choice { display: grid; gap: .5rem; }
.radio { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; color: var(--ink); cursor: pointer; margin: 0; }
.radio input { width: auto; margin: .3rem 0 0; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
h2.mt { margin-top: 1.2rem; }
.people-pick { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; }
.people-pick .check { margin: .2rem 0; }
.split { list-style: none; padding: 0; margin: 0 0 .6rem; } .split li { padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.narrow-left { max-width: 640px; }

@media (max-width: 1100px) {
  .ed-layout { grid-template-columns: minmax(0, 1fr); }
  .ed-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 70vh; border-radius: 14px 14px 0 0; z-index: 25;
    transform: translateY(110%); transition: transform .2s; }
  body.panel-open .ed-panel { transform: none; }
  .panel-close { display: inline; }
  .help-fab { display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 24; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
  body.panel-open .help-fab { display: none; }
}
@media (max-width: 900px) {
  .ed-bar { top: 44px; padding: 8px 10px; gap: 8px; }
  .ed-bar #find { flex: 1 1 140px; width: auto; }
  .ed-bar .btn { padding: .4rem .8rem; }
  .help-grid { grid-template-columns: 1fr; }
  .ed-top h1 { font-size: 1.25rem; }
}
.tabs button { white-space: nowrap; }
.sugg-head .btn { flex: 0 0 auto; }
@media (max-width: 900px) {
  .ed-progress { flex-basis: 100%; }
  .ed-bar .tabs { flex: 1 1 auto; }
  .ed-bar #find { flex: 1 1 100%; order: 3; }
  .ed-top .muted .pill { margin-bottom: .2rem; }
}

.proj-switch select { margin: 0; padding: .3rem .6rem; font-size: .9rem; max-width: 260px; }
.card.project.inactive { opacity: .6; }
.tile .proj-name { font-size: .8rem; color: var(--muted); margin: .4rem 0 0; }
