/* ============================================================
   Vivah Planner — design tokens
   Palette drawn from the ceremony itself: sindoor maroon (chrome),
   marigold gold (accent/celebration), mehendi green (confirmed/done),
   soft sand canvas, ink text.
   ============================================================ */
:root {
  --maroon-900: #4A0E1B;
  --maroon-800: #6E1423;
  --maroon-700: #8C1D3A;
  --gold-500: #D9A521;
  --gold-300: #F1CE6E;
  --gold-100: #FBF0D6;
  --mehendi-600: #3F6B4A;
  --mehendi-100: #E4EEE6;
  --canvas: #F6F1E7;
  --card: #FFFFFF;
  --ink: #2A1B1E;
  --muted: #8A7B6E;
  --line: #E7DDCC;
  --danger: #B23A3A;
  --danger-100: #F7E5E3;
  --warn-100: #FBEED9;
  --warn-700: #9C6B12;
  --info-100: #E4E9F5;
  --info-700: #3B4E8C;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(74, 14, 27, 0.06), 0 4px 16px rgba(74, 14, 27, 0.06);
  --shadow-lift: 0 4px 10px rgba(74, 14, 27, 0.08), 0 10px 28px rgba(74, 14, 27, 0.10);
  --ease: cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }

/* Any element with the `hidden` attribute must actually hide, even if
   a class on it also sets `display` (e.g. .field-row sets display:grid,
   which would otherwise win over the browser's default [hidden] rule
   since both are normal-priority author/UA rules of equal specificity —
   this is what was letting toggled-closed edit panels stay visible). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ------------------------------------------------------------ icons --- */
.icon { display: inline-flex; flex-shrink: 0; }
.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------- layout ---- */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(175deg, var(--maroon-900), var(--maroon-800) 65%);
  color: #F3E4D8;
  padding: 26px 18px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--gold-500), var(--gold-300));
  color: var(--maroon-900);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--font-display);
  font-size: 19px;
  color: #fff;
  line-height: 1.15;
}
.brand-text small {
  display: block;
  font-family: var(--font-body);
  font-size: 10.5px;
  color: var(--gold-300);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 600;
}

.side-nav {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #EAD9CC;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.side-nav a .icon { color: var(--gold-300); opacity: .85; transition: color .14s, opacity .14s; }
.side-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 700; }
.side-nav a.active .icon { color: var(--gold-300); opacity: 1; }

.side-label {
  margin-top: 26px;
  padding: 0 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(234,217,204,0.5);
}

/* the signature: a vertical thread timeline of the 7 functions */
.timeline {
  margin-top: 10px;
  position: relative;
  padding-left: 22px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold-500), rgba(217,165,33,0.15));
}
.timeline-item {
  position: relative;
  padding: 8px 10px 8px 12px;
  display: block;
  border-radius: 8px;
  transition: background .14s var(--ease);
}
.timeline-item:hover { background: rgba(255,255,255,0.07); }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--maroon-800);
  border: 2px solid var(--gold-500);
  transition: box-shadow .14s;
}
.timeline-item.active::before {
  background: var(--gold-500);
  box-shadow: 0 0 0 4px rgba(217,165,33,0.28);
}
.timeline-item.active { background: rgba(255,255,255,0.11); }
.timeline-item .t-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.timeline-item .t-date {
  font-size: 10.5px;
  color: var(--gold-300);
  font-family: var(--font-mono);
  margin-top: 1px;
}
.timeline-item .t-date.tbd { color: rgba(234,217,204,0.5); }

.timeline-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.timeline-row .timeline-item { flex: 1; min-width: 0; }
.timeline-edit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: rgba(234,217,204,0.45);
  opacity: 0;
  transition: opacity .14s, background .14s, color .14s;
}
.timeline-row:hover .timeline-edit { opacity: 1; }
.timeline-edit:hover { background: rgba(255,255,255,0.1); color: var(--gold-300); }

.timeline-add {
  margin-top: 14px;
  padding-left: 22px;
}
.timeline-add summary {
  color: rgba(234,217,204,0.75);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 8px;
}
.timeline-add summary:hover { background: rgba(255,255,255,0.06); color: #fff; }
.timeline-add summary::before { border-color: currentColor; }
.timeline-add[open] summary { margin-bottom: 10px; }
.timeline-add form { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 4px; }
.timeline-add label {
  color: rgba(234,217,204,0.6);
  font-size: 10.5px;
  margin-bottom: 3px;
}
.timeline-add input {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  padding: 7px 9px;
}
.timeline-add input::placeholder { color: rgba(255,255,255,0.35); }
.timeline-add input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 2px rgba(217,165,33,0.25); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
}

