/* DonorPrompt. Colors are tokens; dark follows the device unless the teacher picks one
   (html[data-theme]). The printed sheet stays paper-colored in both themes. */
:root {
  --paper: #F6F4EE; --surface: #FFFDF8; --raised: #FFFFFF;
  --ink: #1C1B19; --ink2: #47443D; --ink3: #67625A;
  --line: #E0DACD; --line2: #C9C1B0;
  --navy: #1F3A5F; --onNavy: #FFFFFF; --navySoft: #E5EBF3; --navyHover: #142843;
  --green: #2D6A39; --greenSoft: #E3EEE4;
  --red: #A12F2F; --redSoft: #F7E5E2;
  --dot: #9A6412; --cellNext: #8EA2BE;
  --desk: #ECE8DF; --sheet: #FFFFFF; --sheetInk: #1A1917; --sheetMute: #4F4B44; --sheetLine: #D3CBBB;
  --sheetKey: #F1EEE6; --keyInk: #1F3A5F;
  --shadow: 0 1px 2px rgba(40,34,20,.05), 0 12px 32px rgba(40,34,20,.08);
  --sheetShadow: 0 1px 2px rgba(40,34,20,.06), 0 14px 36px rgba(40,34,20,.10);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161A; --surface: #1C1F25; --raised: #242830;
    --ink: #EDE9E1; --ink2: #CBC5B9; --ink3: #A9A296;
    --line: #30353E; --line2: #454B56;
    --navy: #A9C1E4; --onNavy: #0F1724; --navySoft: #22304A; --navyHover: #C4D5EE;
    --green: #93CF9C; --greenSoft: #1D3222;
    --red: #F2A69E; --redSoft: #3B2220;
    --dot: #E0B060; --cellNext: #51668A;
    --desk: #111316; --sheet: #EEE9DE; --sheetMute: #4A463F; --sheetLine: #C9C1B1; --sheetKey: #E2DCCF;
    --shadow: none; --sheetShadow: 0 0 0 1px #2A2E35;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14161A; --surface: #1C1F25; --raised: #242830;
  --ink: #EDE9E1; --ink2: #CBC5B9; --ink3: #A9A296;
  --line: #30353E; --line2: #454B56;
  --navy: #A9C1E4; --onNavy: #0F1724; --navySoft: #22304A; --navyHover: #C4D5EE;
  --green: #93CF9C; --greenSoft: #1D3222;
  --red: #F2A69E; --redSoft: #3B2220;
  --dot: #E0B060; --cellNext: #51668A;
  --desk: #111316; --sheet: #EEE9DE; --sheetMute: #4A463F; --sheetLine: #C9C1B1; --sheetKey: #E2DCCF;
  --shadow: none; --sheetShadow: 0 0 0 1px #2A2E35;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 16px/1.5 'Source Sans 3', system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
a:hover { color: var(--navyHover); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
h1 { margin: 0; font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 700; }
[hidden] { display: none !important; }

/* Hebrew content: whole RTL units, David for text, Frank Ruhl for headings. */
.he { font-family: 'David Libre', 'David', serif; direction: rtl; unicode-bidi: isolate; text-align: right; font-size: 19px; line-height: 1.55; }
[dir="rtl"], [dir="ltr"] { unicode-bidi: isolate; }
.hh { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; }
span.he, .he-inline { display: inline; font-family: 'David Libre', serif; font-size: 18px; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink3); }
.ink2 { color: var(--ink2); }
.ic { width: 18px; height: 18px; flex: none; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3); margin: 0; }
.skiplink { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--raised); padding: 8px 12px; border-radius: 8px; }
.skiplink:focus { left: 8px; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 28px; padding: 0 32px; min-height: 68px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: relative; }
.mark { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; white-space: nowrap; color: var(--ink); }
.mark:hover { color: var(--ink); }
.mark .heb { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 26px; color: var(--navy); }
.mark .sep { color: var(--ink3); }
.mark .en { font-weight: 600; font-size: 17px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; flex: 1; }
.nav > a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--ink2);
  text-decoration: none; font-weight: 600; font-size: 15px; }
