:root{
  --bg:#f7f2ea; --paper:#fffdf9; --ink:#2b2118; --muted:#7b6d60; --line:#e6dccd;
  --brand:#5a2e1a; --brand-2:#8a4a24; --gold:#b8893d; --gold-soft:#f3e6cc;
  --ok:#2f6b4f; --ok-soft:#dcefe4; --note:#6b4aa0; --danger:#a33;
  --radius:14px; --shadow:0 1px 2px rgba(60,40,20,.06),0 6px 20px rgba(60,40,20,.06);
  --serif:"Literata",Georgia,serif; --sans:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  --heb:"Noto Serif Hebrew","SBL Hebrew","Ezra SIL","Times New Roman",serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth;scroll-padding-top:70px}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 var(--sans);padding-bottom:calc(76px + env(safe-area-inset-bottom))}
a{color:var(--brand-2)}
h1,h2,h3{font-family:var(--serif);font-weight:600;line-height:1.2;margin:0 0 .4em}
.wrap{max-width:760px;margin:0 auto;padding:16px}
.muted{color:var(--muted)} small{font-size:.82em}
.card{background:var(--paper);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);margin:14px 0}

/* Barra superior */
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;padding:10px 16px;
  background:rgba(247,242,234,.92);backdrop-filter:saturate(1.4) blur(8px);border-bottom:1px solid var(--line)}
.brand{font-family:var(--serif);font-weight:600;font-size:1.1rem;color:var(--brand);text-decoration:none;display:flex;align-items:center;gap:8px}
.brand-mark{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:9px;background:var(--brand);color:var(--gold-soft);font-family:var(--heb);font-size:1.05rem}
.who{font-size:.85rem;color:var(--muted)}

/* Barra inferior */
.tabs{position:fixed;bottom:0;left:0;right:0;z-index:30;display:flex;justify-content:space-around;background:var(--paper);
  border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
.tabs a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:.72rem;color:var(--muted);text-decoration:none;padding:4px 0}
.tabs svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tabs .tab-heb{font-family:var(--heb);font-size:1.25rem;line-height:23px;height:23px}
.tabs a.on{color:var(--brand);font-weight:600}

/* Botones y formularios */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);background:var(--paper);color:var(--ink);
  border-radius:11px;padding:11px 16px;font:500 .95rem var(--sans);cursor:pointer;text-decoration:none}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.ghost{background:transparent}