.main {
  padding: 30px 40px 60px;
  max-width: 1240px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar .eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.topbar h1 { font-size: 27px; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ------------------------------------------------------------ hero ---- */
.hero-banner {
  background: linear-gradient(120deg, var(--maroon-800), var(--maroon-900) 120%);
  border-radius: 14px;
  padding: 22px 26px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.hero-banner::after {
  content: "";
  position: absolute;
  right: -40px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,165,33,0.25), transparent 70%);
}
.hero-banner .hero-count {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--gold-300);
  line-height: 1;
}
.hero-banner .hero-label {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 4px;
}
.hero-banner .hero-event {
  font-family: var(--font-display);
  font-size: 20px;
  color: #fff;
}

/* ---------------------------------------------------------- cards ----- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow .18s var(--ease);
}
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.stat-card .stat-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--gold-100);
  color: var(--warn-700);
}
.stat-card .stat-icon.maroon { background: rgba(110,20,35,0.08); color: var(--maroon-800); }
.stat-card .stat-icon.mehendi { background: var(--mehendi-100); color: var(--mehendi-600); }
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--maroon-800);
  line-height: 1;
}
.stat-card .stat-value.gold { color: var(--warn-700); }
.stat-card .stat-note { font-size: 12.5px; color: var(--muted); }

/* -------------------------------------------------- mini bar chart ---- */
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  border-radius: 999px;
  transition: width .4s var(--ease);
}

/* ---------------------------------------------------------- tables ---- */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  padding: 10px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  background: var(--card);
}
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13.5px;
}
tbody tr { transition: background .1s; }
tbody tr:hover td { background: rgba(217,165,33,0.06); }
td.num, th.num { text-align: right; font-family: var(--font-mono); }

/* sticky header + first column for the wide guest table */
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
.table-sticky tbody td:first-child,
.table-sticky thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: 2px 0 4px rgba(74,14,27,0.05);
}
.table-sticky thead th:first-child { z-index: 3; }
.table-sticky tbody tr:hover td:first-child { background: #FBF8F1; }

/* ---------------------------------------------------------- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-confirmed { background: var(--mehendi-100); color: var(--mehendi-600); }
.badge-call { background: var(--warn-100); color: var(--warn-700); }
.badge-pending { background: var(--warn-100); color: var(--warn-700); }
.badge-ordered { background: var(--info-100); color: var(--info-700); }
.badge-procured { background: var(--mehendi-100); color: var(--mehendi-600); }

/* ---------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s, box-shadow .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--maroon-800); color: #fff; box-shadow: 0 1px 2px rgba(74,14,27,0.15); }
.btn-primary:hover { background: var(--maroon-700); box-shadow: 0 3px 10px rgba(74,14,27,0.25); }
.btn-gold { background: var(--gold-500); color: var(--maroon-900); }
.btn-gold:hover { background: var(--gold-300); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #fff; border-color: var(--maroon-800); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-100); }
.btn-danger:hover { background: var(--danger-100); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* -------------------------------------------------- search / toolbar -- */
.search-wrap { position: relative; }
.search-wrap .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap input { padding-left: 34px; }

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  max-width: 100%;
}
.tabs a {
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background .14s var(--ease), color .14s var(--ease);
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { background: var(--maroon-800); color: #fff; }

/* ---------------------------------------------------------- forms ----- */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #D8C9AE; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(217,165,33,0.18);
}
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.field-row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) {
  .field-row, .field-row-2, .field-row-3 { grid-template-columns: 1fr; }
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px 0; }
legend {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 15px;
  padding: 0 8px;
  color: var(--maroon-800);
}
legend .icon { color: var(--gold-500); }

/* ---------------------------------------------------------- misc ------ */
.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mehendi-100);
  color: var(--mehendi-600);
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 600;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.section-head h2 .icon { color: var(--gold-500); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state .icon { color: var(--line); margin: 0 auto 14px; display: flex; justify-content: center; }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > div { height: 100%; background: var(--mehendi-600); transition: width .4s var(--ease); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.text-muted { color: var(--muted); }

.subfunction-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: box-shadow .16s var(--ease), border-color .16s var(--ease);
}
.subfunction-card:hover { box-shadow: var(--shadow); border-color: #DDCFB4; }
.subfunction-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.subfunction-head .icon { color: var(--gold-500); }
.subfunction-name { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 700; font-family: var(--font-display); }
.subfunction-meta { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 5px; flex-wrap: wrap; }
.subfunction-meta span { display: inline-flex; align-items: center; gap: 4px; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  transition: color .14s, background .14s;
}
.icon-btn:hover { color: var(--danger); background: var(--danger-100); }

details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--maroon-800);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 7px;
  transition: background .14s;
}
details > summary:hover { background: rgba(217,165,33,0.08); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .16s var(--ease);
  flex-shrink: 0;
}
details[open] > summary::before { transform: rotate(45deg); }
details[open] summary { margin-bottom: 12px; }

