/* ---------- tokens ---------- */
:root {
  --paper: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #17212b;
  --ink-2: #3a4757;
  --muted: #5b6878;
  --line: #d5dce4;
  --line-soft: #e6eaef;
  --ua-blue: #0057b7;
  --ua-yellow: #ffd500;
  --flag-top: #0057b7;
  --flag-bottom: #ffd500;
  --mark: rgba(255, 213, 0, .55);
  --token-bg: #e7eef8;
  --token-ink: #0a4a94;
  --tag-bg: #f1e9fb;
  --tag-ink: #6a2fa8;
  --warn-ink: #8a4f00;
  --warn-bg: #fff1cf;
  --bad-ink: #a4231b;
  --bad-bg: #fce6e3;
  --ok-ink: #17643a;
  --ok-bg: #def3e5;
  --focus: #0057b7;
  --shadow: 0 1px 2px rgba(23, 33, 43, .06), 0 4px 16px rgba(23, 33, 43, .06);

  --f-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-text: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --r-s: 6px;
  --r-m: 10px;
  --wrap: 1360px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111a24; --surface: #172230; --surface-2: #1c2938; --ink: #e3e9f0; --ink-2: #c3ccd7;
    --muted: #8e9cad; --line: #2b394a; --line-soft: #223041; --ua-blue: #6ea8ff;
    --flag-top: #2f78d6; --flag-bottom: #f2c800; --mark: rgba(255, 213, 0, .32);
    --token-bg: #1f3350; --token-ink: #a9cbff; --tag-bg: #33264a; --tag-ink: #d3b4ff; --warn-ink: #f3c06a; --warn-bg: #3a2e14;
    --bad-ink: #ff9d92; --bad-bg: #42201d; --ok-ink: #8fd8a9; --ok-bg: #173826;
    --focus: #8ab8ff; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  --paper: #111a24; --surface: #172230; --surface-2: #1c2938; --ink: #e3e9f0; --ink-2: #c3ccd7;
  --muted: #8e9cad; --line: #2b394a; --line-soft: #223041; --ua-blue: #6ea8ff;
  --flag-top: #2f78d6; --flag-bottom: #f2c800; --mark: rgba(255, 213, 0, .32);
  --token-bg: #1f3350; --token-ink: #a9cbff; --tag-bg: #33264a; --tag-ink: #d3b4ff; --warn-ink: #f3c06a; --warn-bg: #3a2e14;
  --bad-ink: #ff9d92; --bad-bg: #42201d; --ok-ink: #8fd8a9; --ok-bg: #173826;
  --focus: #8ab8ff; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}

/* Native controls (select popups, scrollbars, date pickers) follow the active theme, so a
   dark page never gets a white dropdown with light text. */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
select option, select optgroup { background-color: var(--surface); color: var(--ink); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 220px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- masthead ---------- */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.flagmark { width: 30px; height: 30px; flex: none; }
.flag-top { fill: var(--flag-top); }
.flag-bottom, .flag-seam { fill: var(--flag-bottom); }
.flag-seam { display: none; }
h1 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 600; letter-spacing: -.005em; }
.facts { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
.facts b { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.actions { display: flex; align-items: center; gap: 10px; }
.brand { flex: 1 1 auto; }

/* Progress toward the goal: reviewed strings out of all. */
.progress { flex: 0 1 260px; display: grid; gap: 5px; min-width: 180px; }
.progress-label { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.progress-label b { color: var(--ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-label .of { font-variant-numeric: tabular-nums; }
.progress-bar { display: flex; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.progress-bar .seg { display: block; height: 100%; min-width: 0; }
.progress-bar .seg.fixed { background: var(--ua-blue); }
.progress-bar .seg.ok { background: var(--ok-ink); }

.progress-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.progress-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.dot-fixed { background: var(--ua-blue); }
.dot-ok { background: var(--ok-ink); }

/* Row status: a rail on the left edge (scannable while scrolling) plus a badge with a
   check mark (colour is never the only signal). Blue = approved fix, green = as is,
   amber = suggestions waiting. */
.entry { position: relative; }
.entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.entry.st-fixed::before { background: var(--ua-blue); }
.entry.st-asis::before { background: var(--ok-ink); }
.entry.st-pending::before { background: var(--warn-ink); opacity: .7; }
.entry.st-fixed, .entry.st-asis { background: color-mix(in srgb, var(--ok-bg) 22%, var(--surface)); }
.badge.st { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.badge.st svg { width: 12px; height: 12px; }
.badge.st.asis { background: var(--ok-bg); color: var(--ok-ink); }
.badge.st.fixed { background: var(--token-bg); color: var(--token-ink); }
/* Repeated on every row, so as quiet as the other tools; only the check mark carries colour. */
.tool.approve-quick svg { color: var(--ok-ink); }
.tool.approve-quick:hover { background: var(--ok-bg); color: var(--ok-ink); }
.btn.sm.ok svg { width: 14px; height: 14px; }

/* Account menu */
.account { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--surface-2); }
.account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.account-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center;
  background: var(--ua-blue); color: #fff; font-weight: 600; font-size: 14px;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 290px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 36px rgba(0, 0, 0, .28);
}
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.menu-head .avatar { width: 36px; height: 36px; font-size: 16px; }
.menu-head b { display: block; }
.menu-head span { font-size: 12.5px; color: var(--muted); }
.menu [role="menuitem"] {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-s);
  background: none; color: var(--ink); text-align: left; cursor: pointer; font-size: 14px;
}
.menu [role="menuitem"] svg { width: 18px; height: 18px; flex: none; color: var(--muted); margin-top: 1px; }
.menu [role="menuitem"] small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.menu [role^="menuitem"]:hover, .menu [role^="menuitem"]:focus-visible { background: var(--surface-2); outline: none; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.menu-label { padding: 4px 10px 2px; font-size: 12px; color: var(--muted); }
.menu-themes { display: flex; gap: 4px; padding: 4px 6px 6px; }
.menu-themes [role="menuitemradio"] {
  flex: 1; padding: 6px 4px; border: 1px solid var(--line); border-radius: var(--r-s); background: none;
  color: var(--ink-2); font-size: 12.5px; cursor: pointer;
}
.menu-themes [aria-checked="true"],
.menu-themes [aria-checked="true"]:hover,
.menu-themes [aria-checked="true"]:focus-visible { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.auth { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 500; font-size: 14px;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { color: var(--muted); cursor: not-allowed; }
.btn.primary { background: var(--ua-blue); border-color: var(--ua-blue); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0b1624; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0b1624; } }
.btn.primary:hover:not(:disabled) { background: var(--ua-blue); filter: brightness(1.08); }
.btn.primary:disabled { opacity: .7; cursor: progress; color: inherit; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-s);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- tabs ---------- */
.tabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs-in { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; margin-bottom: -1px;
  color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ua-blue); }
.tab-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- contributors ---------- */
.people-view { padding: 20px 0 64px; }
.p-head { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.p-head h2 { margin: 0; font-size: 20px; margin-right: auto; }
.p-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.p-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 14px; }
.p-tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.p-tile span { color: var(--muted); font-size: 12.5px; }
.p-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.p-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.p-table th, .p-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
.p-table tbody tr:last-child > * { border-bottom: 0; }
.p-table th[scope="row"], .p-table thead th:first-child { text-align: left; white-space: normal; min-width: 220px; font-weight: 500; }
.p-table td { font-variant-numeric: tabular-nums; }
.p-table thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.p-table thead button { all: unset; cursor: pointer; }
.p-table thead button:hover, .p-table thead button:focus-visible { color: var(--ink); text-decoration: underline; }
.p-table tbody tr:hover { background: var(--surface-2); }
.p-table .zero { color: var(--muted); opacity: .6; }
.p-name { display: flex; align-items: center; gap: 10px; }
.p-name img, .p-ava { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; }
.p-ava { display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; }
.p-name a { color: inherit; font-weight: 600; }
.p-models { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 4px 0 0 38px; font-size: 12px; color: var(--muted); font-weight: 400; }
.rate { display: inline-flex; align-items: center; gap: 6px; }
.rate-bar { width: 44px; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.rate-bar i { display: block; height: 100%; background: var(--ok-ink); }
.p-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.p-sub { display: flex; align-items: center; gap: 10px; margin: 28px 0 10px; font-size: 16px; }
.p-sub .badge { font-weight: 500; }
.m-name { display: flex; align-items: flex-start; gap: 8px; }
.m-name svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--tag-ink); }
.m-name small { display: block; color: var(--muted); font-size: 12px; font-family: var(--f-mono); font-weight: 400; }
.p-table td.m-prov { text-align: left; }
.author-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px;
  background: var(--token-bg); color: var(--token-ink); font-size: 13px; }
.author-chip[hidden] { display: none; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 6px; border-radius: 50%; }
.chip-x:hover { background: color-mix(in srgb, currentColor 15%, transparent); }

/* ---------- glossary ---------- */
.glossary-view { padding: 20px 0 64px; }
.g-head { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.g-head h2 { margin: 0; font-size: 20px; margin-right: auto; }
.g-intro { margin: 0 0 14px; color: var(--ink-2); max-width: 80ch; }
.g-search { flex: 1 1 260px; max-width: 420px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); }
.g-group { margin: 22px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.g-list { display: grid; gap: 8px; }
.term {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px;
  position: relative;
}
.term::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--r-m) 0 0 var(--r-m); }
.term.approved::before { background: var(--ok-ink); }
.btn:disabled.ok, .btn:disabled.primary { opacity: .45; filter: grayscale(.6); cursor: not-allowed; }
.term.proposed::before { background: var(--warn-ink); opacity: .7; }
.term.rejected { opacity: .7; }
.term-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.term-en { font-weight: 600; font-size: 16px; }
.term-arrow { color: var(--muted); }
.term-uk { font: 500 17px/1.4 var(--f-text); color: var(--ink); }
.term-uk.open { color: var(--muted); font: italic 14px var(--f-ui); }
.term-meta { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.avoid { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.avoid s { color: var(--bad-ink); background: var(--bad-bg); border-radius: 4px; padding: 0 6px; text-decoration-thickness: 1px; }
.term-note { margin: 8px 0 0; white-space: pre-wrap; font-size: 14px; color: var(--ink-2); max-width: 90ch; }
.term-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.term-foot .spacer { flex: 1; }
.term-foot .by { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.term-foot a { color: var(--ua-blue); }
.term .thread { margin-top: 12px; }
.g-empty { color: var(--muted); padding: 20px 0; }
.dlg-body label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.dlg-body label.field input, .dlg-body label.field textarea, .dlg-body label.field select {
  font: 15px var(--f-ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 8px 10px;
}
.dlg-body label.field textarea { min-height: 90px; resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); }

/* Glossary hints above the editor */
.g-hints { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.g-hints .lbl { color: var(--muted); }
.g-hint { background: var(--ok-bg); color: var(--ok-ink); border-radius: 999px; padding: 1px 10px; }
.g-hint b { font-weight: 600; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 14px 0 12px;
}
.toolbar .wrap { display: grid; gap: 10px; }
.searchbar {
  display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: var(--shadow); padding-left: 14px; min-height: 48px;
}
.searchbar:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.search-ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 12px; font-size: 16px; outline: none;
}
.searchbar input::placeholder { color: var(--muted); }
.hint {
  font: 12px var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; margin-right: 8px;
}
.searchbar:focus-within .hint { display: none; }
.searchbar select {
  border: 0; border-left: 1px solid var(--line); background: transparent; padding: 0 14px; height: 48px;
  color: var(--ink-2); cursor: pointer; border-radius: 0 var(--r-m) var(--r-m) 0;
}

.row-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.issues { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-size: 13.5px; color: var(--ink-2);
}
.pill:hover { border-color: var(--muted); }
.pill .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.pill[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pill[aria-checked="true"] .n { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.warn { background: var(--warn-ink); }
.dot.bad { background: var(--bad-ink); }

.sel { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sel select {
  height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236b7888' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
  appearance: none; color: var(--ink); font-size: 13.5px; cursor: pointer; max-width: 260px;
}
.link { border: 0; background: none; padding: 4px 2px; color: var(--ua-blue); cursor: pointer; font-size: 13.5px; }
.link:hover { text-decoration: underline; }
.count { margin: 0 0 0 auto; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---------- list ---------- */
main { padding-top: 16px; padding-bottom: 64px; outline: none; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow); overflow: hidden; }
.colhead {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 10px 20px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); font-weight: 500;
}
.colhead.three { grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.colhead .uk { color: var(--ua-blue); padding-left: 17px; }
.entry { padding: 14px 20px 16px; border-top: 1px solid var(--line-soft); }
#rows > :first-child { border-top: 0; }
.entry:target { background: color-mix(in srgb, var(--ua-blue) 6%, var(--surface)); }

.entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; min-height: 26px; }
.key { font: 500 13px/1.3 var(--f-mono); color: var(--ink-2); word-break: break-all; }
.where { font-size: 12.5px; color: var(--muted); }
.badge { font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 999px; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tools { margin-left: auto; display: flex; gap: 2px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0;
  border-radius: var(--r-s); background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool svg { width: 15px; height: 15px; }
.tool[aria-expanded="true"] { color: var(--ua-blue); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.pair.three { grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.text {
  font: 16px/1.6 var(--f-text); white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0;
  max-width: 68ch;
}
.text .lang { display: none; }
.text.en { color: var(--ink-2); }
.text.uk { border-left: 3px solid var(--ua-blue); padding-left: 14px; color: var(--ink); }
.text.uk.empty { border-left-color: var(--bad-ink); }
.text.uk.blank { border-left-style: dashed; border-left-color: var(--line); }

/* Placeholder for a blank text: a hatched chip, so it never reads as real content. */
.ph {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px;
  font: 13.5px/1.4 var(--f-ui); color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-s);
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-soft) 6px 7px);
}
.ph svg { width: 15px; height: 15px; flex: none; }
.ph.missing { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad-ink) 45%, transparent); background-color: var(--bad-bg); font-weight: 500; }
.ph-note { font-weight: 400; opacity: .8; }
.langs .ph { font-size: 12.5px; padding: 1px 8px 1px 6px; }
.text.cmp { color: var(--muted); }
/* The approved fix shown under a row's Ukrainian text. Its own class name: "approved" is also
   a status class on suggestions and glossary terms. */
.approved-fix {
  margin-top: 10px; padding: 8px 12px; border-radius: var(--r-s); background: var(--ok-bg);
}
.approved-fix > .badge { padding: 0; background: none; display: block; font-weight: 600; }
.tok {
  font: 0.8em var(--f-mono); background: var(--token-bg); color: var(--token-ink);
  border-radius: 4px; padding: 1px 4px; white-space: pre-wrap; font-weight: 400;
}
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.langs {
  margin: 14px 0 0; padding: 12px 16px; display: grid; grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px; background: var(--surface-2); border-radius: var(--r-s);
}
.langs dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.langs dd { margin: 0; font: 15px/1.55 var(--f-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.langs .is-uk { color: var(--ua-blue); font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  .langs { animation: open .16s ease-out; }
  @keyframes open { from { opacity: 0; transform: translateY(-4px); } }
}

/* ---------- dev login bar ---------- */
.devbar {
  background: repeating-linear-gradient(135deg, var(--warn-bg) 0 14px, color-mix(in srgb, var(--warn-bg) 70%, var(--surface)) 14px 28px);
  border-bottom: 1px solid color-mix(in srgb, var(--warn-ink) 30%, transparent); color: var(--warn-ink);
}
.devbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-block: 7px; font-size: 13px; }
.devbar-label { font-weight: 600; }
.devbar-note { opacity: .85; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid color-mix(in srgb, var(--warn-ink) 35%, transparent); border-radius: var(--r-s); padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.seg button:hover { background: var(--surface-2); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--surface); }
.seg .role { opacity: .7; margin-left: 4px; font-size: 12px; }

.pills-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 4px; }
.dot.info { background: var(--ua-blue); }
.dot.ok { background: var(--ok-ink); }
.badge.info { background: var(--token-bg); color: var(--token-ink); }
.tool .cnt {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ua-blue); color: var(--surface);
  font-size: 11.5px; line-height: 18px; text-align: center; font-weight: 600;
}

/* ---------- thread: suggestions + comments ---------- */
.thread { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; display: grid; gap: 14px; }
.thread h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 8px; }
.thread h3 .n { color: var(--muted); font-weight: 400; }
.th-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--r-s); font-size: 13.5px; color: var(--ink-2);
}
.th-status .spacer { flex: 1; }
.sugg-list { display: grid; gap: 8px; }
.sugg {
  display: block; padding: 12px 14px;
  border: 1px solid var(--line-soft); border-radius: var(--r-s); background: var(--surface);
}
.sugg-body { min-width: 0; }

/* Votes */
.votes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; }
.vote-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13px;
}
.vote-btn svg { width: 15px; height: 15px; }
.vote-btn b { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 1ch; }
.vote-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
.vote-btn.up[aria-pressed="true"] { background: var(--ok-bg); color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok-ink) 50%, transparent); }
.vote-btn.down[aria-pressed="true"] { background: var(--bad-bg); color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad-ink) 50%, transparent); }
.vote-btn:disabled { cursor: default; opacity: .75; }
.vote-btn:disabled b { color: var(--ink); }
.vote-hint { font-size: 12.5px; color: var(--muted); }
.top-score { font-weight: 600; margin-left: 2px; }
.top-score.pos { color: var(--ok-ink); }
.top-score.neg { color: var(--bad-ink); }
.voters { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.voters-note { font-style: italic; opacity: .8; }
.voters-note::before { content: "· "; }
.who-up::before { content: "▲ "; color: var(--ok-ink); }
.who-down::before { content: "▼ "; color: var(--bad-ink); }
.sugg.liked:not(.approved) { border-color: color-mix(in srgb, var(--ok-ink) 30%, var(--line-soft)); }
.sugg.disliked:not(.approved) { border-color: color-mix(in srgb, var(--bad-ink) 25%, var(--line-soft)); }
.sugg.approved { border-color: color-mix(in srgb, var(--ok-ink) 45%, transparent); background: color-mix(in srgb, var(--ok-bg) 45%, var(--surface)); }
.sugg.rejected, .sugg.withdrawn { opacity: .72; }
.vote { display: grid; justify-items: center; align-content: start; gap: 0; }
.vote button {
  width: 32px; height: 26px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--r-s);
  background: transparent; color: var(--muted); cursor: pointer;
}
.vote button svg { width: 16px; height: 16px; }
.vote button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.vote button:disabled { cursor: default; opacity: .45; }
.vote button[aria-pressed="true"].up { color: var(--ok-ink); background: var(--ok-bg); opacity: 1; }
.vote button[aria-pressed="true"].down { color: var(--bad-ink); background: var(--bad-bg); opacity: 1; }
.vote .score { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; line-height: 22px; }
.sugg-text { font: 16px/1.6 var(--f-text); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.sugg-text ins, .approved-fix ins { text-decoration: none; background: var(--ok-bg); color: var(--ok-ink); border-radius: 2px; }
.sugg-text del, .approved-fix del { color: var(--bad-ink); background: var(--bad-bg); text-decoration-thickness: 1px; border-radius: 2px; }
.sugg-text[data-mode="diff"] .v-clean, .sugg-text[data-mode="clean"] .v-diff { display: none; }
.link.sm { font-size: 12.5px; padding: 2px 0; margin-top: 2px; }
ins .tok { box-shadow: 0 0 0 1.5px var(--ok-ink); }
del .tok { text-decoration: line-through; box-shadow: 0 0 0 1.5px var(--bad-ink); }
.approved-fix > .badge + * { margin-top: 2px; }
.sugg-meta { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.sugg-meta .author { color: var(--ink-2); font-weight: 500; }
.note { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.note b { font-weight: 500; }
.warns { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 13px; color: var(--bad-ink); }
.warns li::before { content: "⚠ "; }
.warns.okay { color: var(--ok-ink); }
.warns.okay li::before { content: "✓ "; }
.sugg-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.ok { background: var(--ok-ink); border-color: var(--ok-ink); color: var(--surface); }
.btn.ok:hover:not(:disabled) { background: var(--ok-ink); filter: brightness(1.1); }
.btn.danger { color: var(--bad-ink); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.inline-form input { flex: 1 1 220px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); font-size: 13.5px; }
.empty-line { color: var(--muted); font-size: 14px; margin: 0; }

.compose { display: grid; gap: 8px; }
.compose label { font-size: 13px; color: var(--muted); }
.compose textarea {
  width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-s); background: var(--surface); font: 16px/1.55 var(--f-text); color: var(--ink);
}
.compose textarea.small { min-height: 44px; font: 14.5px/1.5 var(--f-ui); resize: none; overflow-y: auto; }

/* Editor: a transparent textarea over a backdrop that paints the same text with marked
   tokens. Both layers must share every metric that affects line breaking. */
.editor { display: grid; gap: 6px; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.ed-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ed-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.ed-btn {
  height: 26px; min-width: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--surface); color: var(--ink-2); font: 13px var(--f-mono); cursor: pointer; white-space: nowrap;
}
.ed-btn:hover { background: var(--surface-2); border-color: var(--muted); }
.ed-btn.k-ph { color: var(--token-ink); background: var(--token-bg); border-color: transparent; }
.ed-btn.k-tag { color: var(--tag-ink); background: var(--tag-bg); border-color: transparent; }
.ed-btn.k-esc { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }
.ed-btn:hover.k-ph, .ed-btn:hover.k-tag, .ed-btn:hover.k-esc { filter: brightness(.95); }
.ed-area { position: relative; background: var(--surface); border-radius: var(--r-s); }
.ed-hl, .compose .ed-area textarea {
  box-sizing: border-box; width: 100%; margin: 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-s); font: 16px/1.55 var(--f-text); letter-spacing: normal; word-spacing: normal;
  font-variant-ligatures: none; font-kerning: normal; tab-size: 4;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; scrollbar-gutter: stable;
}
.ed-hl {
  position: absolute; inset: 0; border-color: transparent; color: var(--ink);
  overflow: hidden; pointer-events: none;
}
.compose .ed-area textarea {
  position: relative; display: block; min-height: 0; resize: none; overflow-y: auto;
  background: transparent; color: transparent; caret-color: var(--ink);
}
.compose .ed-area textarea::selection { color: var(--ink); background: color-mix(in srgb, var(--focus) 30%, transparent); }
.compose .ed-area textarea::placeholder { color: var(--muted); }
/* Backdrop marks: colour only; anything that changes width would break the alignment. */
.e-ph { color: var(--token-ink); background: var(--token-bg); border-radius: 3px; }
.e-tag { color: var(--tag-ink); background: var(--tag-bg); border-radius: 3px; }
.e-esc { color: var(--warn-ink); background: var(--warn-bg); border-radius: 3px; }
.e-ent { color: var(--muted); background: var(--line-soft); border-radius: 3px; }
/* Problems found by the live checks: a tint plus a solid bar along the bottom, visible even
   on a single letter or a run of spaces (a wavy underline is too short to show there).
   box-shadow does not change the text width, so the overlay stays aligned. */
.e-err {
  background: color-mix(in srgb, var(--bad-ink) 26%, transparent);
  box-shadow: inset 0 -2.5px 0 var(--bad-ink); border-radius: 2px 2px 0 0;
  color: var(--bad-ink);
}
.e-nl.e-err::after { color: var(--bad-ink); opacity: 1; font-weight: 700; }
.warn-link {
  border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
  text-align: left; text-decoration: underline dotted; text-underline-offset: 3px;
}
.warn-link:hover { text-decoration-style: solid; }
.e-bad, .tok.bad { color: var(--bad-ink); background: var(--bad-bg); box-shadow: 0 0 0 1.5px var(--bad-ink); border-radius: 2px; }
.e-nbsp { background: var(--warn-bg); box-shadow: inset 0 -2px 0 var(--warn-ink); }
.e-tab { background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 6px); }
.e-nl, .nl { position: relative; }
.e-nl::after, .nl::after {
  content: "↵"; position: absolute; left: 3px; top: 0; color: var(--muted); font: 12px/1 var(--f-ui); opacity: .8;
}

