/* rbib. Palette from Origin (~/src/ohgit-demo); accent is red. */
@font-face { font-family: 'Cursor Gothic'; src: url('/CursorGothic-Regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Libertinus Serif'; src: url('/LibertinusSerif-Regular.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Libertinus Serif'; font-style: italic; src: url('/LibertinusSerif-Italic.otf') format('opentype'); font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f7f7f6;
  --surface: #fbfbfa;
  --surface-raised: #ffffff;
  --surface-soft: #efefed;
  --surface-hover: #f3f3f1;
  --text: #191918;
  --text-secondary: #626260;
  --text-tertiary: #92928f;
  --border: #e3e3e0;
  --border-subtle: #ececea;
  --button: #1b1b1a;
  --button-text: #f8f8f7;
  --red: #b4231b;
  --accent: var(--red);
  --accent-fill: rgba(180, 35, 27, 0.07);
  --hl-y: rgba(232, 184, 20, 0.24);
  --hl-g: rgba(64, 160, 90, 0.17);
  --hl-b: rgba(70, 120, 210, 0.15);
  --hl-r: rgba(200, 50, 40, 0.13);
  --sw-y: #e0b21c; --sw-g: #4fa36a; --sw-b: #5a86d6; --sw-r: #c8463c;
  --shadow: 0 18px 60px rgba(24, 24, 22, 0.14);
  --shadow-pop: 0 10px 34px rgba(24, 24, 22, 0.13), 0 1px 3px rgba(24, 24, 22, 0.06);
  --radius: 10px;
  --radius-control: 7px;
  --font: 'Cursor Gothic', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --font-text: 'Libertinus Serif', 'Noto Serif', 'Noto Serif Hebrew', Georgia, serif;
  --ts: 18px;
  --lh: 1.62;
  font-family: var(--font);
  font-synthesis: none;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #121212; --surface: #171717; --surface-raised: #1b1b1b; --surface-soft: #242424; --surface-hover: #1f1f1f;
  --text: #eeeeec; --text-secondary: #aaa9a6; --text-tertiary: #747471;
  --border: #272725; --border-subtle: #222220; --button: #f1f1ef; --button-text: #1b1b1a;
  --red: #ef7a6f; --accent-fill: rgba(239, 122, 111, 0.1);
  --hl-y: rgba(224, 178, 28, 0.2); --hl-g: rgba(79, 163, 106, 0.2); --hl-b: rgba(90, 134, 214, 0.2); --hl-r: rgba(239, 122, 111, 0.17);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.5); --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.02);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #121212; --surface: #171717; --surface-raised: #1b1b1b; --surface-soft: #242424; --surface-hover: #1f1f1f;
    --text: #eeeeec; --text-secondary: #aaa9a6; --text-tertiary: #747471;
    --border: #272725; --border-subtle: #222220; --button: #f1f1ef; --button-text: #1b1b1a;
    --red: #ef7a6f; --accent-fill: rgba(239, 122, 111, 0.1);
    --hl-y: rgba(224, 178, 28, 0.2); --hl-g: rgba(79, 163, 106, 0.2); --hl-b: rgba(90, 134, 214, 0.2); --hl-r: rgba(239, 122, 111, 0.17);
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.5); --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.02);
  }
}

* { box-sizing: border-box; scrollbar-width: none; }
::-webkit-scrollbar { display: none; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 13px; display: flex; flex-direction: column; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button {
  height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface-raised); cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--surface-hover); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 1px; }
button.solid { background: var(--button); color: var(--button-text); border-color: var(--button); }
button.solid:hover { opacity: 0.88; }
button.ghost { border-color: transparent; background: none; color: var(--text-secondary); }
button.ghost:hover { background: var(--surface-hover); color: var(--text); }
button.icon { width: 28px; padding: 0; font-size: 16px; line-height: 1; }
button.tog { color: var(--text-tertiary); }
button.tog.on { color: var(--text); background: var(--surface-soft); }
input, textarea {
  height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface-raised); outline: none;
}
input:focus, textarea:focus { border-color: var(--text-tertiary); }
a { color: inherit; text-decoration: none; }
kbd {
  font-family: var(--font); font-size: 11px; color: var(--text-secondary); padding: 1px 5px; min-width: 18px; text-align: center;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-raised); display: inline-block;
}
.muted { color: var(--text-secondary); }
.fine { font-size: 11.5px; color: var(--text-tertiary); }
[hidden] { display: none !important; }