/* status pill with icon dot, used in checklist rows */
.status-pill { display: inline-flex; align-items: center; gap: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.pending { background: var(--warn-700); }
.status-dot.ordered { background: var(--info-700); }
.status-dot.procured { background: var(--mehendi-600); }

.event-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.event-group-head:first-child { margin-top: 0; }
.event-group-head h3 { font-size: 16px; margin: 0; }
.event-group-head .count { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ---------------------------------------------------- language switch --- */
.lang-switch {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
}
.lang-switch a { color: var(--muted); padding: 3px 8px; border-radius: 999px; transition: background .14s, color .14s; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active { background: var(--maroon-800); color: #fff; }
.lang-switch-sep { color: var(--line); }
@media (max-width: 900px) {
  .lang-switch { top: 12px; right: 12px; padding: 5px 8px; font-size: 12px; }
}

/* Hindi (Devanagari) rendering: swap the body font for text-heavy content
   so Devanagari glyphs render properly, and give it a touch more line
   height since the script needs it. Headings keep Fraunces where the
   text is still Latin-script (brand name etc. renders fine in Fraunces
   too since Noto Sans Devanagari is used as a global fallback). */
body.lang-hi {
  font-family: "Noto Sans Devanagari", var(--font-body);
}
body.lang-hi h1, body.lang-hi h2, body.lang-hi h3, body.lang-hi h4 {
  font-family: "Noto Sans Devanagari", var(--font-display);
}
body.lang-hi td, body.lang-hi th, body.lang-hi .badge, body.lang-hi label,
body.lang-hi .btn, body.lang-hi .sub, body.lang-hi .stat-label {
  line-height: 1.6;
}

/* ---------------------------------------------------------- toasts ---- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--maroon-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-success { background: var(--mehendi-600); }
.toast-error { background: var(--danger); }
@media (max-width: 560px) {
  #toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* ---------------------------------------------------- confirm modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 27, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  transition: opacity .18s var(--ease);
  padding: 20px;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--card);
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  transform: scale(0.94) translateY(6px);
  transition: transform .18s var(--ease);
}
.modal-overlay.show .modal-box { transform: scale(1) translateY(0); }
.modal-message { margin: 0 0 18px 0; font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------------------------- button loading state --- */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 15px; height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn-ghost.is-loading::after, .btn-gold.is-loading::after {
  border-color: rgba(74,14,27,0.25);
  border-top-color: var(--maroon-800);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------- checklist row status tint --- */
tr.row-procured td:first-child { border-left: 3px solid var(--mehendi-600); }
tr.row-ordered td:first-child { border-left: 3px solid var(--info-700); }
tr.row-pending td:first-child { border-left: 3px solid var(--warn-700); }

/* ------------------------------------------------- guest search note --- */
#guest-search-note {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

/* --------------------------------------------------- small polish --- */
.card, .stat-card, .subfunction-card {
  animation: fade-in-up .25s var(--ease);
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.btn { will-change: transform; }

/* ============================================================
   Welcome / splash screen
   ============================================================ */
html:has(body.welcome-body), body.welcome-body {
  margin: 0;
  height: 100%;
}
.welcome-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(150deg, var(--maroon-900), var(--maroon-800) 60%, var(--maroon-700));
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-slideshow {
  position: absolute;
  inset: 0;
}
.welcome-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease-in-out;
  overflow: hidden;
}
.welcome-slide.active { opacity: 1; }

/* Blurred, cropped copy fills the whole screen for ambiance... */
.welcome-slide-bg {
  position: absolute;
  inset: -30px; /* overscan so the blur never shows a hard edge */
  background-size: cover;
  background-position: center;
  filter: blur(36px) brightness(0.55) saturate(1.15);
  transform: scale(1.1);
  animation: welcome-kenburns 16s ease-in-out infinite alternate;
}
/* ...while the actual photo sits on top, fully visible, never cropped. */
.welcome-slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 40px rgba(0,0,0,0.45));
}
@keyframes welcome-kenburns {
  from { transform: scale(1.1); }
  to { transform: scale(1.22); }
}

.welcome-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(74,14,27,0.55) 0%, rgba(42,10,20,0.35) 45%, rgba(30,7,14,0.75) 100%);
}

.welcome-lang-switch {
  position: absolute;
  z-index: 20;
}

.welcome-content {
  position: relative;
  z-index: 10;
  text-align: center;
  color: #fff;
  padding: 32px;
  max-width: 640px;
  animation: welcome-fade-in 1s ease-out;
}
@keyframes welcome-fade-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(217,165,33,0.18);
  border: 1px solid rgba(217,165,33,0.4);
  color: var(--gold-300);
  margin-bottom: 18px;
}
.welcome-eyebrow {
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-300);
  font-weight: 700;
  margin-bottom: 14px;
}
.welcome-tagline {
  font-family: var(--font-display);
  font-size: clamp(24px, 4.5vw, 38px);
  font-weight: 600;
  color: #fff;
  margin: 0 0 32px 0;
  line-height: 1.35;
  text-shadow: 0 4px 24px rgba(0,0,0,0.35);
}
body.lang-hi .welcome-tagline { font-family: "Noto Sans Devanagari", var(--font-display); }
.welcome-enter-btn {
  font-size: 15px;
  padding: 13px 28px;
  box-shadow: 0 8px 28px rgba(217,165,33,0.35);
}

