:root {
  /* Every colour below comes from the #Aara wax-seal logo (logo.png).
     Logo shades, dark -> light: #0c487e  #30679c  #4183bf  #6ea9e2  #acd5fd  #d2e9ff */
  --logo-900: #0c487e;
  --logo-700: #30679c;
  --logo-600: #4183bf;
  --logo-500: #6ea9e2;
  --logo-300: #acd5fd;
  --logo-100: #d2e9ff;

  --bg: #f4f9ff;              /* very light tint of --logo-100 */
  --surface: #ffffff;
  --surface-2: #e9f3fe;       /* light tint of --logo-100 */
  --ink: var(--logo-900);
  --muted: #3f6f9e;           /* between --logo-700 and --logo-600, readable on white */
  --line: var(--logo-100);
  --brand: var(--logo-700);
  --brand-ink: #ffffff;
  --brand-soft: #e2f0fe;

  /* Accent roles, all mapped to logo blues */
  --gold: var(--logo-500);
  --gold-soft: #eaf4ff;
  --ok: var(--logo-900);
  --ok-soft: var(--logo-100);
  --warn: var(--logo-700);
  --warn-soft: #f4f9ff;
  --danger: var(--logo-900);
  --radius: 10px;              /* the ONE corner radius used everywhere */
  --shadow: 0 1px 2px rgba(12, 72, 126, .06), 0 6px 18px rgba(12, 72, 126, .06);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: only light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }                                  /* hidden always wins over layout rules */
:focus-visible { outline: 2px solid var(--logo-600); outline-offset: 2px; }  /* logo-blue focus ring, not the browser's orange */
html { -webkit-text-size-adjust: 100%; }
html.is-phone, html.is-phone body { touch-action: pan-x pan-y; }   /* phones: scrolling only, no pinch zoom */
html.is-phone button, html.is-phone a, html.is-phone input, html.is-phone select { touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .2px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Loader: hero gradient + logo ---------- */
.loader {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--logo-300) 45%, transparent), transparent 60%),
    linear-gradient(160deg, var(--logo-500) 0%, var(--logo-700) 55%, var(--logo-900) 100%);
  color: #fff; transition: opacity .35s ease, visibility .35s ease;
  animation: loader-failsafe 0s linear 6s forwards;   /* never stays stuck, even if JavaScript fails */
}
.loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.no-loader .loader { display: none; }                 /* already shown once this visit */
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.loader img { width: 128px; height: 128px; filter: drop-shadow(0 10px 24px rgba(12, 72, 126, .45)); animation: loader-breathe 1.8s ease-in-out infinite; }
.loader-name { font: 600 1.6rem var(--serif); letter-spacing: .04em; color: var(--logo-100); }
.loader-dots { display: flex; gap: 6px; }
.loader-dots i { width: 7px; height: 7px; border-radius: var(--radius); background: var(--logo-100); opacity: .35; animation: loader-dot 1.2s ease-in-out infinite; }
.loader-dots i:nth-child(2) { animation-delay: .15s; }
.loader-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes loader-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes loader-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
@keyframes loader-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) { .loader img, .loader-dots i { animation: none; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--logo-700);                  /* same blue as the phone status bar, so there's no empty band */
  box-shadow: 0 1px 0 rgba(12, 72, 126, .25);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; line-height: 1.05; color: #fff; }
.brand img { width: 40px; height: 40px; filter: drop-shadow(0 2px 4px rgba(12, 72, 126, .35)); }
.brand-text { display: flex; flex-direction: column; }
.hero-logo { width: 96px; height: 96px; margin: 0 auto 6px; display: block; filter: drop-shadow(0 6px 14px rgba(12, 72, 126, .35)); }
.brand-mark { font-family: var(--serif); font-size: 1.55rem; font-weight: 700; color: #fff; }
.brand-sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--logo-100); }
.role-badge { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 5px 11px; border-radius: var(--radius); background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .35); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
@media (min-width: 900px) { .role-badge { margin-left: 0; order: 3; } }
.topnav { display: none; gap: 2px; }
.topnav a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius); color: var(--logo-100); font-weight: 500; font-size: .9rem; }
.topnav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topnav a.on { background: #fff; color: var(--logo-700); }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none !important; }
  body { padding-bottom: 32px; }
}

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; color: var(--muted); font: 500 .7rem var(--sans);
  background: none; border: 0; cursor: pointer; border-radius: var(--radius);
}
.bottomnav .on { color: var(--brand); }
.bottomnav .on .ic { background: var(--brand-soft); border-radius: var(--radius); padding: 3px 14px; width: 52px; height: 30px; }

