/* Blumenthals . עיצוב
   כללים: 4 גדלי טקסט (40/28/20/18), צבע הדגשה אחד (יין), מרווחים בכפולות של 8,
   ניגודיות 4.5:1 לפחות, כפתורים בגובה 56 לפחות (נוח גם לאצבע של סבתא). */

:root {
  --paper: #f6f1e7;      /* 60% רקע */
  --card: #fffdf8;       /* 30% משטחים */
  --ink: #1f1d1a;        /* טקסט */
  --muted: #5b5449;      /* טקסט משני, 7.1:1 על הקרם */
  --line: #e4dccd;
  --accent: #8a2e3b;     /* 10% הדגשה יחידה: יין */
  --accent-soft: #f3e4e4;
  --ok: #2f6b3f;
  --warn: #8a5a00;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 29, 26, 0.06), 0 8px 24px rgba(31, 29, 26, 0.06);
  --t1: 40px;
  --t2: 28px;
  --t3: 20px;
  --t4: 18px;
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  font-size: var(--t4);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 120px;
}
[dir="rtl"] body, body[dir="rtl"] { text-align: right; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---------- כותרת עליונה ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 8px;
}
.brand {
  font-family: "Frank Ruhl Libre", Georgia, serif;
  font-weight: 700; font-size: var(--t3); letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 8px;
}
.brand svg { width: 32px; height: 32px; }
.lang {
  display: flex; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px;
}
.lang button {
  border: 0; background: transparent; min-width: 48px; min-height: 40px;
  border-radius: 999px; font-weight: 600; color: var(--muted);
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--card); }

.hello { font-family: "Frank Ruhl Libre", Georgia, serif; font-size: var(--t2); line-height: 1.2; margin: 16px 0 8px; }
.sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- בחירת שבת / חג ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 16px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; scroll-snap-align: start;
  border: 1px solid var(--line); background: var(--card);
  border-radius: var(--radius); padding: 8px 16px; min-height: 64px; min-width: 128px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0;
  text-align: start;
}
.chip b { font-weight: 600; white-space: nowrap; }
.chip span { color: var(--muted); white-space: nowrap; }
.chip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 8px; background: var(--line); vertical-align: middle; }
.chip .dot.yes { background: var(--ok); }
.chip .dot.no { background: var(--muted); }
.chip .dot.closed { background: transparent; border: 2px solid var(--muted); }

/* ---------- כרטיס ---------- */
.card {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 24px;
}
.card h2 {
  font-family: "Frank Ruhl Libre", Georgia, serif;
  font-size: var(--t2); line-height: 1.15; margin: 0 0 8px;
}
.card h3 { font-size: var(--t3); margin: 0 0 16px; }
.date { color: var(--muted); margin: 0 0 24px; }
.section-gap { height: 24px; }

/* ---------- מגיעים / לא ---------- */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.big {
  min-height: 72px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--card); font-size: var(--t3); font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.big[aria-pressed="true"].yes { background: var(--accent); border-color: var(--accent); color: #fff; }
.big[aria-pressed="true"].no { background: var(--ink); border-color: var(--ink); color: var(--card); }

/* ---------- סעודות ---------- */
.meals { display: grid; gap: 8px; margin-top: 24px; }
.meal {
  display: flex; align-items: center; gap: 16px;
  min-height: 56px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; cursor: pointer; user-select: none;
}
.meal input { position: absolute; opacity: 0; pointer-events: none; }
.meal .box {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--line);
  display: grid; place-items: center; background: #fff;
}
.meal .box svg { width: 20px; height: 20px; opacity: 0; }
.meal.on { border-color: var(--accent); background: var(--accent-soft); }
.meal.on .box { background: var(--accent); border-color: var(--accent); }
.meal.on .box svg { opacity: 1; }
.meal.off { opacity: 1; background: var(--paper); cursor: not-allowed; color: var(--muted); }
.meal .why { display: block; color: var(--muted); }

/* ---------- נפשות ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.row + .row { border-top: 1px solid var(--line); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: var(--t2); line-height: 1; display: grid; place-items: center;
}
.stepper output { min-width: 48px; text-align: center; font-size: var(--t2); font-weight: 700; }

.switch { position: relative; width: 64px; height: 40px; flex: 0 0 auto; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.15s;
  pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 32px; height: 32px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.switch input:checked + span { background: var(--accent); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-24px); }
[dir="ltr"] .switch input:checked + span::after { transform: translateX(24px); }

/* ---------- טפסים ---------- */
label.field { display: block; margin-top: 16px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 8px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 56px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff;
}
textarea.input { min-height: 96px; resize: vertical; }
.hint { color: var(--muted); margin: 8px 0 0; }