.welcome-dots {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
}
.welcome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transition: background .3s, transform .3s;
}
.welcome-dot.active { background: var(--gold-300); transform: scale(1.3); }

@media (max-width: 560px) {
  .welcome-content { padding: 24px; }
  .welcome-lang-switch { top: 14px; right: 14px; }
}

/* ------------------------------------------------- category sections --- */
.category-section { margin-bottom: 24px; }
.category-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--gold-500);
}
.category-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--maroon-800);
  margin: 0;
}
.category-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------------------- inline add sub-function --- */
.add-sub-inline { margin-top: 4px; padding: 0 2px; }
.add-sub-inline > summary {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 6px;
}
.add-sub-inline > summary:hover { color: var(--maroon-800); background: rgba(217,165,33,0.08); }
.add-sub-inline[open] > summary { color: var(--maroon-800); }

/* ============================================================
   Platform additions: accounts, admin, day plan, preparation,
   the live board and the assistant dock.
   ============================================================ */

/* ------------------------------------------------------ login screen --- */
.login-content { max-width: 420px; }
.login-heading {
  font-family: var(--font-display);
  font-size: clamp(21px, 3.4vw, 28px);
  color: #fff;
  margin: 0 0 24px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.35);
}
.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  text-align: left;
}
.login-card label { color: var(--muted); }
.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.login-back:hover { color: #fff; }

/* --------------------------------------------------- sidebar account --- */
.side-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(0,0,0,0.18);
}
.side-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, var(--gold-500), var(--gold-300));
  color: var(--maroon-900);
  font-weight: 700;
  font-size: 13px;
}
.side-user-text { min-width: 0; flex: 1; line-height: 1.25; }
.side-user-text strong {
  display: block;
  font-size: 12.5px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-user-text small {
  font-size: 10.5px;
  color: var(--gold-300);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.side-user-out {
  color: rgba(234,217,204,0.55);
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}
.side-user-out:hover { color: #fff; background: rgba(255,255,255,0.1); }
.side-user-link {
  display: block;
  margin-top: 8px;
  padding-left: 10px;
  font-size: 11.5px;
  color: rgba(234,217,204,0.55);
}
.side-user-link:hover { color: var(--gold-300); }

/* ------------------------------------------------------------ banners -- */
.banner-warn, .banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 9px;
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 600;
}
.banner-warn { background: var(--warn-100); color: var(--warn-700); }
.banner-info { background: var(--info-100); color: var(--info-700); }
.banner-warn .btn { margin-left: auto; }

/* -------------------------------------------------------- admin tabs --- */
.admin-tabs {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.admin-tabs a {
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.admin-tabs a:hover { color: var(--ink); background: rgba(217,165,33,0.1); }
.admin-tabs a.active { background: var(--maroon-800); color: #fff; }

.admin-table input, .admin-table select, .admin-table textarea {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
}
.admin-table textarea { resize: vertical; min-height: 34px; }
.admin-table td { padding: 6px; }
tr.add-row td { background: var(--gold-100); }
tr.add-row input, tr.add-row select { background: #fff; }
.check-cell { margin: 0; display: flex; justify-content: center; }
.check-cell input { width: auto; }

/* ------------------------------------------------------------ vidh -- */
.nav-badge {
  margin-left: auto;
  background: var(--gold-600);
  color: #fff;
  border-radius: 999px;
  min-width: 19px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.ritual-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ritual-row {
  display: grid;
  grid-template-columns: 10px minmax(200px, 1.6fr) 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.ritual-row:hover {
  border-color: var(--maroon-800);
  transform: translateX(2px);
}
.ritual-names { display: flex; flex-direction: column; gap: 1px; }
.ritual-names strong { font-size: 14px; }
.ritual-names .devanagari { font-size: 13px; color: var(--maroon-800); }
.ritual-when, .ritual-who {
  font-size: 12.5px;
  color: var(--muted);
}
.ritual-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Day → sub-function cards on the function Vidh tab */
.vidh-day-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.vidh-day-head h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}
.vidh-day-date {
  font-size: 0.95rem;
  color: var(--maroon-800);
  font-weight: 600;
}
.vidh-day-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12.5px;
  color: var(--muted);
  justify-content: flex-end;
}
.subfn-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 16px;
  margin-bottom: 18px;
}
.subfn-accordion {
  padding: 0;
  overflow: hidden;
}
.subfn-accordion > .subfn-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin: 0;
  background: rgba(110, 20, 35, 0.03);
  user-select: none;
}
.subfn-accordion > .subfn-summary::-webkit-details-marker { display: none; }
.subfn-accordion > .subfn-summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--maroon-800);
  border-bottom: 2px solid var(--maroon-800);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.subfn-accordion[open] > .subfn-summary::before {
  transform: rotate(45deg);
  margin-top: 2px;
}
.subfn-accordion > .subfn-summary:hover {
  background: rgba(217, 165, 33, 0.1);
}
.subfn-summary-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  flex: 1;
}
.subfn-summary-title strong {
  font-family: var(--font-display, inherit);
  font-size: 1.1rem;
  color: var(--ink);
}
.subfn-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}
.subfn-summary-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.subfn-body {
  padding: 8px 18px 18px;
  border-top: 1px solid var(--line);
}
.subfn-basics-form { margin-bottom: 10px; }
.subfn-section-fold {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  margin: 10px 0 0;
  background: #fff;
}
.subfn-section-fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  background: transparent;
}
.subfn-section-fold > summary::-webkit-details-marker { display: none; }
.subfn-section-fold > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.subfn-section-fold[open] > summary::before {
  transform: rotate(45deg);
}
.subfn-section-fold > summary .text-muted {
  margin-left: auto;
  font-weight: 500;
  font-size: 12px;
}
.subfn-section-fold > :not(summary) {
  padding: 0 12px 12px;
}
.subfn-add-fold > summary.subfn-add-summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  margin: 0 0 8px;
  background: transparent;
}
.subfn-add-fold > summary.subfn-add-summary::-webkit-details-marker { display: none; }
.subfn-add-fold > summary.subfn-add-summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--maroon-800);
  border-bottom: 2px solid var(--maroon-800);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.subfn-add-fold[open] > summary.subfn-add-summary::before {
  transform: rotate(45deg);
}
.subfn-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.subfn-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.subfn-title h3 {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.subfn-title h3 a { color: inherit; text-decoration: none; }
.subfn-title h3 a:hover { color: var(--maroon-800); }
.subfn-mai { font-size: 15px; color: var(--maroon-800); margin-top: 2px; }
.subfn-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12.5px;
  color: var(--muted);
  justify-content: flex-end;
  align-items: center;
}
.subfn-facts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.subfn-purpose {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.subfn-section { margin-top: 14px; }
.subfn-section .section-head { margin-bottom: 8px; }
.subfn-section h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.howto-form { display: flex; flex-direction: column; gap: 8px; }
.howto-form textarea,
.howto-text {
  width: 100%;
  font-size: 14px;
  line-height: 1.65;
}
.howto-text { margin: 0; color: var(--ink); }
.duty-table input[type="text"] {
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.duty-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.duty-add, .item-add {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.duty-add input, .item-add input, .item-add select {
  flex: 1 1 120px;
  min-width: 100px;
}
.precheck-list.compact li { padding: 4px 0; }

.vidh-items-table input[type="text"],
.vidh-items-table input[type="number"],
.vidh-items-table select {
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.vidh-items-table input.num { text-align: right; font-variant-numeric: tabular-nums; }
.rite-ref-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12.5px;
}
.rite-ref-list li { margin: 2px 0; }

.ritual-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
  display: inline-block;
  flex: none;
}
.ritual-status.status-in-progress { background: var(--gold-600); }
.ritual-status.status-done { background: #4A7C59; }
.ritual-status.status-skipped { background: #b9b2a8; }

.ritual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}
.ritual-aside { display: flex; flex-direction: column; gap: 18px; }
.ritual-purpose { margin-bottom: 20px; }
.ritual-purpose p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.65; }

.fact-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fact-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.fact-value { font-size: 14px; font-weight: 500; }

.precheck-list { list-style: none; margin: 6px 0 0; padding: 0; }
.precheck-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.precheck-list li:last-child { border-bottom: none; }
.precheck-list li.is-done .precheck-text {
  text-decoration: line-through;
  color: var(--muted);
}
.precheck-list form { display: inline-flex; margin: 0; }
.precheck-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4A7C59;
  flex: none;
  padding: 0;
}
.precheck-box:hover { border-color: var(--maroon-800); }
.precheck-text { flex: 1; font-size: 13.5px; }

.inline-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.inline-add input { flex: 1; }

.artisan-block { margin-top: 16px; }
.artisan-block h4 {
  font-size: 13px;
  margin: 0 0 6px;
  color: var(--maroon-800);
}

.scan-thumb {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--muted);
  font-size: 11.5px;
}
.scan-thumb img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: top;
}
.scan-thumb span { display: block; padding: 6px 9px; }
.scan-thumb:hover { border-color: var(--maroon-800); }

