/* ============================================
   Meal Train Multi – refined UI
   ============================================ */

:root {
  --primary: #c2410c;
  --primary-hover: #9a3412;
  --primary-soft: #fff7ed;
  --primary-border: #fed7aa;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --text: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --info-text: #1e40af;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(28 25 23 / 0.04);
  --shadow: 0 4px 16px rgb(28 25 23 / 0.06);
  --shadow-lg: 0 16px 40px rgb(28 25 23 / 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

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

.hidden { display: none !important; }

.top-accent {
  height: 3px;
  background: linear-gradient(90deg, #c2410c, #ea580c, #f59e0b);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  background: #e7e5e4;
  color: var(--text);
}

.btn:hover { background: #d6d3d1; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.25);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgb(194 65 12 / 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 4px 12px rgb(194 65 12 / 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: #fafaf9;
  border-color: #a8a29e;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgb(28 25 23 / 0.05);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.btn-success:hover { background: #dcfce7; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8125rem; border-radius: 8px; }
.btn-lg { padding: 0.9rem 1.6rem; font-size: 1.02rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.2rem 0;
  letter-spacing: -0.02em;
}
.brand:hover .brand-text { color: var(--primary); }
.brand-icon { font-size: 1.35rem; line-height: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collab-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.collab-pill.host {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}
.collab-pill.connecting {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
.collab-pill.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.collab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Layout ---------- */
#main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
  min-height: calc(100vh - 100px);
}

.app-footer {
  text-align: center;
  padding: 1.25rem 1rem 1.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ---------- Landing ---------- */
.landing {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.landing-hero {
  text-align: center;
  padding: 2.75rem 0.75rem 2.5rem;
}

.landing-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.35rem;
}

.landing-hero h1 {
  font-size: clamp(1.9rem, 5.2vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 0.9rem;
  color: var(--text);
}
.landing-hero h1 span {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing-lead {
  font-size: 1.08rem;
  color: var(--text-secondary);
  max-width: 32rem;
  margin: 0 auto 1.85rem;
  line-height: 1.65;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.landing-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2.25rem 0 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s;
}
.feature-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.feature-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--primary-soft);
  border-radius: 10px;
  margin-bottom: 0.85rem;
}

.feature-card h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.feature-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.landing-steps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.landing-steps h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
  letter-spacing: -0.01em;
}

.step-list { list-style: none; counter-reset: step; }
.step-list li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 0.95rem;
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.step-list li:last-child { margin-bottom: 0; }
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-border);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.card-clickable {
  cursor: pointer;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s, transform 0.15s;
}
.card-clickable:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.page-title {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  margin-bottom: 0.2rem;
}
.page-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.15rem;
}
.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.35rem;
}

.live-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 1.05rem;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.live-bar .room-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  background: #fff;
  padding: 0.28rem 0.65rem;
  border-radius: 7px;
  border: 1px solid var(--info-border);
  letter-spacing: 0.04em;
  font-size: 0.88rem;
}

.participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.2rem;
}
.participant-chip {
  font-size: 0.72rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.input,
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.14);
}

.textarea { min-height: 96px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.2rem;
}

/* ---------- Recipients ---------- */
.recipient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: #9a3412;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.recipient-chip button {
  background: none;
  border: none;
  color: #9a3412;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  font-weight: 700;
}

.recipient-card {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
}
.recipient-card strong { display: block; font-size: 0.95rem; }
.recipient-card .notes {
  font-size: 0.84rem;
  color: #9a3412;
  margin-top: 0.15rem;
}