/* ---------- כפתורים ---------- */
.btn {
  min-height: 56px; padding: 8px 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.sticky {
  position: fixed; inset-inline: 0; bottom: 0; padding: 16px;
  background: linear-gradient(to top, var(--paper) 70%, rgba(246, 241, 231, 0));
}
.sticky .wrap { padding: 0; }
.has-tabs .sticky { bottom: 72px; }

/* ---------- הודעות ---------- */
.notice { border-radius: var(--radius); padding: 16px; background: var(--paper); margin: 16px 0 0; }
.notice.closed { background: var(--paper); border: 1px dashed var(--muted); }
.toast {
  position: fixed; inset-inline: 16px; bottom: 96px; margin: 0 auto; max-width: 480px;
  background: var(--ink); color: var(--card); border-radius: var(--radius); padding: 16px 24px;
  box-shadow: var(--shadow); text-align: center; font-weight: 600; z-index: 20;
  transform: translateY(24px); opacity: 0; transition: all 0.2s; pointer-events: none;
}
.toast.show { transform: none; opacity: 1; }
.toast.err { background: var(--accent); }

details.more { margin-top: 8px; }
details.more > summary {
  list-style: none; cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: var(--t3);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-size: var(--t2); color: var(--muted); }
details.more[open] > summary::after { content: "−"; }

/* ---------- מסך אמא ---------- */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.total {
  background: var(--paper); border-radius: var(--radius); padding: 16px;
}
.total .n { font-family: "Frank Ruhl Libre", Georgia, serif; font-size: var(--t1); line-height: 1.1; font-weight: 700; }
.total .l { font-weight: 600; }
.total .s { color: var(--muted); }
.total.closed .n { color: var(--muted); }
.total.main { background: var(--accent); color: #fff; }
.total.main .s { color: #f7e9ea; }

.fam { border-top: 1px solid var(--line); padding: 16px 0; }
.fam:first-child { border-top: 0; padding-top: 0; }
.fam-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fam-name { font-weight: 700; font-size: var(--t3); }
.pill { border-radius: 999px; padding: 4px 16px; font-weight: 600; white-space: nowrap; }
.pill.yes { background: #e3efe5; color: var(--ok); }
.pill.no { background: var(--paper); color: var(--muted); }
.pill.wait { background: #f7ecd6; color: var(--warn); }
.fam-meta { color: var(--muted); margin-top: 8px; }
.fam-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 8px 0; min-height: 40px; text-decoration: underline; }

.tabs {
  position: fixed; inset-inline: 0; bottom: 0; height: 72px; background: var(--card);
  border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 10;
}
.tabs button {
  flex: 1; max-width: 200px; border: 0; background: none; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
}
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-pressed="true"] { color: var(--accent); }

.sheet-bg { position: fixed; inset: 0; background: rgba(31, 29, 26, 0.4); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 24px 16px 32px;
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.center { text-align: center; }
.mt0 { margin-top: 0 !important; }
.mt16 { margin-top: 16px !important; }
.mt24 { margin-top: 24px !important; }
.mt32 { margin-top: 32px !important; }
.mt48 { margin-top: 48px !important; }
.mb0 { margin-bottom: 0 !important; }
.input-ltr { direction: ltr; text-align: start; }
.hidden { display: none !important; }


/* ---------- כותרת אירוע ---------- */
.eyebrow { margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.occ-title { font-family: "Frank Ruhl Libre", Georgia, serif; font-size: var(--t2); line-height: 1.15; margin: 0 0 16px; text-wrap: balance; }

/* ---------- הכותרת של אמא: מי מגיע וכמה ---------- */
.hero {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 24px;
}
.hero-num {
  font-family: "Frank Ruhl Libre", Georgia, serif; font-size: var(--t1); line-height: 1.1;
  font-weight: 700; color: var(--accent);
}
.hero-line { font-size: var(--t3); font-weight: 600; margin-top: 8px; }
.hero-meta { color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-meta svg { width: 20px; height: 20px; }
.hero .totals { margin-top: 24px; }
.total .n { font-variant-numeric: tabular-nums; }

.cluster { border: 2px solid var(--accent); }

/* ---------- רשימות (מה מביאים, אורחים, היסטוריה) ---------- */
.items { list-style: none; margin: 0; padding: 0; }
.items li {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line);
}
.items li:first-child { border-top: 0; }
.item-title { min-width: 0; }
.item-act { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.block { display: block; }
.muted { color: var(--muted); }
.btn.small { min-height: 44px; padding: 4px 16px; }
.inline-add { display: flex; gap: 8px; margin-top: 16px; }
.inline-add .input { flex: 1; min-width: 0; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.label { font-weight: 600; margin: 16px 0 8px; }

.notice.locked { display: flex; gap: 16px; align-items: flex-start; background: var(--paper); }
.notice.locked svg { width: 24px; height: 24px; flex: 0 0 auto; color: var(--accent); margin-top: 4px; }

/* ---------- אמא: מי מגיע לכל סעודה ---------- */
.meal-who { padding: 16px 0; border-top: 1px solid var(--line); }
.meal-who:first-of-type { border-top: 0; padding-top: 0; }
.meal-who-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.popup { max-width: 480px; }
.quick-done { padding-block: 48px; }
.done-mark { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; font-size: var(--t2); font-weight: 700; color: #fff; }
.done-mark.yes { background: var(--ok); }
.done-mark.no { background: var(--muted); }
.center-btns { justify-content: center; }
.name-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.name-chip { min-height: 44px; padding: 4px 16px; border-radius: 999px; border: 1px solid var(--line); background: #f7ecd6; color: var(--warn); font-weight: 600; }
.linkish.plain { text-decoration: none; color: var(--ink); font-weight: 600; min-height: 0; padding: 0; }
.ok-line { color: var(--ok); font-weight: 600; }
.notes { margin: 8px 0 0; padding-inline-start: 24px; }
.notes li { margin-bottom: 8px; }

/* ---------- כפתורים מהירים של אמא ---------- */
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.actions.one { grid-template-columns: 1fr; }
.act {
  min-height: 72px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff;
  font-weight: 700; text-align: start; display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.act small { font-weight: 400; color: var(--muted); font-size: var(--t4); }
.act:hover { border-color: var(--accent); }
.act.armed { background: var(--accent); color: #fff; border-color: var(--accent); }
.act:disabled { opacity: 0.5; }

.quick { padding: 0 24px; }
.quick > summary {
  list-style: none; cursor: pointer; min-height: 64px; display: flex; align-items: center; gap: 16px;
  font-weight: 700; font-size: var(--t3);
}
.quick > summary::-webkit-details-marker { display: none; }
.quick > summary > span:first-child { white-space: nowrap; }
.quick > summary .pill { font-size: var(--t4); padding: 4px 12px; white-space: nowrap; }
.quick > summary::after { content: "+"; margin-inline-start: auto; color: var(--muted); font-size: var(--t2); }
.quick[open] > summary::after { content: "−"; }
.quick[open] { padding-bottom: 16px; }

/* ---------- משפחות: רשימה נפתחת ---------- */
.fam-acc { border-top: 1px solid var(--line); }
.fam-acc:first-of-type { border-top: 0; }
.fam-acc > summary {
  list-style: none; cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.fam-acc > summary::-webkit-details-marker { display: none; }
.fam-acc > summary::after { content: "+"; color: var(--muted); font-size: var(--t2); margin-inline-start: 8px; }
.fam-acc[open] > summary::after { content: "−"; }
.fam-acc > summary .muted { margin-inline-start: auto; }
.fam-acc.inactive .fam-name { color: var(--muted); }
.fam-acc form, .fam-view { padding-bottom: 24px; }

/* פרטים שמולאו פעם אחת: תצוגה, ועריכה בלחיצה */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts dd.ltr { display: block; text-align: start; }

/* ---------- הגדרות: שבתות קרובות ---------- */
.ahead { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.ahead:first-of-type { border-top: 0; }
.ahead-name { display: flex; flex-direction: column; min-width: 0; }
.mini { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr; gap: 0 16px; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 24px; }
.grid2 > * { min-width: 0; }
.desktop-only { display: none !important; }
.narrow { max-width: 640px; }

/* ---------- מחשב ---------- */
@media (min-width: 560px) {
  .wrap { padding: 0 24px; }
  .hello { font-size: var(--t1); }
  .pair { grid-template-columns: 2fr 1fr; }
}

@media (min-width: 960px) {
  .wrap { max-width: 1120px; padding: 0 32px; }
  .wrap.narrow { max-width: 640px; }
  body { padding-bottom: 48px; }
  .grid2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .mobile-only { display: none !important; }
  .desktop-only { display: flex !important; }
  /* הלשוניות עוברות למעלה, מתחת לכותרת */
  .tabs {
    position: static; height: auto; background: transparent; border: 0;
    justify-content: flex-start; gap: 8px; margin: 8px 0 24px; z-index: auto;
  }
  .tabs button {
    flex: 0 0 auto; max-width: none; flex-direction: row; gap: 8px;
    min-height: 48px; padding: 0 24px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  }
  .tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
  .has-tabs .sticky { bottom: 0; }
  .hero { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0 32px; align-items: end; }
  .hero > .eyebrow, .hero > .occ-title, .hero > .hero-num, .hero > .hero-line, .hero > .hero-meta { grid-column: 1; }
  .hero .totals { grid-column: 2; grid-row: 1 / span 6; margin-top: 0; align-self: center; }
  .toast { bottom: 32px; }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 24px; }
}