/* ---------- Layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
/* Page-top buttons. Phone: same-style (outlined) buttons share a row equally; the main blue action gets its own full row. */
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.head-actions > * { flex: 1 1 0; min-width: 0; }
.head-actions > .btn:not(.ghost) { flex-basis: 100%; }
@media (min-width: 600px) {
  .head-actions { width: auto; flex-wrap: nowrap; }
  .head-actions > *, .head-actions > .btn:not(.ghost) { flex: none; }
}
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: minmax(0, 1fr); }
.grid > *, .stats > *, .admin-grid > *, .ev-grid > *, .event-cards > * { min-width: 0; }   /* long text can never stretch a card */
@media (min-width: 760px) { .grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.section { margin-top: 26px; }
.section > h2 { margin-bottom: 10px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.stat { padding: 14px 16px; }
.stat .label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin-top: 4px; font-variant-numeric: lining-nums tabular-nums; }
.stat .value.ok { color: var(--ok); }
.stat .value.warn { color: var(--warn); }
.stat .value.brand { color: var(--brand); }

.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 30px 18px 26px; border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% -10%, color-mix(in srgb, var(--logo-300) 45%, transparent), transparent 60%),
    linear-gradient(160deg, var(--logo-500) 0%, var(--logo-700) 55%, var(--logo-900) 100%);
  color: #ffffff;
}
.hero .kicker { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--logo-100); }
.hero h1 { font-size: 2.6rem; margin: 8px 0 2px; }
.hero .date { opacity: .9; }
.cd { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.cd div { min-width: 64px; padding: 8px 6px; border-radius: var(--radius); background: rgba(210, 233, 255, .14); border: 1px solid rgba(210, 233, 255, .3); }
.cd b { display: block; font: 700 1.6rem/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.cd span { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--logo-100); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.datebox { text-align: center; border-radius: var(--radius); background: var(--gold-soft); padding: 6px 0; line-height: 1.05; }
.datebox b { display: block; font: 600 1.3rem/1.1 var(--sans); font-variant-numeric: tabular-nums; color: var(--brand); }
.datebox span { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.timeline .t-name { font-weight: 600; }
.timeline .free { opacity: .6; }

/* ---------- Pills, badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--radius); font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.gold { background: var(--gold-soft); color: var(--logo-700); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--logo-300); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ev-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius); font-size: .68rem; font-weight: 700; background: var(--surface-2); color: var(--muted); opacity: .45; }
.ev-dot.on { background: var(--brand-soft); color: var(--brand); opacity: 1; }

/* Event headcount cards (guests page) */
.event-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.event-cards > .event-card:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* phone: odd one out spans the full row */
@media (min-width: 600px) {
  .event-cards { grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); }   /* tablet & desktop: all events in one row, equal widths */
  .event-cards > .event-card:last-child:nth-child(odd) { grid-column: auto; }
}
.event-card { display: flex; flex-direction: column; gap: 2px; padding: 12px; color: var(--ink); transition: border-color .15s, background .15s; }
.event-card:hover { border-color: var(--brand); }
.event-card.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ec-name { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ec-people { font: 700 1.8rem/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--brand); }
.ec-sub { font-size: .72rem; color: var(--muted); }
.event-card.on .ec-name, .event-card.on .ec-people, .event-card.on .ec-sub { color: inherit; }

/* Admin overview on Home */
.admin-dash-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-dash-title .ic { color: var(--logo-700); }
.admin-dash-title .small { font-family: var(--sans); font-weight: 500; }
.admin-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.admin-grid .card { margin: 0; }
.dash-list { display: grid; gap: 10px; color: var(--ink); }
.dash-list .cs-head { margin: 0; }
.dash-list ul { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.dash-list li:first-child { border-top: 0; }
.dl-name { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.dl-name small { font-weight: 400; font-size: .75rem; color: var(--muted); }
.budget-nums.two { grid-template-columns: 1fr 1fr; }

/* Admin budget summary on Home */
.budget-summary { display: grid; gap: 12px; color: var(--ink); }
.budget-summary .cs-head { margin: 0; }
.budget-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.budget-nums div { background: var(--surface-2); border-radius: var(--radius); padding: 8px 4px; }
.budget-nums small { display: block; font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.budget-nums b { font: 700 1.1rem var(--serif); font-variant-numeric: lining-nums tabular-nums; }

/* Invitation cards */
.card-status { margin-bottom: 14px; }
.cs-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cs-head b { font-weight: 600; }
.card-toggle-form { flex: none; display: flex; }
.card-toggle { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 5px 10px; border-radius: var(--radius); cursor: pointer;
  border: 1.5px dashed var(--logo-300); background: var(--surface); color: var(--warn); font: 600 .75rem var(--sans); white-space: nowrap; }
.card-toggle .ic { opacity: .35; }
.card-toggle.sent { border: 1.5px solid transparent; background: var(--logo-700); color: #ffffff; }
.card-toggle.sent .ic { opacity: 1; }
.card-toggle[disabled] { opacity: .6; cursor: progress; }

/* Guest toolbar: search + event filter */
.toolbar.guest-toolbar { display: grid; grid-template-columns: 1fr; gap: 10px; }
.toolbar.guest-toolbar .searchbar { min-width: 0; }
.toolbar.guest-toolbar .event-filter select { width: 100%; }
@media (min-width: 600px) { .toolbar.guest-toolbar { grid-template-columns: 1fr 260px; } }

/* Guest rows */
.list > li.guest-row { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 14px 16px; align-items: center; }
.g-main { display: flex; gap: 14px; align-items: center; min-width: 0; }
.g-main .grow { min-width: 0; }
/* People-count block on guest rows */
.g-count { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 56px; height: 56px; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--logo-100); }
.g-count b { font: 600 1.25rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--logo-900); }
.g-count span { font: 600 .56rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.g-phone { display: inline-block; margin-top: 4px; }
.g-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }       /* phone: three equal buttons in one row */
.g-actions > * { min-width: 0; }
.g-actions .btn, .g-actions .card-toggle { width: 100%; min-height: 34px; justify-content: center; }
.g-del { display: contents; }
.g-actions.two { grid-template-columns: 1fr 1fr; }
.gift-amount { align-self: center; font-weight: 600; color: var(--ink); }
@media (min-width: 760px) {
  .list > li.guest-row { grid-template-columns: 1fr auto; gap: 16px; }
  .g-main { align-items: center; }
  .g-actions { grid-template-columns: 124px 92px 100px; }
  .g-actions.two { grid-template-columns: 92px 100px; }                            /* desktop: fixed widths so every row lines up */
}

/* Chips / tabs (scrollable) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.chip small { color: var(--muted); font-weight: 600; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.on small { color: inherit; opacity: .8; }
.chip-add { border-style: dashed; border-color: var(--brand); color: var(--brand); font-weight: 600; cursor: pointer; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; min-height: 38px; border-radius: var(--radius); border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font: 600 .9rem var(--sans); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .8rem; border-radius: var(--radius); }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); }
.actions { display: flex; gap: 2px; justify-content: flex-end; }

label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  display: block; width: 100%; max-width: 100%; min-width: 0;          /* never wider than its column */
  padding: 10px 12px; min-height: 44px; border-radius: var(--radius);
  border: 1px solid var(--line); background-color: var(--surface); color: var(--ink);
  font: 16px/1.3 var(--sans); /* 16px avoids iOS zoom */
}
/* iPhone draws date/time/select fields natively and ignores width & height; take over their look */
input:not([type=checkbox]):not([type=radio]), select, textarea { -webkit-appearance: none; appearance: none; }
input:not([type=checkbox]):not([type=radio]), select { height: 44px; }        /* every single-line field: same height */
input[type=date], input[type=time] {
  text-align: left; padding-right: 38px;
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
input[type=date] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2330679c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16.5' rx='2'/%3E%3Cpath d='M3 9.5h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E"); }
input[type=time] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2330679c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { opacity: 0; }   /* our icon replaces Chrome's */
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
select {
  padding-right: 38px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2330679c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
input[list]::-webkit-calendar-picker-indicator { display: none !important; }   /* hide iOS/Chrome datalist arrow */
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; border-color: var(--brand); }
.field { margin-bottom: 12px; }
.row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row > *, .field { min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-weight: 500; font-size: .85rem; cursor: pointer; }
.checks input { width: auto; min-height: 0; accent-color: var(--brand); }
.searchbar { position: relative; flex: 1; min-width: 200px; }
.searchbar .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbar input { padding-left: 38px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar select { width: auto; }

/* ---------- Tables / lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
@media (max-width: 640px) { .hide-sm { display: none; } }
@media (max-width: 480px) {                                   /* phones: compact tables so they fit without side-scrolling */
  .table th, .table td { padding: 8px 6px; font-size: .8rem; }
  .table th { letter-spacing: .04em; }
  .table td:first-child { overflow-wrap: anywhere; }
  .table:not(.matrix) td { white-space: nowrap; }
  .table:not(.matrix) td:first-child { white-space: normal; }
}

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { font-size: .8rem; color: var(--muted); }
.avatar { font-variant-numeric: lining-nums; flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius); background: var(--gold-soft); color: var(--logo-700); font: 700 1rem var(--serif); }
.count { flex: none; text-align: center; min-width: 42px; }
.count b { display: block; font: 600 1.15rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--brand); }
.count span { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* progress */
.bar { height: 8px; border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--radius); background: linear-gradient(90deg, var(--gold), var(--brand)); }

/* Sector breakdown bars */
.hbar { display: grid; grid-template-columns: 110px 1fr 44px; gap: 10px; align-items: center; padding: 6px 0; font-size: .88rem; }
.hbar .bar { height: 10px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }

/* Matrix (headcount per sector x event) */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix td.zero { color: var(--muted); opacity: .5; }

/* Event cards */
.ev-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .ev-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.ev-card { padding: 20px; display: grid; gap: 18px; }
.ev-card.is-free { opacity: .6; }
.ev-head { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "date name" "date meta"; column-gap: 14px; row-gap: 6px; align-items: center; }
.ev-date { grid-area: date; align-self: start; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 62px; padding: 8px 0; border-radius: var(--radius);
  background: var(--brand-soft); color: var(--brand); line-height: 1.1; }
.ev-date b { font: 700 1.7rem/1 var(--serif); font-variant-numeric: lining-nums; margin: 2px 0; }
.ev-dow, .ev-mon { font-size: .66rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.ev-name { grid-area: name; align-self: end; margin: 0; font-size: 1.65rem; min-width: 0; overflow-wrap: break-word; hyphens: none; }
.ev-meta { grid-area: meta; align-self: start; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); min-width: 0; }
.ev-when, .ev-venue { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-when > span { white-space: nowrap; }                     /* never split "Wednesday" or "12:30 PM" */
.ev-when > span + span::before { content: "·"; margin-right: 6px; opacity: .6; }
.ev-when .ic, .ev-venue .ic { flex: none; }
/* Edit / Delete: full width 50/50 on phones, compact and right-aligned on tablet & desktop */
.ev-foot, .card-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.ev-foot form, .card-foot form { display: contents; }
.ev-foot .btn, .card-foot .btn { width: 100%; }
@media (min-width: 600px) {
  .ev-foot, .card-foot { display: flex; justify-content: flex-end; }
  .ev-foot .btn, .card-foot .btn { width: auto; min-width: 120px; }
}
.ev-note { margin: 0; }
.ev-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ev-stats a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); }
.ev-stats a:hover { background: var(--brand-soft); }
.ev-stats b { font: 700 1.5rem/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--brand); }
.ev-stats span { font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ev-section { border-top: 1px solid var(--line); padding-top: 16px; }
.ev-label { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 600 .74rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ev-label .ic { color: var(--gold); }
.ev-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ev-menu li { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius); background: var(--gold-soft); border-left: 3px solid var(--gold); }
.ev-dish { font-weight: 600; color: var(--ink); }
.ev-dish-note { font-size: .8rem; color: var(--muted); }
.ev-sectors { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ev-sectors a { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 40px; gap: 12px; align-items: center; padding: 7px 8px; margin: 0 -8px; border-radius: var(--radius); color: var(--ink); font-size: .9rem; }
.ev-sectors a:hover { background: var(--surface-2); }
.ev-sec-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-sec-bar { height: 8px; border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.ev-sec-bar i { display: block; height: 100%; border-radius: var(--radius); background: linear-gradient(90deg, var(--gold), var(--brand)); }
.ev-sectors b { text-align: right; font-weight: 600; }
.ev-empty { margin: 0; color: var(--muted); font-size: .88rem; }

/* Vendor cards */
.vendor { display: grid; gap: 10px; }
.vendor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vendor-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.vendor-nums div { background: var(--surface-2); border-radius: var(--radius); padding: 8px 4px; }
.vendor-nums small { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.vendor-nums b { font-variant-numeric: tabular-nums; }
.pay-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.pay-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }

/* Music */
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: linear-gradient(160deg, var(--logo-500), var(--logo-900)); }
.video iframe, .video img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.video button { position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: rgba(12, 72, 126, .25); color: #fff; cursor: pointer; }
.video button .ic { width: 54px; height: 54px; padding: 14px; border-radius: var(--radius); background: rgba(12, 72, 126, .75); }

/* Small row actions (dishes, outfits, payments): outlined so they read as buttons */
.icon-btn.outline { border: 1px solid var(--line); background: var(--surface); color: var(--brand); }
.icon-btn.outline:hover { border-color: var(--logo-300); background: var(--brand-soft); }
.row-actions { display: flex; gap: 6px; flex: none; }
.row-actions form { display: contents; }

/* ---------- Dialog ---------- */
dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); box-shadow: 0 20px 60px rgba(12, 72, 126, .25); }
dialog::backdrop { background: rgba(12, 72, 126, .35); }
dialog form.modal { padding: 18px; }
dialog { overflow-x: hidden; }
dialog .modal { min-width: 0; }
.modal-head { gap: 12px; }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-head .icon-btn { flex: none; }
.modal-head .icon-btn:focus-visible { outline: none; background: var(--surface-2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-foot { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 18px -18px -18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.modal-foot .btn { width: 100%; min-height: 40px; }
@media (min-width: 600px) { .modal-foot { display: flex; justify-content: flex-end; } .modal-foot .btn { width: auto; min-width: 120px; } }
.modal-head p { line-height: 1.4; }
.bulk-links { display: flex; gap: 14px; margin: -2px 0 8px; font-size: .8rem; }
.bulk-links button { border: 0; background: none; padding: 0; color: var(--brand); font: 600 .8rem var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sheet { margin: auto auto 0; width: 100%; max-width: 560px; border-radius: var(--radius); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-weight: 500; font-size: .85rem; }
.sheet-grid a.on { background: var(--brand-soft); color: var(--brand); }

.toast { margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--logo-100); color: var(--logo-900); font-weight: 500; animation: fade 4s forwards; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.note { padding: 10px 14px; border-radius: var(--radius); background: var(--gold-soft); color: var(--logo-900); border-left: 3px solid var(--logo-500); font-size: .88rem; }

/* Approval pop-up */
dialog.approval { width: min(400px, calc(100vw - 32px)); }
.approval-body { padding: 26px 22px 20px; text-align: center; }
.approval-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); margin-bottom: 10px; }
.approval h2 { margin: 0 0 8px; }
.approval p { margin: 0 0 12px; color: var(--muted); line-height: 1.6; }
.approval p b { color: var(--ink); }
.approval-detail { padding: 10px 12px; border-radius: var(--radius); background: var(--gold-soft); color: var(--ink) !important; font-size: .88rem; }
.approval-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }  /* one button per row: Cancel, then Yes */
.approval-actions .btn { width: 100%; min-height: 40px; }

/* Sectors manager */
.sector-dlg .modal { padding: 18px; }
.sector-add { padding: 14px; border-radius: var(--radius); background: var(--surface-2); margin-bottom: 18px; }
.sector-add-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.sector-add-row .btn { width: 100%; }
@media (min-width: 520px) { .sector-add-row { grid-template-columns: 1fr auto; } .sector-add-row .btn { width: auto; } }
.sector-list-title { margin: 0 0 6px; font: 600 .74rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sector-list { list-style: none; margin: 0; padding: 0; }
.sector-list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.sector-view { display: grid; grid-template-columns: 1fr; gap: 10px; }
.sector-info { display: flex; flex-direction: column; min-width: 0; }
.sector-info b { font-weight: 600; overflow-wrap: anywhere; }
.sector-info span { font-size: .8rem; color: var(--muted); }
.sector-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sector-btns form { display: contents; }
.sector-btns .btn { width: 100%; }
@media (min-width: 520px) { .sector-view { grid-template-columns: 1fr auto; align-items: center; } .sector-btns { display: flex; } .sector-btns .btn { width: auto; } }
.sector-edit { display: grid; gap: 8px; }
.sector-edit label { margin: 0; }
.sector-edit-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sector-edit-btns .btn { width: 100%; }

/* Settings */
.settings-card { display: grid; gap: 4px; }
.settings-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.settings-head h2 { margin: 0 0 2px; }
.settings-head p { margin: 0 0 8px; }
.settings-head > div { min-width: 0; }
.settings-head .pill { white-space: normal; }
.settings-head .lock-icon { flex: none; width: 48px; height: 48px; margin: 0; }
.note-card { display: flex; align-items: center; gap: 10px; margin-top: 14px; background: var(--gold-soft); border-left: 3px solid var(--logo-500); color: var(--logo-900); font-size: .88rem; }
.note-card .ic { flex: none; color: var(--logo-700); }

/* Budget lock */
.lock-wrap { display: grid; place-items: center; min-height: 60vh; }
.lock-card { width: min(400px, 100%); text-align: center; padding: 28px 22px; }
.lock-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); margin-bottom: 10px; }

/* Login */
.login-page { background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--logo-300) 45%, transparent), transparent 60%),
    linear-gradient(160deg, var(--logo-500) 0%, var(--logo-700) 55%, var(--logo-900) 100%) fixed; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.login-page .login .card { box-shadow: 0 20px 50px rgba(12, 72, 126, .35); border-color: transparent; }
.login .card { width: min(380px, 100%); text-align: center; padding: 28px 22px; }
.login h1 { font-size: 2.6rem; color: var(--brand); margin: 0; }

.install-banner { display: none; }
.ios-install .ic { vertical-align: -3px; color: var(--logo-700); }
.ios-install { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .88rem; }
.ios-install[hidden] { display: none; }
.offline-bar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--logo-900); color: #fff; font-size: .85rem; font-weight: 500; }
.offline-bar .ic { flex: none; }
.install-banner.show { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media print {
  .topbar, .bottomnav, .toolbar, .actions, .btn, .chips { display: none !important; }
  body { padding: 0; background: #fff; }
  .card { box-shadow: none; }
}
