/* מתיקות של מצווה — candy-wrapper chassidic design system
   Pinned palette (user PRD): purple #4A154B / orange #FF9800 / success #2E7D32 / paper ground / Rubik */

:root {
  --purple: #4A154B;
  --purple-hero: #542b59;      /* matches generated hero art background */
  --purple-deep: #360F37;
  --purple-soft: #7A4A7B;
  --lavender: #E2CDE3;
  --lavender-dim: #C9A9CB;
  --orange: #FF9800;
  --orange-deep: #EF6C00;
  --orange-ink: #B34A00;
  --gold: #FFC107;
  --gold-deep: #8C6D1F;
  --green: #2E7D32;
  --green-bg: #E8F3E9;
  --red: #B3261E;
  --paper: #FAF3EA;
  --card: #FFFFFF;
  --ink: #33152F;
  --ink-soft: #7A5E74;
  --line: #EBDCE6;
  --cat-roads: #1565C0;    --cat-roads-bg: #E7F0FB;
  --cat-ahava: #C2185B;    --cat-ahava-bg: #FBE9F1;
  --cat-tovim: #2E7D32;    --cat-tovim-bg: #E8F3E9;
  --cat-shabbat: #8C6D1F;  --cat-shabbat-bg: #FBF1D6;
  --radius: 20px;
  --radius-s: 14px;
  --shadow: 0 4px 18px rgba(74, 21, 75, 0.12);
  --shadow-pop: 0 10px 30px rgba(54, 15, 55, 0.28);
  --stripe: repeating-linear-gradient(135deg, transparent 0 26px, rgba(255,255,255,0.02) 26px 52px);
  --ease-pop: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'Rubik', 'Segoe UI', Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
body.on-purple {
  background: var(--purple) var(--stripe);
}

::selection { background: var(--gold); color: var(--purple-deep); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--lavender-dim); border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

#app {
  flex: 1;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 18px;
}
#app.wide { max-width: 1100px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }

