:root {
  --bg: #f7f6f2;
  --fg: #1c1c1e;
  --muted: #64646b;
  --card: #ffffff;
  --line: #dedbd3;
  --acc: #1f5fbf;
  --ok: #1a7f37;
  --bad: #c62828;
  --edit: #7a3fd1;
  --del-bg: #fde2e2;
  --ins-bg: #dcf3e2;
  --edit-bg: #ece2fb;
  --hl: #e0202088;
  --scan-bg: #ffffff;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --fg: #ececef;
    --muted: #a3a3ab;
    --card: #1e1e22;
    --line: #34343b;
    --acc: #6aa6ff;
    --ok: #4cc46a;
    --bad: #ff6b63;
    --edit: #b791ff;
    --del-bg: #4d2124;
    --ins-bg: #183d24;
    --edit-bg: #33244f;
    --scan-bg: #f4f1ea;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.55 "Noto Sans Hebrew", "Arial Hebrew", "Segoe UI", Arial, system-ui, sans-serif;
}
.brand[data-env]::after { content: " · " attr(data-env); color: var(--muted); font-weight: 400; }
body[data-env="preview"] .top { border-top: 4px solid #d29922; }
body[data-env="development"] .top { border-top: 4px solid var(--edit); }
a { color: var(--acc); }
.top {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
#nav { display: flex; gap: 14px; font-size: 15px; }
#nav a { text-decoration: none; }
main { max-width: 900px; margin: 0 auto; padding: 12px 16px 120px; }
.foot { text-align: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.msg { color: var(--bad); min-height: 1.4em; margin: 6px 0 0; font-size: 15px; }
h1 { font-size: 22px; margin: 6px 0; }
h2 { font-size: 19px; margin: 8px 0; }
.batchtitle { font-size: 17px; color: var(--muted); font-weight: 600; }
button {
  font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; touch-action: manipulation;
}
button:hover { border-color: var(--acc); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
button.primary kbd { color: #fff; border-color: #ffffff88; }
button.big { width: 100%; padding: 14px; font-size: 18px; display: flex; flex-direction: column; align-items: center; }
button.big .sub { font-size: 13px; opacity: .85; }
button.small { padding: 4px 10px; font-size: 14px; }
input[type="text"], textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
kbd {
  font: 11px/1.3 ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 4px; margin-inline-start: 6px; color: var(--muted);
}
.row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-top: 8px; }

/* sign-in, terms */
.intro { text-align: center; }
.gsi { display: flex; justify-content: center; min-height: 44px; margin: 18px 0; }
.dev { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 12px 0; padding: 8px; border: 1px dashed var(--edit); border-radius: 8px; }
.dev input { width: 10em; }
.terms { margin-bottom: 12px; }
.terms[lang="en"] { border-top: 1px solid var(--line); padding-top: 4px; }
.version { margin: 8px 0 0; }
.optin { display: block; margin: 12px 0 6px; }
form.card > input[type="text"] { margin-bottom: 14px; }

/* review */
.progress { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--ok); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.meta .title { margin-inline-start: auto; }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; font-size: 14px; }
.conf-high { border-color: var(--ok); color: var(--ok); }
.conf-medium { border-color: #b08800; color: #b08800; }
.conf-low { border-color: var(--bad); color: var(--bad); }
.viewer { margin: 10px 0; }
.scroller {
  overflow: auto; max-height: 55vh; background: var(--scan-bg); border: 1px solid var(--line); border-radius: 8px;
  -webkit-overflow-scrolling: touch; text-align: center; direction: ltr;
}
.frame { position: relative; display: inline-block; max-width: none; vertical-align: top; }
.frame img { display: block; width: 100%; height: auto; }
.hl { position: absolute; outline: 2px solid var(--hl); outline-offset: 2px; border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 9999px #0000000f; }
.zoombar { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 6px; }
.zoomlevel { min-width: 3.5em; text-align: center; font-size: 14px; color: var(--muted); }
.texts { display: grid; gap: 6px; }
.texts .row { display: grid; grid-template-columns: 3.6em 1fr; gap: 8px; align-items: baseline; margin: 0; }
.lab { color: var(--muted); font-size: 14px; }
.txt {
  font-size: 23px; line-height: 1.75; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px;
  unicode-bidi: isolate; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: "Frank Ruehl CLM", "Taamey Frank CLM", "David", "Times New Roman", "Noto Serif Hebrew", serif;
}
.ctx { color: var(--muted); }
.span { padding: 0 1px; border-bottom: 2px dotted var(--muted); }
mark { color: inherit; border-radius: 4px; padding: 0 3px; margin: 0 1px; }
mark.del { background: var(--del-bg); outline: 1px solid var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
mark.ins { background: var(--ins-bg); outline: 1px solid var(--ok); }
mark.edit { background: var(--edit-bg); outline: 1px solid var(--edit); }
.ws { color: var(--acc); font-weight: 700; }
.sp { color: var(--acc); font-family: ui-monospace, Menlo, monospace; font-size: .6em; vertical-align: middle; }
.caret { color: var(--bad); font-weight: 700; }
.codes { font: 12px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); text-align: left; }
.codes .del { color: var(--bad); } .codes .ins { color: var(--ok); }
.note { font-size: 14px; text-align: left; margin: 10px 0 0; }
.mine { color: var(--edit); font-weight: 600; }
.editbox { margin-top: 10px; }
.editbox textarea { font-size: 23px; line-height: 1.6; border-color: var(--edit); font-family: "Frank Ruehl CLM", "David", "Times New Roman", serif; }
.preview { margin-top: 6px; }
.actions {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
}
.actions .act { min-height: 56px; font-size: 18px; font-weight: 600; }
.act.ok { border-color: var(--ok); color: var(--ok); }
.act.bad { border-color: var(--bad); color: var(--bad); }
.act.edit { border-color: var(--edit); color: var(--edit); }
.act.skip { color: var(--muted); }
.subnav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.keys { margin: 0; }
.done { text-align: center; }
.done button { margin: 6px; }
@media (min-width: 760px) {
  .actions { position: static; padding: 0; background: none; border: 0; margin: 8px 0; }
}
@media (hover: none) {
  kbd, .keys { display: none; }
}
@media (max-width: 520px) {
  .txt { font-size: 21px; }
  .texts .row { grid-template-columns: 1fr; gap: 0; }
  .meta .title { margin-inline-start: 0; width: 100%; }
}
/* task picker */
.batchhead { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.subsetnav { display: flex; gap: 6px; flex-wrap: wrap; }
.subsetnav a { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.subsetnav a.on { font-weight: 700; border-color: currentColor; }
.savestate { color: var(--muted); align-self: center; }
.savestate[data-state="failed"], .savestate[data-state="stale"] { color: var(--bad); font-weight: 600; }
.picker .pick { display: block; text-decoration: none; color: var(--fg); }
.picker .pick:hover { border-color: var(--acc); }
.block { display: block; margin-top: 4px; }

/* line verification */
:root { --attn-bg: #fff1b8; --attn-line: #b08800; --ai-hint: #6f42c1; }
@media (prefers-color-scheme: dark) { :root { --attn-bg: #4a3d0a; --attn-line: #e0b400; --ai-hint: #b392f0; } }
.ask { margin: 8px 0 4px; font-weight: 600; }
.linebox {
  margin: 8px 0; padding: 8px 0; background: var(--scan-bg); border: 1px solid var(--line); border-radius: 8px; min-height: 60px;
}
.linestrip { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.linestrip .seg { position: relative; overflow: hidden; max-width: 100%; }
.linestrip .seg + .seg { border-top: 1px dashed var(--line); }
.linestrip .seg img { position: absolute; max-width: none; height: auto; display: block; }
.txt.cand { font-size: 28px; line-height: 1.8; margin: 6px 0; }
mark.attn { background: var(--attn-bg); outline: 1px solid var(--attn-line); }
.caret.attn { color: var(--attn-line); font-weight: 700; padding: 0 1px; }
.legend { margin: 2px 0 0; }
.ctxbox { margin-top: 12px; }
.ctxscroll { background: var(--scan-bg); border: 1px solid var(--line); border-radius: 8px; text-align: center; overflow: hidden; }
.ctxband { width: 100%; }
.attrib { margin: 10px 0 0; overflow-wrap: anywhere; }
.actions.five { grid-template-columns: repeat(5, 1fr); }
.actions.six { grid-template-columns: repeat(6, 1fr); }
.actions.five .act, .actions.six .act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; }
@media (max-width: 520px) {
  .txt.cand { font-size: 23px; }
  .actions.five .act { font-size: 15px; min-height: 52px; }
  /* six buttons do not fit one row on a phone: two rows of three */
  .actions.six { grid-template-columns: repeat(3, 1fr); }
  .actions.six .act { font-size: 15px; min-height: 48px; }
}
.editbox .check { gap: 8px; align-items: center; cursor: pointer; }
.editbox .check input { width: 20px; height: 20px; }

.adminbatch table { border-collapse: collapse; margin: 6px 0; }
.adminbatch th, .adminbatch td { border: 1px solid var(--line); padding: 2px 8px; text-align: left; font-weight: normal; }

/* public pages */
.doc { max-width: 760px; }
.doc ul, .doc ol { padding-inline-start: 1.4em; }
.doc li { margin: 6px 0; }
.doc ul ul { margin-top: 4px; }
.cta { display: inline-block; background: var(--acc); color: #fff; text-decoration: none; padding: 10px 18px; border-radius: 8px; font-weight: 600; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }
/* page review (task type page_review): the scan beside its lines */
main:has(.pagereview) { max-width: 1500px; }
.conventions { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.conventions summary { cursor: pointer; font-weight: 600; }
.conventions dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0; }
.conventions dt { color: var(--muted); }
.conventions dd { margin: 0; font-weight: 600; text-align: right; unicode-bidi: plaintext; }
.prgrid { display: grid; gap: 14px; }
@media (min-width: 1000px) {
  .prgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .prgrid .scan { position: sticky; top: 8px; }
  .prgrid .scan .scroller { max-height: calc(100vh - 90px); }
}
/* Phone and narrow screens: the scan stays pinned above the lines (short, zoomable and pannable in its scroller),
   so every line can be checked against it without scrolling back up. dvh follows the on-screen keyboard. */
@media (max-width: 999px) {
  .prgrid .scan { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-bottom: 4px; box-shadow: 0 2px 4px #0002; }
  .prgrid .scan .viewer { margin: 0; }
  .prgrid .scan .scroller { max-height: 34vh; max-height: 34dvh; }
  .prline { scroll-margin-top: calc(34vh + 56px); scroll-margin-top: calc(34dvh + 56px); }
}
.prlines { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.prline { display: grid; grid-template-columns: 2.2em 1fr; gap: 6px; align-items: start; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; }
.prline .num { font-size: 13px; padding-top: 10px; text-align: center; }
.prline .lhead { display: flex; gap: 6px; flex-wrap: wrap; }
.prline .lhead:empty { display: none; }
.prline .flag { font-size: 12px; color: var(--attn-line, #b08800); border: 1px solid currentColor; border-radius: 999px; padding: 0 8px; }
.prline .flag.ai { color: var(--ai-hint); border-style: dashed; }
.prline .state { font-size: 12px; color: var(--edit); border: 1px solid currentColor; border-radius: 999px; padding: 0 8px; }
.prline .state[data-action="not_on_page"], .prline .state[data-action="unreadable"] { color: var(--bad); }
.prline .hidden { font-size: 12px; color: var(--bad); }
.prline .hidden[hidden], .prline .state[hidden] { display: none; }
.prline input.lt {
  width: 100%; font-size: 21px; line-height: 1.5; padding: 4px 8px;
  font-family: "Frank Ruehl CLM", "Taamey Frank CLM", "David", "Times New Roman", "Noto Serif Hebrew", serif;
}
.prline.tiera { border-color: var(--attn-line, #b08800); background: var(--attn-bg, #fff6d6); }
.prline.tiera.looked { background: none; border-color: var(--line); }
.prline.excluded input.lt { text-decoration: line-through; color: var(--muted); }
.prline .tools { display: none; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.prline:focus-within { border-color: var(--acc); }
.prline:focus-within .tools { display: flex; }
.prline .tools button { padding: 2px 8px; font-size: 13px; }
.pending { font-weight: 600; color: var(--attn-line, #b08800); margin: 4px 0; }
.pending.ok { color: var(--ok); }
.decide .confirmbtn { font-size: 17px; padding: 10px 16px; }
.decide .confirmbtn.notyet { opacity: .6; }
.roc { gap: 8px; align-items: center; cursor: pointer; }
.roc input { width: 20px; height: 20px; }
.reject { margin-top: 10px; }
.reject summary { cursor: pointer; color: var(--bad); }
@media (max-width: 520px) {
  .prline { grid-template-columns: 1.6em 1fr; padding: 4px 2px; }
  .prline input.lt { font-size: 19px; }
  .conventions dl { grid-template-columns: 1fr; }
}
