/* 🕯️ שמות לברכה באוהל — עיצוב משותף לטופס ולדף-הניהול. מותאם אייפון + אנדרואיד (Chrome, Samsung Internet). */
:root {
  --bg: #f6f1e6;
  --card: #fffdf8;
  --ink: #1f2a44;
  --muted: #5d6474;
  --line: #e2d9c4;
  --gold: #a8842c;
  --gold-soft: #f2e6c6;
  --navy: #1f3a68;
  --navy-ink: #ffffff;
  --boy-bg: #e7edf8;
  --boy: #1f3a68;
  --girl-bg: #f8e7ef;
  --girl: #8a2f5b;
  --err: #9d2626;
  --err-bg: #fbeaea;
  --ok: #24663b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  --serif: "Frank Ruhl Libre", "FrankRuehl", "David", "Noto Serif Hebrew", "Times New Roman", serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); touch-action: manipulation; }   /* בלי זום בהקשה כפולה (צביטה עדיין עובדת) */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.5;
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: rgba(168, 132, 44, .15);
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
.wrap {
  width: 100%; max-width: 560px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

/* כותרת */
.hero { text-align: center; padding: 8px 4px 14px; }
.flame { width: 34px; height: 48px; display: block; margin: 0 auto 6px; }
.flame.small { width: 28px; height: 40px; }
h1 { font-family: var(--serif); font-weight: 700; font-size: 31px; line-height: 1.15; margin: 0; color: var(--navy); }
h1 span { display: block; font-size: 21px; font-weight: 500; color: var(--gold); margin-top: 6px; }
.lead { margin: 12px auto 0; max-width: 30em; color: var(--muted); font-size: 16.5px; text-wrap: balance; }

/* כרטיסים ושדות */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 16px; margin: 0 0 12px; box-shadow: 0 1px 2px rgba(31, 42, 68, .04);
}
h2 { font-size: 18px; margin: 0 0 10px; color: var(--navy); font-weight: 700; }
.fld { display: block; min-width: 0; }
.fld + .fld { margin-top: 0; }
.lbl { display: block; font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 2px 5px; }
.req { color: var(--err); font-weight: 700; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.pair + .pair { margin-top: 12px; }
input[type=text], input[type=search], input[type=password], input[type=tel] {
  display: block; width: 100%; min-width: 0; min-height: 50px; margin: 0;
  padding: 11px 12px; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  direction: rtl; text-align: right;
  -webkit-appearance: none; appearance: none; outline: none;
  scroll-margin: 90px 0 120px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #a39c8c; opacity: 1; }
input[type=tel] { direction: ltr; text-align: right; }
.fphone { margin-top: 12px; }
.fhint { margin: 6px 2px 0; }
input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input.bad { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }

/* ילדים */
.hint { margin: -4px 0 10px; color: var(--muted); font-size: 15px; }
.kids-head, .kid { display: grid; grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.kids-head { font-size: 14px; font-weight: 600; color: var(--muted); padding: 0 2px 4px; }
.kids { list-style: none; margin: 0; padding: 0; }
.kids > li + li { margin-top: 8px; }
.g {
  width: 54px; min-height: 50px; padding: 0; border-radius: 12px; border: 1.5px solid transparent;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; touch-action: manipulation;
  background: var(--boy-bg); color: var(--boy);
}
.g[data-g=g] { background: var(--girl-bg); color: var(--girl); }
.g:focus-visible { outline: 3px solid var(--gold-soft); border-color: var(--gold); }

/* שמות בלי שם משפחה: [בן/בת] [שם פרטי] [שם האם] [×] */
.extras-head, .xrow { display: grid; grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.extras-head { font-size: 14px; font-weight: 600; color: var(--muted); padding: 0 2px 4px; }

.xrow .x { width: 44px; min-height: 50px; padding: 0; font-size: 22px; color: var(--err); }
#addExtra { margin-top: 10px; width: 100%; }
.btn.wide { width: 100%; min-height: 52px; margin: 0 0 12px; border-style: dashed; border-color: var(--gold); background: var(--card); white-space: normal; text-align: center; line-height: 1.3; }

/* כפתורים */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; color: var(--navy); font: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer; touch-action: manipulation; text-decoration: none;
}
.btn.primary { width: 100%; min-height: 56px; background: var(--navy); color: var(--navy-ink); border-color: var(--navy); font-size: 18px; font-weight: 700; }
.btn.primary[disabled] { opacity: .65; }
.btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 1px; }
/* "+ בקשה" לכל שם — כפתור קטן שמופיע רק כשיש שם, ופותח שבבים */
.rqline { margin: 6px 2px 0; }
.rqt {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px dashed var(--gold);
  background: transparent; color: var(--navy); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.rqt.has { border-style: solid; background: var(--gold-soft); }
.rqp { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip {
  min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; touch-action: manipulation;
}
.chip[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip[aria-pressed=true]::before { content: "✓ "; }
.rqp .rqo { flex: 1 1 100%; min-height: 46px; }
.btn.share { width: 100%; min-height: 54px; margin: 0 0 10px; background: #1f7a4d; border-color: #1f7a4d; color: #fff; font-size: 18px; font-weight: 700; }
.err { margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--err-bg); color: var(--err); font-weight: 600; }
.privacy { text-align: center; color: var(--muted); font-size: 14.5px; margin: 12px 4px 0; }
.thanks { text-align: center; padding: 26px 18px 22px; }
.thanks h2 { font-family: var(--serif); font-size: 28px; margin: 4px 0 8px; }
.thanks p { margin: 0 0 18px; }

/* מלכודת-בוטים — מחוץ לתצוגה, בלי לחרוג מרוחב הדף */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }

/* ── דף-הניהול ─────────────────────────────────────────────────────────── */
.admin .wrap { max-width: 760px; }
.bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(10px + env(safe-area-inset-top)) 0 10px; margin-top: calc(-14px - env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 23px; }
.bar .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 4px; }
.stats { font-size: 16px; }
.stats b { font-size: 20px; color: var(--navy); }
.live { font-size: 13.5px; color: var(--muted); }
.live.off { color: var(--err); }
.tools { display: grid; gap: 10px; margin: 12px 0; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.btns .btn { width: 100%; font-size: 15px; padding: 8px 10px; }
.btn[aria-pressed=true] { background: var(--gold-soft); border-color: var(--gold); }
.list { list-style: none; margin: 0; padding: 0; }
.fam { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.fam.new { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--gold-soft); } to { background: var(--card); } }
.fam.del { opacity: .75; border-style: dashed; }
.fam h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 21px; color: var(--navy); }
.fam .ln { margin: 0; font-size: 17px; }
.fam .meta { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.fam .by { color: var(--ink); font-size: 14.5px; margin-top: 6px; }
.fam .sv { color: var(--ok); font-size: 14px; font-weight: 700; white-space: nowrap; }
.ohel-title { font-family: var(--serif); font-size: 22px; text-align: center; margin: 0 0 2px; }
.rabbi .ohel-bar { margin-top: calc(-14px - env(safe-area-inset-top)); padding-top: calc(10px + env(safe-area-inset-top)); }
.badge { display: inline-block; font-family: var(--font); font-size: 13px; font-weight: 700; background: var(--gold-soft); color: #6b5310; border: 1px solid var(--gold); border-radius: 999px; padding: 1px 8px; margin-inline-start: 6px; vertical-align: middle; }
.fam details { margin-top: 8px; font-size: 14.5px; }
.fam summary { cursor: pointer; color: var(--navy); font-weight: 600; min-height: 32px; }
.fam .ver { border-top: 1px dashed var(--line); padding: 6px 0; }
.fam .ver .meta { margin-top: 0; }
.fam .ver p { margin: 0; }
.fam .ver .btn { min-height: 40px; margin-top: 6px; font-size: 14.5px; }
.fam .acts { display: flex; gap: 8px; margin-top: 10px; }
.fam .acts .btn { flex: 1 1 0; min-width: 0; }
.btn.danger { color: var(--err); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.login { margin-top: 28px; }
.login p { color: var(--muted); }
.login .btn.primary { margin-top: 12px; }
.toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); width: min(92vw, 440px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}
.toast .btn { min-height: 40px; padding: 6px 12px; background: transparent; color: #f4d58d; border-color: #5d6474; }

/* עריכה */
dialog.edit {
  width: min(96vw, 560px); max-width: 560px; max-height: 92dvh; padding: 0; border: 0; border-radius: 16px;
  background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
dialog.edit::backdrop { background: rgba(31, 42, 68, .45); }
.edit form { padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
.edit h2 { margin-bottom: 12px; }
.edit .fld { margin-bottom: 10px; }
.edit .pair { margin-bottom: 10px; }
.edit .pair .fld { margin-bottom: 0; }
.ekid { display: grid; grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; align-items: center; margin-bottom: 8px; }
.ekid .x { width: 44px; min-height: 50px; padding: 0; font-size: 20px; color: var(--err); }
.edit .foot { display: flex; gap: 8px; margin-top: 14px; }
.edit .sub2 { margin-top: 16px; }
.fam .sub { margin: 6px 0 0; font-size: 14.5px; font-weight: 700; color: var(--gold); }
.pn .pf.extras-block { margin-top: 6px; }
.edit .foot .btn { flex: 1 1 0; }
.edit .err { margin-top: 10px; }

/* 🕯️ מצב-אוהל: טקסט גדול, ✔ גדול לכל שם ולכל משפחה */
.ohel-btn { width: 100%; min-height: 56px; background: var(--navy); color: #fff; border-color: var(--navy); font-size: 17px; font-weight: 700; white-space: normal; line-height: 1.3; }
.ohel-bar { position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 10px 0; display: grid; gap: 6px; border-bottom: 2px solid var(--gold); }
.ohel-count { font-size: 24px; font-weight: 800; color: var(--navy); text-align: center; }
.ohel-net { font-size: 15px; text-align: center; color: var(--ok); }
.ohel-net.off { color: var(--err); }
.of { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.of.done { border-color: #8cc29f; background: #f3faf5; }
.ofh { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ofh h2 { font-family: var(--serif); font-size: 26px; margin: 0; min-width: 0; }
.on { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.on .nm { font-family: var(--serif); font-size: 25px; line-height: 1.3; min-width: 0; flex: 1 1 auto; }
.on.done .nm { color: #2f5d3e; }
.on .at { display: block; font-family: var(--font); font-size: 14px; color: var(--ok); }
.tick {
  flex: 0 0 auto; width: 58px; min-height: 58px; border-radius: 14px; border: 2.5px solid #b9b2a2; background: #fff;
  font: inherit; font-size: 28px; font-weight: 800; color: var(--ok); cursor: pointer; touch-action: manipulation;
}
.tick[aria-pressed=true] { background: #2f7d4f; border-color: #2f7d4f; color: #fff; }
.tick.fam { width: auto; min-width: 58px; padding: 0 12px; font-size: 17px; color: var(--navy); }
.tick.fam[aria-pressed=true] { color: #fff; }

/* תצוגת הדפסה (פ"נ) */
.pn { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; font-family: var(--serif); }
.pn header { text-align: center; border-bottom: 2px double var(--gold); padding-bottom: 10px; margin-bottom: 14px; }
.pn header h1 { font-size: 30px; }
.pn header p { margin: 4px 0 0; color: var(--muted); font-size: 16px; font-family: var(--font); }
.pn .fams { columns: 2 220px; column-gap: 28px; }
.pn .pf { break-inside: avoid; page-break-inside: avoid; margin: 0 0 14px; }
.pn .pf h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 2px; color: var(--ink); border-bottom: 1px solid var(--line); }
.pn .pf p { margin: 0; font-size: 18px; line-height: 1.45; }
.pn .tot { text-align: center; color: var(--muted); font-family: var(--font); font-size: 14px; margin-top: 8px; }
.print-tools { display: block; margin: 8px 0 12px; }

/* ── 🖨️ הדפסה לאוהל: עמודי A4 מדודים (180×265 מ"מ בתוך שוליים 12/15 מ"מ) ─────────────── */
.print-tools h2, .bhead h2, .mhead h2 { margin: 6px 0 8px; }
.popts { display: grid; gap: 10px; margin: 6px 0; }
.pgrp { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.plbl { font-weight: 700; color: var(--navy); font-size: 15px; }
.pch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; line-height: 1.3; cursor: pointer; }
.pch input { width: 22px; height: 22px; flex: 0 0 auto; margin: 0; accent-color: var(--navy); }
.pbtns { display: flex; gap: 8px; margin: 10px 0; }
.pbtns .btn { flex: 1 1 0; }
.pages { margin: 6px 0 16px; }
.pmeasure { position: absolute; top: 0; right: 0; width: 1px; height: 1px; overflow: hidden; visibility: hidden; pointer-events: none; }
.page {
  width: 180mm; height: 265mm; padding: 2mm 1.5mm; box-sizing: border-box; overflow: hidden;
  display: flex; flex-direction: column; margin: 0 auto 14px;
  background: #fff; color: #000; direction: rtl; font-family: var(--serif);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .2);
}
.phd { display: flex; align-items: flex-start; justify-content: space-between; gap: 4mm; border-bottom: 2.5px double #000; padding-bottom: 2.5mm; margin-bottom: 4mm; font-family: var(--font); flex: 0 0 auto; }
.pbsd { font-size: 12pt; font-weight: 700; min-width: 24mm; }
.pmid { text-align: center; flex: 1 1 auto; }
.ptitle { font-family: var(--serif); font-size: 16pt; font-weight: 700; line-height: 1.25; }
.psubt { font-size: 10.5pt; margin-top: 1mm; }
.pnum { font-size: 11pt; text-align: left; min-width: 24mm; white-space: nowrap; font-weight: 700; }
.pbatch { font-size: 9.5pt; font-weight: 400; color: #333; }
.pbody { flex: 1 1 auto; }
.size-l .pbody { font-size: 17pt; }
.size-xl .pbody { font-size: 22pt; }
.pblk { padding-bottom: 3.2mm; }
.ph-sec { font-family: var(--font); font-size: .82em; font-weight: 800; border-bottom: 2px solid #000; margin-bottom: 1.6mm; padding-top: .6mm; }
.ph-sub { font-family: var(--font); font-size: .72em; font-weight: 700; margin-bottom: 1mm; }
.pttl { font-weight: 700; font-size: 1.04em; border-bottom: 1px solid #777; margin-bottom: 1mm; line-height: 1.5; }
.pl { display: flex; align-items: baseline; gap: 2.4mm; line-height: 1.68; }
.box { flex: 0 0 auto; display: inline-block; width: .7em; height: .7em; border: 1.7px solid #000; border-radius: 1.5px; position: relative; top: .07em; }
.pstar { flex: 0 0 auto; font-size: .8em; }
.pt { min-width: 0; }
.pctx { color: #444; font-size: .66em; font-family: var(--font); white-space: nowrap; }

/* ⭐ דחוף בכרטיס-הניהול */
.fam .ln .urg { min-width: 40px; min-height: 40px; margin-inline-start: 6px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 18px; color: #b0a37f; cursor: pointer; vertical-align: middle; }
.fam .ln .urg.on { color: #b37a00; border-color: var(--gold); background: var(--gold-soft); }
.fam .ustar { font-size: .9em; }
.fam .sv.mn { color: var(--navy); }
.fam .ph span { unicode-bidi: isolate; }

/* 📦 הדפסות · 📨 הודעות */
.bhead, .mhead { display: grid; gap: 8px; margin: 6px 0 12px; }
.bhead .btn, .mhead > .btn { width: 100%; }
.badge.ok, .batch.done .badge { background: #e7f3ea; border-color: #8cc29f; color: #24663b; }
.mhead select, .mhead textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); box-sizing: border-box;
}
.mhead select { min-height: 48px; }
.mhead textarea { min-height: 170px; line-height: 1.5; }
.mhead details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.mhead summary { cursor: pointer; font-weight: 700; color: var(--navy); min-height: 32px; }
.msg .mtext { white-space: pre-wrap; font-family: var(--font); font-size: 15px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0 0; }
.msg .acts { flex-wrap: wrap; }
.msg .acts .btn, .msg .acts .mphone { flex: 1 1 140px; }
.msg .mphone { min-height: 48px; font-size: 16px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; direction: ltr; text-align: right; box-sizing: border-box; }
.btn.wa { background: #1f7a4d; border-color: #1f7a4d; color: #fff; }
.msg.sent { border-color: #8cc29f; background: #f3faf5; }
.sent-line { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sent-line .btn { min-height: 40px; padding: 6px 12px; }

@media print {
  @page { size: A4; margin: 12mm 15mm; }
  html, body { background: #fff !important; min-height: 0 !important; }
  .no-print, .bar, .toast, .pmeasure, #app, #ohel, #batches, #msgs, #login { display: none !important; }
  .wrap { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  #pages { zoom: 1 !important; margin: 0 !important; }
  .page { box-shadow: none; margin: 0; break-after: page; page-break-after: always; }
  .page:last-child { break-after: auto; page-break-after: auto; }
}