/* Lucide icons (web/icons/*.svg) drawn as masks so they take currentColor */
.ic { display: inline-block; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -3px; }
button .ic { pointer-events: none; }
button:has(.ic) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.icon.on { color: var(--accent); }
.acts .icon { color: var(--text-secondary); }
.acts .icon:hover, .acts .icon.on { color: var(--text); background: var(--surface-soft); }
#add-notebook.on { color: var(--accent); }

/* dropdown trigger: a button with a chevron */
.dd { display: inline-flex; align-items: center; gap: 6px; }
.dd::after {
  content: ''; width: 5px; height: 5px; border: solid var(--text-tertiary); border-width: 0 1.3px 1.3px 0;
  transform: translateY(-2px) rotate(45deg); flex: none; transition: transform 0.12s;
}
.dd.open { background: var(--surface-soft); }
.dd.open::after { transform: translateY(1px) rotate(225deg); }

/* segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--surface-soft); }
.seg button { height: 24px; border: 0; background: none; color: var(--text-secondary); padding: 0 9px; border-radius: 6px; }
.seg button:hover { color: var(--text); background: none; }
.seg button.on { background: var(--surface-raised); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-subtle); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.seg .n { color: var(--text-tertiary); margin-left: 3px; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 12px 0 10px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex: none;
}
.go { flex: 0 1 400px; position: relative; }
.go input { width: 100%; height: 30px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav .icon { border-color: transparent; background: none; color: var(--text-secondary); }
.nav .icon:hover { background: var(--surface-hover); color: var(--text); }
#where { min-width: 120px; justify-content: space-between; border-color: transparent; background: none; font-size: 13.5px; }
#where:hover, #where.open { background: var(--surface-soft); }
.opts, .acts { display: flex; gap: 6px; align-items: center; }
.acts { margin-left: auto; }
#reading { font-family: var(--font-text); font-size: 14px; }
.avatar {
  width: 28px; height: 28px; padding: 0; background: var(--button); color: var(--button-text);
  border: 0; font-size: 12.5px;
}
.avatar:hover, .avatar.open { background: var(--button); opacity: 0.85; }

/* top bar controls are square-cornered */
.top button, .top input { border-radius: 0; }