/* Reading view: token chips by kind, visible invisibles. */
.tok.tag { background: var(--tag-bg); color: var(--tag-ink); }
.tok.esc { background: var(--warn-bg); color: var(--warn-ink); }
.tok.ent { background: var(--line-soft); color: var(--muted); }
.ws.nbsp { background: var(--warn-bg); box-shadow: inset 0 -2px 0 var(--warn-ink); }
.ws.tab { background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 6px); }
.compose textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.compose-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.compose-row .hint-text { color: var(--muted); font-size: 12.5px; margin-left: auto; }
a.btn { text-decoration: none; }
.login-hint a { color: var(--ua-blue); font-weight: 500; }
.login-hint { margin: 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-s); color: var(--muted); font-size: 14px; }

.comments { display: grid; gap: 10px; }
.comment { font-size: 14.5px; line-height: 1.5; }
.comment .who-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 13px; color: var(--muted); }
.comment .who-line b { color: var(--ink-2); font-weight: 500; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- AI authors ---------- */
.agent {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 7px 0 5px; border-radius: 999px;
  background: var(--tag-bg); color: var(--tag-ink); font-size: 12px; line-height: 20px; font-weight: 500;
  vertical-align: middle;  /* where the line around it is not a flex row */
}
.agent svg { width: 13px; height: 13px; }
.btn svg { flex: none; }

/* ---------- dialogs ---------- */
.dlg {
  border: 1px solid var(--line); border-radius: var(--r-m); padding: 0; background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
.dlg::backdrop { background: rgba(10, 16, 24, .55); }
.dlg-body { padding: 22px 24px; display: grid; gap: 14px; }
.dlg-body.wide { width: 100%; }
.dlg:has(.wide) { width: min(780px, calc(100vw - 32px)); }
.dlg h2 { margin: 0; font-size: 19px; }
.dlg h3 { margin: 6px 0 0; font-size: 15px; }
.dlg-lead { margin: 0; color: var(--ink-2); }
.dlg-note, .muted { color: var(--muted); font-size: 13px; margin: 0; }
.terms-text {
  white-space: pre-wrap; font: 14.5px/1.55 var(--f-text); background: var(--surface-2); border-radius: var(--r-s);
  padding: 14px 16px; max-height: 42vh; overflow: auto;
}
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ua-blue); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.token-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.token-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-s);
}
.token-list code, .code-wrap code { font: 13px var(--f-mono); }
.token-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.token-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 200px; }
.token-form input, .token-form select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--ink);
}
.token-new { padding: 12px 14px; border-radius: var(--r-s); background: var(--ok-bg); display: grid; gap: 8px; }
.code-wrap { display: flex; gap: 8px; align-items: flex-start; }
.code-wrap pre {
  flex: 1; margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-s);
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.connect { display: grid; gap: 6px; }
.connect .step { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.client-tabs .pill { height: 30px; }
.token-form .muted { font-size: 12px; }
.connect details, .howto { border: 1px solid var(--line-soft); border-radius: var(--r-s); padding: 8px 12px; }
.connect summary, .howto summary { cursor: pointer; font-weight: 500; }
.connect details[open] summary { margin-bottom: 8px; }
.howto[open] .connect { margin-top: 10px; }

/* ---------- states ---------- */
.sentinel { min-height: 56px; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; }
.empty-state { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.skeleton .entry-head span, .skeleton .text span {
  display: block; height: 12px; border-radius: 4px; background: var(--line-soft);
}
.skeleton .entry-head span { width: 260px; }
.skeleton .text span + span { margin-top: 8px; width: 70%; }
.skeleton .text.uk { border-left-color: var(--line); }

.totop {
  position: fixed; right: 24px; bottom: 24px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; z-index: 20;
}
.totop svg { width: 20px; height: 20px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 30;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: var(--r-s);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .pair, .pair.three { grid-template-columns: 1fr; gap: 12px; }
  .colhead { display: none; }
  .text .lang { display: block; font: 12px var(--f-ui); color: var(--muted); margin-bottom: 2px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  html { scroll-padding-top: 16px; }
  .toolbar { position: static; backdrop-filter: none; }
  .masthead-in { flex-wrap: wrap; }
  h1 { font-size: 16px; }
  .hint { display: none; }
  .searchbar select { padding: 0 8px; max-width: 120px; }
  .sel { flex: 1 1 140px; flex-direction: column; align-items: stretch; gap: 2px; font-size: 12px; }
  .sel select { max-width: none; height: 36px; }
  .who, .long, .devbar-note, .account-name { display: none; }
  .account-btn { padding: 0 6px 0 4px; }
  .brand { flex: 1 1 0; min-width: 0; order: 1; }
  .actions { order: 2; }
  .progress { order: 3; flex: 1 1 100%; }
  .seg { flex-wrap: wrap; }
  .menu { position: fixed; left: 12px; right: 12px; top: auto; width: auto; }
  .sugg { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; padding: 10px; }
  .compose-row .hint-text { display: none; }
  .masthead-in { gap: 10px; }
  .count { margin-left: 0; width: 100%; }
  .entry { padding: 12px 14px 14px; }
  .tools { margin-left: 0; width: 100%; }
  .totop { right: 16px; bottom: 16px; }
}