.btn.danger{color:var(--danger);border-color:#e6c4c4}
.btn:active{transform:translateY(1px)}
.form label,.journal label{display:block;font-weight:600;font-size:.9rem;margin:0 0 14px;color:var(--brand)}
input,select,textarea{width:100%;margin-top:6px;font:16px/1.5 var(--sans);color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 12px}
textarea{font-family:var(--serif);resize:vertical;min-height:60px}
input:focus,select:focus,textarea:focus{outline:2px solid var(--gold);outline-offset:0;border-color:var(--gold)}
.form .btn{width:100%}
.flash{background:var(--ok-soft);color:var(--ok);border-radius:10px;padding:10px 14px;margin:10px 0}
.flash.err{background:#f8e2e2;color:var(--danger)}
.chip{display:inline-block;margin-top:8px;font-size:.85rem;background:var(--gold-soft);color:var(--brand);border-radius:99px;padding:5px 12px;text-decoration:none}

/* Login */
.login{max-width:420px;margin:8vh auto 0;text-align:center}
.login-mark{width:64px;height:64px;margin:0 auto 10px;border-radius:18px;display:grid;place-items:center;background:var(--brand);color:var(--gold-soft);font:600 2.1rem var(--heb)}
.login .form{text-align:left}
.login h1{margin-bottom:0}
.tagline{font:italic 1.05rem var(--serif);color:var(--gold);margin:2px 0 12px}

/* Día */
.day-head{text-align:center;padding-top:6px}
.day-nav{display:flex;align-items:center;justify-content:space-between;gap:8px}
.navbtn{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;font-size:1.6rem;text-decoration:none;color:var(--brand);background:var(--paper);border:1px solid var(--line)}
.eyebrow{font-size:.75rem;letter-spacing:.08em;text-transform:uppercase;color:var(--gold);font-weight:600}
.day-head h1{font-size:2rem;margin:2px 0 0}
.of{font-size:1rem;color:var(--muted);font-weight:400}
.progress{height:8px;border-radius:99px;background:var(--line);overflow:hidden;margin:14px 0 6px}
.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--gold),var(--brand-2))}
.progress-meta{font-size:.82rem;color:var(--muted)}
.toc{list-style:none;padding:0;margin:14px 0 4px;display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.toc a{display:block;background:var(--paper);border:1px solid var(--line);border-radius:99px;padding:6px 14px;font:600 .9rem var(--serif);color:var(--brand);text-decoration:none}
.hint{font-size:.8rem;color:var(--muted);margin:6px 0 0}

.reading{background:var(--paper);border:1px solid var(--line);border-radius:var(--radius);padding:20px 18px;margin:16px 0;box-shadow:var(--shadow)}
.reading-label{font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;color:var(--gold);font-weight:600}
.reading h2{font-size:1.4rem;color:var(--brand)}
.ch{font-size:1rem;color:var(--muted);margin:18px 0 6px;font-family:var(--sans);font-weight:600;letter-spacing:.02em}
.text{font:18px/1.75 var(--serif)}
.v{cursor:pointer;border-radius:5px;transition:background .15s;padding:1px 0}
.v:hover,.v:focus{background:var(--gold-soft);outline:none}
.v.hl,.v.sel{background:#f6e1b0}
.verpick{display:flex;align-items:center;justify-content:center;gap:8px;margin:10px 0 0}
.verpick label{font-size:.8rem;color:var(--muted)}
.ver-select{width:auto;margin:0;padding:6px 30px 6px 12px;border-radius:99px;font:600 .9rem var(--serif);color:var(--brand);background:var(--paper)}
.ver-inline{margin:0 0 6px}
.linkbtn{background:none;border:0;padding:0;margin:-4px 0 14px;font:500 .85rem var(--sans);color:var(--brand-2);cursor:pointer;text-decoration:underline}
.hitem{border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin:0 0 10px;background:#fff}
.hitem .hmeta{display:flex;justify-content:space-between;gap:8px;font-size:.78rem;color:var(--muted);margin-bottom:4px}
.hitem .hmeta b{color:var(--brand)}
.hitem p{margin:0 0 8px;font:15px/1.5 var(--serif);white-space:pre-wrap;max-height:9em;overflow:auto}
.parasha{font-size:1.9rem;margin:2px 0 0}
.heb-name{font-family:var(--heb);font-weight:400;color:var(--gold);font-size:.8em;direction:rtl}
.meaning{font:italic 1rem var(--serif);color:var(--brand-2)}
.date-line{font-size:.82rem;color:var(--muted);margin-top:4px}
.weekdots{display:flex;justify-content:center;gap:6px;margin:12px 0 0}
.wdot{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font:600 .8rem var(--sans);text-decoration:none;color:var(--muted);background:var(--paper);border:1px solid var(--line)}
.wdot.done{background:var(--ok-soft);color:var(--ok);border-color:#b7d9c5}
.wdot.today{border:2px solid var(--brand)}
.wdot.on{background:var(--brand);color:#fff;border-color:var(--brand)}
.wk{padding:14px}
.wk.now{border:2px solid var(--gold)}
.wk-head b{font:600 1.15rem var(--serif);color:var(--brand)}
.grid7{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin:10px 0}
.grid7 .cell{aspect-ratio:auto;padding:4px 0;flex-direction:column;display:flex;align-items:center;font-size:.9rem}
.grid7 .cell small{font-size:.62rem;color:var(--muted)}
.wk-refs{font-size:.82rem;color:var(--ink);line-height:1.5}
.wk-refs b{color:var(--gold);font-weight:600}
.missing{color:var(--muted);font-size:.85em}
.v sup{font:600 .62em var(--sans);color:var(--gold);margin:0 3px 0 6px;vertical-align:.5em}

.journal h2{font-size:1.3rem;color:var(--brand);display:flex;justify-content:space-between;align-items:baseline}
.saved{font:400 .75rem var(--sans);color:var(--ok)}
.journal .btn{width:100%;margin-top:4px}

/* Agenda */
.page-title{font-size:1.6rem;color:var(--brand);margin-top:6px}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:12px 0}
.stat{background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:12px;text-align:center}
.stat b{display:block;font:600 1.6rem var(--serif);color:var(--brand)}
.stat span{font-size:.78rem;color:var(--muted)}
.legend{display:flex;gap:6px;align-items:center;font-size:.8rem;color:var(--muted);flex-wrap:wrap}
.sw{display:inline-block;width:14px;height:14px;border-radius:4px;border:1px solid var(--line);margin-left:8px}
.sw.done{background:var(--ok-soft);border-color:#b7d9c5}.sw.note{box-shadow:inset 0 -4px 0 var(--note)}.sw.cur{border:2px solid var(--brand)}
.block-title{font:600 .9rem var(--sans);margin:18px 0 8px;color:var(--ink)} .block-title small{color:var(--muted);font-weight:400}
.grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
.cell{aspect-ratio:1;display:grid;place-items:center;border-radius:9px;background:var(--paper);border:1px solid var(--line);font-size:.85rem;color:var(--ink);text-decoration:none}
.cell.done{background:var(--ok-soft);border-color:#b7d9c5;color:var(--ok);font-weight:600}
.cell.note{box-shadow:inset 0 -4px 0 var(--note)}
.cell.cur{border:2px solid var(--brand);font-weight:700}

/* Diario */
.search{display:flex;gap:8px;margin:8px 0}
.search input{margin:0}.search select{width:auto;margin:0}
.entry-head{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;text-decoration:none;color:var(--ink);margin-bottom:8px}
.entry-head b{font-family:var(--serif);color:var(--brand)} .entry-head small{color:var(--muted);margin-left:auto}
.entry blockquote{margin:0 0 10px;padding:6px 12px;border-left:3px solid var(--gold);font:italic 1rem/1.6 var(--serif);background:var(--gold-soft);border-radius:0 8px 8px 0}
.entry h4{margin:10px 0 2px;font-size:.8rem;text-transform:uppercase;letter-spacing:.05em;color:var(--gold)}
.entry p{margin:0;font-family:var(--serif)}
mark{background:#f9e27a;border-radius:3px;padding:0 2px}
.empty{text-align:center;padding:30px 16px;color:var(--muted);border:1px dashed var(--line);border-radius:var(--radius);margin:16px 0}

/* Raíces */
.wordlist{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.wcard{display:flex;flex-direction:column;align-items:center;gap:2px;text-align:center;background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:14px 10px;cursor:pointer;font:inherit;color:inherit}
.wcard .orig{font-size:1.9rem;line-height:1.3}
.heb{font-family:var(--heb);direction:rtl}.grk{font-family:var(--serif)}
.wcard .tr{font-style:italic;color:var(--muted);font-size:.85rem}
.wcard .gl{font-weight:600;color:var(--brand)}
.wcard .rf{font-size:.75rem;color:var(--gold)}
.wcard .nt{font-size:.8rem;color:var(--muted);font-family:var(--serif)}

/* Más */
.menu{padding:6px 0}
.menu a{display:block;padding:14px 18px;border-bottom:1px solid var(--line);text-decoration:none;color:var(--ink)}
.menu a:last-child{border-bottom:0;color:var(--danger)}
.credits summary{cursor:pointer;font-weight:600;color:var(--brand)}
.credits p{font-size:.9rem}
.urow{display:flex;flex-direction:column;gap:6px;padding:10px 0;border-bottom:1px solid var(--line)}
.urow:last-child{border:0}
.urow summary{cursor:pointer;font-size:.85rem;color:var(--brand-2)}
.inline{display:flex;gap:8px;margin-top:8px;align-items:center}.inline input{margin:0}
.picker{display:flex;gap:8px}.picker select{margin:0}
.pager{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.res{display:block;padding:10px 0;border-bottom:1px solid var(--line);color:var(--ink);text-decoration:none;font-family:var(--serif)}
.res b{font-family:var(--sans);font-size:.85rem;color:var(--brand)}

/* Hoja inferior (interlineal) */
.sheet{position:fixed;inset:0;z-index:50}
.sheet-bg{position:absolute;inset:0;background:rgba(30,20,10,.45);animation:fade .2s}
.sheet-panel{position:absolute;left:0;right:0;bottom:0;max-height:88vh;display:flex;flex-direction:column;background:var(--paper);
  border-radius:20px 20px 0 0;box-shadow:0 -10px 40px rgba(0,0,0,.2);animation:up .22s ease-out;max-width:760px;margin:0 auto}
.sheet-head{display:flex;align-items:center;gap:8px;padding:14px 16px;border-bottom:1px solid var(--line)}
.sheet-title{flex:1;font-family:var(--serif);font-size:1.05rem;color:var(--brand)}
.sheet-x,.sheet-back{border:0;background:var(--bg);width:34px;height:34px;border-radius:50%;font-size:1.4rem;line-height:1;cursor:pointer;color:var(--ink)}
.sheet-body{overflow:auto;padding:16px;padding-bottom:calc(20px + env(safe-area-inset-bottom))}
@keyframes up{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
@keyframes fade{from{opacity:0}}
.vtext{font:17px/1.6 var(--serif);margin:0 0 12px}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.actions .btn{flex:1;font-size:.88rem;padding:9px 10px}
.il{display:flex;flex-wrap:wrap;gap:8px}
.il.heb{flex-direction:row-reverse;direction:ltr}
.w{display:flex;flex-direction:column;align-items:center;min-width:64px;padding:8px 8px 6px;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer;font:inherit;color:inherit}
.w:hover{border-color:var(--gold);background:var(--gold-soft)}
.w .o{font-size:1.45rem;line-height:1.5}
.w .o.heb{font-family:var(--heb);font-size:1.6rem}
.w .t{font-size:.72rem;font-style:italic;color:var(--muted)}
.w .g{font-size:.8rem;font-weight:600;color:var(--brand);text-align:center;max-width:120px}
.w .s{font-size:.62rem;color:var(--gold)}
.lex-big{text-align:center;margin:4px 0 12px}
.lex-big .o{font-size:3rem;line-height:1.3}
.lex-big .o.heb{font-family:var(--heb)}
.lex-big .t{font-style:italic;color:var(--muted)}
.lex-big .g{font:600 1.35rem var(--serif);color:var(--brand);margin-top:4px}
.meta{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin:8px 0 14px}
.meta span{font-size:.78rem;background:var(--bg);border-radius:99px;padding:4px 10px;color:var(--muted)}
.rootwrap{background:var(--gold-soft);border-radius:12px;padding:12px;margin:0 0 14px;text-align:center}
.rootwrap .lbl{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--brand-2);font-weight:600}
.rootwrap .kind{font:600 1rem var(--serif);color:var(--brand);margin:2px 0 6px}
.rootbox{background:var(--paper);border:1px solid #e8d3a8;border-radius:10px;padding:10px;margin-top:8px;cursor:pointer}
.rootbox.off{cursor:default;opacity:.8}
.rootbox .o{font-size:1.8rem;line-height:1.4}.rootbox .o.heb{font-family:var(--heb)}
.sec{font:600 .8rem var(--sans);text-transform:uppercase;letter-spacing:.05em;color:var(--gold);margin:16px 0 6px}
.conc a{display:block;padding:9px 0;border-bottom:1px solid var(--line);color:var(--ink);text-decoration:none;font:15px/1.5 var(--serif)}
.conc a b{font:600 .8rem var(--sans);color:var(--brand)}
.loading{text-align:center;color:var(--muted);padding:30px}
.note-area{margin-top:6px}

@media (min-width:760px){
  .wrap{padding:24px}
  .text{font-size:19px}
  .sheet-panel{bottom:20px;border-radius:20px;max-height:84vh}
}
@media print{.top,.tabs,.journal .btn,.sheet{display:none}body{background:#fff;padding:0}.reading,.card{box-shadow:none;border:0}}