/* ---------- workspace ---------- */
.work { flex: 1; display: flex; min-height: 0; }
.panes { flex: 1; display: flex; min-width: 0; overflow-x: auto; }
.pane {
  flex: 1 1 0; min-width: 380px; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--surface-raised);
}
.pane:last-child { border-right: 0; }
.pane-head {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 8px; flex: none;
  border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);
}
.pane-head .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.pane-head .title b { font-weight: 400; color: var(--text); }
.pane-head .pmenu { color: var(--text-tertiary); }
.pane-head .grow { flex: 1; }
.pass-dd { height: 26px; padding: 0 8px; color: var(--text); white-space: nowrap; }
.pass-dd:hover, .pass-dd.open { background: var(--surface-soft); }
.ed-dd { height: 26px; max-width: 250px; border-color: transparent; background: none; padding: 0 8px; }
.ed-dd:hover, .ed-dd.open { background: var(--surface-soft); }
.ed-dd b { font-weight: 400; color: var(--text); font-size: 12px; letter-spacing: 0.03em; }
.ed-dd span { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pane-body { flex: 1; overflow-y: auto; padding: 28px 0 40vh; }
.page { max-width: 680px; margin: 0 auto; padding: 0 28px; }

/* states: empty, error, loading */
.state { padding: 40px 0; }
.state p { margin: 0 0 4px; }
.state .retry { margin-top: 12px; }
.empty { color: var(--text-tertiary); padding: 20px 0; }
.skel {
  height: 13px; margin: 15px 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-hover) 50%, var(--surface-soft) 75%) 0 0 / 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skel.title { width: 30%; height: 22px; margin-bottom: 26px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- scripture ---------- */
.chap-title { font-family: var(--font-text); font-size: 27px; font-weight: 400; margin: 0 0 18px 40px; letter-spacing: -0.01em; }
.chap-title small { font-family: var(--font); font-size: 11.5px; color: var(--text-tertiary); margin-left: 10px; letter-spacing: 0.03em; }
.text { font-family: var(--font-text); font-size: var(--ts); line-height: var(--lh); }
body.sans .text { font-family: var(--font); font-size: calc(var(--ts) - 2px); }
.text[dir='rtl'] { font-size: calc(var(--ts) + 3px); }
.vs { position: relative; margin: 0; padding: 3px 14px 3px 40px; border-radius: 6px; transition: background 0.12s; }
.vs .vn {
  position: absolute; left: 4px; top: calc(var(--ts) * var(--lh) / 2 - 3px); width: 26px; text-align: right;
  font-family: var(--font); font-size: 11px; line-height: 1.2; color: var(--text-tertiary); cursor: pointer; user-select: none;
}
.text[dir='rtl'] .vs { padding: 3px 40px 3px 14px; }
.text[dir='rtl'] .vs .vn { left: auto; right: 4px; text-align: left; }
.vs:hover { background: var(--surface-hover); }
.vs:hover .vn, .vs .vn:hover, .vs .vn.open { color: var(--text); }
.vs.sel { background: var(--accent-fill); box-shadow: inset 2px 0 0 var(--accent); }
.vs.sel .vn { color: var(--accent); }
.vs.hl-y { background: var(--hl-y); }
.vs.hl-g { background: var(--hl-g); }
.vs.hl-b { background: var(--hl-b); }
.vs.hl-r { background: var(--hl-r); }
.vs.has-note::before {
  /* note marker sits under the verse number */
  content: ''; position: absolute; left: 25px; top: calc(var(--ts) * var(--lh) / 2 + 12px); width: 4px; height: 4px;
  border-radius: 50%; background: var(--accent);
}
.vs.saved .vn::before { content: '★'; margin-right: 2px; font-size: 8px; color: var(--accent); vertical-align: 1px; }
.chap-foot { display: flex; justify-content: space-between; margin: 34px 0 0 40px; }

/* paragraph layout: verses flow, numbers go superscript */
body.para .vs { display: inline; padding: 0; border-radius: 3px; box-shadow: none; }
body.para .vs .vn { position: static; display: inline; vertical-align: super; font-size: 10px; margin: 0 2px 0 5px; }
body.para .vs.pbreak::before { content: ''; display: block; height: 12px; }
body.para .vs.has-note:not(.pbreak)::before { display: none; }
body.para .pm { display: none; }

.j { color: inherit; }
body.red .j { color: var(--red); }
.i { font-style: italic; }
.dn { font-variant: small-caps; }
.pm { color: var(--text-tertiary); font-family: var(--font); font-size: 0.75em; }
.w[data-s] { cursor: pointer; }
.w[data-s]:hover { text-decoration: underline dotted var(--text-tertiary); text-underline-offset: 3px; }

/* Strong's: number hangs beneath each word, like a reverse interlinear.
   The article (G3588) is dropped; the Interlinear tab still lists it. */
body.strongs .text:has(.w[data-n]) { line-height: calc(var(--lh) + 0.75); }
body.strongs .w[data-n] { position: relative; display: inline-block; line-height: 1.2; }
body.strongs .w[data-n]::after {
  content: attr(data-n); position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  font-family: var(--font); font-size: 9px; line-height: 1; margin-top: 1px; white-space: nowrap;
  color: var(--text-tertiary); font-style: normal; font-variant: normal; font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em; opacity: 0.8; transition: color 0.12s;
}
body.strongs .w[data-n]:hover { text-decoration: none; }
body.strongs .w[data-n]:hover::after { color: var(--accent); opacity: 1; }

/* ---------- popovers ---------- */
.pop {
  position: fixed; z-index: 50; min-width: 200px; max-height: min(72vh, 560px); overflow-y: auto; padding: 4px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
  animation: popin 0.12s ease-out;
}
@keyframes popin { from { opacity: 0; transform: translateY(-3px); } }
.pop .opt { display: flex; align-items: baseline; gap: 10px; padding: 6px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.pop .opt:hover, .pop .opt.act { background: var(--surface-hover); }
.pop .opt .t { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.pop .opt .hint { font-size: 11px; color: var(--text-tertiary); }
.pop .opt.danger { color: var(--accent); }
.pop .opt.off { color: var(--text-tertiary); cursor: default; }
.pop .opt.off:hover { background: none; }
.pop .sep { height: 1px; background: var(--border-subtle); margin: 4px 2px; }
.grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); padding: 12px 9px 5px; }
.pop .none { padding: 14px 9px; color: var(--text-tertiary); }
.pop-search { position: sticky; top: -4px; margin: -4px -4px 2px; padding: 8px; background: var(--surface-raised); border-bottom: 1px solid var(--border-subtle); z-index: 1; }
.pop-search input { width: 100%; border: 0; padding: 0 2px; height: 24px; }
.pop.eds { width: 410px; }
.pop.eds .opt .id { width: 58px; flex: none; font-size: 11.5px; letter-spacing: 0.03em; color: var(--text-secondary); }
.pop.eds .opt.cur .id { color: var(--accent); }
.pop.eds .opt.cur .t::after { content: '  ✓'; color: var(--accent); }
.pop.menu { min-width: 190px; }

.pop.navpop { width: min(720px, 94vw); max-height: min(78vh, 640px); }
.sects { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 6px; }
.bookgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }
.navpop .book, .navpop .ch { border: 0; background: none; text-align: left; height: 26px; padding: 0 9px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; }
.navpop .book:hover { background: var(--surface-hover); }
.navpop .book.cur, .navpop .ch.cur { color: var(--accent); background: var(--accent-fill); }
.chhead { display: flex; align-items: center; gap: 10px; padding: 6px 4px 8px; font-family: var(--font-text); font-size: 18px; }
.chhead button { font-family: var(--font); font-size: 13px; }
.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 3px; padding: 0 4px 6px; }
.navpop .ch { text-align: center; height: 34px; padding: 0; font-variant-numeric: tabular-nums; background: var(--surface-hover); }
.navpop .ch:hover { background: var(--surface-soft); }