/* ---------- Train list ---------- */
.train-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0.55rem;
}
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #f5f5f4;
  color: var(--text-muted);
}
.badge-live { background: #fee2e2; color: #b91c1c; }
.badge-fill { background: var(--primary-soft); color: #c2410c; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 3.25rem 1.5rem;
}
.empty-state .emoji { font-size: 2.75rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.empty-state p { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Slots ---------- */
.slot-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  margin-bottom: 0.7rem;
  background: var(--surface);
  transition: border-color 0.15s;
}
.slot-card.filled {
  border-color: var(--success-border);
  background: var(--success-bg);
}
.slot-date { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.15rem; }
.slot-info { font-size: 0.875rem; color: var(--text-muted); }
.slot-volunteer {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #d6d3d1;
}
.slot-volunteer strong { color: var(--success); }
.slot-actions {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.inline-form {
  background: #fafaf9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem;
  margin-top: 0.75rem;
}

/* ---------- Back ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0.25rem 0;
}
.back-link:hover { color: var(--primary); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.18s var(--ease);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.22s var(--ease);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}
.modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.1rem;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* ---------- Utils ---------- */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.35rem; }
.mt-2 { margin-top: 0.65rem; }
.mb-2 { margin-bottom: 0.65rem; }
.mb-3 { margin-bottom: 1rem; }

@media (max-width: 480px) {
  #main { padding: 1.15rem 1rem 2.5rem; }
  .landing-hero { padding: 1.75rem 0.25rem 2rem; }
  .btn-lg { width: 100%; }
  .landing-cta { flex-direction: column; }
  .app-header-inner { padding: 0.65rem 1rem; }
}

/* ---------- Calendar ---------- */
.cal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.cal-month-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  flex: 1;
}

.cal-nav {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s;
}
.cal-nav:hover:not(:disabled) {
  background: #f5f5f4;
  border-color: #a8a29e;
  color: var(--text);
}
.cal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day {
  aspect-ratio: 1;
  min-height: 52px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  position: relative;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.cal-day.out {
  opacity: 0.25;
  pointer-events: none;
}

.cal-day.in-range {
  background: #fafaf9;
  border-color: var(--border);
  color: var(--text);
}

.cal-day.open {
  cursor: pointer;
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: #9a3412;
}
.cal-day.open:hover {
  background: #ffedd5;
  border-color: #fb923c;
  transform: scale(1.03);
}

.cal-day.filled {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
  cursor: pointer;
}
.cal-day.filled:hover {
  background: #dcfce7;
}

.cal-day.today-mark::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.cal-day-num {
  line-height: 1.1;
}

.cal-day-label {
  font-size: 0.58rem;
  font-weight: 600;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
  line-height: 1.2;
  opacity: 0.9;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cal-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.cal-swatch.open { background: var(--primary-soft); border-color: var(--primary-border); }
.cal-swatch.filled { background: var(--success-bg); border-color: var(--success-border); }

/* Day detail panel under calendar */
.day-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  animation: slideUp 0.2s var(--ease);
}

.day-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.015em;
}

.day-panel-empty {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 480px) {
  .cal-day {
    min-height: 44px;
    font-size: 0.78rem;
    border-radius: 8px;
  }
  .cal-day-label {
    font-size: 0.5rem;
  }
  .cal-wrap {
    padding: 0.9rem 0.65rem 1rem;
  }
}

.cal-day.selected {
  box-shadow: 0 0 0 2px var(--primary);
  z-index: 1;
}

.cal-day.pickable {
  cursor: pointer;
  background: #fafaf9;
  border-color: var(--border);
  color: var(--text);
}
.cal-day.pickable:hover {
  background: #ffedd5;
  border-color: #fb923c;
  color: #9a3412;
}

.cal-day.open .cal-day-label {
  color: #9a3412;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cal-day {
  min-height: 58px;
}

.user-chip {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f5f5f4;
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Admin howto box */
.admin-howto {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.5rem;
}
.howto-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.howto-list li { margin-bottom: 0.4rem; }
.howto-list li:last-child { margin-bottom: 0; }

.member-row { margin-bottom: 0.65rem; }

/* iPhone / iPad improvements */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .app-header-inner {
    padding-top: max(0.7rem, env(safe-area-inset-top));
  }
  .app-footer {
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  #main {
    padding: 1rem 0.9rem 2.5rem;
  }
  .landing-hero {
    padding: 1.75rem 0.25rem 1.5rem;
  }
  .landing-hero h1 {
    font-size: 1.85rem;
  }
  .landing-cta {
    flex-direction: column;
  }
  .landing-cta .btn {
    width: 100%;
  }
  .toolbar {
    flex-direction: column;
  }
  .toolbar .btn {
    width: 100%;
  }
  .btn, .btn-sm {
    min-height: 44px; /* Apple touch target */
  }
  .btn-sm {
    padding: 0.55rem 0.9rem;
  }
  .cal-day {
    min-height: 48px;
    font-size: 0.8rem;
  }
  .cal-nav {
    width: 44px;
    height: 44px;
  }
  .member-actions {
    width: 100%;
    margin-top: 0.65rem;
  }
  .member-row .flex-between {
    flex-direction: column;
    align-items: stretch !important;
  }
  .member-actions .btn {
    width: 100%;
  }
  .app-header-inner {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .brand-text {
    font-size: 0.95rem;
  }
  .user-chip {
    max-width: 100px;
    font-size: 0.7rem;
  }
  .modal-panel {
    max-width: 100%;
    margin: 0.5rem;
    padding: 1.25rem;
  }
  .form-actions .btn {
    width: 100%;
  }
  .form-actions {
    flex-direction: column;
  }
  .live-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .live-bar .btn {
    width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  #main {
    max-width: 720px;
    padding: 1.5rem 1.5rem 3rem;
  }
  .cal-day {
    min-height: 64px;
  }
}

/* Prevent iOS zoom on input focus */
@media (max-width: 480px) {
  .input,
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px !important;
  }
}

/* =====================================================
   Healthy Hub–style landing (SES Meal Hub)
   ===================================================== */
.hh-landing {
  --hh-bg: #f7f4ef;
  --hh-surface: #ffffff;
  --hh-ink: #1c1917;
  --hh-muted: #57534e;
  --hh-green: #3d6b4f;
  --hh-green-deep: #2f553e;
  --hh-green-soft: #e8f0eb;
  --hh-line: #e7e5e0;
  background: var(--hh-bg);
  color: var(--hh-ink);
  min-height: 100vh;
  margin: -1.75rem -1.25rem -3.5rem;
  width: calc(100% + 2.5rem);
  max-width: none;
  font-family: var(--font);
}

@media (max-width: 768px) {
  .hh-landing {
    margin: -1rem -0.9rem -2.5rem;
    width: calc(100% + 1.8rem);
  }
}

.hh-nav {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hh-line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.hh-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.hh-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.hh-logo-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--hh-green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 1px solid #c5d9cc;
}
.hh-nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.hh-nav-links a,
.hh-link-btn {
  background: none;
  border: none;
  color: var(--hh-muted);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  padding: 0.25rem 0;
}
.hh-nav-links a:hover,
.hh-link-btn:hover {
  color: var(--hh-ink);
}

.hh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0.8rem 1.35rem;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.hh-btn:active { transform: translateY(1px); }
.hh-btn-primary {
  background: var(--hh-green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 107, 79, 0.25);
}
.hh-btn-primary:hover { background: var(--hh-green-deep); }
.hh-btn-secondary {
  background: #fff;
  color: var(--hh-ink);
  border-color: var(--hh-line);
}
.hh-btn-secondary:hover { background: #fafaf9; }
.hh-btn-nav {
  background: #e8a317;
  color: #1c1917;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(232, 163, 23, 0.35);
}
.hh-btn-nav:hover { filter: brightness(0.97); }

.hh-hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
}
.hh-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
}
.hh-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--hh-green-soft);
  color: var(--hh-green-deep);
  border: 1px solid #c5d9cc;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.15rem;
}
.hh-title {
  font-size: clamp(2.1rem, 4.5vw, 3.15rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 1rem;
  color: var(--hh-ink);
}
.hh-title span {
  color: var(--hh-green);
}
.hh-lead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--hh-muted);
  max-width: 34rem;
  margin-bottom: 1.5rem;
}
.hh-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.hh-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  font-size: 0.82rem;
  color: var(--hh-muted);
}
.hh-trust span { display: inline-flex; align-items: center; gap: 0.3rem; }

