:root {
  /* Paleta de Torá para Todos: azul del texto del logo y dorado de la menorá */
  --brand-blue: #1250b0;
  --brand-gold: #e6b80d;
  --bg: #f8f6f0;
  --panel: #ffffff;
  --panel-2: #f1eee4;
  --text: #1b2433;
  --muted: #667085;
  --line: #e3ddcb;
  --accent: var(--brand-blue);
  --accent-bg: #dce7f9;
  --gold-bg: #fbf0c6;
  --font-title: 'Marcellus', 'Frank Ruhl Libre', Georgia, serif;
  --c0: #fde68a;
  --c1: #bfdbfe;
  --c2: #bbf7d0;
  --c3: #fbcfe8;
  --c4: #fed7aa;
  --c5: #ddd6fe;
  --serif-he: 'Frank Ruhl Libre', 'SBL Hebrew', 'Times New Roman', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --bg: #0f1522; --panel: #18202f; --panel-2: #212b3d; --text: #e8ecf4; --muted: #9aa6bb; --line: #2c384e; --accent: #7ba6f0; --accent-bg: #1f3558; --gold-bg: #3a3212; color-scheme: dark; }
}
:root[data-theme='dark'] { --bg: #0f1522; --panel: #18202f; --panel-2: #212b3d; --text: #e8ecf4; --muted: #9aa6bb; --line: #2c384e; --accent: #7ba6f0; --accent-bg: #1f3558; --gold-bg: #3a3212; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover:not(:disabled) { background: var(--panel-2); }
button:disabled { opacity: .35; cursor: default; }
button.on { background: var(--accent-bg); border-color: var(--accent); }
select { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; padding: 0 12px; }
.status { color: var(--muted); padding: 16px; }
.status.err { color: #dc2626; }
.he { font-family: var(--serif-he); }

/* ---------- cabecera y pestañas ---------- */
#topbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-bottom: 3px solid var(--brand-gold); box-shadow: 0 1px 6px rgba(18, 80, 176, .08); }
.brand { flex: none; display: flex; align-items: center; border-radius: 8px; padding: 0 6px; margin-right: 4px; }
.brand img { height: 52px; width: auto; display: block; }
:root[data-theme='dark'] .brand { background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .brand { background: #fff; } }
#topbar > button, .add-wrap > button { flex: none; }
#tabs { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.tab { flex: none; display: flex; align-items: center; gap: 6px; max-width: 220px; padding: 5px 6px 5px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; user-select: none; }
.tab.on { background: var(--accent-bg); border-color: var(--accent); font-weight: 600; box-shadow: inset 0 -3px 0 var(--brand-gold); }
.tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-x { border: 0; background: transparent; padding: 0 5px; border-radius: 4px; color: var(--muted); }
.tab-x:hover { background: var(--line) !important; color: var(--text); }
.add-wrap { position: relative; }
#add-menu { position: absolute; right: 0; top: 110%; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; min-width: 210px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#add-menu[hidden] { display: none; }
#add-menu button { border: 0; text-align: left; background: transparent; padding: 8px 10px; }
#add-menu button:hover { background: var(--panel-2); }

/* ---------- estructura ---------- */
#layout { flex: 1; display: flex; min-height: 0; }
#sidebar { width: 300px; flex: none; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding-bottom: 12px; }
#sidebar.collapsed { display: none; }
.side-section { padding: 12px; border-bottom: 1px solid var(--line); }
.side-title { font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
#q { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
button.link { border: 0; background: none; color: var(--accent); padding: 6px 0; font-size: 13px; }
#results { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.res { text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; }
.res { display: flex; justify-content: space-between; gap: 8px; }
.res-he { font-size: 17px; color: var(--muted); }
.res:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--panel-2); }
.res.top { background: var(--accent-bg); }
.res.snip { display: block; border-bottom: 1px solid var(--line); border-radius: 0; }
.res .ref { font-weight: 600; font-size: 13px; }
.snippet { font-size: 13px; color: var(--muted); margin-top: 2px; }
.snippet.he { font-family: var(--serif-he); font-size: 16px; }
.snippet b { background: var(--c0); color: #111; border-radius: 2px; }
.file-row { display: flex; gap: 2px; }
.file-row button:first-child { flex: 1; text-align: left; border: 0; background: transparent; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .x { border: 0; background: transparent; color: var(--muted); }
#views { flex: 1; min-width: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }

/* ---------- barras de herramientas ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.seg-group { display: inline-flex; }
.seg-group > button { border-radius: 0; margin-left: -1px; }
.seg-group > button:first-child { border-radius: 6px 0 0 6px; margin: 0; }
.seg-group > button:last-child { border-radius: 0 6px 6px 0; }
.seg-group > .zoom-label { padding: 4px 8px; border: 1px solid var(--line); margin-left: -1px; min-width: 52px; text-align: center; background: var(--panel); }

/* ---------- visor de texto ---------- */
.tv-bar .tv-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 120px; text-align: center; }
.tv-title .he-t { font-family: var(--serif-he); font-size: 18px; }
.tv-title .en-t { font-size: 12px; color: var(--muted); }
.tv-bar .side-toggle { margin-left: auto; }
.hl-bar { padding: 4px 10px; gap: 6px; background: var(--panel-2); }
.hl-label { font-size: 13px; color: var(--muted); }
.hl-btn { padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.hl-btn.on { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 600; }
.hl-btn.c0 { background: var(--c0); color: #111; } .hl-btn.c1 { background: var(--c1); color: #111; } .hl-btn.c2 { background: var(--c2); color: #111; }
.hl-btn.c3 { background: var(--c3); color: #111; } .hl-btn.c4 { background: var(--c4); color: #111; } .hl-btn.c5 { background: var(--c5); color: #111; }
.hl-btn.c0:hover, .hl-btn.c1:hover, .hl-btn.c2:hover, .hl-btn.c3:hover, .hl-btn.c4:hover, .hl-btn.c5:hover { filter: brightness(.95); }
.hl-bar .hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.tv-body { flex: 1; display: flex; min-height: 0; }
.tv-main { flex: 1; overflow-y: auto; padding: 18px 24px 80px; min-width: 0; }
.tv-main.marking { cursor: crosshair; }
.tv-side { width: 340px; flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.tv-side[hidden] { display: none; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.side-head .x { border: 0; background: transparent; }
.tv-side details { border-bottom: 1px solid var(--line); }
.tv-side summary { cursor: pointer; padding: 8px 12px; font-weight: 600; }
.tv-side summary small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.link-item { display: flex; width: 100%; justify-content: space-between; gap: 8px; border: 0; border-radius: 0; background: transparent; padding: 6px 12px 6px 22px; text-align: left; }
.link-item .he { font-size: 17px; }
.link-item small { color: var(--muted); }

.tv-text { max-width: 1250px; margin: 0 auto; --fs: 24px; }
.seg { position: relative; display: grid; gap: 4px 36px; padding: 8px 4px 8px 34px; border-radius: 8px; }
.seg:hover { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.seg.sel { background: var(--accent-bg); }
.segnum { position: absolute; left: 2px; top: 10px; width: 26px; padding: 0; font-size: 12px; color: var(--muted); border: 0; background: transparent; border-radius: 50%; }
.segnum:hover { background: var(--accent-bg) !important; color: var(--text); }
.txt { line-height: 1.7; }
.txt:empty { display: none; }
.txt.he { font-family: var(--serif-he); font-size: var(--fs); text-align: right; }
.txt.en { font-size: calc(var(--fs) * 0.72); font-family: Georgia, 'Times New Roman', serif; color: var(--text); }
.lang-he .txt.en { display: none; }
.lang-en .txt.he { display: none; }
.lang-both .seg { grid-template-columns: 1fr 1fr; }
.lang-both .txt.he { grid-column: 2; grid-row: 1; }
.lang-both .txt.en { grid-column: 1; grid-row: 1; }
.lang-both .txt.he:empty + .txt.en, .lang-both .seg:not(:has(.txt.en:not(:empty))) .txt.he { grid-column: 1 / -1; }
.footnote, .footnote-marker { display: none; }
.txt big { font-size: 1.15em; }
.txt strong, .txt b { font-weight: 700; }
mark.hl { color: #111; border-radius: 3px; padding: 0 1px; }
mark.c0 { background: var(--c0); } mark.c1 { background: var(--c1); } mark.c2 { background: var(--c2); }
mark.c3 { background: var(--c3); } mark.c4 { background: var(--c4); } mark.c5 { background: var(--c5); }
.tv-main.marking ::selection { background: rgba(37, 99, 235, .35); }
.source { text-align: center; font-size: 12px; color: var(--muted); margin-top: 30px; }
@media (max-width: 800px) { .lang-both .seg { grid-template-columns: 1fr; } .lang-both .txt.he, .lang-both .txt.en { grid-column: 1; grid-row: auto; } }

/* ---------- hoja de Talmud ---------- */
.is-daf:not(.no-sides) .lang { display: none; }
.tv-text.daf-mode { max-width: none; }
.daf-page { width: calc(var(--fs) * 42); margin: 8px auto 0; padding: 26px 30px 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 14px rgba(0,0,0,.14); font-family: var(--serif-he); font-size: var(--fs); line-height: 1.65; }
.daf-head { text-align: center; border-bottom: 3px double var(--line); margin-bottom: 18px; padding-bottom: 8px; line-height: 1.3; }
.daf-head .t { font-size: 1.5em; font-weight: 700; }
.daf-head .s { font: 12px system-ui, sans-serif; color: var(--muted); direction: ltr; }
.daf-block { position: relative; margin: 0 0 .7em; text-align: justify; text-align-last: right; }
.daf-block .tag { position: absolute; right: 100%; margin-right: 12px; top: .3em; writing-mode: vertical-rl; font: 11px system-ui, sans-serif; color: var(--muted); letter-spacing: .05em; }
.daf-block.k-mishna { font-weight: 700; font-size: 1.08em; padding: 6px 10px; margin-inline: -10px; border-radius: 4px; background: color-mix(in srgb, var(--c0) 22%, transparent); border-inline-start: 4px solid var(--c0); }
.daf-block.k-mishna .tag { margin-right: 18px; }
.daf-block.k-hadran { text-align: center; text-align-last: center; margin: 1em 0; }
.daf-page big strong { font-size: 1.45em; }
.daf-page .txt.he { font-size: inherit; line-height: inherit; text-align: inherit; }
.dseg.sel { background: var(--accent-bg); border-radius: 4px; }
.dnum { font: 10px system-ui, sans-serif; vertical-align: super; border: 0; background: none; color: var(--muted); padding: 0 2px; opacity: .45; border-radius: 3px; }
.dnum:hover { opacity: 1; background: var(--accent-bg) !important; }

.daf-page.no-side { width: calc(var(--fs) * 24); padding-inline: 46px 40px; }
.daf-page.no-side .dcol, .daf-page.no-side .daf-bottom { display: none; }
.daf-page.no-side .daf-grid { grid-template-columns: 1fr; margin-top: 0; }
.daf-page.no-side .dcenter { border: 0; padding: 0; }
.daf-page:not(.no-side) .daf-block .tag { display: none; }
.daf-grid { display: grid; direction: ltr; grid-template-columns: 26fr 48fr 26fr; column-gap: 14px; margin-top: 1.6em; }
.dcol, .dcenter, .daf-bottom .ctext { direction: rtl; }
.dcol { position: relative; font-size: calc(var(--fs) * var(--sf, .7)); line-height: 1.5; }
.dcenter { border-inline: 1px solid var(--line); padding-inline: 12px; }
.dlabel { position: absolute; top: -1.7em; inset-inline: 0; text-align: center; font: 600 .85em/1 var(--serif-he); color: var(--muted); letter-spacing: .04em; }
.ctext { font-family: 'Noto Rashi Hebrew', var(--serif-he); text-align: justify; text-align-last: right; }
.ctext b { font-weight: 700; }
.daf-bottom { display: grid; direction: ltr; grid-template-columns: 1fr 1fr; column-gap: 28px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: calc(var(--fs) * var(--sf, .7)); line-height: 1.5; }
.daf-bottom[hidden] { display: none; }
.daf-bottom.single { display: block; column-count: 2; column-gap: 28px; direction: rtl; }
.ctext.cont.sep { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.daf-only { display: none; }
.is-daf .daf-only { display: inline-flex; }

/* ---------- dibujo ---------- */
.draw-toolbar { gap: 10px; }
.swatches { display: flex; align-items: center; gap: 4px; }
.swatch { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.color-input { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.width-ctl { display: flex; align-items: center; gap: 4px; }
.width-ctl input { width: 90px; }
.draw-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.draw-canvas:not(.active) { pointer-events: none; }
.bv { background: var(--bg); }
.board-wrap { flex: 1; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; padding: 8px; }
.board-frame { width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; box-shadow: 0 2px 16px rgba(0,0,0,.25); }
.board-frame canvas { cursor: crosshair; }

/* ---------- documentos ---------- */
.dv-scroll { flex: 1; overflow: auto; background: #6b7280; padding: 16px; }
.dv-pages { --zoom: 1; width: calc(var(--zoom) * 100%); max-width: none; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.dv-pages > .status { color: #fff; }
.dv-page { position: relative; width: 100%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.dv-page > .pdf-canvas, .dv-page > .dv-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.dv-page > .draw-canvas { position: absolute; inset: 0; }

/* ---------- notas ---------- */
.nv .note-editor { flex: 1; overflow-y: auto; padding: 24px max(24px, calc((100% - 820px) / 2)); background: var(--panel); outline: none; font-size: 18px; line-height: 1.6; }
.note-editor:empty::before { content: attr(data-ph); color: var(--muted); }
.note-editor h2 { margin: .6em 0 .3em; }

/* ---------- inicio ---------- */
.home { overflow-y: auto; }
.home-inner { max-width: 860px; margin: 0 auto; padding: 32px 24px 80px; }
.home h1 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 34px; color: var(--accent); }
.home-hero { display: flex; align-items: center; gap: 22px; margin-bottom: 14px; padding-bottom: 16px; border-bottom: 3px solid var(--brand-gold); }
.home-hero img { height: 96px; width: auto; border-radius: 10px; }
:root[data-theme='dark'] .home-hero img { background: #fff; padding: 4px 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .home-hero img { background: #fff; padding: 4px 8px; } }
.lead { color: var(--muted); margin-bottom: 20px; }
.quick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.quick button { padding: 12px 18px; font-size: 16px; }
.lib-tree details > summary { display: flex; justify-content: space-between; padding: 8px 10px; cursor: pointer; border-radius: 6px; font-weight: 600; }
.lib-tree details > summary:hover { background: var(--panel-2); }
.lib-tree .he { font-size: 18px; }
.lib-children { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 8px; }
.lib-book { display: flex; width: 100%; justify-content: space-between; border: 0; background: transparent; text-align: left; padding: 6px 10px; border-radius: 6px; }

/* ---------- ajustes ---------- */
#settings-menu { position: absolute; right: 0; top: 110%; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 300px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#settings-menu[hidden] { display: none; }
#settings-menu fieldset { border: 0; padding: 0; margin: 0 0 10px; }
#settings-menu legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
#settings-menu label { display: block; padding: 3px 0; cursor: pointer; }
#settings-menu .small { padding: 0; }
.ver-select { max-width: 230px; }
.notice { margin: 0 0 12px; padding: 6px 10px; font-size: 13px; color: var(--muted); background: var(--panel-2); border-radius: 6px; }

/* ---------- índice de libros complejos ---------- */
.toc-head h2 { margin: 0 0 4px; }
.toc-list { max-width: 760px; margin: 12px auto 0; }
.tv-text:has(.toc-list) { max-width: 760px; }
.toc-list summary { display: flex; justify-content: space-between; padding: 8px 10px; cursor: pointer; font-weight: 600; border-radius: 6px; }
.toc-list summary:hover { background: var(--panel-2); }
.toc-children { margin-left: 16px; border-left: 2px solid var(--line); padding-left: 8px; }
.toc-leaf { display: flex; width: 100%; justify-content: space-between; border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; }
.toc-list .he { font-size: 18px; }

/* ---------- módulos ---------- */
#module-btn { font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#module-menu { position: absolute; left: 0; top: 110%; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; flex-direction: column; }
#module-menu[hidden] { display: none; }
#module-menu .mod { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: transparent; padding: 10px 12px; text-align: left; border-radius: 6px; }
#module-menu .mod:hover { background: var(--panel-2); }
#module-menu .mod.on { background: var(--accent-bg); }
#module-menu .mod-name { font-weight: 600; }
#module-menu .mod-desc { font-size: 12px; color: var(--muted); }
[data-module='torah'] #layout, [data-module='torah'] #tabs, [data-module='torah'] #add-tab, [data-module='torah'] #toggle-side,
[data-module='crono'] #layout, [data-module='crono'] #tabs, [data-module='crono'] #add-tab, [data-module='crono'] #toggle-side,
[data-module='mapas'] #layout, [data-module='mapas'] #tabs, [data-module='mapas'] #add-tab, [data-module='mapas'] #toggle-side,
[data-module='hojas'] #layout, [data-module='hojas'] #tabs, [data-module='hojas'] #add-tab, [data-module='hojas'] #toggle-side,
[data-module='envivo'] #layout, [data-module='envivo'] #tabs, [data-module='envivo'] #add-tab, [data-module='envivo'] #toggle-side,
[data-module='manual'] #layout, [data-module='manual'] #tabs, [data-module='manual'] #add-tab, [data-module='manual'] #toggle-side,
[data-module='calendario'] #layout, [data-module='calendario'] #tabs, [data-module='calendario'] #add-tab, [data-module='calendario'] #toggle-side { display: none; }
[data-module='torah'] #topbar > .add-wrap:has(#add-tab), [data-module='crono'] #topbar > .add-wrap:has(#add-tab), [data-module='hojas'] #topbar > .add-wrap:has(#add-tab), [data-module='mapas'] #topbar > .add-wrap:has(#add-tab), [data-module='envivo'] #topbar > .add-wrap:has(#add-tab), [data-module='manual'] #topbar > .add-wrap:has(#add-tab), [data-module='calendario'] #topbar > .add-wrap:has(#add-tab) { display: none; }
#topbar #tabs { margin-left: 0; }
[data-module='torah'] #topbar, [data-module='crono'] #topbar, [data-module='hojas'] #topbar, [data-module='mapas'] #topbar, [data-module='calendario'] #topbar, [data-module='manual'] #topbar, [data-module='envivo'] #topbar { justify-content: flex-start; }
[data-module='torah'] #topbar > .add-wrap:has(#settings-btn), [data-module='crono'] #topbar > .add-wrap:has(#settings-btn) { margin-left: 0; }

/* ---------- preparación para la lectura de la Torá ---------- */
@font-face { font-family: 'StamAshkenaz'; src: url('../fonts/StamAshkenazCLM.ttf') format('truetype'); }
@font-face { font-family: 'StamSefarad'; src: url('../fonts/StamSefaradCLM.ttf') format('truetype'); }
@font-face { font-family: 'KeterYG'; src: url('../fonts/KeterYG-Medium.ttf') format('truetype'); }
#torah { flex: 1; min-height: 0; display: flex; flex-direction: column; --tp-fs: 26px; --tp-stam: 'StamAshkenaz'; }
#torah[hidden] { display: none; }
.tp-bar { gap: 10px; }
.tp-pick-wrap { position: relative; }
.tp-pick { font-weight: 600; font-size: 16px; }
.tp-pick-he { font-size: 20px; margin-inline: 6px; }
.tp-menu { position: absolute; top: 110%; left: 0; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: min(900px, 90vw); max-height: 70vh; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.tp-menu[hidden] { display: none; }
.tp-group-title { font-weight: 700; padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tp-chip { display: flex; width: 100%; justify-content: space-between; gap: 6px; border: 0; background: transparent; text-align: left; padding: 5px 6px; border-radius: 6px; }
.tp-chip .he { font-size: 17px; color: var(--muted); }
.tp-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tp-cols { flex: 1; min-height: 0; display: grid; direction: ltr; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 18px 0; }
.tp-col { min-height: 0; overflow-y: auto; border-radius: 10px; position: relative; }
.tp-col-title { position: sticky; top: 0; z-index: 2; padding: 6px 12px; font: 600 12px system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: inherit; }
.tp-left { background: var(--panel); border: 1px solid var(--line); }
.tp-left .tp-body { padding: 8px 22px 40px; font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: var(--tp-fs); line-height: 2; text-align: justify; text-align-last: right; }
.tp-right { background: #f3e6c4; color: #1d1a14; border: 1px solid #d8c694; box-shadow: inset 0 0 40px rgba(120,85,20,.12); }
.tp-right .tp-col-title { color: #7a6a43; }
.tp-right .tp-body { padding: 8px 34px 40px; font-family: var(--tp-stam), 'Frank Ruhl Libre', serif; font-size: calc(var(--tp-fs) * 1.35); line-height: 1.75; text-align: justify; text-align-last: right; }
.tp-body p.para { margin: 0 0 .15em; }
.tp-body .gap { display: inline-block; width: 2.2em; }
.tp-left .chap { font: 600 13px system-ui, sans-serif; color: var(--muted); margin: 18px 0 2px; text-align: right; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.tp-left .vn { font: 11px system-ui, sans-serif; color: var(--accent); margin-inline: 3px; vertical-align: super; }
.tp-left .verse.block { display: block; margin: 0 0 .6em; padding-bottom: .4em; border-bottom: 1px dotted var(--line); }
.tp-left .verse.block.brk { margin-bottom: 1.3em; }
.tp-left .tr-line { direction: ltr; text-align: left; font: 15px/1.45 Georgia, serif; color: var(--muted); margin-top: 2px; }
.tp-body .w { border-radius: 3px; cursor: pointer; }
.tp-body .w.hl { background: rgba(37, 99, 235, .28); }
.tp-right .w.hl { background: rgba(190, 40, 40, .22); }
.tp-source { text-align: center; font-size: 12px; padding: 6px 12px; margin: 0; }
@media (max-width: 800px) { .tp-cols { grid-template-columns: 1fr; overflow-y: auto; } .tp-col { overflow: visible; } }
.tp-body .big { font-size: 1.55em; line-height: 0; }
.tp-left .w.qere { border-bottom: 1px dotted var(--accent); }

/* ---------- diccionario de taamim ---------- */
.tp-tabs { display: flex; gap: 6px; padding: 8px 18px 0; background: var(--bg); }
.tp-tab { border-radius: 8px 8px 0 0; border-bottom: 0; padding: 7px 14px; }
.tp-tab.on { background: var(--accent-bg); border-color: var(--accent); font-weight: 600; }
.tp-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tp-view[hidden] { display: none; }
.tp-legend { display: none; font-size: 12px; color: var(--muted); }
.tp-colored .tp-legend { display: inline-flex; align-items: center; gap: 4px; }
.tp-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.tp-legend .lg.td, .tp-colored .tp-left .w.td { background: rgba(37, 99, 235, .22); }
.tp-legend .lg.tc, .tp-colored .tp-left .w.tc { background: rgba(22, 163, 74, .26); }
.tp-body .w.flash { background: rgba(245, 158, 11, .55); animation: tpflash 2.4s ease-out; }
@keyframes tpflash { 0% { box-shadow: 0 0 0 6px rgba(245,158,11,.5); } 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } }
.tp-left .vn { cursor: pointer; }
.tp-left .vn:hover { background: var(--accent-bg); border-radius: 3px; }

.tp-dict { padding: 14px 18px 12px; }
.td-root { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 16px; }
.td-side { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.td-filters { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.td-search { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.td-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.td-chip { padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.td-chip.on { background: var(--accent-bg); border-color: var(--accent); font-weight: 600; }
.td-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.td-group { display: flex; flex-direction: column; margin: 14px 2px 6px; }
.td-group small { color: var(--muted); font-size: 12px; }
.td-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.td-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; }
.td-item.on { background: var(--accent-bg); border-color: var(--accent); }
.td-g { font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: 28px; line-height: 1.2; min-width: 34px; text-align: center; direction: rtl; }
.td-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.td-es { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-he { font-size: 14px; color: var(--muted); direction: rtl; text-align: left; }
.td-detail { min-height: 0; overflow-y: auto; }
.td-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 26px 28px; max-width: 900px; }
.td-card h2 { margin: 0 0 4px; }
.td-card h3 { margin: 22px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.td-card p { margin: 0 0 10px; line-height: 1.55; }
.td-head { display: flex; gap: 22px; align-items: center; }
.td-glyph { font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: 96px; line-height: 1.1; min-width: 120px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; direction: rtl; }
.td-he-big { font-size: 34px; direction: rtl; text-align: left; }
.td-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.td-badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.td-badge.D { background: rgba(37,99,235,.18); border-color: rgba(37,99,235,.4); }
.td-badge.C { background: rgba(22,163,74,.2); border-color: rgba(22,163,74,.4); }
.td-badge.N { background: rgba(245,158,11,.2); border-color: rgba(245,158,11,.45); }
.td-facts { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 16px 0 0; }
.td-fact { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.td-fact dt { color: var(--muted); font-size: 13px; }
.td-fact dd { margin: 0; }
.td-examples { display: flex; flex-wrap: wrap; gap: 10px; }
.td-ex { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 14px; }
.td-ex-w { font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: 30px; direction: rtl; line-height: 1.4; }
.td-ex-ref { font-size: 12px; color: var(--muted); }
.td-verse { font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: 28px; line-height: 2; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; text-align: right; }
.td-verse mark { background: rgba(245,158,11,.4); color: inherit; border-radius: 3px; padding: 0 2px; }
.td-go { margin-top: 10px; }
.td-levels { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 6px; }
.td-level { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; }
.td-level-mem { display: flex; flex-wrap: wrap; gap: 6px; }
.td-mini { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 6px; font-size: 13px; }
.td-mini .td-g { font-size: 22px; min-width: 24px; }
.td-analysis { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.td-arow { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; }
.td-aw { font-family: 'KeterYG', 'Frank Ruhl Libre', serif; font-size: 28px; direction: rtl; text-align: right; line-height: 1.5; }
.td-ac { display: flex; flex-wrap: wrap; gap: 6px; }
.td-achip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px 1px 6px; font-size: 13px; }
.td-achip.D { background: rgba(37,99,235,.15); }
.td-achip.C { background: rgba(22,163,74,.18); }
.td-achip .td-g { font-size: 22px; min-width: 22px; }
.tp-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.tp-overlay[hidden] { display: none; }
.tp-ov-card { background: var(--panel); border-radius: 12px; border: 1px solid var(--line); width: min(760px, 100%); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.tp-ov-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.tp-ov-body { overflow-y: auto; padding: 8px 18px 18px; }
@media (max-width: 900px) { .td-root { grid-template-columns: 1fr; } .td-side { max-height: 45vh; } }

/* ---------- melodías ---------- */
.td-melody { margin: 4px 0 10px; }
.td-vtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.td-vtab { padding: 3px 11px; border-radius: 999px; font-size: 13px; }
.td-vtab.on { background: var(--accent-bg); border-color: var(--accent); font-weight: 600; }
.td-contour { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; overflow-x: auto; color: var(--text); }
.td-svg { display: block; width: 100%; min-width: 280px; max-height: 260px; }
.td-dot { fill: var(--text); transition: fill .08s, r .08s; }
.td-dot.pre { fill: none; stroke: var(--text); stroke-width: 2; stroke-dasharray: 3 3; }
.td-dot.on { fill: #dc2626; r: 10; }
.td-syl { fill: var(--text); font-family: system-ui, sans-serif; }
.td-mctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.td-play { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; padding: 6px 16px; }
.td-play:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); }
.td-sel { padding: 5px 8px; }
.td-src { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.td-voice { margin-top: 14px; padding: 10px 14px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.td-voice h4 { margin: 0 0 8px; font-size: 14px; }
.td-vrow { display: flex; flex-wrap: wrap; gap: 8px; }
.td-upload { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
.td-upload:hover { background: var(--panel-2); }
.td-vstatus { display: block; margin-top: 6px; font-size: 13px; }

/* ---------- identidad de marca ---------- */
h1, h2, .td-card h2, .tp-pick-label { font-family: var(--font-title); font-weight: 400; }
.td-card h2 { color: var(--accent); }
.quick button { border-color: var(--accent); color: var(--accent); background: var(--panel); }
.quick button:hover { background: var(--accent-bg) !important; }
.tp-tab.on, .td-chip.on, .td-vtab.on { box-shadow: inset 0 -3px 0 var(--brand-gold); }
.td-item.on { box-shadow: inset 3px 0 0 var(--brand-gold); }
.td-badge.N { background: var(--gold-bg); border-color: var(--brand-gold); }
.td-verse mark { background: var(--gold-bg); box-shadow: inset 0 -2px 0 var(--brand-gold); }
.tp-body .w.flash { background: rgba(230, 184, 13, .55); }
#module-menu .mod.on { box-shadow: inset 3px 0 0 var(--brand-gold); }
.tp-col-title { border-bottom: 2px solid var(--brand-gold); }
.tp-right .tp-col-title { border-bottom-color: rgba(230, 184, 13, .7); }

/* ---------- maqueta de séfer Torá (columna derecha) ---------- */
.scribe-measure { position: absolute; visibility: hidden; white-space: nowrap; direction: rtl; left: -9999px; top: 0; }
.tp-right .tp-body.scribe { padding: 30px 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 44px; text-align: initial; text-align-last: initial; line-height: 1; }
.scol { position: relative; border-inline: 1px solid rgba(120, 85, 20, .35); background: rgba(255, 252, 240, .35); box-shadow: 0 1px 0 rgba(120, 85, 20, .25) inset; }
.scol-label { position: absolute; top: -1.9em; left: 0; right: 0; text-align: center; font: 600 11px system-ui, sans-serif; letter-spacing: .06em; color: #7a6a43; }
.sline { display: flex; direction: rtl; white-space: nowrap; align-items: center; border-bottom: 1px solid rgba(120, 85, 20, .22); overflow: visible; }
.sline.j { justify-content: space-between; }
.sline.nj { justify-content: flex-start; gap: .3em; }
.sline.blank { border-bottom-color: rgba(120, 85, 20, .22); }
.sline .gap { flex: none; display: inline-block; }
.sline .w { flex: none; }
.tp-bar .tp-scribe.on { background: var(--accent-bg); }
.sline.cols { display: flex; justify-content: space-between; }
.scolumn { display: flex; direction: rtl; justify-content: space-between; align-items: center; white-space: nowrap; }
.sline .w.out { opacity: .3; cursor: default; }
.tp-bar .tp-lines-wrap[hidden] { display: none; }
.tp-right .tp-body.scribe { align-items: flex-start; }
.tp-right .tp-body.scribe .scol { margin-inline: auto; flex: none; }

/* la columna del séfer puede ser más ancha que el panel (zoom): debe poder desplazarse hacia la izquierda */
.tp-right { direction: rtl; }
.tp-right .tp-col-title { direction: ltr; }

/* ---------- aviso para pantallas pequeñas (la herramienta no es responsive) ---------- */
#small-screen-notice { display: none; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 8px 14px; background: var(--gold-bg); color: var(--text); border-bottom: 2px solid var(--brand-gold); font-size: 13px; line-height: 1.35; }
#small-screen-notice a { color: var(--accent); font-weight: 600; white-space: nowrap; }
#small-screen-notice button { margin-left: auto; border: 0; background: transparent; padding: 2px 8px; font-size: 16px; color: var(--muted); }
@media (max-width: 767px) { #small-screen-notice:not([hidden]) { display: flex; } }

/* ---------- cronología de los sabios ---------- */
#crono { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#crono[hidden] { display: none; }
.cr-tabs { padding: 8px 12px 0; display: flex; gap: 6px; }
.cr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; }
.cr-search { width: 200px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.cr-readout { min-width: 110px; font-variant-numeric: tabular-nums; }
.cr-main { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 0 12px 12px; }
.cr-chart { flex: 1; min-width: 0; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; position: relative; }
.cr-inner { position: relative; padding-bottom: 14px; min-height: 100%; }
.cr-side { width: 310px; flex: none; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.cr-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cr-card.sel { border-color: var(--accent); }
.cr-card h3 { margin: 0 0 4px; font-size: 17px; }
.cr-card h4 { margin: 10px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cr-card p { margin: 4px 0; }
.cr-card.small p { font-size: 12px; }
.cr-card-head { display: flex; gap: 10px; align-items: center; }
.cr-he { font-size: 20px; direction: rtl; }
.he { font-family: 'KeterYG', 'Noto Serif Hebrew', serif; direction: rtl; }
.cr-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; margin-right: 6px; }
.cr-dot.big { width: 22px; height: 22px; border-radius: 6px; margin: 0; }
.cr-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cr-chip { border-width: 2px; border-radius: 12px; padding: 1px 8px; font-size: 12px; }
.cr-leg { display: flex; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 4px 2px; }
.cr-leg .cr-leg-t { flex: 1; }
.cr-leg.off { opacity: .4; text-decoration: line-through; }
.cr-sty { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.cr-sample { display: inline-block; width: 18px; height: 10px; background: var(--accent); vertical-align: middle; border-radius: 2px; }
.cr-sample.dash { border: 2px dashed var(--text); background: transparent; }
.cr-sample.thick { border: 3px solid var(--text); background: transparent; }
.cr-sample.dotfill { background-image: radial-gradient(var(--text) 1px, transparent 1.5px); background-size: 4px 4px; background-color: var(--accent-bg); }
/* eje y rejilla */
.cr-axis { position: sticky; top: 0; z-index: 6; height: 30px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.cr-axis-label { position: sticky; left: 0; width: 188px; padding: 6px 10px; font-size: 12px; color: var(--muted); background: var(--panel-2); z-index: 2; height: 100%; box-sizing: border-box; }
.cr-tick { position: absolute; top: 18px; bottom: 0; border-left: 1px solid var(--line); }
.cr-tick.major { top: 12px; border-color: var(--muted); }
.cr-tick span { position: absolute; top: -17px; left: -18px; width: 36px; text-align: center; font-size: 11px; color: var(--muted); }
.cr-lanes { position: relative; }
.cr-lines { position: absolute; inset: 0; pointer-events: none; }
.cr-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); opacity: .5; }
.cr-grid.major { opacity: 1; }
.cr-ev { position: absolute; top: 0; bottom: 0; border-left: 2px solid #d9534f; z-index: 1; }
.cr-ev.soft { opacity: .6; }
.cr-band { position: absolute; top: 0; bottom: 0; background: rgba(217, 83, 79, .12); }
.cr-evrow { position: relative; z-index: 3; }
.cr-evlab { position: absolute; transform: translateX(2px); font-size: 12px; background: var(--panel); border: 1px solid #d9534f; border-radius: 4px; padding: 1px 6px; white-space: nowrap; cursor: pointer; }
.cr-lane { position: relative; border-bottom: 1px solid var(--line); z-index: 2; }
.cr-lanelab { position: sticky; left: 0; width: 188px; box-sizing: border-box; height: 100%; padding: 8px 10px; background: var(--panel); border-right: 1px solid var(--line); font-weight: 600; font-size: 13px; z-index: 5; display: block; }
.cr-lanelab small { display: block; color: var(--muted); font-weight: 400; }
.cr-track { position: absolute; inset: 0; }
.cr-bar { position: absolute; box-sizing: border-box; border-radius: 6px; display: flex; align-items: center; cursor: pointer; border: 1px solid rgba(0, 0, 0, .15); transition: opacity .15s; }
.cr-bar.dash { border: 2px dashed rgba(0, 0, 0, .55); }
.cr-bar.thick { border: 3px solid rgba(0, 0, 0, .55); }
.cr-bar.dotfill { background-image: radial-gradient(rgba(255, 255, 255, .55) 1.5px, transparent 2px); background-size: 6px 6px; }
.cr-bar.cont { border-right-style: dotted; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.cr-bar.work { background: var(--gold-bg, #fff3c4); border-color: var(--brand-gold); }
.cr-bar.dim { opacity: .18; }
.cr-bar.sel { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 3; }
.cr-bar.hit { outline: 3px solid var(--brand-gold); }
.cr-name { padding: 0 8px; white-space: nowrap; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cr-name.out { position: absolute; left: 100%; padding-left: 6px; color: var(--text); text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel); overflow: visible; }
.cr-pin-sede { position: absolute; display: flex; align-items: center; gap: 4px; font-size: 13px; }
.cr-pin-sede i { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-gold); display: inline-block; }
.cr-guide { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--muted); pointer-events: none; z-index: 4; }
.cr-pinline { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--accent); z-index: 4; pointer-events: none; }
.cr-pinline span { position: absolute; top: 2px; left: 4px; background: var(--accent); color: #fff; padding: 0 6px; border-radius: 4px; font-size: 12px; }
.cr-note, .cr-credit { padding: 10px 14px 0; font-size: 12px; color: var(--muted); position: sticky; left: 0; }
.cr-tip { position: fixed; z-index: 50; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 6px; font-size: 13px; pointer-events: none; display: flex; flex-direction: column; max-width: 260px; }
.cr-tip[hidden] { display: none; }
@media print {
  #topbar, .cr-toolbar, .cr-tabs, .cr-side { display: none !important; }
  .cr-chart { overflow: visible; border: 0; }
}

/* ---------- recuadro flotante de la cámara ---------- */
#topbar > .add-wrap:has(#login-btn) { margin-left: auto; }
.cam-box { position: fixed; z-index: 200; background: #000; border: 2px solid var(--brand-gold); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); overflow: hidden; user-select: none; touch-action: none; }
.cam-box[hidden] { display: none; }
.cam-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 6px; background: rgba(18, 80, 176, .92); color: #fff; font-size: 12px; cursor: grab; }
.cam-box.moving .cam-head, .cam-box.moving .cam-body { cursor: grabbing; }
.cam-tools { display: flex; align-items: center; gap: 3px; }
.cam-tools button { background: transparent; color: #fff; border: 0; padding: 1px 6px; font-size: 14px; line-height: 1.2; }
.cam-tools button:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.cam-select { max-width: 110px; font-size: 11px; padding: 1px; }
.cam-body { position: relative; aspect-ratio: 16 / 9; background: #111; cursor: grab; }
.cam-body video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cam-box.mirror video { transform: scaleX(-1); }
.cam-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; color: #fff; font-size: 13px; }
.cam-msg[hidden] { display: none; }
.cam-resize { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 55%, var(--brand-gold) 55%, var(--brand-gold) 65%, transparent 65%, transparent 75%, var(--brand-gold) 75%, var(--brand-gold) 85%, transparent 85%); }
.cam-box[data-shape='circle'] { border-radius: 50%; border-width: 3px; }
.cam-box[data-shape='circle'] .cam-body { aspect-ratio: 1 / 1; }
.cam-box[data-shape='circle'] .cam-head { position: absolute; top: 0; left: 0; right: 0; z-index: 2; justify-content: center; opacity: 0; transition: opacity .15s; background: rgba(18, 80, 176, .85); }
.cam-box[data-shape='circle']:hover .cam-head { opacity: 1; }
.cam-box[data-shape='circle'] .cam-grip { display: none; }
@media print { .cam-box, #camera-btn { display: none !important; } }

/* ---------- acceso (sesión y permisos) ---------- */
#acceso-menu { position: absolute; right: 0; top: 110%; z-index: 120; width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
#acceso-menu[hidden] { display: none; }
#acceso-menu h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
#acceso-menu p { margin: 6px 0; }
#acceso-menu .primary { background: var(--accent); color: #fff; border-color: var(--accent); width: 100%; margin-top: 4px; }
.acc-perms { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.acc-perms .ok { color: #1b7a3d; }
.acc-perms .no { color: var(--muted); }
.acc-row { display: flex; gap: 6px; margin-top: 10px; }
.acc-err { color: #b42318; font-size: 12px; }
#camera-btn[hidden] { display: none; }

/* ---------- vista de libro para cualquier texto ---------- */
.is-daf.no-sides .daf-only { display: none; }
.daf-page.bilingual .daf-grid { grid-template-columns: 1fr 1fr; column-gap: 26px; }
.daf-page.bilingual .dcol:last-of-type { display: none; }
.daf-page.bilingual .dcol { direction: ltr; font-family: Georgia, 'Times New Roman', serif; font-size: calc(var(--fs) * .62); line-height: 1.55; }
.daf-page .btr { margin: 0 0 .8em; text-align: justify; }
.daf-page.tr-only .dcenter, .daf-page.tr-only .daf-block { direction: ltr; text-align: left; text-align-last: left; font-family: Georgia, 'Times New Roman', serif; font-size: .72em; line-height: 1.6; }
.daf-page.tr-only { direction: ltr; }
.daf-block.k-para { margin-bottom: .9em; }
.daf-block.k-flow { margin-bottom: 0; }
.daf-page.bilingual { width: min(calc(var(--fs) * 42), 100%); box-sizing: border-box; }
.daf-page.bilingual .dcenter { border-inline: 0; }

/* ---------- créditos ---------- */
#creditos { width: min(680px, 92vw); max-height: 86vh; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
#creditos::backdrop { background: rgba(10, 20, 40, .45); }
#creditos .cr-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: var(--panel); border-bottom: 3px solid var(--brand-gold); }
#creditos h2 { margin: 0; font-size: 18px; }
#creditos .cr-body { padding: 4px 18px; overflow: auto; }
#creditos section { padding: 10px 0; border-bottom: 1px solid var(--line); }
#creditos section.dest { background: var(--gold-bg, #fff3c4); margin: 10px -10px 0; padding: 10px; border-radius: 8px; border: 0; }
#creditos h3 { margin: 0 0 4px; font-size: 14px; color: var(--accent); }
#creditos p, #creditos ul { margin: 4px 0; font-size: 13.5px; }
#creditos ul { padding-inline-start: 18px; }
#creditos > p { padding: 8px 18px 14px; margin: 0; }
#creditos a { color: var(--accent); }
#creditos { margin: auto; inset: 0; }

/* ---------- hojas A4 de la vista de libro ---------- */
.book-wrap { margin: 8px auto 14px; position: relative; }
.book { width: 210mm; transform-origin: top left; }
.sheet { width: 210mm; height: 296.6mm; box-sizing: border-box; padding: 12mm 13mm 8mm; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #fff; color: #1b2433;
  border: 1px solid var(--line); box-shadow: 0 2px 14px rgba(0, 0, 0, .16); margin: 0 0 18px; overflow: hidden; font-family: var(--serif-he); font-size: var(--fs); line-height: 1.6;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .txt.he { font-size: inherit; line-height: inherit; text-align: inherit; }
.sheet big strong { font-size: 1.45em; }
.sh-head { direction: rtl; font: 600 11px var(--serif-he); color: #667085; border-bottom: 1px solid #ddd; margin-bottom: 4mm; padding-bottom: 1.5mm; }
.sh-head .dim { font-weight: 400; direction: ltr; unicode-bidi: plaintext; }
.sh-head.first { text-align: center; border-bottom: 3px double #cfc8b0; margin-bottom: 5mm; padding-bottom: 2mm; color: inherit; font: inherit; line-height: 1.3; }
.sh-head.first .t { font-size: 1.45em; font-weight: 700; }
.sh-head.first .s { font: 12px system-ui, sans-serif; color: #667085; direction: ltr; }
.sh-main { min-height: 0; padding-top: 1.5em; box-sizing: border-box; }
.bgrid { height: 100%; overflow: hidden; direction: ltr; display: grid; grid-template-columns: 1fr; column-gap: 12px; align-items: start; }
.bgrid.mode-side { grid-template-columns: 26fr 48fr 26fr; }
.bgrid.mode-bi { grid-template-columns: 1fr 1fr; column-gap: 8mm; }
.bgrid .dcol { display: none; }
.bgrid.mode-side .dcol, .bgrid.mode-bi .dcol:first-child { display: block; }
.bgrid.mode-side .dcenter { border-inline: 1px solid #ddd; padding-inline: 8px; }
.bgrid .dcenter { border-inline: 0; padding-inline: 0; }
.bgrid.mode-side .dcenter { border-inline: 1px solid #ddd; padding-inline: 8px; }
.sheet:not(.no-side) .daf-block .tag { display: none; }
.sheet.no-side .daf-block.k-mishna .tag { display: none; }
.bgrid .dcol { direction: ltr; }
.bgrid.mode-bi .dcol { font-family: Georgia, 'Times New Roman', serif; font-size: calc(var(--fs) * .62); line-height: 1.55; }
.bgrid.mode-side .dcol { direction: rtl; }
.sheet .btr { margin: 0 0 .8em; text-align: justify; }
.sheet.tr-only .dcenter, .sheet.tr-only .daf-block { direction: ltr; text-align: left; text-align-last: left; font-family: Georgia, 'Times New Roman', serif; font-size: .78em; line-height: 1.6; }
.bgrid.mode-rest { grid-template-columns: 1fr; }
.bgrid .rest { position: relative; direction: rtl; }
.bgrid .rest .dlabel { position: static; margin-bottom: 4px; }
.rest-text { column-count: 2; column-gap: 8mm; font-size: calc(var(--fs) * var(--sf)); line-height: 1.5; direction: rtl; }
.sh-foot { height: 15mm; overflow: hidden; border-top: 1px solid #ddd; padding-top: 1.5mm; display: grid; grid-template-columns: 1fr auto; gap: 6mm; font: 7.5px/1.35 system-ui, sans-serif; color: #667085; direction: ltr; }
.sh-page { font-size: 10px; font-weight: 600; white-space: nowrap; }
#print-root { position: absolute; left: -12000px; top: 0; width: 210mm; }
#print-root .sheet { margin: 0; box-shadow: none; }
@page { size: A4; margin: 0; }
@media print {
  html, body { height: auto !important; overflow: visible !important; display: block !important; background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { position: static !important; left: auto !important; width: auto; }
  #print-root .sheet { border: 0; break-after: page; page-break-after: always; }
  #print-root .sheet[data-last] { break-after: auto; page-break-after: auto; }
}
.pdf-btn { display: none; }
.is-daf .pdf-btn { display: inline-block; }

/* ---------- ventana de descarga PDF ---------- */
#pdf-dlg { width: min(560px, 92vw); max-height: 88vh; padding: 0; margin: auto; inset: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
#pdf-dlg::backdrop { background: rgba(10, 20, 40, .45); }
#pdf-dlg .cr-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 3px solid var(--brand-gold); }
#pdf-dlg h2 { margin: 0; font-size: 18px; }
#pdf-dlg .cr-body { padding: 10px 18px; overflow: auto; max-height: 60vh; }
.pdf-warn { background: var(--gold-bg, #fff3c4); border: 1px solid var(--brand-gold); border-radius: 8px; padding: 10px 12px; }
.pdf-warn h3 { margin: 0 0 6px; font-size: 15px; }
.pdf-warn p { margin: 6px 0; font-size: 13.5px; }
.pdf-sat { color: #b42318; font-weight: 700; }
.pdf-ok { display: block; margin-top: 8px; font-weight: 600; font-size: 13.5px; }
.pdf-scope { margin: 12px 0 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 8px; }
.pdf-scope label { display: block; padding: 3px 0; }
.pdf-n { width: 64px; }
.pdf-status { min-height: 1.3em; color: var(--accent); font-size: 13px; }
.pdf-row { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 14px; }
.pdf-row .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.pdf-row .primary:disabled { opacity: .45; cursor: not-allowed; }

.bgrid .dcol.vacia { display: none !important; }
.bgrid.mode-side.solo-l { grid-template-columns: 32fr 68fr; }
.bgrid.mode-side.solo-r { grid-template-columns: 68fr 32fr; }

.cont-wrap { margin-top: 10px; padding-top: 6px; border-top: 1px solid #ddd; }
.cont-label { font: 600 .8em var(--serif-he); color: #667085; margin-bottom: 2px; direction: rtl; }
.cont-wrap .ctext { font-size: calc(var(--fs) * var(--sf)); line-height: 1.5; }
.dcenter .cont-wrap .ctext { font-size: calc(var(--fs) * var(--sf)); }

/* ---------- respaldo ---------- */
#respaldo-dlg { width: min(560px, 92vw); max-height: 88vh; padding: 0; margin: auto; inset: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
#respaldo-dlg::backdrop { background: rgba(10, 20, 40, .45); }
#respaldo-dlg .cr-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 3px solid var(--brand-gold); }
#respaldo-dlg h2 { margin: 0; font-size: 18px; }
#respaldo-dlg .cr-body { padding: 4px 18px 14px; overflow: auto; max-height: 72vh; }
#respaldo-dlg section { padding: 10px 0; border-bottom: 1px solid var(--line); }
#respaldo-dlg h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
#respaldo-dlg p { margin: 4px 0; font-size: 13.5px; }
#respaldo-dlg label { display: block; margin: 4px 0 8px; font-size: 13.5px; }
#respaldo-dlg button { margin: 2px 6px 2px 0; }
#respaldo-dlg .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
#respaldo-dlg hr { border: 0; border-top: 1px dashed var(--line); margin: 10px 0; }

/* ---------- hojas de fuentes ---------- */
#hojas { flex: 1; min-height: 0; display: flex; }
#hojas[hidden] { display: none; }
.hoja-btn { display: inline-block; }
.hj-side { width: 250px; flex: none; border-inline-end: 1px solid var(--line); background: var(--panel); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.hj-side .primary, .hj-bar .primary, .hj-empty .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.hj-item { display: flex; align-items: stretch; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.hj-item.on { border-color: var(--accent); background: var(--accent-bg); }
.hj-item button { border: 0; background: transparent; }
.hj-item-t { flex: 1; text-align: left; display: flex; flex-direction: column; min-width: 0; }
.hj-item-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hj-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hj-bar { flex-wrap: wrap; gap: 8px; align-items: center; }
.hj-title { font-weight: 700; min-width: 220px; flex: 1; }
.hj-sub { min-width: 160px; flex: 1; }
.hj-bar input { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.hj-panel { padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.hj-panel[hidden] { display: none; }
.hj-prow { display: flex; gap: 6px; }
.hj-prow input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.hj-res { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 240px; overflow: auto; }
.hj-cand { display: flex; justify-content: space-between; text-align: left; }
.hj-doc { flex: 1; overflow: auto; padding: 14px 18px 60px; --hj-fs: 22px; }
.hj-empty { max-width: 520px; margin: 60px auto; text-align: center; }
.hj-hint { color: var(--muted); text-align: center; margin: 30px; }
.hj-block { max-width: 920px; margin: 0 auto 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; }
.hj-block.over { outline: 3px dashed var(--accent); }
.hj-bbar { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.hj-bbar .hj-kind { flex: 1; }
.hj-bbar button { padding: 0 7px; font-size: 13px; }
.hj-grip { cursor: grab; font-size: 16px; padding: 0 4px; }
.hj-refrow { display: flex; gap: 4px; margin-bottom: 6px; }
.hj-ref-in { flex: 1; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 13px; }
.hj-h-in { width: 100%; box-sizing: border-box; font-size: 1.5em; font-weight: 700; border: 0; border-bottom: 2px solid var(--brand-gold); background: transparent; color: var(--text); padding: 4px 2px; }
.hj-n-in, .hj-note-in { width: 100%; box-sizing: border-box; resize: none; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--panel-2); color: var(--text); font: 15px/1.5 system-ui, sans-serif; min-height: 2.6em; }
.hj-note-in { margin-top: 8px; }
.hj-block.hj-note { background: var(--gold-bg, #fff3c4); }
.hj-src-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 4px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.hj-src-ref { font-weight: 700; color: var(--accent); }
.hj-src-he { font-size: 1.15em; }
.hj-rows { font-size: var(--hj-fs, 22px); line-height: 1.6; }
.hj-row { display: grid; grid-template-columns: 1fr; gap: 4px 20px; padding: 4px 0; position: relative; }
.hj-rows.lang-both .hj-row { grid-template-columns: 1fr 1fr; direction: rtl; }
.hj-rows.lang-both .hj-tr { direction: ltr; }
.hj-he { font-family: var(--serif-he); text-align: justify; }
.hj-tr { font-family: Georgia, 'Times New Roman', serif; font-size: .72em; line-height: 1.55; text-align: justify; }
.hj-n { position: absolute; inset-inline-end: -1.6em; top: .4em; font: 10px system-ui; color: var(--muted); }
.hj-rows.lang-tr .hj-row, .hj-rows.lang-he .hj-row { padding-inline-end: 0; }
.hj-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); display: flex; gap: 14px; align-items: center; }
.hj-toast .link { color: var(--brand-gold); }
.hj-pick { position: fixed; z-index: 300; width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.hj-pick-t { font-size: 12px; color: var(--muted); padding: 4px 6px; }
.hj-pick button { text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hj-pick button:hover { background: var(--panel-2); }
.hj-pick-new { color: var(--accent); font-weight: 600; }
.hj-present-ov { position: fixed; inset: 0; z-index: 400; background: #0f1522; color: #eef1f8; display: flex; flex-direction: column; }
.hj-stage { flex: 1; overflow: auto; padding: 5vh 8vw 12vh; font-size: var(--hj-fs, 28px); }
.hj-stage .hj-src-head { border-color: #38445c; }
.hj-stage .hj-src-ref { color: #9bbcff; }
.hj-stage .hj-row { direction: rtl; }
.hj-stage .hj-n { color: #8793ab; }
.hj-p-h { font-size: 2.2em; text-align: center; margin-top: 18vh; color: var(--brand-gold); }
.hj-p-n { font: 1.1em/1.6 system-ui, sans-serif; max-width: 900px; margin: 10vh auto; white-space: pre-wrap; }
.hj-p-note { font: .6em/1.55 system-ui, sans-serif; color: #c5cde0; border-inline-start: 3px solid var(--brand-gold); padding-inline-start: 12px; margin-top: 18px; white-space: pre-wrap; direction: ltr; }
.hj-pnav { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,.08); border-radius: 20px; padding: 4px 12px; }
.hj-pnav button, .hj-pclose { background: transparent; color: #fff; border: 0; font-size: 18px; }
.hj-pclose { position: absolute; top: 10px; right: 14px; }
/* PDF */
.hj-sheet .sh-main { padding-top: 0; overflow: hidden; }
.hj-flow { direction: ltr; }
.hj-sheet .hj-rows { font-size: var(--fs); }
.hj-sheet .hj-row { padding: 3px 0; }
.hj-sheet .hj-n { inset-inline-end: -1.4em; }
.hj-pdf-h { font-size: 1.25em; margin: .9em 0 .3em; border-bottom: 2px solid #e6b80d; padding-bottom: 2px; }
.hj-pdf-note { margin: .5em 0; font: .62em/1.5 system-ui, sans-serif; border-inline-start: 3px solid #e6b80d; padding-inline-start: 8px; white-space: pre-wrap; color: #333; }
.hj-sheet .hj-src-head { margin-top: .8em; font-size: .72em; }
@media print { .hoja-btn, .hj-toast, .hj-pick { display: none !important; } }

/* ---------- modo clase ---------- */
.clase-btn { display: inline-block; }
.tv.clase-on { position: fixed; inset: 0; z-index: 150; background: var(--bg); display: flex; flex-direction: column; }
.tv.clase-on .tv-bar, .tv.clase-on .hl-bar, .tv.clase-on .tv-side { display: none !important; }
.tv.clase-on .tv-body { flex: 1; min-height: 0; }
.tv.clase-on .tv-main { padding: 4vh 6vw 14vh; }
.tv.clase-on .tv-text { max-width: 1500px; margin: 0 auto; }
.tv.clase-on .seg { transition: opacity .2s; border-radius: 10px; cursor: pointer; padding-block: .25em; }
.tv.clase-on .seg.cl-focus { background: var(--accent-bg); box-shadow: -.35em 0 0 var(--brand-gold); }
.foco-dim .seg.cl-off { opacity: .2; }
.foco-solo .seg.cl-off { display: none; }
.clase-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 160; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; background: rgba(15, 21, 34, .92); color: #fff; padding: 8px 12px; border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); transition: opacity .35s; max-width: 96vw; }
.clase-bar.hide { opacity: 0; pointer-events: none; }
.clase-bar button { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25); font-size: 15px; padding: 5px 12px; }
.clase-bar button:hover:not(:disabled) { background: rgba(255, 255, 255, .25); }
.clase-bar button.on { background: #d92d20; border-color: #ff8a80; }
.cl-laser { position: fixed; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, #ff2a2a 22% 55%, rgba(255, 42, 42, 0) 72%); box-shadow: 0 0 14px 6px rgba(255, 42, 42, .55); pointer-events: none; z-index: 9999; opacity: 0; transition: opacity .35s; will-change: transform; }
.cl-laser.on { opacity: 1; }
body.cl-nocursor, body.cl-nocursor * { cursor: none !important; }
/* presentación de hojas */
.hj-stage.foco-dim .hj-row.cl-off { opacity: .2; }
.hj-stage.foco-solo .hj-row.cl-off { display: none; }
.hj-stage .hj-row { cursor: pointer; border-radius: 8px; transition: opacity .2s; }
.hj-stage .hj-row.cl-focus { background: rgba(155, 188, 255, .14); box-shadow: -.3em 0 0 var(--brand-gold); }
.hj-pnav .hj-mode { font-size: 13px; }
.hj-pnav button.on { background: #d92d20; border-radius: 8px; }
@media print { .clase-bar, .cl-laser { display: none !important; } }

/* ---------- calendario judío ---------- */
#calendario { flex: 1; min-height: 0; display: flex; }
#calendario[hidden] { display: none; }
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-toolbar { flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-title { margin: 0 8px; font-size: 18px; }
.cal-he { font-weight: 400; color: var(--muted); font-size: .8em; direction: rtl; unicode-bidi: isolate; }
.cal-sp { flex: 1; }
.cal-status { padding: 6px 14px; font-size: 13.5px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.cal-status.lock { background: #fde7e4; color: #8a1c10; font-weight: 600; }
.cal-status.err { background: var(--gold-bg); }
:root[data-theme='dark'] .cal-status.lock { background: #4a1a15; color: #ffb4a8; }
.cal-grid-wrap { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; min-width: 640px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 2px 0; }
.cal-cell { display: flex; flex-direction: column; align-items: stretch; text-align: left; min-height: 96px; padding: 4px 6px; border-radius: 8px; gap: 2px; background: var(--panel); }
.cal-cell.out { opacity: .5; }
.cal-cell.shabbat { background: var(--accent-bg); }
.cal-cell.yt { background: var(--gold-bg); border-color: var(--brand-gold); }
.cal-cell.fast { box-shadow: inset 0 -3px 0 #8d6e63; }
.cal-cell.rc { box-shadow: inset 0 3px 0 var(--accent); }
.cal-cell.today { outline: 2px solid var(--brand-gold); }
.cal-cell.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cal-num { display: flex; justify-content: space-between; align-items: baseline; }
.cal-hd { font-size: 11.5px; color: var(--muted); direction: rtl; unicode-bidi: isolate; }
.cal-evs { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.cal-ev { font-size: 11.5px; line-height: 1.25; }
.cal-ev.par { font-weight: 700; color: var(--accent); font-size: 13px; direction: rtl; text-align: left; }
.cal-ev.hol { font-weight: 600; }
.cal-ev.ytv { color: #8a5a00; }
.cal-ev.time, .cal-ev.omer { color: var(--muted); }
.cal-detail { width: 300px; flex: none; border-inline-start: 1px solid var(--line); background: var(--panel); padding: 12px; overflow: auto; }
.cal-detail h3 { margin: 0 0 2px; }
.cal-hdate { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.cal-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.cal-acts { margin-top: 6px; }
.cal-acts .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-ley { margin-top: 6px; font-size: 13.5px; }
.cal-aliyot { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cal-ref { padding: 2px 8px; font-size: 12.5px; }
@media (max-width: 900px) { #calendario { flex-direction: column; } .cal-detail { width: auto; border-inline-start: 0; border-top: 1px solid var(--line); max-height: 40%; } }

/* ---------- comparar versiones ---------- */
#cmp-dlg { width: min(1400px, 96vw); height: 92vh; max-height: 92vh; margin: auto; inset: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); flex-direction: column; overflow: hidden; --cmp-fs: 20px; }
#cmp-dlg[open] { display: flex; }
#cmp-dlg::backdrop { background: rgba(0, 0, 0, .5); }
.cmp-head { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.cmp-head h2 { margin: 0 8px; font-size: 17px; }
.cmp-sp { flex: 1; }
.cmp-cols { display: grid; grid-template-columns: 38px repeat(var(--n), minmax(0, 1fr)); gap: 8px; padding: 6px 12px 6px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); align-items: center; }
.cmp-cols > :first-child { grid-column: 2; }
.cmp-colhead { display: flex; gap: 4px; min-width: 0; grid-column: auto; }
.cmp-colhead select { flex: 1; min-width: 0; font-size: 13px; }
.cmp-add { justify-self: start; white-space: nowrap; }
.cmp-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px 14px; }
.cmp-row { display: grid; grid-template-columns: 30px repeat(var(--n), minmax(0, 1fr)); gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.cmp-row:hover { background: var(--accent-bg); }
.cmp-num { color: var(--muted); font-size: 12px; text-align: right; padding-top: .4em; }
.cmp-cell { font-size: var(--cmp-fs); line-height: 1.5; }
.cmp-cell.rtl { font-family: 'Frank Ruhl Libre', 'Noto Serif Hebrew', 'SBL Hebrew', serif; font-size: calc(var(--cmp-fs) * 1.25); text-align: right; }
@media (max-width: 800px) { .cmp-cols, .cmp-row { grid-template-columns: repeat(var(--n), minmax(220px, 1fr)); overflow-x: auto; } .cmp-num { display: none; } .cmp-cols > :first-child { grid-column: auto; } }

/* ---------- aliyot y haftará ---------- */
.tp-aliyot { gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 4px; padding-bottom: 4px; }
.tp-al { padding: 2px 9px; min-width: 28px; font-size: 13px; }
.tp-al-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.tp-haft { background: var(--gold-bg); border-color: var(--brand-gold); }
.aliyah-mark { display: inline-block; font: 600 11px/1.6 system-ui, sans-serif; direction: ltr; color: var(--accent); background: var(--accent-bg); border-radius: 6px; padding: 0 7px; margin: 2px 6px; vertical-align: middle; }
div.aliyah-mark { display: block; width: max-content; margin: 8px 0 2px; }

/* ---------- práctica de taamim ---------- */
.tp-practice { flex: 1; min-height: 0; overflow: auto; padding: 12px 18px; }
.pr-wrap { max-width: 820px; margin: 0 auto; }
.pr-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pr-bar .on { background: var(--accent-bg); border-color: var(--accent); font-weight: 600; }
.pr-score { color: var(--muted); font-size: 13.5px; }
.pr-intro { display: flex; flex-direction: column; gap: 8px; }
.pr-mode { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 10px 14px; border-radius: 10px; }
.pr-card { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 14px 16px; }
.pr-q { font-weight: 600; margin: 0 0 10px; }
.pr-verse { font-size: calc(var(--tp-fs, 26px) * 1.05); line-height: 1.9; margin-bottom: 12px; font-family: var(--tp-fs-font, inherit); }
.pr-w { border: 0; background: transparent; padding: 0 3px; border-radius: 6px; font: inherit; color: inherit; cursor: default; }
button.pr-w { cursor: pointer; }
button.pr-w:hover:not(:disabled) { background: var(--accent-bg); }
.pr-target { background: var(--gold-bg); box-shadow: 0 0 0 2px var(--brand-gold); border-radius: 6px; padding: 0 5px; }
.pr-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.pr-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 10px; }
.pr-glyph { font-size: 30px; line-height: 1.2; }
.pr-opt.good, .pr-good { background: #d7f5dc; border-color: #1a8f3c; }
.pr-opt.bad, .pr-bad { background: #fde0dc; border-color: #c0392b; }
:root[data-theme='dark'] .pr-opt.good, :root[data-theme='dark'] .pr-good { background: #17381f; }
:root[data-theme='dark'] .pr-opt.bad, :root[data-theme='dark'] .pr-bad { background: #4a1d19; }
.pr-fb { margin-top: 10px; }
.pr-ok { color: #1a8f3c; font-weight: 700; margin: 4px 0; }
.pr-no { color: #c0392b; font-weight: 700; margin: 4px 0; }
.pr-ficha { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 10px; font-size: 13.5px; }
.pr-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pr-fb .primary, .pr-end .primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- sin conexión ---------- */
#offline-badge { margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: var(--gold-bg); border: 1px solid var(--brand-gold); font-size: 12.5px; white-space: nowrap; }
#offline-badge[hidden] { display: none; }
#offline-dlg { width: min(520px, 94vw); margin: auto; inset: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); }
#offline-dlg::backdrop { background: rgba(0, 0, 0, .45); }
#offline-dlg .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
#offline-dlg .cr-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 3px solid var(--brand-gold); }
#offline-dlg .cr-head h2 { margin: 0; font-size: 17px; }
#offline-dlg .cr-body { padding: 12px 18px 16px; }
#offline-dlg .pdf-row { display: flex; gap: 8px; flex-wrap: wrap; }

.cr-src { margin-top: 8px; }
.cr-src summary { cursor: pointer; font-weight: 600; }
.cr-src-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }

/* ---------- manual de uso ---------- */
#manual { flex: 1; min-height: 0; display: flex; }
#manual[hidden] { display: none; }
.mn-toc { width: 270px; flex: none; border-inline-end: 1px solid var(--line); background: var(--panel); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.mn-search { width: 100%; }
.mn-links { display: flex; flex-direction: column; gap: 2px; }
.mn-link { text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; }
.mn-link:hover { background: var(--accent-bg); }
.mn-link.on { background: var(--accent-bg); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-gold); }
.mn-link[hidden] { display: none; }
.mn-body { flex: 1; min-width: 0; overflow: auto; padding: 18px 28px 60px; scroll-behavior: smooth; }
.mn-body > * { max-width: 860px; margin-inline: auto; }
.mn-head { position: relative; border-bottom: 3px solid var(--brand-gold); margin-bottom: 14px; padding-bottom: 8px; }
.mn-head h1 { margin: 0; font-family: Marcellus, serif; color: var(--accent); }
.mn-head p { margin: 4px 0 0; }
.mn-print { position: absolute; right: 0; top: 4px; }
.mn-sec { padding: 6px 0 14px; border-bottom: 1px solid var(--line); scroll-margin-top: 10px; }
.mn-sec[hidden] { display: none; }
.mn-sec h2 { font-family: Marcellus, serif; margin: 12px 0 6px; font-size: 22px; }
.mn-sec h4 { margin: 14px 0 4px; color: var(--accent); }
.mn-sec p, .mn-sec li { line-height: 1.55; }
.mn-sec.flash { animation: mnflash 1.6s; }
@keyframes mnflash { 0%, 40% { background: var(--gold-bg); } 100% { background: transparent; } }
.mn-note { background: var(--gold-bg); border: 1px solid var(--brand-gold); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.mn-table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14.5px; }
.mn-table th, .mn-table td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.mn-table th { background: var(--panel-2); }
kbd { font: 12px/1 ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; background: var(--panel); white-space: nowrap; }
.mn-sec details { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.mn-sec summary { cursor: pointer; font-weight: 600; }
@media (max-width: 800px) { #manual { flex-direction: column; } .mn-toc { width: auto; max-height: 38%; border-inline-end: 0; border-bottom: 1px solid var(--line); } }
@media print {
  body.imprimiendo-manual { display: block; height: auto; overflow: visible; }
  body.imprimiendo-manual > *:not(#manual) { display: none !important; }
  body.imprimiendo-manual #manual { display: block; }
  body.imprimiendo-manual .mn-toc, body.imprimiendo-manual .mn-print { display: none; }
  body.imprimiendo-manual .mn-body { overflow: visible; padding: 0; }
  body.imprimiendo-manual .mn-sec { break-inside: avoid-page; }
}

.cam-tools button.off { opacity: .8; background: rgba(217, 45, 32, .75); }
.cam-tools button.on { background: rgba(255, 255, 255, .3); }
.cam-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0, 0, 0, .45); pointer-events: none; }
.cam-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2ecc71, #f1c40f 70%, #e74c3c); }
.cam-meter.off i { background: #888; }

/* cámara en círculo: los controles van en una píldora centrada en la parte baja (donde el círculo es ancho) y no se recortan */
.cam-box[data-shape='circle'] .cam-head { top: auto; bottom: 9%; left: 50%; right: auto; transform: translateX(-50%); width: 74%; border-radius: 999px; padding: 3px 6px; background: rgba(18, 80, 176, .9); }
.cam-box[data-shape='circle'] .cam-tools { flex-wrap: wrap; justify-content: center; gap: 2px; width: 100%; }
.cam-box[data-shape='circle'] .cam-select { display: none; } /* los menús de dispositivo se usan en el recuadro rectangular */
.cam-box[data-shape='circle'] .cam-meter { left: 24%; right: 24%; bottom: 3%; border-radius: 3px; overflow: hidden; }

#module-menu .mod.locked .mod-name::after { content: ' 🔒'; font-size: 12px; }
#acceso-menu .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
#acceso-menu .acc-row button { flex: 1; }

/* ---------- clase en vivo ---------- */
#envivo { flex: 1; min-height: 0; display: flex; }
#envivo[hidden] { display: none; }
.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: auto; }
.ev-video { background: #000; aspect-ratio: 16 / 9; max-height: 52vh; width: 100%; flex: none; }
.ev-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.ev-bar { flex-wrap: wrap; gap: 8px; align-items: center; }
.ev-doc { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ev-live.on { background: #d92d20; color: #fff; border-color: #d92d20; }
.ev-text { flex: 1; min-height: 160px; padding: 10px 18px 30px; }
.ev-ref { margin: 4px 0 10px; font-family: Marcellus, serif; }
.ev-seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 8px 10px 8px 30px; border-radius: 10px; border-inline-start: 4px solid transparent; transition: background .2s; }
.ev-n { position: absolute; left: 6px; top: 10px; font-size: 11px; color: var(--muted); }
.ev-he { font-size: calc(var(--fs, 22px) * 1.2); line-height: 1.8; text-align: right; font-family: 'Frank Ruhl Libre', 'KeterYG', serif; order: 2; }
.ev-tr { font-size: var(--fs, 22px); line-height: 1.5; order: 1; }
.ev-segs.lang-he .ev-seg { grid-template-columns: 1fr; }
.ev-segs.lang-he .ev-tr, .ev-segs.lang-en .ev-he { display: none; }
.ev-segs.lang-en .ev-seg { grid-template-columns: 1fr; }
.ev-focus { background: rgba(230, 184, 13, .22); border-inline-start-color: var(--brand-gold); }
.ev-empty { padding: 10px; }
.ev-chat { width: 330px; flex: none; border-inline-start: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ev-ch { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ev-list { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ev-msg { background: var(--panel-2); border-radius: 10px; padding: 6px 9px; font-size: 14px; }
.ev-msg.mine { background: var(--accent-bg); }
.ev-mh { display: flex; align-items: baseline; gap: 2px; font-size: 12.5px; }
.ev-acts { margin-left: auto; display: inline-flex; gap: 2px; }
.ev-acts button { border: 0; background: transparent; padding: 0 4px; font-size: 12px; opacity: .6; cursor: pointer; }
.ev-acts button:hover { opacity: 1; }
.ev-mt { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.ev-note { padding: 0 12px; min-height: 1em; color: var(--muted); }
.ev-form { padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.ev-input { width: 100%; box-sizing: border-box; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; background: var(--bg); color: var(--text); }
.ev-fr { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.ev-send { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 900px) { #envivo { flex-direction: column; overflow: auto; } .ev-chat { width: auto; height: 46vh; border-inline-start: 0; border-top: 1px solid var(--line); } .ev-seg { grid-template-columns: 1fr; } }

.ev-video { position: sticky; top: 0; z-index: 3; }

/* clase en vivo */
.ev-priv { padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.ev-priv[hidden] { display: none; }
.ev-priv .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.ev-privrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.ev-code { font: 700 15px ui-monospace, Menlo, monospace; letter-spacing: .06em; background: var(--panel); border: 1px dashed var(--accent); border-radius: 8px; padding: 3px 10px; user-select: all; }
.ev-privrow .live { background: #d92d20; color: #fff; border-color: #d92d20; }
.ev-codeform { display: inline-flex; gap: 6px; }
.ev-codeform input { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; min-width: 230px; background: var(--bg); color: var(--text); }
.ev-video { position: relative; }
.ev-video.ev-novid { display: none; }
.ev-vid { width: 100%; height: 100%; background: #000; object-fit: contain; display: block; }
.ev-vid[hidden], .ev-video iframe[hidden] { display: none; }
.ev-vmsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #fff; background: rgba(0, 0, 0, .55); font-size: 15px; pointer-events: none; }
.ev-vmsg[hidden] { display: none; }
.ev-vmsg.err { background: rgba(120, 20, 10, .7); }

/* clase en vivo: el contenido de estudio es el protagonista; el vídeo del docente es una ventana flotante */
.ev-main { overflow: hidden; }
.ev-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ev-content { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: auto; }
.ev-content > .view { flex: 1; min-height: 0; }
.ev-ro .tv-bar, .ev-ro .hl-bar, .ev-ro .tv-side { display: none !important; }
.ev-ro .tv-body { flex: 1; min-height: 0; }
.ev-ro .seg { transition: background .2s; border-radius: 10px; border-inline-start: 4px solid transparent; }
.ev-ro .seg.ev-focus { background: rgba(230, 184, 13, .22); border-inline-start-color: var(--brand-gold); }
.ev-float { position: absolute; z-index: 6; background: #000; border: 2px solid var(--brand-gold); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); overflow: hidden; touch-action: none; }
.ev-float[hidden] { display: none; }
.ev-float.moving { user-select: none; }
.ev-float.moving .ev-fb { pointer-events: none; }
.ev-fh { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 6px; background: rgba(18, 80, 176, .92); color: #fff; font-size: 12px; cursor: grab; }
.ev-float.moving .ev-fh { cursor: grabbing; }
.ev-ftools { display: flex; gap: 3px; }
.ev-ftools button { background: transparent; color: #fff; border: 0; padding: 1px 6px; font-size: 14px; line-height: 1.2; }
.ev-ftools button:hover { background: rgba(255, 255, 255, .22); }
.ev-fb { position: relative; aspect-ratio: 16 / 9; background: #111; }
.ev-fb .ev-vid { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; display: block; background: #000; }
.ev-fb .ev-vid[hidden] { display: none; }
.ev-fz { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 55%, var(--brand-gold) 55%, var(--brand-gold) 65%, transparent 65%, transparent 75%, var(--brand-gold) 75%, var(--brand-gold) 85%, transparent 85%); }
.ev-float[data-shape='circle'] { border-radius: 50%; border-width: 3px; }
.ev-float[data-shape='circle'] .ev-fb { aspect-ratio: 1 / 1; }
.ev-float[data-shape='circle'] .ev-fh { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); width: 62%; z-index: 2; opacity: 0; transition: opacity .15s; border-radius: 999px; justify-content: center; }
.ev-float[data-shape='circle']:hover .ev-fh { opacity: 1; }
.ev-float[data-shape='circle'] .ev-fgrip { display: none; }
.ev-vmsg { font-size: 13px; }
.ev-showcam { margin-left: 6px; }

/* clase en vivo: pantalla compartida del docente */
.ev-screenbox { position: absolute; inset: 0; z-index: 4; background: #111; display: flex; align-items: center; justify-content: center; }
.ev-screenbox[hidden] { display: none; }
.ev-screenvid { width: 100%; height: 100%; object-fit: contain; background: #111; }
.ev-vista { margin-left: 6px; }

/* clase en vivo: el atributo hidden debe ganar siempre a los display de los botones y grupos */
#envivo [hidden] { display: none !important; }

/* manual por perfiles: lo marcado como «maestro» no se muestra a los alumnos */
.mn-body:not(.es-maestro) [data-rol='maestro'] { display: none !important; }
.mn-perfil { margin: 2px 0 0; color: var(--muted); }

/* clase en vivo: grabación */
.ev-recbanner { background: #d92d20; color: #fff; font-weight: 600; text-align: center; padding: 5px 10px; font-size: 14px; }
.ev-recbanner[hidden] { display: none; }
.ev-reccam { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.ev-rectime { color: #d92d20; font-weight: 700; font-variant-numeric: tabular-nums; }

/* clase en vivo: la vista del docente lleva la barra completa de la Biblioteca, salvo el PDF */
.ev-doc-view .pdf-btn { display: none !important; }
.ev-doc-view { height: 100%; }

/* ---------- mapas ---------- */
#mapas { flex: 1; min-height: 0; display: flex; }
#mapas[hidden] { display: none; }
.mp-side { width: 240px; flex: none; border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: auto; background: var(--panel); }
.mp-head { font-size: 15px; padding: 2px 4px; }
.mp-list { display: flex; flex-direction: column; gap: 4px; }
.mp-item { text-align: start; border: 1px solid transparent; background: transparent; padding: 8px 10px; border-radius: 8px; }
.mp-item:hover { background: var(--panel-2); }
.mp-item.on { background: var(--accent-bg); border-color: var(--border); font-weight: 600; }
.mp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mp-bar { gap: 10px; }
.mp-title { font-weight: 600; font-size: 16px; }
.mp-doc { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.mp-doc[hidden], .mp-hint[hidden], .mp-add[hidden], .mp-open[hidden] { display: none; }
.mp-stage { position: relative; flex: 1; min-height: 0; background: var(--panel-2); }
.mp-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mp-frame[hidden] { display: none; }
.mp-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.mp-empty[hidden] { display: none; }
@media (max-width: 700px) { #mapas { flex-direction: column; } .mp-side { width: auto; border-inline-end: 0; border-bottom: 1px solid var(--border); max-height: 38%; } }

/* selector de idioma ES | EN */
.lang-sw { align-self: center; }
.lang-sw .lang-btn { padding: 4px 8px; font-size: 12px; font-weight: 600; }
.lang-sw .lang-btn.on { background: var(--accent-bg); color: var(--accent); }

/* barra de materiales del modo clase (solo docente): arriba, fuera del área de estudio que ven los alumnos */
.cl-materiales { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 170; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: #15203a; color: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .35); overflow-x: auto; white-space: nowrap; }
.cl-mat-tabs, .cl-mat-mods { display: flex; gap: 6px; align-items: center; }
.cl-mat-sep { width: 1px; align-self: stretch; margin: 8px 2px; background: rgba(255, 255, 255, .3); }
.cl-materiales button { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25); font-size: 14px; padding: 4px 10px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cl-materiales button:hover { background: rgba(255, 255, 255, .25); }
.cl-materiales button.on { background: var(--brand-gold); border-color: var(--brand-gold); color: #1b2433; font-weight: 600; }
body.cl-con-materiales .tv.clase-on { inset: 44px 0 0 0; }
/* en Clase en vivo (docente): la misma barra, dentro del módulo y sin fijar */
.cl-materiales.en-linea { position: static; height: auto; min-height: 40px; z-index: auto; padding: 4px 10px; border-radius: 6px; margin: 0 0 6px; box-shadow: none; }
@media print { .cl-materiales { display: none !important; } }
