* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Frank Ruehl CLM", "SBL Hebrew", "David", sans-serif;
  background: #fafaf7;
  color: #222;
}
header {
  padding: 8px 16px;
  background: #2b2b2b;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
header select { font-size: 14px; padding: 2px 4px; }
header .status { margin-inline-start: auto; opacity: 0.7; font-size: 13px; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  height: calc(100vh - 44px);
  overflow: hidden;
}
main > * { min-width: 0; min-height: 0; }
#reader-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 320px;
  border-inline-start: 1px solid #ddd;
  min-width: 0;
  overflow: hidden;
}
#reader-pane > * { min-width: 0; min-height: 0; }
#daf-text {
  overflow: auto;
  padding: 24px 32px;
  font-size: 22px;
  line-height: 2.1;
  background: #fff;
}
.daf-word {
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
  transition: background 0.08s;
}
.daf-word:hover { background: #ffe9a8; }
.daf-word.selected { background: #ffd24a; }
.daf-word.no-unit { color: #888; }

#local-evidence, #external-evidence {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #ddd;
  background: #f3f1eb;
  min-height: 0;
}
#external-evidence { border-top: none; border-inline-start: 1px solid #ddd; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px 0;
  border-bottom: 1px solid #ccc;
  background: #ece9df;
}
.tab {
  background: #ddd9cd;
  border: 1px solid #ccc;
  border-bottom: none;
  padding: 6px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
}
.tab.active { background: #fff; font-weight: 600; }
.tab-loc { font-weight: 400; color: #555; margin-inline-start: 4px; }

.synopsis-loc {
  position: sticky;
  inset-inline-start: 0;
  background: #fff7d8;
  border-bottom: 1px solid #e0d99c;
  padding: 4px 8px;
  margin: -12px -16px 8px;
  font-weight: 600;
  font-size: 14px;
  z-index: 2;
  width: max-content;
  min-width: 100%;
}
.tab-body { padding: 12px 16px; overflow: auto; flex: 1; min-height: 0; min-width: 0; font-size: 14px; }
.hint { color: #888; font-style: italic; }

table.synopsis {
  border-collapse: collapse;
  font-size: 15px;
  direction: rtl;
}
table.synopsis td, table.synopsis th {
  border: 1px solid #ddd;
  padding: 3px 6px;
  white-space: nowrap;
  vertical-align: top;
}
table.synopsis th {
  background: #efece2;
  font-weight: 600;
  position: sticky;
  inset-inline-start: 0;
  text-align: start;
  font-size: 13px;
}
table.synopsis td.gap { color: #bbb; }
table.synopsis td.hit { background: #ffd24a; font-weight: 600; }
table.synopsis td.hit-col { background: #fff4cf; }
table.synopsis tr.row-hit td { background: #fff4cf; }

.swap-summary { margin: 6px 0 12px; }
.swap-summary summary { cursor: pointer; font-weight: 600; }
.swap-list { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; }
.swap-form { background: #e8e4d2; border-radius: 4px; padding: 2px 6px; font-size: 14px; cursor: pointer; user-select: none; }
.swap-form:hover { background: #d8d4c0; }
.swap-form.active { background: #ffd24a; }
.other-form.active { background: #ffd24a; padding: 0 4px; border-radius: 3px; font-weight: 600; }
.filter-witnesses {
  margin-top: 4px;
  padding: 4px 6px;
  background: #fff4cf;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1.7;
}
.filter-witnesses .fw { white-space: nowrap; }
.filter-witnesses .fw-meta { color: #666; font-size: 12px; }

.info-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  padding: 0 6px;
  cursor: pointer;
  font-size: 13px;
  margin-inline-start: 8px;
}
.info-btn:hover { background: #ffe9a8; }
.witness-info-pop {
  position: absolute;
  inset-inline-start: 8px;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #b0a060;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  padding: 8px;
  z-index: 5;
  max-width: 720px;
  max-height: 360px;
  overflow: auto;
}
table.witness-info {
  border-collapse: collapse;
  font-size: 13px;
  direction: rtl;
}
table.witness-info th, table.witness-info td {
  border: 1px solid #e0dcca;
  padding: 3px 6px;
  text-align: start;
  vertical-align: top;
}
table.witness-info thead th { background: #efece2; }
table.witness-info tbody th { background: #faf8ee; font-weight: 600; white-space: nowrap; }

.parma-search-bar {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 8px;
  align-items: center;
}
.parma-search-bar input {
  flex: 1;
  padding: 4px 8px;
  font-size: 15px;
}
.parma-search-bar button { padding: 4px 10px; cursor: pointer; }

.parma-forms {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: #555;
}
.parma-group { margin-bottom: 14px; }
.parma-group h4 { margin: 8px 0 4px; font-size: 14px; }
.parma-occ {
  padding: 3px 0;
  border-bottom: 1px dotted #e2dec8;
  font-size: 14px;
  line-height: 1.6;
}
.parma-locus {
  display: inline-block;
  min-width: 38px;
  color: #205020;
  background: #d8e7cc;
  border-radius: 3px;
  padding: 0 5px;
  font-weight: 600;
  font-size: 13px;
  margin-inline-end: 6px;
}
.parma-ctx { color: #333; }
.parma-noteref {
  font-size: 10px;
  color: #c08000;
  cursor: help;
  margin: 0 1px;
}
.parma-form-hit {
  background: #ffd24a;
  font-weight: 600;
  padding: 0 3px;
  border-radius: 3px;
}
.parma-form-hit.conf-low, .conf-low { color: #b87a00; font-style: italic; }
.parma-form-hit.conf-medium, .conf-medium { color: #806000; }

.mishnah-sources { display: flex; flex-direction: column; gap: 10px; }
.mishnah-sources[hidden] { display: none; }   /* [hidden] must beat display:flex */

/* View toggle in the משנה search bar */
.mishnah-view-toggle { display: inline-flex; gap: 0; margin-inline-start: 8px; }
.mishnah-view-toggle button {
  border: 1px solid #ccc;
  background: #fff;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.mishnah-view-toggle button:first-child { border-radius: 4px 0 0 4px; }
.mishnah-view-toggle button:last-child  { border-radius: 0 4px 4px 0; margin-inline-start: -1px; }
.mishnah-view-toggle button.active { background: #ffd24a; font-weight: 600; }

/* By-location view */
.byloc-summary { margin-bottom: 8px; font-size: 14px; }
.byloc-list { display: flex; flex-direction: column; gap: 6px; }
.byloc-row { border: 1px solid #e0dcca; border-radius: 4px; background: #fffdf3; }
.byloc-row > summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px;
  cursor: pointer;
  background: #efece2;
  border-radius: 4px 4px 0 0;
  list-style: none;
}
.byloc-row[open] > summary { border-bottom: 1px solid #e0dcca; }
.byloc-row > summary::-webkit-details-marker { display: none; }
.byloc-locus { font-weight: 600; }
.byloc-srcs { display: inline-flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.byloc-src-pill {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  color: #fff;
  background: #888;
}
.byloc-src-pill.src-parma     { background: #6f4d2f; }
.byloc-src-pill.src-kaufmann  { background: #2f5d6f; }
.byloc-src-pill.src-cambridge { background: #4a5e3a; }
.byloc-src-pill.src-albeck    { background: #6a4a6a; }

.byloc-body { padding: 6px 10px; }
.byloc-src { margin-bottom: 6px; }
.byloc-src-title {
  font-size: 11px; color: #666;
  border-bottom: 1px dotted #d8d2b8; padding-bottom: 2px; margin-bottom: 3px;
  letter-spacing: 0.3px;
}
.byloc-occ { font-size: 14px; line-height: 1.7; }

.mishnah-source {
  border: 1px solid #e0dcca;
  border-radius: 4px;
  background: #fffdf3;
}
.mishnah-source > summary {
  padding: 6px 10px;
  cursor: pointer;
  background: #efece2;
  border-radius: 4px 4px 0 0;
  list-style: none;
}
.mishnah-source[open] > summary { border-bottom: 1px solid #e0dcca; }
.mishnah-source > summary::-webkit-details-marker { display: none; }
.mishnah-source > div { padding: 8px 10px; }
.msrc-meta { color: #666; font-size: 12px; font-weight: 400; margin-inline-start: 6px; }

.parma-expand {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 12px;
  cursor: pointer;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.parma-expand:hover { background: #ffe9a8; }

.kauf-expand {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 12px;
  cursor: pointer;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.kauf-expand:hover { background: #ffe9a8; }
.folio-link { color: #2050a0; text-decoration: none; font-size: 12px; margin-inline-start: 4px; }
.folio-link:hover { text-decoration: underline; }
.kauf-img-pane {
  margin: 6px 0;
  background: #fff;
  border: 1px solid #d9d2a8;
  border-radius: 4px;
  padding: 6px;
  overflow: auto;
}
.kauf-img-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid #ccc;
  background: #f5f0e6;
}
.kauf-img-inner {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  background-repeat: no-repeat;
}
.kauf-bbox {
  position: absolute;
  border: 2px solid #d92c2c;
  background: transparent;
  pointer-events: none;
  animation: kauf-bbox-flash 1.6s ease-in-out infinite;
}
@keyframes kauf-bbox-flash {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; background: rgba(255, 60, 60, 0.20); }
}
.kauf-img-cap { font-size: 12px; margin-top: 4px; }

.albeck-pdf-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 12px;
  cursor: pointer;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.albeck-pdf-btn:hover { background: #ffe9a8; }
.albeck-pdf-pane {
  margin: 6px 0;
  background: #fff;
  border: 1px solid #d9d2a8;
  border-radius: 4px;
  padding: 6px;
}
.albeck-pdf-nav-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}
.albeck-pdf-nav { padding: 2px 8px; cursor: pointer; }
.albeck-pdf-pageno { font-weight: 600; }
.albeck-pdf-img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid #ccc;
  background: #f5f0e6;
}
.kauf-img-cap a { color: #2050a0; text-decoration: none; }
.kauf-img-cap a:hover { text-decoration: underline; }

.camb-expand {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 12px;
  cursor: pointer;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.camb-expand:hover { background: #ffe9a8; }
.camb-img-pane {
  margin: 6px 0;
  background: #fff;
  border: 1px solid #d9d2a8;
  border-radius: 4px;
  padding: 6px;
}
.camb-iiif-img { max-width: 100%; height: auto; display: block; border: 1px solid #ccc; }
.parma-full {
  margin: 6px 0 4px 24px;
  padding: 6px 8px;
  background: #fffdf3;
  border: 1px dashed #d9d2a8;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.7;
}
.parma-full-text { color: #333; }
.parma-full-note { margin-top: 4px; font-size: 12px; }

.pv-table {
  margin-top: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.pv-head, .pv-row {
  display: grid;
  grid-template-columns: 1fr 60px 3fr;
  gap: 8px;
  padding: 5px 8px;
  align-items: baseline;
}
.pv-head {
  background: #efece2;
  font-size: 12px;
  color: #666;
  font-weight: 600;
}
.pv-row {
  border-top: 1px solid #eee;
  cursor: pointer;
  font-size: 14px;
}
.pv-row:hover { background: #fff4cf; }
.pv-row.primary { background: #fff4cf; }
.pv-row.primary .pv-form { font-weight: 700; }
.pv-form { color: #333; }
.pv-count { color: #205020; font-weight: 600; text-align: start; }
.pv-tracts { color: #555; font-size: 13px; }
.pv-zero { padding: 6px 8px; font-size: 12px; }

/* When Parma tab is active, widen the right panel from 420px to ~50%. */
body.parma-wide main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
body.dict-wide main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* ---- Dictionary panel ---- */
.dict-search-bar {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 8px;
  align-items: center;
}
.dict-search-bar input { flex: 1; padding: 4px 8px; font-size: 15px; }
.dict-search-bar button { padding: 4px 10px; cursor: pointer; }
#dict-settings-btn { padding: 4px 8px; font-size: 15px; line-height: 1; }
#dict-settings-btn.active { background: #ffd24a; }

.dict-settings {
  border: 1px solid #e2e0d6;
  border-radius: 5px;
  background: #faf9f3;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.dict-settings-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.dict-dialect-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px 10px;
}
.dict-dialect-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
}
.dict-dialect-item input { cursor: pointer; }
.dict-settings-note { font-size: 11px; color: #886; margin-top: 6px; }

.dict-section { margin-bottom: 12px; border: 1px solid #e2e0d6; border-radius: 5px; background: #fff; }
.dict-section > summary {
  cursor: pointer;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 14px;
  background: #efece2;
  border-radius: 5px 5px 0 0;
  list-style-position: inside;
}
.dict-section[open] > summary { border-bottom: 1px solid #e2e0d6; }
.dict-section-body { padding: 8px 10px; }

.dict-via, .dict-chip .via { color: #885; font-size: 12px; }

/* Sokoloff PDF viewer */
.dict-pdf-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dict-pdf-bar button {
  border: 1px solid #ccc; background: #fff; border-radius: 4px;
  padding: 0 10px; font-size: 16px; cursor: pointer; line-height: 1.6;
}
.dict-pdf-bar button:disabled { opacity: 0.4; cursor: default; }
.dict-pdf-caption { flex: 1; font-size: 12px; color: #555; }
.dict-pdf-canvas-wrap {
  border: 1px solid #ddd; background: #f7f6f1; border-radius: 4px;
  overflow: auto; max-height: 70vh; text-align: center;
}
.dict-pdf-page { position: relative; display: inline-block; direction: ltr; }
.dict-pdf-page canvas { display: block; max-width: 100%; }

/* pdf.js text layer — transparent, selectable OCR text overlaid on the canvas. */
.textLayer {
  position: absolute;
  text-align: initial;
  inset: 0;
  overflow: clip;
  opacity: 1;
  line-height: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  caret-color: CanvasText;
  z-index: 1;
}
.textLayer span, .textLayer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(0, 90, 255, 0.28); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  user-select: none;
}
.textLayer.selecting .endOfContent { top: 0; }
.dict-pdf-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.dict-chip {
  background: #e8e4d2; border-radius: 4px; padding: 2px 7px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.dict-chip:hover { background: #d8d4c0; }
.dict-chip.active { background: #ffd24a; font-weight: 600; }
.dict-chip-xref { background: #e7eef6; border: 1px dashed #9fb6d0; }
.dict-xref-note { margin: 0 0 6px; }

.cal-detail { margin-top: 8px; }
.cal-compounds-toggle {
  display: block; width: 100%; text-align: start;
  margin-top: 10px; padding: 6px 0; border: none; border-top: 1px solid #e2dec8;
  background: none; cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 600; color: #555;
}
.cal-compounds-toggle:hover { color: #222; }
.cal-compounds-toggle .ct-caret { display: inline-block; width: 1em; color: #999; }
.cal-compounds-body { margin-top: 6px; }

/* CAL structured entries — English-primary content, so left-justified, with
   Hebrew headwords/citations isolated back to RTL. */
.cal-entry { padding: 6px 0; border-bottom: 1px dotted #e2dec8; direction: ltr; text-align: left; }
.cal-entry:last-child { border-bottom: none; }
.cal-hw, .cal-cit-he { direction: rtl; unicode-bidi: isolate; }
.cal-head { line-height: 1.8; }
.cal-hw { font-size: 19px; font-weight: 700; }
.cal-voc { color: #444; font-size: 14px; }
.cal-translit { color: #888; font-size: 13px; font-style: italic; }
.cal-pos { color: #205020; font-size: 12px; background: #e3edda; border-radius: 3px; padding: 0 5px; }
.cal-gloss { color: #222; }
.cal-senses { margin: 4px 0 0; padding-inline-start: 22px; }
.cal-sense { margin: 3px 0; line-height: 1.6; }
.cal-binyan { color: #704000; font-size: 12px; font-weight: 600; }
.cal-dialect {
  display: inline-block; background: #e0e6ef; color: #2a4a7a;
  border-radius: 3px; padding: 0 4px; font-size: 11px; margin-inline-end: 3px;
}
.cal-citation {
  margin: 3px 0 3px 14px; padding-inline-start: 8px;
  border-inline-start: 2px solid #e0dcca; font-size: 13px; line-height: 1.6;
}
.cal-cit-he { font-size: 15px; }
.cal-cit-tr { color: #444; font-style: italic; }
.cal-cit-ref { color: #777; font-size: 12px; }

.dict-xrefs { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 5px; }
.dict-xref {
  background: #f0ead8; border: 1px solid #ddd0a8; color: #6a5800;
  border-radius: 3px; padding: 0 6px; font-size: 12px;
}

/* Jastrow — English-primary definitions, left-justified; Hebrew headword RTL. */
.jas-entry { padding: 6px 0; border-bottom: 1px dotted #e2dec8; direction: ltr; text-align: left; }
.jas-entry:last-child { border-bottom: none; }
.jas-head { line-height: 1.8; }
.jas-hw { font-size: 18px; font-weight: 700; direction: rtl; unicode-bidi: isolate; }
.jas-src { text-decoration: none; color: #2050a0; font-size: 14px; }
.jas-body { font-size: 15px; line-height: 1.7; direction: ltr; text-align: left; }
.jas-body .jas-sense { margin: 2px 0; }
.jas-body .jas-d1 { margin-inline-start: 16px; }
.jas-body .jas-d2 { margin-inline-start: 32px; }
.jas-body a { color: #2050a0; text-decoration: none; }
.jas-body a:hover { text-decoration: underline; }

.locations { display: flex; flex-direction: column; gap: 6px; }
.loc {
  border-bottom: 1px solid #e2e0d6;
  padding-bottom: 6px;
}
.loc a.occ-link { color: #2050a0; text-decoration: none; }
.loc a.occ-link:hover { text-decoration: underline; }
.ratio {
  display: inline-block;
  background: #d8e7cc;
  color: #205020;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  margin-inline-start: 6px;
}
.loc-others {
  margin-top: 2px;
  color: #555;
  font-size: 13px;
  line-height: 1.5;
}

.witness-block { margin-bottom: 14px; }
.witness-block h4 { margin: 0 0 4px; font-size: 14px; }
.witness-block .occ { font-size: 13px; margin: 2px 0; }
.witness-block .occ a { color: #2050a0; text-decoration: none; cursor: pointer; }
.witness-block .occ a:hover { text-decoration: underline; }
.count-badge {
  display: inline-block;
  background: #ddd;
  border-radius: 8px;
  padding: 0 6px;
  margin-inline-start: 4px;
  font-size: 12px;
}

/* =================== Menukad-scan OCR =================== */
.menukad-card { padding: 4px 2px; }
.menukad-form {
  font-size: 30px; line-height: 1.6; font-weight: 600; color: #1a3a6b;
  font-family: "SBL Hebrew", "Frank Ruehl CLM", "David", serif;
}
.menukad-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.menukad-chip { padding: 1px 8px; border-radius: 10px; color: #fff; font-weight: 600; }
.menukad-chip.menukad-exact { background: #1a7f37; }
.menukad-chip.menukad-fuzzy { background: #b8860b; }
.menukad-chip.menukad-missing, .menukad-chip.menukad-ocr_only { background: #999; }
.menukad-conf, .menukad-base { color: #555; }
.menukad-show-img {
  margin-top: 12px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  background: #ece9df; border: 1px solid #ccc; border-radius: 6px;
}
.menukad-show-img:hover { background: #e0dcce; }

/* Whole-page OCR view */
.menukad-page-meta { font-size: 12px; color: #666; margin-bottom: 6px; }
.menukad-page {
  font-family: "SBL Hebrew", "Frank Ruehl CLM", "David", serif;
  font-size: 19px;
  line-height: 1.5;
  direction: rtl;
  color: #1a1a1a;
}
.menukad-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}
.menukad-w { padding: 0 1px; border-radius: 3px; cursor: pointer; }
.menukad-w:hover { background: #ffe9a8; }
/* exact matches: no extra styling — read naturally */
.menukad-w.menukad-fuzzy    { background: #fff4cf; }
.menukad-w.menukad-missing  { color: #999; font-style: italic; }
.menukad-w.menukad-ocr_only { background: #e3eaf5; color: #1a3a6b; }
.menukad-w.hl {
  background: #ffd24a;
  font-weight: 700;
  outline: 2px solid #b87a00;
  animation: menukad-hl-flash 1.4s ease-in-out 0s 2;
}
@keyframes menukad-hl-flash {
  0%, 100% { background: #ffd24a; }
  50%      { background: #fff4cf; }
}

.tab-close {
  margin-inline-start: 6px; color: #a00; font-weight: 700; cursor: pointer;
  border-radius: 3px; padding: 0 3px;
}
.tab-close:hover { background: #f0c0c0; }

.scan-img-pane { overflow: auto; height: 100%; background: #54534f; padding: 8px; }
.scan-col {
  position: relative; direction: ltr; margin: 0 auto;
  overflow: hidden;            /* clip to the body-text column horizontally */
  box-shadow: 0 2px 12px rgba(0,0,0,.5); background: #fff;
}
.scan-img { display: block; }
.scan-bbox {
  position: absolute; border: 2px solid #e0a800; background: rgba(255,213,74,.28);
  border-radius: 2px; pointer-events: none;
  animation: scan-bbox-flash 1.6s ease-in-out infinite;
}
@keyframes scan-bbox-flash {
  0%, 100% { background: rgba(255,213,74,.12); }
  50%      { background: rgba(255,213,74,.40); }
}

/* ── mishnah parallel-columns (index) view ── */
.mpar-nav { display: flex; gap: 12px; margin-bottom: 8px; font-size: 14px; }
.mpar-nav select { font-size: 14px; }
.mpar-head { font-weight: 600; margin-bottom: 6px; }
.mpar-rows { display: flex; flex-direction: column; gap: 6px; }
.mpar-row {
  border: 1px solid #e0dcca; border-radius: 4px; background: #fffdf3;
  padding: 6px 8px;
}
.mpar-row.mpar-spine { background: #fff7d6; border-color: #e6c84a; }
.mpar-srclabel {
  font-size: 12px; font-weight: 600; color: #555;
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 3px;
}
.mpar-text { font-size: 17px; line-height: 1.7; }
.mpar-badge {
  font-size: 11px; font-weight: 500; padding: 1px 5px; border-radius: 3px;
  border: 1px solid transparent;
}
.mpar-loc   { background: #eef; color: #335; border-color: #ccd; }
.mpar-split { background: #e7f5e7; color: #275; border-color: #bde0bd; }
.mpar-merge { background: #fdeede; color: #964; border-color: #eed3ad; }
.mpar-low   { background: #fde7e7; color: #944; border-color: #eebcbc; }
.mpar-frac  { background: #f0f0f0; color: #666; border-color: #ddd; margin-inline-start: auto; }

/* ── unified image panel additions ── */
.scan-imgpanel-header {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px 8px;
  font-size: 13px; flex-wrap: wrap;
}
.scan-imgpanel-header button {
  font-size: 13px; padding: 2px 8px; cursor: pointer;
  border: 1px solid #ccc; border-radius: 4px; background: #fafafa;
}
.scan-img-plain { border: 1px solid #ddd; }
.mpar-img-btn {
  font-size: 12px; padding: 0 4px; margin-inline-start: 4px; cursor: pointer;
  border: 1px solid #ccd; border-radius: 3px; background: #eef; line-height: 1.6;
}
.mpar-img-btn:hover { background: #dde; }
