/* Rivnitz Pushka — mobile-first prototype, granite / gold, matching the pishka demo. */
:root {
  --cream: #f3f1ec;
  --cream-d: #e8e4db;
  --ink: #2a2622;
  --muted: #6a6258;
  --gold: #c49a3c;
  --gold-d: #8e6c1e;
  --gold-lt: #e8d7a3;
  --stone: #6c6a68;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--cream); }
body {
  font-family: Georgia, "Times New Roman", "Frank Ruhl Libre", "Times New Roman", Times, serif;
  color: var(--ink);
  background: var(--cream);
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

.he { font-family: "Frank Ruhl Libre", "Times New Roman", "David Libre", David, "Noto Serif Hebrew", serif; }

.app {
  height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--cream);
  position: relative;
}

header.top {
  padding: calc(var(--safe-t) + 10px) 18px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
header.top img.mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
header.top .brand {
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-d);
  line-height: 1.15;
}
header.top .brand span {
  display: block;
  letter-spacing: 0.04em;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink);
  margin-top: 1px;
}

main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 18px;
}
.screen.is-on { display: block; }

h1 {
  font-size: 1.45rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
  letter-spacing: 0.01em;
}
.lede {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0 0 0.8rem;
}

/* ---------- Donate ---------- */
.pishka-slot {
  width: min(250px, 68vw);
  margin: 0 auto 6px;
}
#rivnitz-pishka { width: 100%; }

.amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 6px 0 10px;
}
.chip, .freq-btn, .donate-btn, .link-btn, .ghost-btn {
  font-family: inherit;
  appearance: none;
  cursor: pointer;
}
.chip {
  border: 1px solid rgba(142, 108, 30, 0.28);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.55rem 0.2rem;
  font-size: 0.98rem;
  min-height: 42px;
}
.chip.is-on {
  background: linear-gradient(180deg, #d4ad52 0%, #b8892d 100%);
  border-color: transparent;
  color: #2a1e08;
  font-weight: 600;
}
.custom-row { display: none; margin: 0 0 10px; }
.custom-row.is-on { display: flex; align-items: center; gap: 6px; }
.custom-row label { color: var(--muted); font-size: 0.9rem; }
.custom-row input {
  flex: 1;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(142, 108, 30, 0.35);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.freq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}
.freq-btn {
  border: 1px solid rgba(142, 108, 30, 0.28);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.55rem 0.4rem;
  font-size: 0.92rem;
  min-height: 42px;
}
.freq-btn.is-on {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.freq-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -4px 0 10px;
  line-height: 1.35;
}

.donate-btn {
  display: block;
  width: 100%;
  border: 0;
  background: linear-gradient(180deg, #d4ad52 0%, #b8892d 100%);
  color: #2a1e08;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(255, 240, 200, 0.4) inset, 0 2px 8px rgba(90, 60, 0, 0.18);
}
.donate-btn:disabled { opacity: 0.6; }
.contact-mini {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 10px 0 4px;
}
.contact-mini a { color: var(--gold-d); text-decoration: none; }

/* stub sheet */
.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(110%);
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  width: min(440px, calc(100% - 24px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(40, 30, 20, 0.22);
  padding: 18px 18px 16px;
  z-index: 20;
  transition: transform 0.35s ease;
  pointer-events: none;
  visibility: hidden;
}
.sheet.is-on {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  visibility: visible;
}
.sheet h2 { font-size: 1.15rem; font-weight: 400; margin: 0 0 0.4rem; }
.sheet p { margin: 0 0 0.7rem; font-size: 0.92rem; color: var(--muted); line-height: 1.45; }
.sheet .tag {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-d);
  border: 1px solid var(--gold);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.5rem;
}
.link-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: var(--ink);
  color: var(--cream);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.ghost-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.4rem;
}

/* ---------- History ---------- */
.banner {
  background: #fff8e6;
  border: 1px dashed var(--gold);
  color: var(--gold-d);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  margin: 0 0 12px;
  text-transform: uppercase;
}
.year-total {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(40, 30, 20, 0.06);
}
.year-total .k { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.year-total .v { font-size: 1.8rem; margin-top: 2px; }
.year-total .v small { font-size: 0.9rem; color: var(--muted); }

.hist-list { list-style: none; margin: 0 0 14px; padding: 0; }
.hist-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 8px;
}
.hist-list .when { font-size: 0.82rem; color: var(--muted); }
.hist-list .what { font-size: 0.98rem; }
.hist-list .amt { font-size: 1.05rem; white-space: nowrap; }

/* ---------- Yahrzeit ---------- */
.yah-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(40, 30, 20, 0.06);
  text-align: center;
}
.yah-card .he-date {
  font-size: 1.85rem;
  margin: 0.2rem 0 0.15rem;
}
.yah-card .en-date { color: var(--muted); font-size: 0.95rem; }
.next-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.next-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--cream-d);
  font-size: 0.95rem;
}
.next-list li:first-child { border-top: 0; }
.next-list .is-next .when { color: var(--gold-d); font-weight: 600; }
.note-shabbos { font-size: 0.82rem; color: var(--muted); text-align: left; margin: 6px 0 0; }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.toggle .lab { font-size: 0.95rem; }
.toggle .lab small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: var(--cream-d);
  border-radius: 99px;
  transition: 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(20px); }