.pop.wide { width: 340px; padding: 12px; }
.settings { display: grid; gap: 12px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-secondary); }
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper button { width: 28px; padding: 0; }
.stepper output { min-width: 34px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.settings .preview { padding: 12px 14px; border-radius: 8px; background: var(--surface-hover); }

.pop.tool { min-width: 0; padding: 4px; }
.vtool { display: flex; align-items: center; gap: 4px; }
.vtool .sw { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--surface-raised); box-shadow: 0 0 0 1px var(--border); }
.vtool .sw.hl-y { background: var(--sw-y); } .vtool .sw.hl-g { background: var(--sw-g); }
.vtool .sw.hl-b { background: var(--sw-b); } .vtool .sw.hl-r { background: var(--sw-r); }
.vtool .sw.on { box-shadow: 0 0 0 1.5px var(--text); }
.vtool .sw:hover { transform: scale(1.08); }
.vtool .vsep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
.vtool .ghost { height: 26px; padding: 0 8px; }

.hcard {
  position: fixed; z-index: 60; width: 300px; padding: 12px 14px; pointer-events: none;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(2px); transition: opacity 0.12s, transform 0.12s;
}
.hcard.on { opacity: 1; transform: none; }
.hcard .hl { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hcard .lemma { font-family: var(--font-text); font-size: 22px; }
.hcard .xl { font-family: var(--font-text); font-style: italic; color: var(--text-secondary); margin: 1px 0 6px; }
.hcard .gl { font-family: var(--font-text); font-size: 15px; line-height: 1.45; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- multi-verse retrieval ---------- */
.mvr-form { display: grid; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); flex: none; }
.mvr-form textarea { height: 62px; padding: 8px 10px; resize: vertical; font-size: 13px; line-height: 1.5; }
.mvr-form .row { display: flex; gap: 6px; align-items: center; }
.mvr-form .row .grow { flex: 1; text-align: right; padding-right: 4px; }
.mvr-form .ed-dd { border-color: var(--border); }
.passage { margin: 0 0 32px; }
.passage h3 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; font-weight: 400; font-size: 11px;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-secondary);
}
.passage h3 a { margin-left: auto; color: var(--text-tertiary); letter-spacing: 0; text-transform: none; font-size: 12px; }
.passage h3 a:hover { color: var(--accent); }
.passage .text { padding-left: 16px; border-left: 2px solid var(--border); }
.passage .text sup { font-family: var(--font); font-size: 10px; color: var(--text-tertiary); margin: 0 2px 0 3px; }
.passage .err { color: var(--text-tertiary); font-style: italic; }
.count { color: var(--text-tertiary); font-size: 12px; margin: 0 0 14px; }

