/* ========== Base ========== */
:root {
  --brand: #5F2E38;
  --brand-dark: #421F26;
  --brand-light: #8B4858;
  --cream: #FFFBF3;
  --cream-deep: #FDF8F2;
  --cream-card: #FFFDF9;
  --gold: #C8A96A;
  --gold-soft: #E8D5B0;
  --text: #2A1A1F;
  --text-muted: #6B5760;
  --line: #E8DCD4;
  --danger: #B23A48;
  --success: #4A7C59;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(95, 46, 56, 0.08);
  --shadow-lg: 0 12px 40px rgba(95, 46, 56, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Heebo", "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.bg-decor {
  background:
    radial-gradient(ellipse at top right, rgba(200, 169, 106, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(95, 46, 56, 0.08) 0%, transparent 50%),
    var(--cream);
  background-attachment: fixed;
}

/* ========== Pace modal ========== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(40, 20, 25, 0.55);
  z-index: 9999;
  padding: 16px;
  align-items: center; justify-content: center;
  display: none;
  overflow-y: auto;
}
.modal-backdrop.open {
  display: flex;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--cream-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 760px; width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head h3 { margin: 0; color: var(--brand); font-size: 18px; }
.modal-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.modal-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 30px; color: var(--text-muted); line-height: 1;
  padding: 0 6px; margin-inline-start: 12px;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { color: var(--brand); }
.modal-body { padding: 12px 18px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.pace-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.pace-table { width: 100%; border-collapse: collapse; min-width: 540px; }
table.pace-table th, table.pace-table td {
  padding: 10px 8px; text-align: start; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
table.pace-table th {
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap;
}
table.pace-table tbody tr:last-child td { border-bottom: 0; }
table.pace-table .pace-week-label { font-weight: 600; color: var(--text); font-size: 14px; }
table.pace-table .pace-week-meta { font-size: 10.5px; color: var(--text-muted); display: block; margin-top: 2px; white-space: nowrap; }
table.pace-table tr.pace-current-row { background: rgba(200, 169, 106, 0.12); }
table.pace-table tr.pace-current-row .pace-week-label { color: var(--brand); }
table.pace-table .cell-num { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.15; }
table.pace-table tr.pace-current-row .cell-num { color: var(--brand); font-size: 16px; }
table.pace-table .cell-delta {
  font-size: 11px; font-weight: 600; margin-top: 3px; line-height: 1;
  display: inline-flex; align-items: center; gap: 3px;
}
.cell-delta.up   { color: var(--success); }
.cell-delta.down { color: var(--danger); }
.cell-delta.flat { color: var(--text-muted); font-weight: 500; }
.pace-note { font-size: 11.5px; color: var(--text-muted); margin: 14px 0 0; line-height: 1.5; }
.pace-empty { padding: 18px 0; text-align: center; color: var(--text-muted); font-size: 14px; }

@media (max-width: 640px) {
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 92vh; max-height: 92dvh; }
  .modal-head { padding: 14px 16px 10px; }
  .modal-head h3 { font-size: 16px; }
  .modal-body { padding: 10px 14px 16px; }
  table.pace-table th { font-size: 10px; padding: 8px 6px; }
  table.pace-table td { padding: 9px 6px; }
  table.pace-table .pace-week-label { font-size: 13px; }
  table.pace-table .cell-num { font-size: 14px; }
}

/* ========== Embed mode ========== */
body.embed .yechi-banner,
body.embed .site-header,
body.embed .rebbe-block,
body.embed .site-footer {
  display: none !important;
}
body.embed.bg-decor {
  background: transparent;
}
body.embed .hero { padding-top: 12px; }
body.embed main.container { padding-top: 0; }
@media (max-width: 540px) {
  body.embed main.container { padding-left: 8px; padding-right: 8px; padding-bottom: 24px; }
  body.embed .card { padding: 22px 14px; }
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== Header ========== */
.site-header {
  background: var(--cream-card);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255, 253, 249, 0.95);
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.site-logo img {
  height: 56px;
  width: auto;
}
.site-logo .site-logo-secondary {
  height: 38px;
  margin-right: -4px;
  opacity: 0.92;
}
.site-logo h1 {
  margin: 0;
  font-size: 22px;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-logo .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========== Yechi banner ========== */
.yechi-banner {
  background: linear-gradient(90deg, var(--brand-dark) 0%, var(--brand) 50%, var(--brand-dark) 100%);
  color: var(--gold-soft);
  text-align: center;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--gold);
}
.yechi-banner .yechi-text {
  background: linear-gradient(180deg, #F4E1B8 0%, #C8A96A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* ========== Rebbe block ========== */
.rebbe-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 32px auto 0;
  padding: 0 24px;
}
.rebbe-frame {
  position: relative;
  width: 190px;
  height: 253px;
  border-radius: 14px;
  padding: 6px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--brand) 100%);
  box-shadow: 0 8px 28px rgba(95, 46, 56, 0.22);
}
.rebbe-frame img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  object-position: center top;
  display: block;
  border: 3px solid var(--cream-card);
}
@media (max-width: 540px) {
  .rebbe-frame { width: 150px; height: 200px; }
}

/* ========== Hero ========== */
.hero {
  text-align: center;
  padding: 56px 24px 40px;
  max-width: 760px;
  margin: 0 auto;
}
.hero .eyebrow {
  display: inline-block;
  background: var(--brand);
  color: var(--cream);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}
.hero h2 {
  font-size: clamp(28px, 5vw, 44px);
  margin: 0 0 14px;
  color: var(--brand);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero .heart {
  display: inline-block;
  font-size: 1em;
  vertical-align: -0.05em;
  margin: 0 4px;
}
.hero .dates {
  font-size: 18px;
  color: var(--text);
  font-weight: 500;
  margin: 0 0 6px;
}
.hero .lead {
  font-size: 16px;
  color: var(--text-muted);
  margin: 16px auto 0;
  max-width: 620px;
}

/* ========== Card / Form ========== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
.card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--brand);
  font-weight: 700;
}
.card .helper {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.form-group {
  margin-bottom: 22px;
}
.form-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
}
.form-label .req { color: var(--danger); margin-right: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  direction: rtl;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(95, 46, 56, 0.12);
}
.form-textarea { min-height: 80px; resize: vertical; }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) {
  .input-row { grid-template-columns: 1fr; }
}

/* ========== Meal cards ========== */
.meals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.meal-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: #fff;
  transition: all 0.18s ease;
  cursor: pointer;
}
.meal-card:hover {
  border-color: var(--gold-soft);
  background: var(--cream-deep);
}
.meal-card.selected {
  border-color: var(--brand);
  background: linear-gradient(135deg, #fff 0%, var(--cream-deep) 100%);
  box-shadow: 0 2px 8px rgba(95, 46, 56, 0.08);
}
.meal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.meal-check {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.meal-info {
  flex: 1;
  min-width: 0;
}
.meal-title {
  font-weight: 700;
  font-size: 17px;
  color: var(--brand);
  margin: 0 0 2px;
}
.meal-date {
  font-size: 13px;
  color: var(--text-muted);
}
.meal-prices {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  gap: 10px;
  flex-direction: column;
}
.meal-card.selected .meal-prices {
  display: flex;
}
.price-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.price-option:hover { border-color: var(--gold); }
.price-option input[type="radio"] {
  accent-color: var(--brand);
  margin: 0;
}
.price-option.checked {
  border-color: var(--brand);
  background: rgba(95, 46, 56, 0.04);
}
.price-label { flex: 1; font-size: 14px; }
.price-amount {
  font-weight: 700;
  color: var(--brand);
  font-size: 15px;
}

/* ========== Summary ========== */
.summary {
  margin-top: 24px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--cream);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.summary .label {
  font-size: 14px;
  opacity: 0.9;
}
.summary .total {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand);
  color: var(--cream);
  width: 100%;
  padding: 16px 28px;
  font-size: 17px;
  margin-top: 8px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-secondary:hover { background: var(--brand); color: var(--cream); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--brand); }

/* ========== Messages ========== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 15px;
}
.alert-error {
  background: #FDECEE;
  color: var(--danger);
  border: 1px solid #F5C9CE;
}
.alert-success {
  background: #E8F3EB;
  color: var(--success);
  border: 1px solid #C9E2D2;
}

/* ========== Success screen ========== */
.success-screen {
  text-align: center;
  padding: 48px 24px;
}
.success-screen .check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin-bottom: 18px;
}
.success-screen h3 {
  font-size: 26px;
  color: var(--brand);
  margin: 0 0 8px;
}
.success-screen p {
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* Prominent "check your email / spam" notice on the success screen */
.email-notice {
  text-align: right;
  margin: 8px auto 26px;
  max-width: 480px;
  padding: 16px 18px;
  border: 1.5px solid var(--gold);
  background: linear-gradient(135deg, #FFF8EA 0%, var(--cream-deep) 100%);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(200, 169, 106, 0.18);
}
.email-notice .en-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.email-notice .en-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--brand-dark);
  font-size: 15px;
  flex-shrink: 0;
}
.email-notice p {
  margin: 4px 0 0;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.55;
}
.email-notice strong { color: var(--brand); }

/* ========== Payment notice + confirm ========== */
.payment-notice {
  margin: 24px 0 4px;
  padding: 18px 20px;
  border: 1.5px dashed var(--gold);
  background: linear-gradient(135deg, #FFF8EA 0%, var(--cream-deep) 100%);
  border-radius: var(--radius-sm);
  position: relative;
}
.payment-notice .pn-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.payment-notice .pn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 15px;
}
.payment-notice p {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
}

.confirm-row {
  margin: 18px 0 6px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: border-color 0.15s;
}
.confirm-row:hover { border-color: var(--brand-light); }
.confirm-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.confirm-row.invalid {
  border-color: var(--danger);
  background: #FEF6F7;
}
.confirm-row .ct {
  font-size: 14.5px;
  line-height: 1.5;
}
.confirm-row .ct strong { color: var(--brand); }

/* ========== Secondary logo strip ========== */
.logo-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 36px 0 0;
  padding: 0 24px;
  gap: 24px;
}
.logo-strip img {
  height: 60px;
  width: auto;
  opacity: 0.92;
  transition: opacity 0.2s;
}
.logo-strip img:hover { opacity: 1; }

/* ========== Footer ========== */
.site-footer {
  background: var(--brand-dark);
  color: var(--cream);
  padding: 36px 24px;
  margin-top: 60px;
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.site-footer p { margin: 0; opacity: 0.9; font-size: 14px; }
.site-footer a { color: var(--gold-soft); }
.site-footer .contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

/* ========== Admin specific ========== */
.admin-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.login-box {
  max-width: 420px;
  margin: 80px auto;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}
.toolbar h2 {
  margin: 0;
  color: var(--brand);
  font-size: 26px;
}
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.meal-breakdown {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.meal-breakdown h3 {
  margin: 0 0 16px;
  color: var(--brand);
  font-size: 18px;
}
.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-name {
  font-weight: 600;
}
.breakdown-name .sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.breakdown-stats {
  display: flex;
  gap: 18px;
  font-size: 14px;
}
.breakdown-stats .b-count {
  font-weight: 700;
  color: var(--brand);
}

table.signups {
  width: 100%;
  border-collapse: collapse;
  background: var(--cream-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.signups thead {
  background: var(--brand);
  color: var(--cream);
}
table.signups th,
table.signups td {
  padding: 12px 14px;
  text-align: right;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
table.signups th {
  font-weight: 600;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0.02em;
}
table.signups tbody tr:hover { background: var(--cream-deep); }
table.signups tbody tr:last-child td { border-bottom: none; }
.meals-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.meal-chip {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(95, 46, 56, 0.1);
  color: var(--brand);
  white-space: nowrap;
}
.meal-chip.full { background: rgba(200, 169, 106, 0.18); color: var(--brand-dark); }
.meal-chip.free { background: rgba(74, 124, 89, 0.18); color: var(--success); }
.btn-delete {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-delete:hover { background: var(--danger); color: white; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ========== Admin: week nav + aggregate banner ========== */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 22px;
}
.week-nav-card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 22px;
  min-width: 280px;
  text-align: center;
  box-shadow: var(--shadow);
}
.week-nav-card .parsha {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.week-nav-card .meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.week-nav-card .closed-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(178,58,72,0.12);
  color: var(--danger);
  border-radius: 100px;
}
.arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--brand);
  background: var(--cream-card);
  color: var(--brand);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.arrow-btn:hover:not(:disabled) {
  background: var(--brand);
  color: var(--cream);
  transform: scale(1.05);
}
.arrow-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.agg-banner {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
}
.agg-stat .l { font-size: 12px; opacity: 0.85; letter-spacing: 0.04em; text-transform: uppercase; }
.agg-stat .v { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin-top: 2px; }
.agg-stat .s { font-size: 11px; opacity: 0.75; margin-top: 2px; }

/* Table wrapping */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 720px) {
  table.signups { font-size: 13px; }
  table.signups th, table.signups td { padding: 10px 8px; }
}

/* ========== Events admin ========== */
.events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.event-card {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.event-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.event-card-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.event-card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.status-badge {
  flex-shrink: 0;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge.on  { background: rgba(74, 124, 89, 0.15); color: var(--success); }
.status-badge.off { background: rgba(178, 58, 72, 0.12); color: var(--danger); }
.event-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.event-card-stats .n {
  font-weight: 800;
  color: var(--brand);
  font-size: 16px;
}
.share-link {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-link input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  background: var(--cream-deep);
  color: var(--text-muted);
  direction: ltr;
  text-align: left;
}
.btn-copy {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1.5px solid var(--brand);
  background: transparent;
  color: var(--brand);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-copy:hover { background: var(--brand); color: var(--cream); }
.event-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Item / tier editor */
.item-editor {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--cream-deep);
}
.item-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.item-editor-num {
  font-weight: 700;
  color: var(--brand);
  font-size: 15px;
}
.tiers-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
}
.tier-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tier-row .tier-label-input { flex: 1; min-width: 0; }
.tier-amount {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tier-amount span { color: var(--text-muted); font-weight: 700; }
.tier-amount .tier-amount-input { width: 90px; }
.tier-row .btn-delete { flex-shrink: 0; padding: 6px 10px; }

.qr-canvas {
  display: block;
  width: 260px;
  height: 260px;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
}

/* Printable sign modal: preview beside the form, stacked on phones */
.sign-modal { max-width: 820px; width: 100%; }
.sign-modal .modal-head > div { min-width: 0; }
.sign-modal .modal-sub { overflow-wrap: anywhere; }
.sign-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.sign-preview canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2480 / 3508;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.sign-form .btn-primary { width: 100%; }
@media (max-width: 640px) {
  .sign-body { grid-template-columns: 1fr; }
  .sign-preview { max-width: 300px; margin: 0 auto; width: 100%; }
}

@media (max-width: 540px) {
  .events-list { grid-template-columns: 1fr; }
}

/* ========== Mobile responsiveness ========== */
@media (max-width: 720px) {
  /* Site header */
  .site-header { padding: 12px 14px; }
  .site-header-inner { gap: 10px; }
  .site-logo img { height: 42px; }
  .site-logo .site-logo-secondary { height: 28px; }
  .site-logo h1 { font-size: 17px; }
  .site-logo .subtitle { font-size: 11px; }
  #user-bar { display: flex !important; align-items: center; gap: 6px; }
  #user-email { display: none; }
  #user-bar .btn { padding: 6px 12px !important; font-size: 13px; }

  /* Admin shell + toolbar */
  .admin-shell { padding: 14px 10px; }
  .toolbar { gap: 10px; margin-bottom: 16px; }
  .toolbar h2 { font-size: 18px; flex: 1 1 100%; }
  .toolbar-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .toolbar-actions .btn { flex: 1 1 calc(50% - 3px); padding: 9px 10px !important; font-size: 13px !important; white-space: nowrap; }

  /* Aggregate banner */
  .agg-banner { padding: 14px 16px; gap: 10px; }
  .agg-stat .l { font-size: 10px; }
  .agg-stat .v { font-size: 20px; }
  .agg-stat .s { font-size: 10px; }

  /* Week navigation */
  .week-nav { gap: 6px; margin-bottom: 16px; }
  .week-nav-card {
    min-width: 0 !important;
    flex: 1;
    padding: 10px 12px !important;
  }
  .week-nav-card .parsha { font-size: 17px !important; }
  .week-nav-card .meta { font-size: 11px !important; }
  .arrow-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    flex-shrink: 0;
  }

  /* Per-week stats — keep 2 cols on phone */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-label { font-size: 11px; }
  .stat-card .stat-value { font-size: 21px; }
  .stat-card .stat-sub { font-size: 10px; }

  /* Meal breakdown — stack name + stats vertically */
  .meal-breakdown { padding: 16px 16px; margin-bottom: 18px; }
  .meal-breakdown h3 { font-size: 16px; margin-bottom: 12px; }
  .breakdown-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
  }
  .breakdown-stats { flex-wrap: wrap; gap: 10px 14px; font-size: 13px; }

  /* Signups table — keep all columns visible; horizontal scroll handles overflow */
  table.signups { font-size: 12.5px; }
  table.signups th, table.signups td { padding: 8px 8px; white-space: nowrap; }
  table.signups td:nth-child(7) {
    /* notes column: allow wrapping, give it a sensible width */
    white-space: normal;
    min-width: 140px;
    max-width: 220px;
  }
  .btn-delete { padding: 4px 8px; font-size: 11px; }
  .meal-chip { font-size: 11px; padding: 2px 6px; }
}
@media (max-width: 420px) {
  /* Tighter still on very small screens */
  .site-logo h1 { font-size: 15px; }
  .week-nav-card .parsha { font-size: 15px !important; }
  .toolbar h2 { font-size: 16px; }
  .agg-banner { grid-template-columns: repeat(2, 1fr); }
  .agg-stat .v { font-size: 18px; }
}