.hh-hero-visual { position: relative; }
.hh-photo-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(28, 25, 23, 0.12);
  background: #ddd;
  aspect-ratio: 4/3;
}
.hh-photo-bg {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(160deg, rgba(61,107,79,0.15), rgba(28,25,23,0.25)),
    url('https://images.unsplash.com/photo-1606787366850-de6330128bfc?auto=format&fit=crop&w=900&q=80') center/cover no-repeat;
}
.hh-float-chip {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.8);
}
.hh-float-chip span { font-size: 1.25rem; }
.hh-float-chip strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
}
.hh-float-chip small {
  display: block;
  font-size: 0.75rem;
  color: var(--hh-muted);
}

.hh-stats {
  margin-top: 2.5rem;
  background: var(--hh-surface);
  border: 1px solid var(--hh-line);
  border-radius: 20px;
  padding: 1.35rem 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(28,25,23,0.04);
}
.hh-stat strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--hh-green);
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}
.hh-stat span {
  font-size: 0.8rem;
  color: var(--hh-muted);
}

.hh-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
  text-align: center;
}
.hh-section-alt {
  background: rgba(255,255,255,0.45);
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}
.hh-section-alt > * {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.hh-section-title {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.65rem;
}
.hh-section-sub {
  color: var(--hh-muted);
  font-size: 1.05rem;
  max-width: 32rem;
  margin: 0 auto 2rem;
  line-height: 1.55;
}

.hh-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  text-align: left;
}
.hh-feature {
  background: var(--hh-surface);
  border: 1px solid var(--hh-line);
  border-radius: 18px;
  padding: 1.35rem 1.25rem;
  box-shadow: 0 2px 12px rgba(28,25,23,0.03);
}
.hh-feature-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: var(--hh-green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}
.hh-feature h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.hh-feature p {
  font-size: 0.92rem;
  color: var(--hh-muted);
  line-height: 1.5;
}