.nav > a:hover { background: var(--paper); color: var(--ink); }
.nav > a.on { color: var(--navy); background: var(--navySoft); }
.nav-end { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav-end form { margin: 0; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--navy); }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 760px) {
  .top { padding: 0 8px 0 16px; min-height: 60px; gap: 8px; }
  .mark .heb { font-size: 23px; }
  .mark .en { font-size: 16px; }
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 30; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px 12px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav-end { margin: 8px 0 0; border-top: 1px solid var(--line); padding-top: 8px; justify-content: space-between; }
}

/* ---------- page frame ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 36px 40px 80px; display: flex; flex-direction: column; gap: 24px; }
.page.wide { max-width: 1200px; padding-top: 28px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--ink2); }
@media (max-width: 760px) { .page { padding: 20px 16px 48px; gap: 16px; } h1 { font-size: 26px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 24px; }
@media (max-width: 760px) { .pad { padding: 16px; } }

/* ---------- buttons ---------- */
.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line2); background: var(--raised); color: var(--ink);
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.btn:hover { color: var(--ink); border-color: var(--ink3); }
.btn.pri { background: var(--navy); border-color: var(--navy); color: var(--onNavy); }
.btn.pri:hover { background: var(--navyHover); border-color: var(--navyHover); color: var(--onNavy); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--navy); padding: 0 10px; }
.btn.quiet:hover { background: var(--navySoft); }
.btn.danger { color: var(--red); }
.btn.off, .btn:disabled { background: transparent; border: 1.5px dashed var(--line2); color: var(--ink2); cursor: not-allowed; }
.btn.lg { min-height: 52px; font-size: 17px; border-radius: 12px; padding: 0 24px; }
.btn.block { width: 100%; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; text-decoration: none; font-size: 15px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* "…" menus (details/summary) */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; background: var(--raised);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; text-align: left; }
.menu-list form { margin: 0; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: 8px; background: transparent; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.menu-list button:hover, .menu-list a:hover { background: var(--paper); }
.menu-list .danger { color: var(--red); }

/* ---------- form bits ---------- */
.field { width: 100%; min-height: 48px; border: 1px solid var(--line2); border-radius: 10px; background: var(--raised); padding: 0 14px; font-size: 16px; }
.lab { font-weight: 700; font-size: 16px; margin-bottom: 8px; display: block; }
.err { display: flex; gap: 8px; align-items: flex-start; color: var(--red); background: var(--redSoft); border-radius: 10px; padding: 10px 12px;
  font-weight: 600; font-size: 15px; margin: 10px 0 0; }
.notice { display: flex; gap: 8px; align-items: flex-start; background: var(--navySoft); color: var(--ink); border-radius: 10px; padding: 10px 12px;
  font-weight: 600; font-size: 15px; margin: 0; }
.help { margin: 10px 0 0; font-size: 15px; color: var(--ink2); }
.opt { font-size: 13px; font-weight: 700; color: var(--ink3); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 10px; }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; cursor: pointer; font-size: 16px; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }

/* switch: <button role="switch" aria-checked> with a .track */
.switchrow { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; border: 0; background: transparent; font-weight: 600;
  font-size: 15px; cursor: pointer; padding: 0; text-align: left; color: var(--ink); }
.track { width: 48px; height: 28px; border-radius: 999px; background: var(--line2); position: relative; flex: none; }
.track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; transition: left .15s; }
[aria-checked="true"] > .track { background: var(--navy); }
[aria-checked="true"] > .track::after { left: 23px; background: var(--onNavy); }

/* segmented radio group */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line2); gap: 3px; flex-wrap: wrap; }
.seg button { min-height: 44px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--ink2); }
.seg button[aria-checked="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 0 0 1.5px var(--navy); }

.qchip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--raised); color: var(--ink);
  font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.qchip[aria-pressed="true"] { background: var(--navySoft); border: 2px solid var(--navy); color: var(--navy); }