.bio { font-size: 0.95rem; line-height: 1.55; color: var(--ink); }
.bio p { margin: 0 0 0.7rem; }
.sources { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.sources a { color: var(--gold-d); }

/* ---------- Shiurim ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(40, 30, 20, 0.06);
  min-height: 88px;
}
.card img, .card .thumb {
  width: 96px;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
  background: #d9d4cb;
  display: block;
}
.card .thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-d);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px;
  text-align: center;
}
.card .meta { padding: 10px 12px 10px 0; }
.card .kind {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-d);
}
.card h3 { font-size: 0.98rem; font-weight: 400; margin: 0.15rem 0 0.2rem; line-height: 1.3; }
.card .by { font-size: 0.8rem; color: var(--muted); }

/* ---------- Tabs ---------- */
nav.tabs {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: #fff;
  border-top: 1px solid var(--cream-d);
  z-index: 10;
}
nav.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}
nav.tabs button.is-on { color: var(--gold-d); }
nav.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--cream);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  max-width: min(420px, calc(100% - 32px));
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 30;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
  body { overflow: auto; }
  .app {
    min-height: 100dvh;
    height: auto;
    box-shadow: 0 0 0 1px var(--cream-d);
  }
  main { min-height: 70vh; position: relative; }
  .screen { position: relative; min-height: 70vh; }
}

nav.tabs svg { width: 20px; height: 20px; }

/* ---------- Kvittel ---------- */
.hours-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  margin: 0 0 10px;
  font-size: 0.92rem;
}
.hours-banner .dot {
  width: 8px; height: 8px;
  background: #6dbe6d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(109,190,109,0.25);
  flex-shrink: 0;
}
.hours-banner .he { letter-spacing: 0; }

.stub-note {
  background: #fff8e6;
  border: 1px dashed var(--gold);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  margin: 0 0 8px;
}
.stub-note strong { color: var(--gold-d); font-weight: 600; }

.form-block { margin-bottom: 8px; }
.form-block label.fld, .fld-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-block .fld-label .he {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
  margin-left: 0.35rem;
}
.form-block input[type="text"],
.form-block input[type="tel"],
.form-block input[type="email"],
.form-block input[type="number"],
.form-block textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(142, 108, 30, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.form-block textarea { min-height: 40px; resize: vertical; }
.form-block input:focus, .form-block textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.name-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  direction: rtl;
}
.name-grid .fld .he { text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--ink); }
.bn-bt {
  display: flex;
  flex-direction: row;
  gap: 4px;
}
.bn-bt button {
  appearance: none;
  font: inherit;
  border: 1px solid rgba(142, 108, 30, 0.28);
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  min-height: 42px;
  min-width: 44px;
  cursor: pointer;
  color: var(--ink);
}
.bn-bt button.is-on {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.preview-name {
  text-align: center;
  font-size: 1.2rem;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  min-height: 2.2em;
}

.req-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.req-chips button {
  appearance: none;
  font: inherit;
  border: 1px solid rgba(142, 108, 30, 0.28);
  background: #fff;
  border-radius: 99px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.25;
}
.req-chips button small {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.req-chips button.is-on {
  background: linear-gradient(180deg, #d4ad52 0%, #b8892d 100%);
  border-color: transparent;
  color: #2a1e08;
}
.req-chips button.is-on small { color: #4a350c; }

.pidyon-row input { max-width: 8rem; }
.pidyon-hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; line-height: 1.4; }

#screen-kvittel .donate-btn{margin-top:4px;margin-bottom:4px;width:100%;padding-top:0.7rem;padding-bottom:0.7rem;}
#screen-kvittel{padding-bottom:16px;}

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pidyon-hint { margin-top: 4px; font-size: 0.75rem; }
#screen-kvittel h1 { margin-bottom: 0.45rem; }
#screen-kvittel .preview-name { margin-top: 5px; font-size: 1.12rem; padding: 5px 10px; }
#screen-kvittel .req-chips button { padding: 0.32rem 0.65rem; }

.pidyon-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pidyon-line .fld { margin-bottom: 0; flex: 1; }
.pidyon-line input { width: 5.5rem; max-width: 5.5rem; flex-shrink: 0; }
.pidyon-hint { margin-top: 3px; font-size: 0.7rem; line-height: 1.25; }

#kvit-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
#kvit-types button { width: 100%; padding: 0.28rem 0.25rem; }