/* ---------- entrance ---------- */
.screen { animation: rise 0.34s var(--ease-pop); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- login ---------- */
.login-screen { padding-top: 12px; text-align: center; }
.login-hero {
  width: min(48vw, 210px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  display: block;
  -webkit-mask-image: radial-gradient(closest-side, #000 58%, transparent 98%);
  mask-image: radial-gradient(closest-side, #000 58%, transparent 98%);
}
.login-title {
  margin: 2px 0 0;
  font-size: clamp(2.1rem, 8vw, 3rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
.login-title em { font-style: normal; color: var(--gold); }
.login-sub {
  margin: 8px 0 18px;
  color: var(--lavender);
  font-size: 1.05rem;
  font-weight: 500;
}
.panel {
  background: var(--card);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-pop);
  padding: 26px 22px;
  text-align: right;
  margin-bottom: 26px;
}
.panel h2 { margin: 0 0 18px; font-size: 1.3rem; font-weight: 800; color: var(--purple); }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 0.92rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  transition: border-color 0.15s;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%237A4A7B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 20px;
  padding-left: 44px;
}
.field input:focus, .field select:focus { border-color: var(--orange); outline: none; }
.field input::placeholder { color: #85688A; }
.field .hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 5px; }
.field .hint-strong { color: var(--orange-ink); font-weight: 700; }

.pin-input {
  text-align: center;
  letter-spacing: 0.6em;
  font-size: 1.5rem !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.12s var(--ease-pop), box-shadow 0.12s, background 0.15s;
}
.btn:active { transform: translateY(2px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  width: 100%;
  min-height: 56px;
  font-size: 1.18rem;
  color: #fff;
  background: linear-gradient(180deg, var(--orange), var(--orange-deep));
  box-shadow: 0 6px 16px rgba(239, 108, 0, 0.38), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover:not([disabled]) { box-shadow: 0 8px 22px rgba(239, 108, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.35); }
.btn-ghost {
  min-height: 42px;
  padding: 0 18px;
  font-size: 0.95rem;
  color: var(--purple);
  background: transparent;
  border: 2px solid var(--lavender);
}
.btn-ghost:hover { border-color: var(--purple-soft); }
.btn.loading { pointer-events: none; opacity: 0.7; }
.btn.loading::after {
  content: "";
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.switch-row { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.switch-row .switch-link { margin-top: 0; }
.switch-link {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-weight: 600;
  color: var(--purple);
  background: none; border: none; cursor: pointer; font-size: 1rem;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--lavender-dim);
}
.on-purple .below-panel { color: var(--lavender-dim); font-size: 0.9rem; }
.on-purple .below-panel a { color: var(--lavender); }

.form-error {
  display: none;
  background: #FBEAE9;
  color: var(--red);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 14px;
}
.form-error.show { display: block; }

/* ---------- student header ---------- */
.student-top {
  background: var(--purple) var(--stripe);
  margin: 0 -18px;
  padding: 18px 22px 56px;
  color: #fff;
  border-radius: 0 0 34px 34px;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hello { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.hello-class { color: var(--lavender); font-size: 0.95rem; font-weight: 500; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px;
  border: none; cursor: pointer;
  background: rgba(255,255,255,0.14);
  color: #fff;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }
.icon-btn .icon { width: 22px; height: 22px; }

.progress-wrap { margin-top: 18px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--lavender); font-weight: 600; }
.progress-label strong { color: var(--gold); font-weight: 800; }
.candy-strip { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.candy-strip .icon { width: 30px; height: 30px; color: rgba(255,255,255,0.45); }
.candy-strip .icon.won { color: var(--gold); filter: drop-shadow(0 1px 3px rgba(26, 5, 27, 0.5)); }

/* ---------- task card ---------- */
.card-lift { margin-top: -34px; }
.task-card {
  background: var(--card);
  border-radius: var(--radius);
  border-top: 6px solid var(--orange);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.task-card.done-card { border-top-color: var(--gold); background: linear-gradient(180deg, #FFFDF5, #FFF8E2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.date-badge {
  background: var(--purple);
  color: #fff;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 700;
}
.shabbat-badge {
  background: var(--cat-shabbat-bg);
  color: var(--gold-deep);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
}

.task-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  background: #FCFAF6;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.task-row:hover { border-color: var(--lavender-dim); }
.task-row input { position: absolute; opacity: 0; pointer-events: none; }
.task-row .box {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 2.5px solid var(--lavender-dim);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  transition: all 0.18s var(--ease-pop);
  margin-top: 2px;
}
.task-row .box .icon { width: 20px; height: 20px; }
.task-row:has(input:checked) { background: var(--green-bg); border-color: #BBDCBD; }
.task-row:has(input:checked) .box { background: var(--green); border-color: var(--green); color: #fff; transform: scale(1.06); }
.task-row:has(input:focus-visible) { outline: 3px solid var(--orange); outline-offset: 2px; }
.task-row.static { cursor: default; }
.task-text { flex: 1 1 12rem; min-width: 0; }
.task-illust {
  flex: none;
  align-self: center;
  margin-inline: auto;
  width: 104px;
  height: 104px;
  border-radius: var(--radius-s);
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
}
@media (max-width: 520px) {
  .task-illust { width: 84px; height: 84px; }
}
.task-kind { font-weight: 800; font-size: 1.02rem; color: var(--purple); margin-bottom: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-desc { font-size: 1rem; color: var(--ink); }

.cat-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.cat-tag .icon { width: 16px; height: 16px; }
.cat-tag[data-cat="roads"]   { background: var(--cat-roads-bg);   color: var(--cat-roads); }
.cat-tag[data-cat="ahava"]   { background: var(--cat-ahava-bg);   color: var(--cat-ahava); }
.cat-tag[data-cat="tovim"]   { background: var(--cat-tovim-bg);   color: var(--cat-tovim); }
.cat-tag[data-cat="shabbat"] { background: var(--cat-shabbat-bg); color: var(--cat-shabbat); }

/* "הידעת?" fact strip */
.fact-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  line-height: 1.6;
}
.fact-strip .icon { width: 20px; height: 20px; flex: none; margin-top: 3px; }
.fact-strip strong { font-weight: 800; }
.fact-strip .fact-body { flex: 1 1 16rem; min-width: 0; }
.fact-text.swap { animation: fact-in 0.35s var(--ease-pop); display: inline-block; }
@keyframes fact-in { from { opacity: 0; transform: translateY(4px); } }
.fact-more {
  flex: none;
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: currentColor;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: transform 0.12s var(--ease-pop), background 0.15s;
}
.fact-more:hover { background: rgba(255, 255, 255, 0.85); }
.fact-more:active { transform: translateY(1px) rotate(-6deg); }
.fact-more .icon { width: 15px; height: 15px; margin: 0; }
.fact-strip[data-cat="roads"]   { background: var(--cat-roads-bg);   color: #0D4D8C; }
.fact-strip[data-cat="ahava"]   { background: var(--cat-ahava-bg);   color: #961244; }
.fact-strip[data-cat="tovim"]   { background: var(--cat-tovim-bg);   color: #1F5C23; }
.fact-strip[data-cat="shabbat"] { background: var(--cat-shabbat-bg); color: #6B5318; }

/* signatures */
.sig-section { border-top: 2px dashed var(--line); margin-top: 18px; padding-top: 16px; }
.sig-title { font-weight: 800; color: var(--purple); font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.sig-done {
  display: flex; align-items: center; gap: 10px;
  background: var(--green-bg);
  color: var(--green);
  font-weight: 700;
  border-radius: var(--radius-s);
  padding: 13px 16px;
  margin-bottom: 12px;
}
.sig-canvas-wrap { position: relative; margin-bottom: 6px; }
canvas.sig-pad {
  display: block;
  width: 100%;
  height: 150px;
  background: #FFFEFB;
  border: 2px dashed var(--lavender-dim);
  border-radius: var(--radius-s);
  touch-action: none;
  cursor: crosshair;
}
.sig-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #7A5E74;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.2s;
}
.sig-canvas-wrap.inked .sig-placeholder { opacity: 0; }
.sig-clear {
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 0.88rem; font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px;
  padding: 4px 2px;
}
.sig-clear:hover { color: var(--purple); }

.save-wrap { margin-top: 16px; }
.save-note { text-align: center; font-size: 0.88rem; color: var(--ink-soft); margin-top: 10px; }

/* completed day */
.done-banner { text-align: center; padding: 8px 4px 4px; }
.done-star { width: 74px; height: 74px; color: var(--gold); filter: drop-shadow(0 4px 10px rgba(184,134,11,0.4)); animation: stamp 0.5s var(--ease-pop); }
@keyframes stamp { from { transform: scale(2.2) rotate(-18deg); opacity: 0; } }
.done-banner h3 { margin: 6px 0 4px; font-size: 1.35rem; font-weight: 900; color: var(--gold-deep); }
.done-banner p { margin: 0; color: var(--ink-soft); font-weight: 500; }

/* ---------- pinkas grid ---------- */
.section-title { font-size: 1.5rem; font-weight: 900; color: var(--purple); margin: 22px 0 4px; letter-spacing: -0.01em; }
.section-sub { color: var(--ink-soft); margin: 0 0 18px; font-size: 0.98rem; }
.days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
.day-tile {
  position: relative;
  border-radius: 18px;
  padding: 14px;
  min-height: 128px;
  display: flex; flex-direction: column; gap: 6px;
  text-align: right;
  font: inherit;
  cursor: pointer;
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(74,21,75,0.06);
  transition: transform 0.15s var(--ease-pop), box-shadow 0.15s;
}
.day-tile:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--shadow); }
.day-tile .tile-week { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.day-tile .tile-date { font-size: 1.15rem; font-weight: 800; color: var(--purple); line-height: 1.2; }
.day-tile .tile-state { margin-top: auto; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.day-tile .tile-icon { position: absolute; top: 12px; left: 12px; width: 26px; height: 26px; color: var(--lavender-dim); }

.day-tile.done {
  background: linear-gradient(150deg, #FFD963, #FFAF1F);
  border-color: #F3A712;
  box-shadow: 0 4px 14px rgba(243, 167, 18, 0.35);
}
.day-tile.done .tile-week { color: #6B4E00; }
.day-tile.done .tile-date { color: #4A3300; }
.day-tile.done .tile-state { color: #4A3300; }
.day-tile.done .tile-icon { color: #FFF3CE; }

.day-tile.today-tile { border-color: var(--orange); border-width: 3px; }
.day-tile.today-tile::after {
  content: "היום!";
  position: absolute; top: -12px; right: 12px;
  background: var(--orange);
  color: #fff;
  font-size: 0.78rem; font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(239,108,0,0.4);
}
.day-tile.open-past .tile-state { color: var(--orange-ink); }
.day-tile:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  opacity: 0.75;
}
.day-tile:disabled .tile-state { color: var(--ink-soft); }

/* ---------- celebrate modal ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(42, 10, 43, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
  animation: fadein 0.25s;
}
@keyframes fadein { from { opacity: 0; } }
.celebrate-box {
  background: #FDF3E6;
  border-radius: 28px;
  max-width: 400px;
  width: 100%;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 12px 26px 30px;
  text-align: center;
  box-shadow: var(--shadow-pop);
  animation: pop 0.45s var(--ease-pop);
}
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.celebrate-img {
  width: min(50vw, 200px);
  height: auto;
  aspect-ratio: 1;
  -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 98%);
  mask-image: radial-gradient(closest-side, #000 60%, transparent 98%);
}
.celebrate-box h2 { margin: 0 0 8px; font-size: 1.7rem; font-weight: 900; color: var(--purple); }
.celebrate-box p { margin: 0 0 20px; font-size: 1.08rem; color: var(--ink); }
.celebrate-box p strong { color: var(--orange-deep); }

/* ---------- shabbat ---------- */
.shabbat-screen { text-align: center; padding-top: 12vh; color: #fff; }
.shabbat-screen .icon { width: 88px; height: 88px; color: var(--gold); }
.shabbat-screen h1 { font-size: 2.4rem; font-weight: 900; margin: 18px 0 8px; }
.shabbat-screen p { color: var(--lavender); font-size: 1.1rem; max-width: 34ch; margin: 0 auto; }

/* ---------- notices / empty ---------- */
.notice {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px;
  text-align: center;
  margin: 18px 0;
}
.notice h3 { margin: 0 0 6px; color: var(--purple); font-weight: 800; }
.notice p { margin: 0; color: var(--ink-soft); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; right: 50%;
  transform: translateX(50%) translateY(20px);
  background: var(--purple-deep);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease-pop);
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(50%) translateY(0); }
.toast.error { background: var(--red); }

/* ---------- dedication ---------- */
.dedication {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
}
.on-purple .dedication { color: var(--lavender-dim); }

/* ---------- confetti ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 200; }

/* ---------- mishnayos page ---------- */
.panel-logo {
  display: block;
  width: min(64%, 250px);
  height: auto;
  margin: 0 auto 16px;
}
.mishna-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fs-controls { display: flex; gap: 8px; margin-bottom: 14px; }
.fs-btn {
  min-width: 58px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  font-family: inherit; font-size: 1.05rem; font-weight: 800;
  color: var(--purple);
  background: var(--card);
  border: 2px solid var(--lavender);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s var(--ease-pop);
}
.fs-btn:hover { border-color: var(--purple-soft); }
.fs-btn:active { transform: translateY(2px); }
.mishna-link-row { margin: -4px 4px 12px; text-align: left; }
.mishna-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--orange-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(179, 74, 0, 0.35);
}
.mishna-link:hover { color: var(--orange-deep); }
.mishna-intro {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
  color: var(--ink);
}
.mishna-intro strong { color: var(--purple); }
.neshama-letters {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 14px 0 4px;
}
.neshama-letters span {
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #FFD963, #FFAF1F);
  color: #4A3300;
  font-family: 'Frank Ruhl Libre', 'Rubik', serif;
  font-size: 1.7rem;
  font-weight: 700;
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(243,167,18,0.35);
}
.mishna-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.mishna-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.mishna-letter {
  flex: none;
  width: 54px; height: 54px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple);
  color: var(--gold);
  font-family: 'Frank Ruhl Libre', 'Rubik', serif;
  font-size: 1.8rem;
  font-weight: 700;
  border-radius: 16px;
}
.mishna-source { font-weight: 800; color: var(--purple); font-size: 1.08rem; }
.mishna-source small { display: block; font-weight: 600; color: var(--ink-soft); font-size: 0.85rem; margin-top: 2px; }
.mishna-text {
  font-family: 'Frank Ruhl Libre', 'David Libre', serif;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 2;
  color: var(--ink);
  margin: 0;
}

/* ---------- admin ---------- */
.admin-bar {
  background: var(--purple) var(--stripe);
  color: #fff;
  margin: 0 -18px;
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.admin-bar h1 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.admin-bar .sub { color: var(--lavender); font-size: 0.85rem; font-weight: 500; }
.admin-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-gold {
  min-height: 42px; padding: 0 18px; font-size: 0.95rem;
  color: var(--purple-deep);
  background: linear-gradient(180deg, var(--gold), #FFA000);
  box-shadow: 0 3px 10px rgba(255,160,0,0.4);
  text-decoration: none;
}
.btn-outline-light {
  min-height: 42px; padding: 0 16px; font-size: 0.95rem;
  color: #fff; background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.4);
}
.btn-outline-light:hover { background: rgba(255,255,255,0.22); }

.tabs { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.tab {
  font: inherit; font-weight: 700; font-size: 0.98rem;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--lavender);
  background: var(--card);
  color: var(--purple);
  cursor: pointer;
  transition: all 0.15s;
}
.tab[aria-selected="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }

.stat-chips { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: var(--card);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  min-width: 140px;
}
.chip .chip-num { font-size: 1.7rem; font-weight: 900; color: var(--purple); font-variant-numeric: tabular-nums; }
.chip .chip-label { font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }
.chip.gold .chip-num { color: var(--orange-deep); }

.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0;
  margin-bottom: 22px;
  overflow-x: auto;
}
.table-card h3 { margin: 14px 20px 4px; color: var(--purple); font-weight: 800; font-size: 1.08rem; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 12px 16px 8px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 0.97rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(74,21,75,0.03); }
td.num { font-variant-numeric: tabular-nums; font-weight: 700; }

.bar-wrap { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: #F0E6EE; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--orange), var(--gold)); }
.bar-num { font-size: 0.88rem; font-weight: 700; color: var(--orange-ink); font-variant-numeric: tabular-nums; min-width: 40px; }

.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.mini-btn {
  font: inherit; font-size: 0.85rem; font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--lavender);
  background: #fff;
  color: var(--purple);
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--purple-soft); }
.mini-btn.danger { color: var(--red); border-color: #F0CDCB; }
.mini-btn.danger:hover { border-color: var(--red); }
.mini-btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 20px; }
.inline-form input, .inline-form select {
  font: inherit; font-size: 0.95rem;
  height: 42px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.inline-form input:focus, .inline-form select:focus { border-color: var(--orange); outline: none; }
.search-input { width: min(340px, 100%); }

/* raffle */
.raffle-stage {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 34px 22px;
  margin-bottom: 22px;
}
.raffle-stage h3 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 900; color: var(--purple); }
.raffle-stage .raffle-sub { color: var(--ink-soft); margin: 0 0 22px; }
.raffle-drum {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--purple);
  min-height: 2.2em;
  display: flex; align-items: center; justify-content: center;
}
.winner-card {
  margin: 18px auto 0;
  max-width: 380px;
  background: linear-gradient(150deg, #FFD963, #FFAF1F);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 8px 24px rgba(243,167,18,0.45);
  animation: pop 0.5s var(--ease-pop);
}
.winner-card .icon { width: 44px; height: 44px; color: #fff; filter: drop-shadow(0 2px 4px rgba(107, 78, 0, 0.35)); }
.winner-card .w-name { font-size: 1.6rem; font-weight: 900; color: #4A3300; margin: 6px 0 2px; }
.winner-card .w-class { font-weight: 700; color: #6B4E00; }
.winner-card .w-tickets { font-size: 0.9rem; color: #6B4E00; margin-top: 8px; }

@media (max-width: 520px) {
  .panel { padding: 22px 16px; }
  .days-grid { grid-template-columns: repeat(2, 1fr); }
  .chip { flex: 1; min-width: 110px; }
}

/* admin on phones: bar stacks, forms fill, tables scroll in place */
@media (max-width: 700px) {
  .admin-bar { padding: 14px 16px; }
  .admin-bar h1 { font-size: 1.05rem; }
  .admin-actions { width: 100%; }
  .admin-actions .btn { flex: 1; white-space: nowrap; }
  .tabs { gap: 6px; }
  .tab { padding: 9px 14px; font-size: 0.9rem; flex: 1; text-align: center; }
  .inline-form { padding: 12px 14px; }
  .inline-form input, .inline-form select { flex: 1 1 130px; min-width: 0; }
  .inline-form .mini-btn { flex: 1 1 100%; min-height: 44px; }
  .search-input { flex: 1 1 100% !important; }
  .table-card h3 { margin: 12px 14px 2px; font-size: 1rem; }
  .stat-chips { gap: 8px; }
  .chip { padding: 12px 14px; min-width: 0; flex: 1; }
  .chip .chip-num { font-size: 1.35rem; }
  .mini-btn { min-height: 40px; }
  /* The actions column (שמירה/מחיקה) is the LAST column of a horizontally scrolling
     table — in RTL it starts off-screen to the left with no hint it exists. Pin it to
     the visible edge so the buttons are always reachable while the rest scrolls. */
  th:last-child, td:last-child {
    position: sticky;
    inset-inline-end: 0;
    background: var(--card);
    box-shadow: 8px 0 10px -8px rgba(42, 10, 43, 0.18);
  }
}
