:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6a6f76;
  --line: #dcd9d0;
  --accent: #1f5f99;
  --accent-soft: #e4eef8;
  --hit: #fff0b3;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --chip: #eeece6;
  --hebrew: "SBL Hebrew", "Ezra SIL", "Taamey Frank CLM", "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191c;
    --panel: #1f2226;
    --ink: #e4e6e9;
    --muted: #9aa1a9;
    --line: #353a40;
    --accent: #7db4ea;
    --accent-soft: #23364a;
    --hit: #5a4a10;
    --warn: #e7b25e;
    --warn-soft: #3a2f1c;
    --chip: #2b2f34;
  }
}
:root[data-theme="dark"] {
  --bg: #17191c; --panel: #1f2226; --ink: #e4e6e9; --muted: #9aa1a9; --line: #353a40;
  --accent: #7db4ea; --accent-soft: #23364a; --hit: #5a4a10; --warn: #e7b25e; --warn-soft: #3a2f1c; --chip: #2b2f34;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}
button, select, input { font: inherit; color: inherit; }
button, select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
a, .link { color: var(--accent); cursor: pointer; text-decoration: none; }
a:hover, .link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.he { font-family: var(--hebrew); direction: rtl; unicode-bidi: isolate; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar h1 { font-size: 16px; margin: 0; }
.topbar label { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.spacer { flex: 1; }

.cols {
  flex: 1;
  min-height: 0;
  display: grid;
  /* the references column keeps a fixed width; entry and texts share the rest */
  grid-template-columns: 250px minmax(360px, 1.35fr) 340px minmax(320px, 1fr);
}
.col {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 10px 12px;
}
.col:last-child { border-right: 0; }
.placeholder { color: var(--muted); margin-top: 40px; text-align: center; }

/* ---- column 1: entry list ---- */
.col-list { display: flex; flex-direction: column; padding: 0; background: var(--panel); }
.list-tools { padding: 10px; border-bottom: 1px solid var(--line); }
.search-row { display: flex; gap: 4px; }
#search {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  font-size: 16px;
}
#search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#kbd-toggle { font-family: var(--hebrew); font-size: 16px; }
.keypad {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  margin-top: 6px;
  direction: rtl;
}
[hidden] { display: none !important; }
.keypad button { font-family: var(--hebrew); font-size: 17px; padding: 1px 0; }
.filter-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.vfilter { white-space: nowrap; }
.vfilter label { margin-right: 4px; font-size: 12px; color: var(--muted); }
.entry-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; outline: none; }
.entry-list li {
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.entry-list li:hover { background: var(--accent-soft); }
.entry-list li.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.entry-list .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.entry-list .lemma { font-family: var(--hebrew); font-size: 20px; direction: rtl; }
.entry-list .meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.entry-list .gl { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-list .more { text-align: center; color: var(--accent); }
.ver { display: inline-block; font-size: 10px; padding: 0 4px; border-radius: 3px; background: var(--chip); color: var(--muted); }
.ver.v2 { background: var(--warn-soft); color: var(--warn); }

/* ---- column 2: entry ---- */
.entry-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.entry-head .lemma { font-family: var(--hebrew); font-size: 34px; direction: rtl; }
.entry-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.bf-head { margin: 14px 0 4px; font-weight: 600; color: var(--muted); font-size: 13px; }
.meaning {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px 10px;
  margin: 8px 0;
}
.meaning.active, .con.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.m-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.m-letter { font-weight: 700; color: var(--accent); }
.m-sense { margin: 3px 0; }
.m-glosses { font-weight: 600; }
.m-head .chip { vertical-align: middle; }
.m-second { color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; margin-top: 4px; }
.m-second .m-glosses { font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.chip { font-size: 11px; background: var(--chip); border-radius: 10px; padding: 0 7px; color: var(--muted); }
.chip.dom { color: var(--ink); cursor: pointer; text-decoration: none; }
a.chip.dom:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.chip.core { font-style: italic; }
.chip .code { color: var(--muted); font-size: 10px; margin-left: 4px; }
.coll { font-family: var(--hebrew); font-size: 17px; direction: rtl; unicode-bidi: isolate; }
.flag { font-size: 10px; padding: 0 5px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); }
.m-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; font-size: 13px; }
.m-actions .count { color: var(--muted); }
.cons { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 4px; }
.con { border: 1px solid transparent; border-radius: 4px; padding: 4px 6px; margin: 2px 0; }
.con:hover { background: var(--bg); }
.con .type { font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: var(--chip); color: var(--muted); }
.con .num { color: var(--muted); margin-right: 4px; }
.empty { color: var(--muted); font-style: italic; }
.abbr { font-variant: small-caps; letter-spacing: .02em; }
.xref { border-bottom: 1px dotted var(--accent); }
.notes { margin-top: 18px; }
.notes h3, .refs-head h3, .texts-head h3 { font-size: 13px; margin: 0 0 6px; }
.note { font-size: 13px; margin: 4px 0; }
.note .caller { font-weight: 700; color: var(--accent); margin-right: 4px; }

/* ---- column 3: references ---- */
.refs-head, .texts-head {
  position: sticky;
  top: -10px;
  background: var(--bg);
  padding: 4px 0 6px;
  margin-top: -4px;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.refs-head .sub { font-size: 12px; color: var(--muted); }
.refs-head .tools, .texts-head .tools { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.ref-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ref-list li { padding: 3px 6px; border-radius: 4px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ref-list li:hover { background: var(--accent-soft); }
.ref-list li.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.ref-list li a { color: var(--accent); }
.ref-note { font-size: 10px; color: var(--warn); margin-left: 4px; }

/* ---- column 4: texts ---- */
.text-block { margin: 10px 0; }
.text-block .vname { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.text-block .mapped { font-size: 11px; color: var(--muted); margin-left: 6px; }
.text-block .body { margin-top: 2px; }
.text-block .body.he { font-size: 20px; line-height: 1.7; }
.text-block .ctx { color: var(--muted); }
.text-block .nohit { font-size: 10px; color: var(--warn); margin-left: 6px; }
mark.hit { background: var(--hit); color: inherit; border-radius: 3px; padding: 0 1px; }
.vnum { font-size: 10px; color: var(--muted); vertical-align: super; margin: 0 2px; }
.ref-notes { background: var(--warn-soft); border-radius: 4px; padding: 6px 8px; margin: 8px 0; font-size: 13px; }
.vis-menu { position: relative; }
.vis-menu .menu {
  position: absolute; right: 0; top: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 6px 10px; z-index: 5; white-space: nowrap;
}
.vis-menu .menu { max-height: 70vh; overflow-y: auto; }
.vis-row { display: flex; align-items: center; gap: 4px; }
.vis-row label { flex: 1; padding-right: 10px; }
.vis-row button { font-size: 10px; padding: 0 5px; line-height: 1.6; }
.vis-row button:disabled { opacity: .3; cursor: default; }
.vis-foot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; text-align: right; }

@media (max-width: 1100px) {
  .cols { grid-template-columns: 220px 1fr; grid-auto-rows: minmax(0, 1fr); overflow-y: auto; }
  .col { border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .cols { grid-template-columns: 1fr; }
  .col-list { max-height: 45vh; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}

.domain-banner {
  margin: 6px 0 2px; padding: 4px 8px; border-radius: 4px;
  background: var(--accent-soft); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap;
}
.domain-banner #domain-clear { margin-left: auto; cursor: pointer; }
.entry-list .type, .con .type { font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: var(--chip); color: var(--muted); }
.focus-bar { font-size: 13px; color: var(--muted); background: var(--accent-soft); border-radius: 4px; padding: 4px 8px; margin: 6px 0; }

.copy-verse {
  border: 0; background: none; padding: 0 4px; margin-left: 4px;
  font-size: 13px; line-height: 1; color: var(--muted); cursor: pointer; opacity: .55;
}
.text-block:hover .copy-verse { opacity: 1; }
.copy-verse:hover { color: var(--accent); }
.copy-verse.done { color: #2e8b57; opacity: 1; }

.langs-pick { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.langs-pick #langs-btn { color: var(--ink); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langs-menu { left: 0; right: auto; z-index: 20; display: grid; grid-auto-flow: column; grid-template-rows: repeat(9, auto); column-gap: 20px; width: max-content; max-height: none; overflow: visible; }
.langs-menu label { display: block; color: var(--ink); }
.export-menu { z-index: 20; }
.export-title { font-weight: 600; margin-bottom: 6px; }
.export-version { margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.export-langs { display: grid; grid-auto-flow: column; grid-template-rows: repeat(9, auto); column-gap: 20px; }
.export-langs label { display: block; color: var(--ink); }
.export-menu .vis-foot a { cursor: pointer; }
.export-menu .export-go { margin-left: 10px; }
.lang-tag { font-size: 11px; color: var(--muted); display: inline-block; min-width: 72px; }
.m-second .m-sense { margin: 2px 0; }

/* ---- editing ---- */
#edit-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
#undo:disabled { opacity: .45; cursor: default; }
a.ed { font-size: 12px; color: var(--accent); opacity: .7; margin-left: 4px; cursor: pointer; white-space: nowrap; }
a.ed:hover { opacity: 1; text-decoration: none; }
.con-head { display: block; }
.edit-panel {
  border: 1px solid var(--accent); border-radius: 6px; background: var(--accent-soft);
  padding: 8px 10px; margin: 6px 0; display: flex; flex-direction: column; gap: 6px;
}
.ed-title { font-weight: 600; font-size: 13px; }
.ed-label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.ed-label.inline { flex-direction: row; align-items: center; gap: 6px; }
.edit-panel textarea, .edit-panel input:not([type=checkbox]), .edit-panel select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px;
}
.edit-panel textarea { width: 100%; resize: vertical; }
.ed-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ed-actions .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.hint { font-size: 11px; color: var(--muted); }
.ed-group { display: flex; flex-direction: column; gap: 3px; }
.ed-rows { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-chip { color: var(--ink); }
.ed-chip[draggable="true"] { cursor: grab; }
.ed-chip.dragging { opacity: 0.4; }
.ed-chip.drop-at { outline: 2px dashed var(--accent, #2a6fb0); outline-offset: 1px; }
.ed-mv { cursor: pointer; color: var(--muted); padding: 0 3px; font-weight: 700; }
.ed-mv:hover { color: var(--ink); text-decoration: none; }
.ed-x { cursor: pointer; color: var(--muted); margin-left: 3px; font-weight: 700; }
.ed-x:hover { color: #c0392b; text-decoration: none; }
.ed-add { display: flex; gap: 4px; flex-wrap: wrap; }
.ed-add .ed-dom { flex: 2; min-width: 180px; }
.ed-add .ed-src { flex: 1; min-width: 120px; }
.ed-forms { display: flex; flex-direction: column; gap: 4px; }
.ed-form-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-form-row .ed-tag { width: 190px; font-family: ui-monospace, Consolas, monospace; }
.ed-preview { font-size: 13px; }
.ed-preview.bad { color: #c0392b; }
.ed-build { font-size: 12px; cursor: pointer; }
.ed-builder { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 2px; }
.ed-builder label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.ed-add-form { align-self: flex-start; }
.ref-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; margin-top: 6px; }
.ref-actions select { max-width: 220px; font-size: 12px; }
.ref-check { margin: 0 4px 0 0; vertical-align: middle; }

.mv-group { display: inline-flex; gap: 1px; margin-right: 6px; vertical-align: middle; }
.mv { font-size: 10px; line-height: 1; padding: 2px 3px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
a.mv { color: var(--accent); opacity: 1; margin: 0; cursor: pointer; }
a.mv:hover { background: var(--accent-soft); text-decoration: none; }
.mv.off { color: var(--line); }
.bf-num { font-weight: 700; color: var(--accent); }
body.saving a.ed, body.saving #undo { pointer-events: none; opacity: .4; }
body.saving { cursor: progress; }

.st-group { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; }
a.st { font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); margin: 0; opacity: .85; }
a.st:hover { background: var(--accent-soft); opacity: 1; }
.cons > a.st, .m-actions a.st { display: inline-block; margin-top: 4px; }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px #f5c542; } 100% { box-shadow: 0 0 0 3px transparent; } }
a.st[data-ed="delete"]:hover { color: #c0392b; border-color: #c0392b; }
#domains-link, #vocab-link { font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }

/* ---- concordance ---- */
.conc-btn { font-size: 12px; padding: 1px 7px; border: 1px solid var(--accent); border-radius: 3px; margin-right: 6px; }
#conc-report { margin-top: 6px; font-size: 12px; }
.cc-lemmas, .cc-summary { font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cc-lemma { background: var(--chip); border-radius: 10px; padding: 0 6px; font-size: 15px; }
.cc-rm { cursor: pointer; margin-left: 4px; color: var(--muted); font-size: 12px; }
.cc-sum { background: var(--chip); border-radius: 3px; padding: 0 5px; }
.cc-sum.bad { background: #f8d7d3; color: #a12a1c; }
.cc-sum.warn { background: var(--warn-soft); color: var(--warn); }
.cc-sum.ok { background: #d9f0df; color: #1e6b35; }
.cc-list li { font-size: 13px; }
.cc-chip { font-size: 10px; border-radius: 3px; padding: 0 4px; margin-left: 3px; background: var(--accent-soft); color: var(--accent); }
.cc-chip.n { background: #ece3f7; color: #5b2c8f; }
.cc-chip.x { background: #e3f1f7; color: #1d5f7a; }
.cc-cons { margin-left: 4px; }
.cc-issue { font-size: 10px; border-radius: 3px; padding: 0 4px; margin-left: 3px; }
.cc-issue.bad { background: #f8d7d3; color: #a12a1c; font-weight: 600; }
.cc-issue.warn { background: var(--warn-soft); color: var(--warn); }
.cc-gl { color: #a12a1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cc-sum.bad, :root:not([data-theme="light"]) .cc-issue.bad { background: #4a1f1a; color: #f3a397; } }
.cc-more { display: block; text-align: center; padding: 6px; cursor: pointer; }

/* ---- dragging references ---- */
#ref-list li[draggable="true"] { cursor: grab; }
.drag-ghost { position: absolute; top: -100px; left: -100px; padding: 3px 8px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 12px; }
body.dragging-refs .meaning, body.dragging-refs .con { outline: 1px dashed var(--line); }
.drop-target { position: relative; outline: 2px solid var(--accent) !important; background: var(--accent-soft) !important; }
.drop-target::after { content: attr(data-drop-hint); position: absolute; top: 4px; right: 6px; z-index: 3;
  font-size: 12px; background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 3px; pointer-events: none; }
.drop-refused { position: relative; outline: 2px dashed var(--warn) !important; }
.drop-refused::after { content: attr(data-drop-hint); position: absolute; top: 4px; right: 6px; z-index: 3;
  font-size: 12px; background: var(--warn); color: #fff; padding: 1px 7px; border-radius: 3px; pointer-events: none; }
.drag-hint { margin-top: 4px; }

.alt-lemmas { font-family: var(--hebrew); font-size: 22px; color: var(--muted); direction: rtl; display: inline-flex; gap: 6px; align-items: baseline; }
.alt-label { font-size: 11px; color: var(--muted); margin-right: -6px; }
.alt-sep { font-size: 14px; }

/* ---- reports and checks ---- */
.report-row { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.report-btn { font-size: 12px; padding: 1px 6px; }
.check-btn { margin-left: 0; }
.ck-row { cursor: default !important; }
.ck-problem { color: #a12a1c; }
.ck-where, .ck-ref { cursor: pointer; }
.ck-ref { font-weight: 600; }

/* ---- notes ---- */
.notes h3 { display: flex; align-items: center; gap: 6px; }
.note { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.note-loc { margin-left: 18px; color: var(--muted); }

/* ---- all references ---- */
#ar-find { flex: 1; min-width: 140px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }
.ar-place { cursor: pointer; text-decoration: none; }
.cc-chip.c { background: var(--chip); color: var(--muted); }

.nf-box { margin: 8px 0; }
.nf-list { margin: 4px 0 4px 18px; padding: 0; font-size: 13px; }
#report-sel { font-size: 13px; }
#entry-view, #macula-sel { width: 8.5em; font-size: 12px; padding: 1px 4px; margin-right: 6px; border-color: var(--accent); color: var(--accent); }

/* ---- entry column: fixed top, scrolling meanings, notes panel ---- */
.col-entry { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.col-entry > .placeholder { padding: 10px 12px; }
.entry-top { flex: none; padding: 10px 12px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.entry-top .entry-meta { margin-bottom: 0; }
.entry-top .focus-bar { margin: 6px 0 0; }
.entry-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 12px; }
.entry-notes { flex: none; max-height: 33%; overflow-y: auto; border-top: 2px solid var(--line); background: var(--panel); padding: 4px 12px 8px; }
.entry-notes .notes { margin-top: 0; }
.entry-notes .notes h3 { position: sticky; top: -4px; background: var(--panel); padding: 4px 0; margin: 0; z-index: 1; }

/* compact meaning lists in the references column: "a, a4, hN" */
.cc-where { margin-left: 6px; font-size: 12px; color: var(--accent); }
.cc-where .c { color: var(--muted); }
.cc-where .n { color: #5b2c8f; }
.cc-where .x { color: #1d5f7a; }
.cc-where a { color: inherit; }

/* the notes panel can be folded away */
.notes-toggle { cursor: pointer; color: inherit; user-select: none; }
.notes-toggle:hover { color: var(--accent); }
.notes.collapsed .notes-list { display: none; }
.ck-settype { margin-left: 6px; cursor: pointer; font-size: 12px; color: var(--accent); }

/* click-to-cycle type and IsBiblicalTerm (edit mode) */
a.cycle { cursor: pointer; text-decoration: none; }
a.cycle:hover { outline: 1px solid var(--accent); }
a.chip.empty-bt { color: var(--muted); }
.ed-vc { min-width: 220px; }

/* ---- meaning editor window (over the list, entry and references columns) ---- */
.me-dialog { position: fixed; left: 0; bottom: 0; z-index: 50; margin: 0; border-radius: 0; display: flex; flex-direction: column;
  background: var(--bg); border: 0; border-right: 2px solid var(--accent); box-shadow: 4px 0 18px rgba(0,0,0,.18); padding: 0; }
.me-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex: none; }
.me-head .ed-actions { margin: 0; }
.me-title { font-weight: 600; }
.me-body { overflow-y: auto; padding: 10px 14px 18px; flex: 1; min-height: 0; }
.me-row { display: flex; gap: 18px; margin-bottom: 8px; }
.me-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 18px; margin-bottom: 10px; }
.me-grid > div { border-top: 1px solid var(--line); padding-top: 6px; }
.me-senses { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
.me-sense { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 8px; margin: 0; }
.me-sense legend { font-weight: 600; padding: 0 4px; }
.me-sense textarea { width: 100%; box-sizing: border-box; resize: vertical; overflow: hidden; }
.me-text { min-width: 220px; }

/* Hebrew inside a chip (synonyms, antonyms): readable size, not the chip's 11px */
.chip .he { font-size: 16px; line-height: 1.2; }

/* popup when "References" is clicked while the references column shows a list */
.refs-pop { position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--accent); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); padding: 8px; display: flex; flex-direction: column; gap: 4px; max-width: 420px; }
.refs-pop .rp-title { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.refs-pop button { text-align: left; }

/* domain suggestions, drawn in the page under the input */
.ac-wrap { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; z-index: 70; min-width: 320px; max-width: 520px; max-height: 260px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 16px rgba(0,0,0,.18); font-size: 13px; }
.ac-item { padding: 3px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item:hover, .ac-item.hi { background: var(--chip); }

/* status line: always one line; the full text of saves is in the recent-changes list */
#status { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status.has-log { cursor: pointer; }
#status.has-log:hover { color: var(--accent); }
.log-pop { position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); padding: 8px 10px; width: 480px; max-height: 60vh; overflow-y: auto; font-size: 13px; }
.log-pop .rp-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.log-item { border-top: 1px solid var(--line); padding: 4px 0; }
.log-item ul { margin: 2px 0 0; padding-left: 18px; }

/* type check when saving a contextual meaning */
.me-ask { position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.25); display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.me-ask-box { background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 12px 16px; max-width: 460px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.me-ask-box p { margin: 6px 0; }

/* "Show…" at the top right of the entry column */
.entry-head #entry-view { margin-left: auto; margin-right: 0; align-self: center; }

/* clipboard indicator in the top bar */
.clip { font-size: 12px; background: var(--chip); border-radius: 10px; padding: 1px 8px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.clip .he { font-size: 15px; }
.clip-x { cursor: pointer; color: var(--muted); margin-left: 4px; }

/* Hebrew words: lemma and grammar as a tooltip, a click opens the word popup */
.text-block .w { cursor: pointer; border-radius: 3px; }
.text-block .w:hover { background: var(--accent-soft); }
.word-pop {
  position: fixed; z-index: 40; width: 460px; max-height: 60vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: 8px 12px; font-size: 13px;
}
.word-pop .wp-word { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.word-pop .wp-close { margin-left: auto; cursor: pointer; color: var(--muted); }
.word-pop .wp-lemma { font-size: 20px; }
.word-pop .wp-entry + .wp-entry { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.word-pop .wp-head { display: flex; align-items: baseline; gap: 8px; }
.word-pop .wp-open { margin-left: auto; font-size: 12px; }
.word-pop .wp-pos { margin: 2px 0 4px; }
.word-pop .wp-m { padding: 3px 6px; border-radius: 4px; margin: 2px 0; }
.word-pop .wp-m.hit { background: var(--hit); }
.word-pop .wp-m:not(.hit) { opacity: .6; }
.word-pop .wp-con { margin: 2px 0 0 14px; }
.word-pop .wp-lemma, .word-tip .wt-lemma { font-family: var(--hebrew); }
.word-pop .wp-lemma.small-he { font-size: 17px; }
.word-pop .wp-copy { cursor: pointer; color: var(--accent); font-size: 12px; margin-right: 4px; opacity: .7; }
.word-pop .wp-copy:hover { opacity: 1; }
.word-tip {
  position: fixed; z-index: 45; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--panel); border-radius: 4px; padding: 3px 8px; font-size: 12px;
}
.word-tip .wt-lemma { font-size: 18px; margin-right: 6px; }
.word-pop .wp-coll { margin: 1px 0 2px; }
.ed-alts { font-size: 20px; width: 260px; }

/* 📌 Keep: the references list can stay while another entry is opened */
.refs-pin { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); padding: 4px 0 6px; }
.refs-pin label { cursor: pointer; color: var(--ink); }
.refs-pin.foreign { background: var(--warn-soft); border-radius: 4px; padding: 4px 8px; margin-bottom: 6px; color: var(--ink); }
.refs-pin .he { font-size: 16px; }
.refs-pin .pin-back { font-size: 12px; }

/* Valency from MACULA */
.val-dialog .val-lex { border-top: 1px solid var(--line); padding: 8px 0; }
.val-dialog .val-lex-head { margin-bottom: 4px; }
.val-table { border-collapse: collapse; width: 100%; }
.val-table th { text-align: left; font-weight: 600; font-size: 11px; color: var(--muted); padding: 2px 4px; }
.val-table td { padding: 2px 4px; }
.val-table .val-form { width: 150px; font-family: ui-monospace, Consolas, monospace; }
.val-table .val-val { width: 180px; font-family: var(--hebrew); font-size: 16px; }
.val-table .val-gloss { width: 100%; }
.val-table .val-n { text-align: right; color: var(--muted); cursor: help; }
.entry-head #macula-sel { margin-left: -6px; margin-right: 0; align-self: center; }
.col-dialog .col-text { width: 420px; font-family: var(--hebrew); font-size: 16px; }
.col-dialog .col-note { white-space: nowrap; }
.col-dialog tr.col-exists .col-text { color: var(--muted); }
.col-dialog tr.col-single { display: none; }
.col-dialog.show-singles tr.col-single { display: table-row; }
.col-dialog .col-tools { font-size: 12px; }
.col-dialog .col-tools a { cursor: pointer; color: var(--accent); }
.col-dialog .col-tools label { margin-right: 12px; }
.refs-pop .rp-foot { margin-top: 4px; }

/* the first references of a meaning, written out (click one to read it) */
.ref-preview { color: var(--muted); }
.ref-preview .ref-peek { color: var(--accent); cursor: pointer; }
.ref-preview .ref-peek[draggable="true"] { cursor: grab; }
.ref-preview .ref-peek.active { background: var(--hit); border-radius: 3px; }
.ref-preview .show-refs { margin-left: 2px; }
.ref-preview .ref-caller { font-size: 9px; color: var(--warn); margin-left: 1px; cursor: help; }

/* correcting the NJPS85 / NRSVue alignment ("✎ links") */
.text-block .align-edit { font-size: 11px; margin-left: 6px; }
.text-block.aligning { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.text-block.aligning .main-verse .ew { cursor: pointer; border-radius: 3px; }
.text-block.aligning .main-verse .ew:hover { background: var(--accent-soft); }
.text-block .ew.sel { background: var(--accent); color: #fff; }
#texts .w.hsel { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft); }
#texts .w.hlink, #texts .ew.hlink { background: #ffe58a; color: #000; border-radius: 3px; }
.align-bar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; margin: 4px 0; }
.align-bar .al-what { flex: 1; color: var(--muted); }

/* busy indicator (busy.js): spinner + seconds in the top bar, a running bar at the top */
.busy { display: none; align-items: center; gap: 5px; color: var(--accent); font-size: 12px; flex: 0 0 auto; }
.is-busy .busy { display: inline-flex; }
.busy-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft);
  border-top-color: var(--accent); animation: busy-spin .8s linear infinite; }
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; overflow: hidden; display: none; pointer-events: none; }
.is-busy .busy-bar { display: block; }
.busy-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent);
  animation: busy-run 1.2s ease-in-out infinite; }
.is-busy, .is-busy body { cursor: progress; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@keyframes busy-run { from { left: -30%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .busy-spin { animation-duration: 2.4s; }
  .busy-bar::before { animation: none; left: 0; width: 100%; opacity: .5; }
}

/* field search window (search.js) */
.search-dialog { position: fixed; z-index: 55; width: 680px; max-width: calc(100vw - 8px); max-height: 80vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.22); padding: 8px 12px 10px; font-size: 13px; }
.sq-head { display: flex; align-items: center; margin-bottom: 6px; }
.sq-close, .sq-x, .sq-add { cursor: pointer; color: var(--accent); }
.sq-x { font-size: 16px; padding: 0 4px; }
.sq-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.sq-row select { max-width: 230px; }
.sq-value { flex: 1; min-width: 140px; }
.sq-line { margin: 8px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sq-actions .primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.sq-msg { color: var(--muted); }
.hit-snip { color: var(--muted); font-style: italic; }

/* texts column: previous / next verse and "go to" (Hebrew numbering) */
.verse-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.verse-nav h3 { margin: 0; }
.vn-step { padding: 0 6px; font-size: 11px; line-height: 18px; }
.vn-go { width: 150px; font-size: 12px; margin-left: auto; }
.vn-msg { font-size: 12px; color: var(--warn); flex-basis: 100%; text-align: right; }
.vn-msg:empty { display: none; }