.sibling-list { display: flex; flex-direction: column; gap: 1px; }
.sibling-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
}
.sibling-list a:hover { background: var(--paper); }
.sibling-list a.active { background: var(--gold-100); font-weight: 600; }

tr.row-unverified td { background: rgba(217, 165, 33, .07); }

/* ------------------------------------------------------ verify screen -- */
.verify-row {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  padding: 16px;
  margin-bottom: 12px;
}
.verify-scan img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}
.verify-scan span { display: block; margin-top: 6px; font-size: 11px; }
.verify-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.verify-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ---------------------------------------------------------- accounts -- */
.payment-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.payment-form .field { margin: 0; }
.payment-form .field-wide { grid-column: span 2; }
.payment-form button { height: 38px; justify-content: center; }

.filter-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-row .field { margin: 0; min-width: 180px; }

tr.total-row td { background: var(--paper); font-weight: 500; }
tr.note-row td { padding-top: 0; font-size: 12px; border-top: none; }
.text-warn { color: #A33A2B; font-weight: 600; }
.tick { color: #4A7C59; display: inline-flex; }

@media (max-width: 1100px) {
  .ritual-layout { grid-template-columns: 1fr; }
  .verify-row { grid-template-columns: 1fr; }
  .ritual-row {
    grid-template-columns: 10px 1fr;
    grid-auto-rows: min-content;
  }
  .ritual-when, .ritual-who, .ritual-meta { grid-column: 2; }
  .vidh-day-head { flex-direction: column; align-items: flex-start; }
  .vidh-day-meta { justify-content: flex-start; }
  .subfn-head { flex-direction: column; }
  .subfn-facts { justify-content: flex-start; }
}

/* -------------------------------------------------- permission ticks -- */
.role-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}
.role-legend-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--paper);
}
.role-legend-item strong { display: block; font-size: 13px; }
.role-legend-item span { font-size: 11.5px; color: var(--muted); }