/* ---------- search ---------- */
.sbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sbar .count { margin: 0; }
.dist { margin: 0 0 14px; }
.dist summary, .cbook summary, .entry summary { cursor: pointer; list-style: none; }
.dist summary::-webkit-details-marker, .cbook summary::-webkit-details-marker, .entry summary::-webkit-details-marker { display: none; }
.dist summary { color: var(--text-secondary); font-size: 12px; padding: 4px 0; }
.dist summary::before, .cbook summary::before { content: '▸'; display: inline-block; width: 12px; color: var(--text-tertiary); transition: transform 0.12s; }
.dist[open] summary::before, .cbook[open] summary::before { transform: rotate(90deg); }
.distgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 18px; padding: 6px 0 4px; }
.drow {
  display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 8px; height: 22px; padding: 0 4px;
  border: 0; background: none; text-align: left; font-size: 12px; color: var(--text-secondary);
}
.drow span { overflow: hidden; text-overflow: ellipsis; }
.drow i { display: block; height: 4px; border-radius: 2px; background: var(--border); }
.drow b { font-weight: 400; text-align: right; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.drow:hover i, .drow.on i { background: var(--accent); }
.drow.on { color: var(--text); }
.hits { list-style: none; margin: 0; padding: 0; }
.hits li { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); cursor: pointer; }
.hits li:hover .ref { color: var(--accent); }
.hits .ref { font-size: 11.5px; color: var(--text-secondary); display: block; margin-bottom: 2px; }
.hits .t { font-family: var(--font-text); font-size: 16.5px; line-height: 1.5; }
.hits mark { background: var(--hl-y); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- notebook ---------- */
.nb { list-style: none; margin: 0; padding: 0; }
.nb li { padding: 10px 10px 10px 12px; margin: 0 -10px 2px -12px; border-radius: 8px; cursor: pointer; }
.nb li:hover { background: var(--surface-hover); }
.nb li.hl-y { box-shadow: inset 3px 0 0 var(--sw-y); } .nb li.hl-g { box-shadow: inset 3px 0 0 var(--sw-g); }
.nb li.hl-b { box-shadow: inset 3px 0 0 var(--sw-b); } .nb li.hl-r { box-shadow: inset 3px 0 0 var(--sw-r); }
.nb .ref { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-secondary); min-height: 22px; }
.nb .when { margin-left: auto; color: var(--text-tertiary); }
.nb .rm { width: 22px; height: 22px; opacity: 0; font-size: 14px; }
.nb li:hover .rm { opacity: 1; }
.nb .t { font-family: var(--font-text); font-size: 16px; line-height: 1.5; margin-top: 2px; }
.nb .note { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--accent); color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.hl-y { background: var(--sw-y); } .dot.hl-g { background: var(--sw-g); } .dot.hl-b { background: var(--sw-b); } .dot.hl-r { background: var(--sw-r); }