.qchip .he { font-size: 18px; line-height: 1; }

.search { display: flex; align-items: center; gap: 10px; min-height: 52px; border: 1px solid var(--line2); border-radius: 12px; background: var(--raised);
  padding: 0 14px; color: var(--ink3); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 17px; outline: none; min-height: 48px; color: var(--ink); }
.search:focus-within { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------- build ---------- */
.build { max-width: 1200px; margin: 0 auto; padding: 28px 40px 96px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.build-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.build-side { flex: 1 1 320px; min-width: 300px; position: sticky; top: 24px; }
.sechead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sechead > .end { margin-left: auto; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy);
  color: var(--onNavy); font-weight: 700; font-size: 15px; flex: none; }
.sub { margin: 6px 0 0 42px; color: var(--ink2); }
.matsum { background: var(--paper); border-radius: 12px; padding: 16px 20px; }
.matsum .hh { font-size: 27px; line-height: 1.3; }
.facts { display: flex; gap: 6px 20px; flex-wrap: wrap; color: var(--ink2); font-size: 15px; }
.plist { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 420px; background: var(--raised); }
.prow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; cursor: pointer; text-align: right; font-family: 'David Libre', serif; font-size: 19px; line-height: 1.4; color: var(--ink); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--paper); }
.prow.sel { background: var(--navySoft); }
.prow.anchor { box-shadow: inset -4px 0 0 var(--navy); }
.pbadge { flex: none; min-width: 44px; height: 36px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 19px; background: var(--paper); border: 1px solid var(--line); }
.prow.sel .pbadge { background: var(--navy); color: var(--onNavy); border-color: var(--navy); }
.ptext { flex: 1; min-width: 0; }
.pmeta { font-family: 'Source Sans 3', sans-serif; font-size: 15px; color: var(--ink3); white-space: nowrap; }
.pend { flex: none; color: var(--navy); width: 18px; }
.pickhint { font-size: 15px; color: var(--ink2); display: flex; align-items: flex-start; gap: 8px; margin: 0; }
.pickhint .ic { margin-top: 3px; }
.numbox { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.numbox-l { font-weight: 700; font-size: 16px; }
.numrow { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; font-size: 16px; color: var(--ink2); }
.numrow label { white-space: nowrap; }
.numrow input { width: 72px; min-width: 0; min-height: 44px; border: 1px solid var(--line2); border-radius: 10px; background: var(--raised); padding: 0 10px; font-size: 17px; font-weight: 700; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--ink2); align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lchip { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 30px; height: 26px; padding: 0 6px; border-radius: 7px;
  border: 1px solid var(--line2); background: var(--raised); font-family: 'David Libre', serif; font-size: 16px; position: relative; }
.lchip.inc { background: var(--greenSoft); border: 2px solid var(--green); color: var(--green); }
.lchip.skip { background: var(--paper); border: 1.5px dashed var(--line2); color: var(--ink3); }
.udot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.fsim { border-top: 1px solid var(--line); padding-top: 16px; }
.fsim-title { font-size: 21px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { min-width: 52px; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--raised); color: var(--ink);
  font-family: 'David Libre', serif; font-size: 20px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; position: relative; }
.chip.inc { background: var(--greenSoft); border: 2px solid var(--green); color: var(--green); font-weight: 700; }
.chip.skip { background: var(--paper); border: 1.5px dashed var(--line2); color: var(--ink3); }
.chip .u { position: absolute; top: 5px; left: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.chip .n { font-family: 'Source Sans 3', sans-serif; font-size: 12px; color: var(--ink3); font-weight: 600; }
.fstat { margin-top: 8px; font-size: 14px; color: var(--ink3); }
.lengrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 20px; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line2); border-radius: 12px; background: var(--raised); overflow: hidden; }
.stepper button { width: 50px; min-height: 50px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.stepper button:hover { background: var(--paper); }
.stepper button:disabled { color: var(--line2); cursor: default; background: transparent; }
.stepper output { min-width: 60px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.pre { min-width: 48px; justify-content: center; padding: 0 12px; }
.est { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 12px; padding: 12px 16px; font-size: 15px; color: var(--ink2); }
.est b { color: var(--ink); }
.repeat { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.repeat .switchrow { font-size: 16px; }
.repeat .help { margin: 4px 0 0 60px; }
.summary { padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.summary .hh { font-size: 28px; line-height: 1.25; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum { margin: 0; display: flex; flex-direction: column; }
.sum div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.sum dt { color: var(--ink2); }
.sum dd { margin: 0; font-weight: 700; text-align: right; }
.why { margin: 0; font-size: 14px; color: var(--ink2); }
.reassure { margin: 0; font-size: 14px; color: var(--ink3); }
.phonebar { display: none; }
@media (max-width: 900px) {
  .build { padding: 16px 16px 180px; gap: 14px; }
  .build-main { gap: 14px; }
  .build-side { display: none; }
  .sub { margin-left: 0; }
  .lengrid { grid-template-columns: 1fr; gap: 18px; }
  .repeat .help { margin-left: 0; }
  .phonebar { display: flex; flex-direction: column; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface);
    border-top: 1px solid var(--line); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .phonebar .top-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .phonebar .hh { font-size: 20px; }
  .phonebar .why { font-size: 13px; }
  .quick { flex-wrap: nowrap !important; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
  .plist { max-height: 330px; }
  .prow { gap: 10px; padding: 8px 12px; font-size: 18px; min-height: 58px; }
  .prow .pmeta { display: block; font-size: 14px; }
  .seg.full { display: flex; }
  .seg.full button { flex: 1; padding: 0 8px; font-size: 14px; }
  .presets { width: 100%; }
  .presets .pre { flex: 1; }
}

/* ---------- preview bar ---------- */
.desk { background: var(--desk); }
.pbar-top { position: sticky; top: 0; z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); }
.pbar-in { max-width: 1200px; margin: 0 auto; padding: 14px 40px; display: flex; flex-direction: column; gap: 10px; }
.namef { display: flex; flex-direction: column; gap: 2px; flex: 1 1 320px; min-width: 240px; }
.namef span { font-size: 13px; font-weight: 700; color: var(--ink3); letter-spacing: .04em; text-transform: uppercase; }
.namef input { min-height: 46px; border: 1px solid var(--line2); border-radius: 10px; background: var(--raised); padding: 0 14px;
  font-family: 'Frank Ruhl Libre', serif; font-weight: 500; font-size: 20px; direction: rtl; text-align: right; width: 100%; }
.draft { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--ink2); border: 1.5px dashed var(--line2);
  border-radius: 999px; padding: 2px 10px; }
.status { font-weight: 600; color: var(--ink); }
.sheets { padding: 40px 40px 56px; }
.sheets-in { max-width: 1048px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; align-items: flex-end; }
.after-sheet { width: 816px; max-width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.preview-phonebar { display: none; }
@media (max-width: 1140px) {
  .sheets-in { align-items: center; }
}
@media (max-width: 760px) {
  .pbar-top { position: static; }
  .pbar-in { padding: 10px 16px; }
  .pbar-in .desk-only { display: none; }
  .sheets { padding: 16px 12px 120px; }
  .preview-phonebar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface);
    border-top: 1px solid var(--line); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .preview-phonebar .pri { flex: 1; }
  .seg.full { display: flex; width: 100%; }
  .seg.full button { flex: 1; }
}

/* ---------- the printed sheet ---------- */
.sheet { background: var(--sheet); color: var(--sheetInk); border-radius: 4px; box-shadow: var(--sheetShadow); direction: rtl;
  font-family: 'David Libre', serif; font-size: 19px; line-height: 1.6; padding: 56px 72px 40px; width: 816px; max-width: 100%; position: relative; }
.shead { display: flex; justify-content: space-between; align-items: flex-start; font-size: 16px; color: var(--sheetMute); }
.stitle { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 30px; text-align: center; margin: 6px 0 2px; line-height: 1.3; }
.srange { text-align: center; font-size: 18px; color: var(--sheetMute); }
.slines { display: flex; gap: 40px; margin-top: 22px; font-size: 18px; }
.slines span { flex: 1; border-bottom: 1px solid var(--sheetInk); padding-bottom: 2px; }
.tbadge { margin: 18px auto 0; width: max-content; max-width: 100%; border: 2px solid var(--sheetInk); padding: 4px 18px;
  font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 19px; }
.qs { margin-top: 26px; border-top: 1.5px solid var(--sheetInk); }
.part { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 21px; border-bottom: 1.5px solid var(--sheetInk); padding-bottom: 4px; margin: 30px 0 8px; }
.q { position: relative; padding: 14px 0; border-bottom: 1px solid var(--sheetLine); }
.q:last-child { border-bottom: 0; }
.q.swapped { background: var(--sheetKey); box-shadow: 0 0 0 8px var(--sheetKey); border-radius: 2px; }
.q.swapped .key, .q.swapped .choices li.ok { background: var(--sheet); }
.qstem { display: flex; gap: 10px; font-weight: 500; }
.qnum { font-weight: 700; min-width: 26px; flex: none; }
.choices { list-style: none; margin: 6px 36px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.choices li { display: flex; gap: 8px; padding: 1px 6px; border-radius: 4px; }
.choices li.ok { background: var(--sheetKey); font-weight: 700; }
.okmark { margin-right: auto; font-family: 'Source Sans 3', sans-serif; font-size: 13px; font-weight: 700; color: var(--keyInk);
  display: inline-flex; align-items: center; gap: 4px; direction: ltr; white-space: nowrap; }
.wlines { margin: 10px 36px 0 0; display: flex; flex-direction: column; gap: 26px; padding-top: 14px; }
.wlines div { border-bottom: 1px solid var(--sheetLine); height: 1px; }
.key { margin: 10px 36px 0 0; background: var(--sheetKey); border-radius: 6px; padding: 10px 14px; font-size: 17px; line-height: 1.55;
  display: flex; flex-direction: column; gap: 2px; }
.qctl { position: absolute; left: -260px; top: 12px; width: 180px; direction: ltr; display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end; font-family: 'Source Sans 3', sans-serif; line-height: 1.4; }
.tag { font-family: 'David Libre', serif; direction: rtl; font-size: 17px; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 2px 10px; white-space: nowrap; }
.swap { min-height: 44px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line2); background: var(--raised); color: var(--ink);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.swapnote { font-size: 13px; color: var(--ink2); text-align: right; line-height: 1.35; }
.foot { display: flex; justify-content: space-between; font-size: 14px; color: var(--sheetMute); margin-top: 26px; border-top: 1px solid var(--sheetLine); padding-top: 8px; }
/* The gutter only fits on wide screens; otherwise the controls sit under the question. */
@media (max-width: 1140px) {
  .q { display: flex; flex-direction: column; }
  .qctl { position: static; width: auto; order: 10; flex-direction: row-reverse; align-items: center; justify-content: flex-start; flex-wrap: wrap;
    margin: 12px 36px 0 0; direction: ltr; }
  .qctl .tag { background: var(--sheetKey); color: var(--sheetInk); border-color: var(--sheetLine); }
  .qctl .swap { background: #FFFFFF; color: var(--sheetInk); border-color: var(--sheetLine); }
  .qctl .swapnote { color: var(--sheetMute); text-align: left; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .sheet { padding: 22px 16px 18px; font-size: 18px; }
  .stitle { font-size: 22px; }
  .slines { gap: 16px; font-size: 16px; }
  .choices, .key, .wlines, .qctl { margin-right: 0; }
  .q.swapped { box-shadow: 0 0 0 4px var(--sheetKey); }
}

/* ---------- saved ---------- */
.saved-head { display: flex; gap: 18px; align-items: flex-start; }
.okcircle { width: 52px; height: 52px; border-radius: 50%; background: var(--greenSoft); color: var(--green); display: flex; align-items: center; justify-content: center; flex: none; }
.saved-head .he { font-size: 24px; margin-top: 6px; }
.copies { display: flex; gap: 20px; flex-wrap: wrap; }
.copy { flex: 1 1 400px; padding: 24px; display: flex; gap: 24px; align-items: flex-start; }
.copy h2 { font-size: 22px; }
.thumb { width: 150px; height: 194px; flex: none; background: var(--sheet); border: 1px solid var(--sheetLine); border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 16px rgba(0,0,0,.08); direction: rtl; padding: 14px; display: flex; flex-direction: column;
  gap: 6px; font-family: 'David Libre', serif; color: var(--sheetInk); }
.thumb i { display: block; height: 3px; background: var(--sheetLine); border-radius: 2px; }
.thumb .t { text-align: center; font-size: 11px; font-family: 'Frank Ruhl Libre', serif; font-weight: 700; }
.thumb .lines { font-size: 8px; display: flex; gap: 10px; }
.thumb .lines span { flex: 1; border-bottom: 1px solid var(--sheetInk); }
.thumb .badge { font-size: 8px; text-align: center; border: 1px solid var(--sheetInk); align-self: center; padding: 0 4px; }
.thumb i.k { height: 16px; background: var(--sheetKey); }
.actions-card { padding: 16px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qdetails > summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px;
  font-weight: 700; font-size: 17px; cursor: pointer; }
.qdetails[open] > summary { border-bottom: 1px solid var(--line); }
.qdetails .inner { padding: 20px; display: flex; flex-direction: column; gap: 16px; align-items: center; background: var(--desk); border-radius: 0 0 16px 16px; }
.dialog { border: 1px solid var(--line2); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 24px; width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(20, 18, 14, .45); }
.dialog form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.dialog input.he-input { direction: rtl; text-align: right; font-family: 'Frank Ruhl Libre', serif; font-size: 19px; }
@media (max-width: 760px) {
  .saved-head { gap: 12px; }
  .okcircle { width: 40px; height: 40px; }
  .copy { padding: 16px; gap: 14px; flex-direction: column; }
  .thumb { display: none; }
  .copy .row .btn { flex: 1; }
}

/* ---------- home ---------- */
.next { padding: 32px; box-shadow: var(--shadow); display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-end; }
.next-main { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.next .big { font-size: 44px; line-height: 1.15; }
.next-acts { display: flex; flex-direction: column; gap: 10px; flex: 0 1 260px; }
.trow { display: flex; align-items: center; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.trow .when { flex: 0 0 190px; font-size: 15px; color: var(--ink2); }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; flex-wrap: wrap; }
.cardhead a { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 760px) {
  .next { padding: 20px; gap: 18px; }
  .next .big { font-size: 34px; }
  .next-main, .next-acts { flex-basis: 100%; }
  .trow { gap: 10px; padding: 14px 16px; }
  .trow .when { flex-basis: 100%; }
  .trow .row { width: 100%; }
  .trow .row .btn { flex: 1; }
}

/* coverage strip: 221 cells, right to left so א׳ is on the right */
.cov { display: flex; height: 22px; gap: 1px; direction: rtl; border-radius: 4px; overflow: hidden; }
.cov.lg { height: 30px; }
.cov > * { flex: 1; min-width: 0; background: var(--line); display: block; }
.cov > .d { background: var(--navy); }
.cov > .x { background: var(--cellNext); }
.cov > a:focus-visible { outline-offset: 0; }
.ticks { display: flex; justify-content: space-between; direction: rtl; font-family: 'David Libre', serif; font-size: 16px; color: var(--ink3); margin-top: 4px; }
.keys { display: flex; gap: 8px 20px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--ink2); }
.keys > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* ---------- tables (My tests, Admin) ---------- */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink3); padding: 12px 16px;
  border-bottom: 1px solid var(--line2); white-space: nowrap; }
.grid th.num, .grid td.num { text-align: right; }
.grid th a { color: var(--navy); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.grid td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.grp td { background: var(--paper); font-weight: 700; font-size: 14px; color: var(--ink2); padding: 10px 16px; }
.grid td.acts { text-align: right; white-space: nowrap; }
.grid td.acts > * { vertical-align: middle; }
.sel { min-height: 48px; border: 1px solid var(--line2); border-radius: 12px; background: var(--raised); padding: 0 12px; font-size: 16px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.filters .search { flex: 1 1 360px; min-height: 48px; }
.filters .search input { font-size: 16px; min-height: 44px; }
.filters label.f { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.justsaved { font-size: 12px; font-weight: 700; color: var(--navy); background: var(--navySoft); border-radius: 999px; padding: 1px 8px; margin-left: 8px; font-family: 'Source Sans 3', sans-serif; }
.tcards { display: none; }
@media (max-width: 760px) {
  .tests-table { display: none; }
  .tcards { display: flex; flex-direction: column; }
  .tcard { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
  .tcard:first-child { border-top: 0; }
  .tcard .row .btn { flex: 1; }
  .tgrp { background: var(--paper); font-weight: 700; font-size: 14px; color: var(--ink2); padding: 10px 16px; border-top: 1px solid var(--line); }
  .tgrp:first-child { border-top: 0; border-radius: 16px 16px 0 0; }
  .filters label.f { flex: 1 1 140px; }
  .filters label.f .sel { flex: 1; min-width: 0; }
}

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.pill.active { background: var(--navySoft); color: var(--navy); }
.pill.invited { border: 1.5px dashed var(--line2); color: var(--ink2); }
.pill.disabled { background: var(--paper); border: 1px solid var(--line2); color: var(--ink3); }
.dotc { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.invite { display: flex; gap: 10px; max-width: 640px; margin: 0; }
.invite .field { flex: 1; min-width: 0; }
.pending { border-top: 1px solid var(--line); padding-top: 12px; }
.pend-row { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; padding: 4px 0; }
.pend-row .acts { margin-left: auto; display: flex; gap: 4px; }
.pend-row form { margin: 0; }
.ucards { display: none; }
@media (max-width: 760px) {
  .admin-table { display: none; }
  .ucards { display: flex; flex-direction: column; }
  .ucard { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
  .ucard:first-child { border-top: 0; }
  .invite { flex-direction: column; }
}

/* ---------- sign in ---------- */
.signin { min-height: 100vh; padding: 56px 16px 32px; display: flex; flex-direction: column; align-items: center; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 36px 32px;
  display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 400px; }
.box h1, .box h2 { margin: 0; font-size: 24px; line-height: 1.25; text-align: center; }
.box form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.box .field { min-height: 52px; font-size: 17px; border-radius: 12px; }
.box .lab { font-size: 15px; margin-bottom: 6px; }
.box .btn { min-height: 52px; font-size: 17px; border-radius: 12px; width: 100%; }
.box .btn.quiet { min-height: 44px; font-size: 16px; }
.box p { margin: 0; }
.box .center { text-align: center; }
.box .small { font-size: 14px; color: var(--ink3); text-align: center; }
.mark-stack { flex-direction: column; align-items: center; gap: 0; align-self: center; }
.mark-stack .heb { font-size: 40px; line-height: 1.1; }
.mark-stack .en { font-size: 16px; color: var(--ink2); letter-spacing: .02em; }
.bsd { font-family: 'David Libre', serif; width: 100%; max-width: 400px; margin: 0 0 12px; color: var(--ink3); font-size: 18px; }
.roundic { width: 56px; height: 56px; border-radius: 50%; background: var(--navySoft); color: var(--navy); display: flex; align-items: center; justify-content: center; align-self: center; }
@media (max-width: 480px) { .signin { padding-top: 24px; } .box { padding: 28px 20px; } }

@media print {
  .top, .pbar-top, .preview-phonebar, .phonebar { display: none !important; }
}