tr.caps-row td { background: var(--paper); padding: 4px 10px 12px; }
.caps-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.caps-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-right: 4px;
}
.cap-tick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin: 0;
  cursor: pointer;
}
.cap-tick input { width: auto; margin: 0; }
.pill-warn {
  background: var(--gold-100);
  border: 1px solid var(--gold-600);
  color: var(--maroon-800);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-style: normal;
  margin-left: 6px;
}

.field-help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
  color: var(--ink);
  margin: 0;
}
.switch-row input { width: auto; }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .14s, background .14s;
}
.pill-link:hover { border-color: var(--maroon-800); background: #fff; }
.pill-link.active {
  border-color: var(--maroon-800);
  background: var(--maroon-50, #f8efe8);
  color: var(--maroon-800);
  font-weight: 600;
}

/* ------------------------------------------------------ auto / manual -- */
.auto-tag, .manual-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.auto-tag { background: var(--info-100); color: var(--info-700); }
.manual-tag { background: var(--gold-100); color: var(--warn-700); }

.override-box {
  background: var(--canvas);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
}
.hint-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* --------------------------------------------------- preparation page -- */
.prep-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s;
}
.prep-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
  border-color: #DDCFB4;
}
.prep-card-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--maroon-800);
  margin-bottom: 4px;
}
.prep-card-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.prep-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  font-size: 12.5px;
}

.hint-card { background: linear-gradient(180deg, #fff, var(--gold-100)); }
.hint-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 14.5px;
  color: var(--maroon-800);
  margin-bottom: 10px;
}
.hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--gold-500);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .14s, transform .06s;
}
.hint-chip:hover { background: var(--gold-100); }
.hint-chip:active { transform: scale(0.97); }