/* ---------- study panel ---------- */
.study {
  width: 440px; flex: none; display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--border); background: var(--surface);
}
.study-head { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 18px; flex: none; }
.study-ref { flex: 1; font-family: var(--font-text); font-size: 19px; }
.study-acts { display: flex; gap: 4px; }
.study-acts button { height: 26px; padding: 0 8px; }
.study-acts .icon { width: 26px; padding: 0; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; }
.tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; height: 34px;
  color: var(--text-tertiary); padding: 0 8px; flex: none;
}
.tabs button:hover { color: var(--text); background: none; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.study-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.study-body .vtext { font-family: var(--font-text); font-size: 16.5px; line-height: 1.55; margin: 0 0 16px; }
.study-body .grp { padding-left: 0; }

table.il { width: 100%; border-collapse: collapse; }
.il th { text-align: left; font-weight: 400; font-size: 11px; color: var(--text-tertiary); padding: 0 6px 6px; border-bottom: 1px solid var(--border); }
.il td { padding: 8px 6px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.il tr:hover td { background: var(--surface-hover); }
.il .en { font-family: var(--font-text); font-size: 15px; }
.il .lemma { font-family: var(--font-text); font-size: 17px; }
.il .lemma[lang='he'] { font-size: 19px; }
.il .xl { font-style: italic; color: var(--text-secondary); font-family: var(--font-text); }
.il .gl { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.sn { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--accent); cursor: pointer; white-space: nowrap; }
.sn:hover { text-decoration: underline; }
.morph { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-soft); color: var(--text-secondary); letter-spacing: 0.02em; }

.bibles .b { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.bibles .b .ed { font-size: 11px; color: var(--text-tertiary); display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 20px; }
.bibles .b .ed b { font-weight: 400; color: var(--text-secondary); letter-spacing: 0.03em; margin-right: 4px; }
.bibles .b .ed button { height: 20px; font-size: 11px; padding: 0 6px; }
.bibles .b .t { font-family: var(--font-text); font-size: 16px; line-height: 1.5; margin-top: 2px; }

.xrefs .xref { display: block; width: 100%; height: auto; padding: 0; border: 0; border-radius: 0; background: none; white-space: normal; text-align: left; }
.xrefs .ref { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.xrefs .votes { color: var(--text-tertiary); font-size: 10.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.xref-credit { margin-top: 18px; line-height: 1.5; }
.xref-credit a:hover { color: var(--accent); }

.lex h2 { font-family: var(--font-text); font-weight: 400; font-size: 32px; margin: 0; }
.lex .sub { color: var(--text-secondary); margin: 4px 0 6px; }
.lex .sub i { font-family: var(--font-text); font-size: 15px; }
.lex dl { margin: 0; }
.lex dt { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 16px; }
.lex dd { margin: 4px 0 0; font-family: var(--font-text); font-size: 15.5px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; font-family: var(--font); }
.chip { padding: 2px 9px; border-radius: 99px; background: var(--surface-soft); font-size: 12px; }
.chip b { font-weight: 400; color: var(--text-tertiary); margin-left: 5px; }
.cbook { font-family: var(--font); margin: 2px 0; }
.cbook summary { font-size: 12.5px; padding: 4px 0; }
.cbook summary b { font-weight: 400; color: var(--text-tertiary); margin-left: 4px; }
.occ { columns: 2; column-gap: 16px; font-size: 12.5px; padding: 2px 0 8px 12px; }
.occ div { break-inside: avoid; padding: 2px 0; cursor: pointer; color: var(--text-secondary); }
.occ .cv { color: var(--text); font-variant-numeric: tabular-nums; display: inline-block; min-width: 38px; }
.occ div:hover, .occ div:hover .cv { color: var(--accent); }

.dict-form { display: flex; gap: 6px; margin-bottom: 14px; }
.dict-form input { flex: 1; }
.entry { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.entry .src { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
.entry h4 { margin: 2px 0 6px; font-weight: 400; font-size: 16px; }
.entry .body { font-family: var(--font-text); font-size: 15px; line-height: 1.55; white-space: pre-wrap; }

.noteed textarea { width: 100%; height: 140px; padding: 10px 12px; resize: vertical; font-family: var(--font-text); font-size: 15.5px; line-height: 1.5; }
.noteed .nstat { margin: 4px 0 18px; }

/* ---------- rich text (notes) ---------- */
.rich { outline: none; line-height: 1.6; }
.rich:empty::before, .nb-title:empty::before { content: attr(data-ph); color: var(--text-tertiary); pointer-events: none; }
.rich h1 { font-size: 24px; font-weight: 400; margin: 14px 0 6px; }
.rich h2 { font-size: 19px; font-weight: 400; margin: 12px 0 4px; }
.rich h3 { font-size: 16px; font-weight: 400; margin: 10px 0 4px; color: var(--text-secondary); }
.rich p, .rich div { margin: 0; }
.rich pre { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--surface-soft); padding: 8px 10px; border-radius: 6px; white-space: pre-wrap; }
.rich ul, .rich ol { margin: 4px 0; padding-left: 22px; }
.rich ul.dashed { list-style: none; }
.rich ul.dashed > li::before { content: '–'; margin-left: -16px; width: 16px; display: inline-block; color: var(--text-secondary); }
.noteedit { min-height: 140px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-raised); font-size: 14px; }
.noteedit:focus { border-color: var(--text-tertiary); }

/* ---------- notebook view: folders | list | editor ---------- */
.nbview { flex: 1; display: grid; grid-template-columns: 220px 300px 1fr; min-width: 0; min-height: 0; background: var(--surface-raised); }
.nb-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.nb-folders { flex: 1; overflow-y: auto; padding: 10px 8px; }
button.fold {
  justify-content: flex-start;
  display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 10px; border: 0; background: none;
  border-radius: 7px; color: var(--text); text-align: left; position: relative;
}
.fold .ic { color: var(--accent); width: 15px; height: 15px; }
.fold span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.fold b { font-weight: 400; font-size: 11.5px; color: var(--text-tertiary); }
.fold.on { background: var(--surface-soft); }
.fold .rmf { display: none; color: var(--text-tertiary); }
.fold .rmf .ic { color: inherit; width: 13px; height: 13px; }
.fold:hover .rmf { display: inline-flex; }
.fold:hover .rmf + b, .fold:hover b:has(+ .rmf) { display: none; }
.nb-side .grp { padding: 16px 10px 6px; }
.newfold { padding: 4px 6px; }
.newfold input { width: 100%; height: 28px; }
.nb-sidefoot { display: grid; gap: 2px; padding: 8px; border-top: 1px solid var(--border-subtle); }
.nb-sidefoot button { justify-content: flex-start; height: 30px; color: var(--accent); padding: 0 10px; }
.nb-sidefoot button:hover { color: var(--accent); }

.nb-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.nb-search { display: flex; align-items: center; gap: 8px; margin: 10px 10px 4px; padding: 0 10px; height: 32px; border-radius: 8px; background: var(--surface-soft); color: var(--text-tertiary); }
.nb-search input { flex: 1; border: 0; background: none; padding: 0; height: 30px; }
.nb-items { flex: 1; overflow-y: auto; padding: 0 10px 20px; }
.nb-items .grp { display: flex; align-items: center; gap: 6px; padding: 14px 10px 6px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-secondary); }
.nb-items .grp .ic { width: 12px; height: 12px; }
button.nb-item {
  justify-content: stretch; justify-items: stretch; grid-template-columns: minmax(0, 1fr);
  display: grid; gap: 2px; width: 100%; height: auto; padding: 10px 12px; border: 0; border-radius: 9px; background: none;
  text-align: left; white-space: normal; border-bottom: 1px solid var(--border-subtle);
}
.nb-item:hover { background: var(--surface-hover); }
.nb-item.on { background: var(--surface-soft); border-bottom-color: transparent; }
.nb-item .ttl { font-size: 14px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nb-item .meta { font-size: 12px; color: var(--text-tertiary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nb-item .meta .when { color: var(--text-secondary); margin-right: 4px; }
.nb-item .fold-l { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-tertiary); }
.nb-item .fold-l .ic { width: 12px; height: 12px; }
.nb-none { padding: 40px 10px; text-align: center; color: var(--text-tertiary); }

.nb-ed { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nb-tool { display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 10px; flex: none; }
.nb-tool > div { display: flex; gap: 2px; min-width: 120px; }
.nb-tool > div:last-child { justify-content: flex-end; }
.nb-tool .icon { color: var(--text-secondary); }
.nb-tool .icon:hover { color: var(--text); }
.nb-doc { flex: 1; overflow-y: auto; padding: 4px 0 30vh; }
.nb-doc > * { padding: 0 28px; } /* full width, flush left like Apple Notes */
.nb-date { text-align: left; font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 18px; }
.nb-title { font-family: var(--font-text); font-weight: 400; font-size: 30px; margin-top: 0; margin-bottom: 14px; outline: none; display: flex; align-items: baseline; gap: 14px; }
.nb-title .open { font-family: var(--font); font-size: 12.5px; color: var(--text-tertiary); cursor: pointer; display: inline-flex; align-items: center; }
.nb-title .open:hover { color: var(--accent); }
.nb-title.lemma { font-size: 40px; }
.nb-sub { color: var(--text-secondary); margin-top: -6px; }
.nb-sub i { font-family: var(--font-text); font-size: 16px; }
.nb-body { font-family: var(--font-text); font-size: 17px; line-height: 1.6; min-height: 200px; }
.nb-body.pre { white-space: pre-wrap; font-size: 16px; }
.nb-verse {
  font-family: var(--font-text); font-size: 20px; line-height: 1.55; margin: 0 28px 14px;
  border-left: 3px solid var(--border); padding: 4px 0 4px 18px !important;
}
.nb-verse.hl-y { border-left-color: var(--sw-y); } .nb-verse.hl-g { border-left-color: var(--sw-g); }
.nb-verse.hl-b { border-left-color: var(--sw-b); } .nb-verse.hl-r { border-left-color: var(--sw-r); }
.nb-verse cite { display: block; font-family: var(--font); font-style: normal; font-size: 11px; color: var(--text-tertiary); margin-top: 6px; letter-spacing: 0.04em; }
.nb-swatches { display: flex; align-items: center; gap: 6px; margin-bottom: 26px; }
.nb-swatches .sw { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid var(--surface-raised); box-shadow: 0 0 0 1px var(--border); }
.nb-swatches .sw.hl-y { background: var(--sw-y); } .nb-swatches .sw.hl-g { background: var(--sw-g); }
.nb-swatches .sw.hl-b { background: var(--sw-b); } .nb-swatches .sw.hl-r { background: var(--sw-r); }
.nb-swatches .sw.on { box-shadow: 0 0 0 1.5px var(--text); }
.nb-swatches .ghost { margin-left: 8px; height: 26px; }
.nb-blank { margin: auto; text-align: center; color: var(--text-tertiary); }
.nb-blank .solid { margin-top: 10px; }

/* Aa format menu */
.pop.fmt { width: 230px; padding: 6px; }
.fmt-inline { display: flex; justify-content: space-between; padding: 2px 2px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border-subtle); }
.fmt-inline .icon { width: 40px; }
.fmt-inline .icon.on { background: var(--accent); color: #fff; }
.pop.fmt .opt.f-title .t { font-size: 22px; }
.pop.fmt .opt.f-head .t { font-size: 17px; }
.pop.fmt .opt.f-sub .t { font-size: 14.5px; color: var(--text-secondary); }
.pop.fmt .opt.f-mono .t { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

/* ---------- dialogs / toast ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); color: var(--text);
  box-shadow: var(--shadow); padding: 22px; width: 360px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.28); }
.login { display: grid; gap: 12px; }
.login p { margin: 0; line-height: 1.5; }
.login label { display: grid; gap: 4px; color: var(--text-secondary); font-size: 12px; }
.login .field-error { color: var(--accent); font-size: 11.5px; }
.login input[aria-invalid="true"] { border-color: var(--accent); }
.login button:disabled { opacity: 0.5; cursor: wait; }
.pop .sync-status { font-size: 11px; color: var(--text-tertiary); padding: 2px 9px 6px; }
.login .row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.keys h2 { margin: 0 0 12px; font-weight: 400; font-size: 18px; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 18px; align-items: center; }
.keys dt { text-align: right; }
.keys dd { margin: 0; color: var(--text-secondary); }
.keys form { display: flex; justify-content: flex-end; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(16px); opacity: 0; z-index: 70;
  display: flex; align-items: center; gap: 12px;
  background: var(--button); color: var(--button-text); padding: 8px 14px; border-radius: 8px;
  transition: 0.18s; pointer-events: none;
}
.toast.act.on { pointer-events: auto; padding-right: 6px; }
.toast .undo { height: 24px; border: 0; background: rgba(127, 127, 127, 0.22); color: inherit; padding: 0 10px; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- narrow ---------- */

@media (max-width: 1100px) { .nbview { grid-template-columns: 180px 260px 1fr; } }
@media (max-width: 900px) {
  .nbview { grid-template-columns: 1fr; }
  .nb-side, .nb-list { display: none; }
  .top { gap: 6px; padding: 0 8px; }

  #where { min-width: 0; }
  .study { position: fixed; inset: auto 0 0 0; width: auto; height: 62vh; border-left: 0; border-top: 1px solid var(--border); box-shadow: var(--shadow); z-index: 40; border-radius: 14px 14px 0 0; }
  .pane { min-width: 100vw; scroll-snap-align: start; }
  .panes { scroll-snap-type: x mandatory; }
  #add-pane { display: none; }
  .sects { grid-template-columns: 1fr; }
  .page { padding: 0 16px; }
}