.hh-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: left;
  margin-bottom: 2rem;
}
.hh-step {
  background: var(--hh-surface);
  border: 1px solid var(--hh-line);
  border-radius: 18px;
  padding: 1.25rem;
}
.hh-step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--hh-green-soft);
  color: var(--hh-green-deep);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  border: 1px solid #c5d9cc;
}
.hh-step h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.hh-step p {
  font-size: 0.88rem;
  color: var(--hh-muted);
  line-height: 1.45;
}
.hh-bottom-cta { text-align: center; }

.hh-footer {
  border-top: 1px solid var(--hh-line);
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--hh-muted);
}

@media (max-width: 900px) {
  .hh-hero-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .hh-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .hh-feature-grid {
    grid-template-columns: 1fr;
  }
  .hh-steps {
    grid-template-columns: 1fr 1fr;
  }
  .hh-nav-links {
    display: none;
  }
}

@media (max-width: 520px) {
  .hh-stats,
  .hh-steps {
    grid-template-columns: 1fr;
  }
  .hh-cta-row {
    flex-direction: column;
  }
  .hh-cta-row .hh-btn {
    width: 100%;
  }
  .hh-nav-inner {
    padding: 0.75rem 1rem;
  }
  .hh-hero {
    padding: 1.5rem 1rem 1.25rem;
  }
  .hh-btn {
    min-height: 48px;
  }
}

#main.main-landing {
  max-width: none;
  padding: 0;
  min-height: 100vh;
}
body.on-landing {
  background: #f7f4ef;
}
body.on-landing .top-accent {
  display: none;
}

/* Fathers / parish theme accents */
.fathers-landing .landing-badge {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.fathers-landing .landing-hero h1 span {
  color: #9a3412;
}
body {
  --primary: #9a3412;
  --primary-hover: #7c2d12;
  --primary-soft: #fff7ed;
  --primary-border: #fed7aa;
}
.top-accent {
  background: linear-gradient(90deg, #9a3412, #c2410c, #ea580c);
}

.cal-day.open .cal-day-label,
.cal-day.filled .cal-day-label {
  -webkit-line-clamp: 3;
  font-size: 0.62rem;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
}
.cal-day {
  min-height: 62px;
}

.organizer-login-btn {
  margin-top: 0.35rem;
  opacity: 0.9;
}
.landing-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.compost-note {
  display: block;
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.4;
}
.day-panel {
  scroll-margin-bottom: 1.5rem;
}