.prep-table input, .prep-table select {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
  border-color: transparent;
  background: transparent;
}
.prep-table input:hover, .prep-table select:hover { border-color: var(--line); background: #fff; }
.prep-table input:focus, .prep-table select:focus { background: #fff; }
.prep-table td { padding: 4px 6px; }
.prep-table tr.is-done { opacity: 0.62; }
.prep-table tr.is-done input[data-field="item_name"] { text-decoration: line-through; }
.prep-table td.just-saved { background: var(--mehendi-100) !important; transition: background .5s; }
.prep-table tfoot td { border-top: 2px solid var(--line); border-bottom: none; padding-top: 10px; }

.qty-cell { position: relative; display: flex; align-items: center; gap: 2px; }
.qty-cell input { text-align: right; }
.lock-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--line);
  padding: 3px;
  border-radius: 5px;
  flex-shrink: 0;
  display: inline-flex;
}
.lock-btn:hover { color: var(--muted); background: var(--canvas); }
.lock-btn.is-locked { color: var(--warn-700); background: var(--warn-100); }

.prep-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------- day planner -- */
.day-grid td { vertical-align: top; }
.day-grid tr.is-today td { background: var(--gold-100); }
.day-cell { display: block; }
.day-cell strong { display: block; font-size: 13.5px; }
.day-cell small { display: block; font-size: 11.5px; color: var(--muted); }
.day-event-tag {
  display: inline-block;
  margin-top: 4px;
  margin-right: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(110,20,35,0.09);
  color: var(--maroon-800);
  font-size: 10.5px;
  font-weight: 700;
}
.meal-cell {
  display: block;
  padding: 6px 8px;
  border-radius: 7px;
  border-left: 3px solid var(--line);
  background: var(--canvas);
  transition: background .14s;
}
.meal-cell:hover { background: #fff; }
.meal-cell .meal-menu {
  display: block;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}
.meal-cell .meal-count { display: block; font-size: 11px; color: var(--muted); }
.meal-cell.status-served { border-left-color: var(--mehendi-600); }
.meal-cell.status-prepping { border-left-color: var(--gold-500); }
.meal-cell.status-cancelled { border-left-color: var(--danger); opacity: 0.55; }
.meal-card .meal-form { margin-top: 14px; }

.capacity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--mehendi-100);
  color: var(--mehendi-600);
  font-size: 12px;
  font-weight: 600;
}
.capacity-chip.is-over { background: var(--danger-100); color: var(--danger); }

/* --------------------------------------------------------- live board -- */
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  display: inline-block;
  transition: background .3s;
}
.live-dot.is-live {
  background: var(--mehendi-600);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,107,74,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(63,107,74,0); }
}

.day-switcher {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 20px;
}
.day-switcher a {
  flex-shrink: 0;
  text-align: center;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  transition: border-color .14s, background .14s;
}
.day-switcher a strong { display: block; font-size: 13px; }
.day-switcher a small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; }
.day-switcher a:hover { border-color: var(--maroon-800); }
.day-switcher a.is-today { border-color: var(--gold-500); }
.day-switcher a.active { background: var(--maroon-800); border-color: var(--maroon-800); }
.day-switcher a.active strong, .day-switcher a.active small { color: #fff; }

.live-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.live-row:last-child { border-bottom: none; }
.live-row-time { font-size: 12.5px; color: var(--muted); width: 46px; flex-shrink: 0; }
.live-row-body { flex: 1; min-width: 0; line-height: 1.35; }
.live-row-body strong { display: block; font-size: 13.5px; }
.live-row-body small { display: block; font-size: 11.5px; color: var(--muted); }
.live-row-action { flex-shrink: 0; }
.live-row-action select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.live-row.status-done, .live-row.status-served { border-left-color: var(--mehendi-600); background: rgba(63,107,74,0.04); }
.live-row.status-in-progress, .live-row.status-prepping { border-left-color: var(--gold-500); background: rgba(217,165,33,0.06); }
.live-row.status-skipped, .live-row.status-cancelled { opacity: 0.5; }
.live-columns { align-items: start; }

.feed-row {
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.4;
}
.feed-row:last-child { border-bottom: none; }
.feed-what { font-weight: 700; color: var(--maroon-800); text-transform: capitalize; }
.feed-summary { color: var(--ink); }
.feed-who { display: block; font-size: 11px; color: var(--muted); }

tr.status-row-done td { background: rgba(63,107,74,0.05); }
tr.status-row-skipped { opacity: 0.55; }

/* ------------------------------------------------------------- decor -- */
.decor-card { padding: 0; overflow: hidden; }
.decor-card.is-selected { border-color: var(--gold-500); box-shadow: 0 0 0 2px rgba(217,165,33,0.25); }
.decor-image { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; }
.decor-noimage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 26px 22px;
  background: linear-gradient(150deg, var(--gold-100), var(--canvas));
  color: var(--muted);
  font-size: 12.5px;
}
.decor-noimage .icon, .decor-noimage svg { color: var(--gold-500); }
.decor-body { padding: 16px 18px 18px; }
.decor-text { font-size: 13.5px; white-space: pre-wrap; line-height: 1.55; }

.menu-group { margin-bottom: 18px; }
.menu-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  color: var(--maroon-800);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--gold-500);
}

/* ============================================================
   Assistant dock — splits the layout rather than covering it
   ============================================================ */
:root { --chat-w: 380px; }

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 150;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(140deg, var(--maroon-800), var(--maroon-900));
  color: var(--gold-300);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(74,14,27,0.4);
  transition: transform .16s var(--ease), opacity .16s;
}
.chat-launcher:hover { transform: scale(1.06); }
body.chat-open .chat-launcher { opacity: 0; pointer-events: none; }

.chat-dock {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--chat-w);
  z-index: 140;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 30px rgba(74,14,27,0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .24s var(--ease);
}
body.chat-open .chat-dock { transform: translateX(0); }

/* the actual "split", rather than an overlay: the page column gives up
   exactly the dock's width, so nothing is ever hidden behind it */
body.chat-open .app-shell { margin-right: var(--chat-w); }
body.chat-open .lang-switch { right: calc(var(--chat-w) + 24px); }
.app-shell, .lang-switch { transition: margin-right .24s var(--ease), right .24s var(--ease); }

.chat-resizer {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
}
.chat-resizer:hover { background: rgba(217,165,33,0.35); }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(140deg, var(--maroon-900), var(--maroon-800));
  color: #fff;
}
.chat-head-title { display: flex; align-items: center; gap: 10px; }
.chat-head-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(217,165,33,0.2);
  color: var(--gold-300);
  flex-shrink: 0;
}
.chat-head-title strong { display: block; font-family: var(--font-display); font-size: 14.5px; }
.chat-head-title small { display: block; font-size: 10.5px; color: var(--gold-300); letter-spacing: 0.05em; }
.chat-head-actions { display: flex; gap: 2px; }
.chat-head-actions .icon-btn { color: rgba(255,255,255,0.6); }
.chat-head-actions .icon-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--canvas);
}

.chat-empty { text-align: center; padding: 26px 8px; color: var(--muted); }
.chat-empty-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--gold-100);
  color: var(--gold-500);
  margin-bottom: 12px;
}
.chat-empty p { font-size: 13.5px; margin: 0 0 16px; }
.chat-suggestions { display: flex; flex-direction: column; gap: 7px; }
.chat-chip {
  padding: 9px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.chat-chip:hover { border-color: var(--gold-500); background: var(--gold-100); }

.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: var(--shadow);
}
.chat-user .chat-bubble {
  background: var(--maroon-800);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-assistant .chat-bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul { margin: 6px 0; padding-left: 18px; }
.chat-bubble li { margin-bottom: 3px; }
.chat-bubble code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--canvas);
  padding: 1px 4px;
  border-radius: 4px;
}
.chat-user .chat-bubble code { background: rgba(255,255,255,0.16); }

.chat-thinking .chat-bubble { display: flex; gap: 4px; padding: 14px; }
.chat-thinking span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chat-blink 1.2s infinite;
}
.chat-thinking span:nth-child(2) { animation-delay: .18s; }
.chat-thinking span:nth-child(3) { animation-delay: .36s; }
@keyframes chat-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-tools {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 4px;
  margin-top: -6px;
}

.chat-proposal {
  border: 1px solid var(--gold-500);
  background: var(--gold-100);
  border-radius: 11px;
  padding: 13px 15px;
  font-size: 12.5px;
}
.chat-proposal-head { font-weight: 600; margin-bottom: 7px; }
.chat-proposal ul { margin: 0 0 11px; padding-left: 18px; }
.chat-proposal li { margin-bottom: 2px; }
.chat-proposal-done { color: var(--mehendi-600); font-weight: 600; }
.chat-proposal-done a { text-decoration: underline; }

.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.chat-input textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  border-radius: 10px;
  font-size: 13.5px;
  padding: 9px 12px;
}
.chat-input .btn { flex-shrink: 0; height: 38px; padding: 0 13px; }

/* On a phone the dock takes the screen -- there's no room to split. */
@media (max-width: 900px) {
  body.chat-open .app-shell { margin-right: 0; }
  body.chat-open .lang-switch { right: 24px; }
  .chat-dock { width: 100%; }
  .chat-resizer { display: none; }
}

@media print {
  .sidebar, .chat-dock, .chat-launcher, .lang-switch, .admin-tabs { display: none !important; }
  .app-shell { display: block; margin-right: 0 !important; }
  .main { max-width: none; padding: 0; }
}
