/* ============================================================
   RSVP system - styles
   Mobile first, RTL + LTR (logical properties only: start/end, inline/block)
   ============================================================ */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f2f0eb;
  --surface-3: #e9e6df;
  --text: #1f2328;
  --text-2: #464b53;
  --muted: #6b6f76;
  --border: #e5e2da;
  --border-strong: #d4d0c6;

  --primary: #6d4aff;
  --primary-hover: #5b38ee;
  --primary-soft: #f0ecff;
  --primary-ring: rgba(109, 74, 255, .22);

  --danger: #c62828;
  --danger-hover: #a91f1f;
  --danger-soft: #fdeded;
  --success: #1e7d45;
  --success-soft: #e7f5ec;
  --warning: #8f5a00;
  --warning-soft: #fff4dc;
  --info: #1f5fa8;
  --info-soft: #e9f1fb;

  /* RSVP statuses - text/badge colors (always shown with a label) */
  --st-yes: #1e7d45;      --st-yes-soft: #e7f5ec;
  --st-no: #c62828;       --st-no-soft: #fdeded;
  --st-maybe: #8f5a00;    --st-maybe-soft: #fff4dc;
  --st-pending: #3f5f9e;  --st-pending-soft: #ebf0f9;

  /* RSVP statuses - chart marks (validated palette, fixed order: yes, maybe, no, pending) */
  --chart-yes: #2f9e5f;
  --chart-maybe: #d99a1e;
  --chart-no: #d9534f;
  --chart-pending: #5f83c9;
  --chart-series: #6d4aff;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(31, 35, 40, .05);
  --shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 6px 20px rgba(31, 35, 40, .06);
  --shadow-lg: 0 10px 40px rgba(31, 35, 40, .18);
  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 1.65rem; margin: 0; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; font-weight: 700; }
h3 { font-size: 1rem; margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 .6em; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 72px; }

.muted { color: var(--muted); }
.text-warning { color: var(--warning); }
.small { font-size: .88rem; }
.center { text-align: center; }
.mt { margin-block-start: 16px; }
.mb-0 { margin-block-end: 0; }
.inline { display: inline; margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Entrance animation ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.container > * { animation: rise-in .35s var(--ease) both; }
.container > *:nth-child(2) { animation-delay: .03s; }
.container > *:nth-child(3) { animation-delay: .06s; }
.container > *:nth-child(4) { animation-delay: .09s; }
.container > *:nth-child(n+5) { animation-delay: .12s; }

/* ---------- Top bar ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-block-end: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  min-height: 60px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.brand::before {
  content: ""; width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #8b6dff, #6d4aff 55%, #4f2fe0);
  box-shadow: 0 2px 6px var(--primary-ring);
}
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav a, .nav .linklike {
  color: var(--text-2); padding: 8px 10px; white-space: nowrap; border-radius: var(--radius-sm); font-size: .95rem;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover, .nav .linklike:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-spacer { flex: 1; }
.nav-user { color: var(--muted); font-size: .9rem; padding: 0 6px; white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
/* Many menu items (system admin): the name moves to the tooltip of "change password" (it stays in the phone menu),
   and the menu folds into the ☰ button a bit earlier, so it never breaks into two rows */
@media (min-width: 861px) { .has-many-nav .nav-user { display: none; } }
@media (max-width: 1080px) {
  .has-many-nav .nav-toggle { display: block; }
  .has-many-nav .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-block-end: 12px; }
  .has-many-nav .nav.open { display: flex; animation: fade-in .2s ease; }
  .has-many-nav .nav-spacer { display: none; }
  .has-many-nav .nav-user { display: inline; padding: 8px 12px; }
}
.nav-toggle {
  display: none; margin-inline-start: auto; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 1.2rem; padding: 4px 10px; cursor: pointer;
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-block-end: 12px; }
  .nav.open { display: flex; animation: fade-in .2s ease; }
  .nav-spacer { display: none; }
  .nav-user { padding: 8px 12px; }
}

/* ---------- Page head ---------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-block-end: 20px;
}
.page-head .subtitle { color: var(--muted); margin: 4px 0 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; margin-block-end: 6px; }
.back-link::before { content: "→"; }
[dir="ltr"] .back-link::before { content: "←"; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-block-end: 12px; }
.section-title h2 { margin: 0; }

/* ---------- Cards & grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-block-end: 16px;
}
.card.narrow { max-width: 480px; margin-inline: auto; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-block-end: 14px; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-main-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
}
.grid-2 > .card, .grid-3 > .card, .grid-main-side > * > .card:last-child { margin-block-end: 0; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.event-card { display: flex; flex-direction: column; gap: 4px; transition: transform .2s var(--ease), box-shadow .2s var(--ease); color: inherit; }
a.event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.event-card.is-past { opacity: .7; }
.event-card h2 { margin-block-end: 4px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty .empty-icon { font-size: 2.2rem; line-height: 1; margin-block-end: 10px; opacity: .85; }
.empty p { color: var(--muted); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-block-end: 16px; }
.stats-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .stats-4 { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
a.stat { color: inherit; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .9rem; font-weight: 500; }
.stat-sub { color: var(--muted); font-size: .84rem; }
.stat.status-yes { background: var(--st-yes-soft); border-color: transparent; }
.stat.status-yes .stat-value { color: var(--st-yes); }
.stat.status-no { background: var(--st-no-soft); border-color: transparent; }
.stat.status-no .stat-value { color: var(--st-no); }
.stat.status-maybe { background: var(--st-maybe-soft); border-color: transparent; }
.stat.status-maybe .stat-value { color: var(--st-maybe); }
.stat.status-pending { background: var(--st-pending-soft); border-color: transparent; }
.stat.status-pending .stat-value { color: var(--st-pending); }
.stat.tone-warning .stat-value { color: var(--warning); }
.stat.tone-danger .stat-value { color: var(--danger); }

/* ---------- Status breakdown bar (chart) ---------- */
.status-bar-wrap { margin-block: 4px 4px; }
.status-bar {
  display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: visible;
  background: var(--surface); margin-block-end: 12px;
}
.status-seg { position: relative; min-width: 4px; flex-basis: 0; border-radius: 4px; transition: filter .15s ease; cursor: default; }
.status-seg:hover { filter: brightness(1.08) saturate(1.1); }
.seg-yes { background: var(--chart-yes); }
.seg-maybe { background: var(--chart-maybe); }
.seg-no { background: var(--chart-no); }
.seg-pending { background: var(--chart-pending); }
.seg-empty { flex-grow: 1; background: var(--surface-3); }
.status-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--text-2); }
.status-legend li { display: inline-flex; align-items: center; gap: 6px; }
.status-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.status-legend strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Mini column chart (single series) ---------- */
.bars {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px;
  align-items: end; height: 150px; padding-block-start: 22px;
  border-block-end: 1px solid var(--border);
}
.bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-fill {
  background: var(--chart-series); border-radius: 4px 4px 0 0; min-height: 2px;
  transform-origin: bottom; animation: grow-up .6s var(--ease) both;
  transition: filter .15s ease;
}
.bar:hover .bar-fill { filter: brightness(1.12); }
.bar.is-zero .bar-fill { background: var(--surface-3); }
@keyframes grow-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-value { position: absolute; inset-block-start: -20px; inset-inline: 0; text-align: center; font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bars-labels {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px;
  font-size: .78rem; color: var(--muted); text-align: center; margin-block-start: 6px;
}

/* ---------- Tooltip: [data-tip] ---------- */
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; inset-block-end: calc(100% + 8px); inset-inline-start: 50%;
  transform: translateX(-50%); white-space: nowrap; z-index: 20;
  background: #1f2328; color: #fff; font-size: .8rem; padding: 5px 9px; border-radius: 6px;
  box-shadow: var(--shadow); pointer-events: none; animation: fade-in .12s ease;
}
[dir="rtl"] [data-tip]:hover::after, [dir="rtl"] [data-tip]:focus-visible::after { transform: translateX(50%); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.badge.status-yes { background: var(--st-yes-soft); color: var(--st-yes); }
.badge.status-no { background: var(--st-no-soft); color: var(--st-no); }
.badge.status-maybe { background: var(--st-maybe-soft); color: var(--st-maybe); }
.badge.status-pending { background: var(--st-pending-soft); color: var(--st-pending); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }

/* ---------- Alerts (inline) ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-block-end: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert ul { margin: 0; padding-inline-start: 18px; }

/* ---------- Toasts (flash messages) ---------- */
.toasts {
  position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px));
}
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: #1f2328; color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: toast-in .35s var(--ease) both;
}
.toast.leaving { animation: toast-out .25s ease forwards; }
.toast-icon {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 800; color: #1f2328; background: #8fe3b0;
}
.toast-error .toast-icon { background: #ffb4ae; }
.toast-warning .toast-icon { background: #ffd98a; }
.toast-info .toast-icon { background: #b4cdf5; }
.toast-text { flex: 1; padding-block-start: 1px; }
.toast-close { background: none; border: none; color: rgba(255, 255, 255, .6); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px; }
.toast-close:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-weight: 600; font-size: .92rem; }
.field .req { color: var(--danger); margin-inline-start: 2px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #bdb8ac; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input[dir=ltr] { text-align: start; }
[dir="rtl"] input[dir=ltr] { text-align: right; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input[type=search] { padding-inline-start: 36px; background: var(--surface) no-repeat; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap::before {
  content: "⌕"; position: absolute; inset-inline-start: 12px; inset-block-start: 50%; transform: translateY(-52%);
  color: var(--muted); font-size: 1.15rem; pointer-events: none;
}

.form-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding-block-start: 8px; border-block-start: 1px solid var(--border); margin-block-start: 4px;
}
.form-actions .spacer { flex: 1; }

/* Switch (checkbox) */
/* A single checkbox with its label (e.g. "remember me") */
.check-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; margin-block: 2px 6px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; cursor: pointer; }
.radio-list { display: grid; gap: 2px; }
.radio-list .check-row { font-weight: 500; }
.check-row-top { align-items: flex-start; }
.check-row-top input { margin-top: 3px; }
.check-row .hint { font-weight: 400; }
.h-sm { font-size: 1rem; margin: 0 0 4px; }
.mt-0 { margin-top: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); position: relative; flex: none;
  transition: background-color .2s ease;
}
.switch .track::after {
  content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: inset-inline-start .2s var(--ease);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { inset-inline-start: 19px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-ring); }

/* Check list with search (e.g. assigning users) */
.checklist { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.checklist-search { padding: 8px; border-block-end: 1px solid var(--border); background: var(--surface-2); }
.checklist-search input { min-height: 38px; }
.checklist-items { max-height: 260px; overflow-y: auto; }
.checklist-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
  border-block-end: 1px solid var(--border); transition: background-color .12s ease;
}
.checklist-item:last-child { border-block-end: none; }
.checklist-item:hover { background: var(--surface-2); }
.checklist-item input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.checklist-item .meta { color: var(--muted); font-size: .85rem; }
.checklist-empty { padding: 14px; color: var(--muted); text-align: center; }

/* Placeholder chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .85rem; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2);
  transition: all .15s ease;
}
.chip:hover { border-style: solid; border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .95rem; padding: 10px 18px; min-height: 44px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-ring); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; min-height: 34px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .plus { font-size: 1.15em; line-height: 1; }

.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }

/* ---------- Toolbar (search + filters) ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-block-end: 14px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.filters button, .filters a {
  font: inherit; font-size: .88rem; border: none; background: transparent; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .15s ease; display: inline-flex; gap: 6px; align-items: center;
}
.filters button:hover, .filters a:hover { color: var(--text); text-decoration: none; }
.filters .active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.filters .count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: 12px 14px; border-block-end: 1px solid var(--border); text-align: start; vertical-align: middle; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--surface-2); text-transform: none; white-space: nowrap; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: #faf9f6; }
.table tbody tr:last-child td { border-block-end: none; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: end; white-space: nowrap; }
.table .actions .btn { margin-inline-start: 2px; }
.table .primary-cell a { font-weight: 600; color: var(--text); }
.table .primary-cell a:hover { color: var(--primary); }
.table .sub { color: var(--muted); font-size: .84rem; }
tr.is-dimmed td { opacity: .6; }
.no-results { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- Key/value list ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 500; }

/* ---------- Simple list ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-block-end: 1px solid var(--border); }
.list li:last-child { border-block-end: none; }
.list .sub { color: var(--muted); font-size: .85rem; }

/* ---------- Message preview (WhatsApp-like bubble) ---------- */
.preview-pane { background: #efe7dd; border-radius: var(--radius); padding: 18px; min-height: 160px; }
.bubble {
  background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  word-break: break-word; max-width: 420px; font-size: .95rem; line-height: 1.5;
}
.bubble-text { white-space: pre-wrap; }
.bubble-image {
  height: 120px; border-radius: 8px; margin-block-end: 8px;
  background: repeating-linear-gradient(45deg, #ece7f9, #ece7f9 10px, #e3dcf6 10px, #e3dcf6 20px);
  display: grid; place-items: center; color: var(--primary); font-size: .85rem; font-weight: 600;
}

/* ---------- Dialog (confirm) ---------- */
dialog.modal {
  border: none; border-radius: 16px; padding: 0; width: min(440px, calc(100% - 32px));
  box-shadow: var(--shadow-lg); color: var(--text);
}
dialog.modal[open] { animation: modal-in .25s var(--ease); }
dialog.modal::backdrop { background: rgba(20, 22, 26, .45); backdrop-filter: blur(2px); animation: fade-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-body { padding: 22px 22px 8px; }
.modal-body h3 { font-size: 1.1rem; margin-block-end: 8px; }
.modal-body p { color: var(--text-2); margin: 0; white-space: pre-line; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 22px 20px; }

/* ---------- Language switcher ---------- */
.locale-switcher { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.locale-switcher button {
  font: inherit; font-size: .85rem; border: none; background: transparent; color: var(--muted);
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.locale-switcher button:hover { color: var(--text); }
.locale-switcher button.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.locale-switcher.in-card { display: flex; width: fit-content; margin: 20px auto 0; }
@media (max-width: 860px) { .locale-switcher.in-nav { align-self: flex-start; margin: 4px 12px; } }

/* ---------- Auth pages ---------- */
body.is-bare {
  background:
    radial-gradient(1200px 500px at 85% -10%, #ece6ff 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #fdeee2 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
}
.auth-wrap { min-height: calc(100vh - 100px); display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; padding: 30px 28px; border-radius: 18px; }
.auth-title { text-align: center; margin-block-end: 4px; }
.auth-logo {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #8b6dff, #6d4aff 55%, #4f2fe0);
  box-shadow: 0 6px 18px var(--primary-ring); display: grid; place-items: center; color: #fff; font-size: 1.5rem;
}
.password-toggle-wrap { position: relative; }
.password-toggle {
  position: absolute; inset-inline-end: 6px; inset-block-start: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .82rem; padding: 6px 8px; border-radius: 6px;
}
.password-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.password-toggle-wrap input { padding-inline-end: 64px; }

/* ============================================================
   Stage 3 - guest management
   ============================================================ */

/* ---------- Event sub-navigation ---------- */
.subnav {
  display: flex; gap: 4px; overflow-x: auto; margin-block-end: 20px;
  border-block-end: 1px solid var(--border); scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  padding: 10px 14px; color: var(--text-2); white-space: nowrap; font-weight: 500;
  border-block-end: 2px solid transparent; margin-block-end: -1px; transition: color .15s ease, border-color .15s ease;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }

/* ---------- Tags ---------- */
.tag {
  --tag: #5f6b7a;
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.7;
  color: color-mix(in srgb, var(--tag) 78%, #000);
  background: color-mix(in srgb, var(--tag) 13%, #fff);
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag); }
.tags-line { display: flex; flex-wrap: wrap; gap: 4px; margin-block-start: 4px; }

/* Tag picker (checkbox chips) */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-picker label { cursor: pointer; }
.tag-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tag-picker .tag { padding: 4px 12px; font-size: .85rem; border: 1.5px solid transparent; opacity: .55; transition: all .15s ease; }
.tag-picker input:checked + .tag { opacity: 1; border-color: var(--tag); }
.tag-picker input:focus-visible + .tag { box-shadow: 0 0 0 3px var(--primary-ring); }
.tag-picker label:hover .tag { opacity: 1; }

/* Color swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches span {
  display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--sw);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); transition: transform .12s ease, box-shadow .12s ease;
}
.swatches label:hover span { transform: scale(1.1); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatches input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ---------- Guests table ---------- */
.table .check-cell { width: 42px; }
.table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
tr.is-duplicate { background: #fff8ec; }
tr.is-duplicate:hover { background: #fff2dc !important; }
tr.is-duplicate td:first-child { box-shadow: inset -3px 0 0 var(--chart-maybe); }
[dir="ltr"] tr.is-duplicate td:first-child { box-shadow: inset 3px 0 0 var(--chart-maybe); }
tr.is-selected { background: var(--primary-soft) !important; }
.dup-note { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--warning); margin-block-start: 3px; }
.dup-note::before { content: "⚠"; }
.note-icon { color: var(--muted); font-size: .85rem; cursor: help; }

/* Sortable headers */
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th[data-sort]::after { content: "↕"; opacity: .35; margin-inline-start: 4px; font-size: .9em; }
th[data-sort][aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--primary); }
th[data-sort][aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--primary); }

.result-count { color: var(--muted); font-size: .88rem; }

/* Narrow screens: keep name + status visible, move secondary details under the name */
.show-sm { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .table th, .table td { padding: 10px 8px; }
  .toolbar select, .toolbar .btn { flex: 1; }
}
.toolbar select { width: auto; min-width: 150px; min-height: 40px; padding-block: 6px; }

/* ---------- Bulk action bar ---------- */
.bulk-bar {
  position: fixed; inset-block-end: 20px; inset-inline: 16px; margin-inline: auto; max-width: 860px; z-index: 120;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px;
  background: #1f2328; color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: toast-in .25s var(--ease) both;
}
.bulk-bar .bulk-count { font-weight: 700; }
.bulk-bar .spacer { flex: 1; }
.bulk-bar select { width: auto; min-height: 36px; padding: 4px 10px; background: #2c3138; color: #fff; border-color: #464c55; }
.bulk-bar .btn { min-height: 36px; padding: 6px 12px; }
.bulk-bar .btn-ghost { color: #d7dbe0; }
.bulk-bar .btn-ghost:hover { background: #2c3138; color: #fff; }

/* ---------- Status picker (radio cards) ---------- */
.status-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 600px) { .status-picker { grid-template-columns: repeat(4, 1fr); } }
.status-picker label { cursor: pointer; }
.status-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.status-picker span {
  display: block; text-align: center; padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); font-weight: 600; color: var(--text-2); transition: all .15s ease;
}
.status-picker label:hover span { border-color: var(--muted); }
.status-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.status-picker input[value=yes]:checked + span { background: var(--st-yes-soft); border-color: var(--st-yes); color: var(--st-yes); }
.status-picker input[value=no]:checked + span { background: var(--st-no-soft); border-color: var(--st-no); color: var(--st-no); }
.status-picker input[value=maybe]:checked + span { background: var(--st-maybe-soft); border-color: var(--st-maybe); color: var(--st-maybe); }
.status-picker input[value=pending]:checked + span { background: var(--st-pending-soft); border-color: var(--st-pending); color: var(--st-pending); }

/* ---------- Import ---------- */
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: .92rem; }
.steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--border-strong); }
.steps .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted); transition: all .2s ease;
}
.steps li.active { color: var(--text); }
.steps li.active .num { background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-ring); }
.steps li.done .num { background: var(--success-soft); color: var(--success); }

.dropzone {
  position: relative; border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: all .2s ease; display: block;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-icon { font-size: 2.2rem; line-height: 1; margin-block-end: 8px; }
.dropzone strong { display: block; font-size: 1.05rem; margin-block-end: 4px; }
.dropzone input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; margin: 18px 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.map-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .map-grid { grid-template-columns: repeat(3, 1fr); } }
.summary-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 4px 14px; }
.preview-table tr.row-error td { background: var(--danger-soft); }
.preview-table tr.row-warning td { background: #fffaf0; }
.row-msg { font-size: .8rem; }
.row-msg.error { color: var(--danger); }
.row-msg.warning { color: var(--warning); }
.dup-list { margin: 8px 0 0; padding-inline-start: 20px; max-height: 260px; overflow-y: auto; }
.dup-list li { margin-block-end: 4px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent;
  display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Misc ---------- */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text] { width: auto; flex: 1; min-width: 160px; }
.history { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.history li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-block-end: 1px solid var(--border); }
.history li:last-child { border-block-end: none; }
.table-compact th, .table-compact td { padding: 8px 10px; }

/* ============================================================
   Stage 4 - guest RSVP page, invitation settings, sending
   ============================================================ */

/* ---------- Guest page ---------- */
body.guest-body {
  background:
    radial-gradient(900px 420px at 50% -120px, #ece6ff 0%, transparent 70%),
    radial-gradient(700px 400px at 100% 100%, #fdeee2 0%, transparent 60%),
    var(--bg);
}
body.guest-body .container { max-width: 600px; padding-block-start: 16px; }
.guest-page { display: flex; flex-direction: column; gap: 16px; }
.guest-lang { display: flex; justify-content: center; gap: 4px; }
.guest-lang a {
  font-size: .85rem; color: var(--muted); padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .7);
}
.guest-lang a.active { color: var(--primary); font-weight: 700; background: var(--surface); box-shadow: var(--shadow-sm); }
.guest-lang a:hover { text-decoration: none; color: var(--text); }
.guest-card {
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden;
  border: 1px solid var(--border);
}
.guest-hero { display: block; width: 100%; max-height: 520px; object-fit: contain; background: var(--surface-2); }
.guest-hero-plain {
  height: 140px; display: grid; place-items: center; font-size: 3rem;
  background: linear-gradient(135deg, #8b6dff, #6d4aff 55%, #4f2fe0);
}
.guest-body-inner { padding: 22px 22px 24px; text-align: center; }
.guest-hello { color: var(--primary); font-weight: 600; margin-block-end: 2px; }
.guest-title { font-size: 1.75rem; line-height: 1.25; margin-block-end: 14px; }
.guest-details { list-style: none; padding: 0; margin: 0 auto 14px; display: inline-flex; flex-direction: column; gap: 6px; text-align: start; }
.guest-details li { display: flex; align-items: flex-start; gap: 10px; font-size: 1.02rem; }
.gd-icon { width: 24px; text-align: center; flex: none; }
.guest-desc { color: var(--text-2); background: var(--surface-2); border-radius: 12px; padding: 10px 14px; margin-block: 4px 14px; }
.guest-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.guest-rsvp { padding: 24px 22px; }
.guest-rsvp h2 { font-size: 1.35rem; margin-block-end: 4px; }

.rsvp-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-block-start: 8px; }
.rsvp-choice { cursor: pointer; }
.rsvp-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rsvp-choice span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px; border-radius: 16px;
  border: 2px solid var(--border-strong); font-weight: 700; color: var(--text-2); text-align: center;
  transition: transform .15s var(--ease), border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.rsvp-choice b {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem;
  background: var(--surface-2); color: var(--muted); transition: all .15s ease;
}
.rsvp-choice:hover span { transform: translateY(-2px); box-shadow: var(--shadow); }
.rsvp-choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.choice-yes input:checked + span { border-color: var(--st-yes); background: var(--st-yes-soft); color: var(--st-yes); }
.choice-yes input:checked + span b { background: var(--st-yes); color: #fff; }
.choice-maybe input:checked + span { border-color: var(--st-maybe); background: var(--st-maybe-soft); color: var(--st-maybe); }
.choice-maybe input:checked + span b { background: var(--chart-maybe); color: #fff; }
.choice-no input:checked + span { border-color: var(--st-no); background: var(--st-no-soft); color: var(--st-no); }
.choice-no input:checked + span b { background: var(--st-no); color: #fff; }
.rsvp-choice input:checked + span { animation: pop .25s var(--ease); }
@keyframes pop { 50% { transform: scale(1.04); } }

.stepper { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.stepper .btn { width: 48px; height: 48px; padding: 0; font-size: 1.4rem; border-radius: 50%; }
.stepper input { width: 90px; text-align: center !important; font-size: 1.4rem; font-weight: 700; min-height: 52px; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.btn-lg { min-height: 54px; font-size: 1.08rem; border-radius: 14px; }

.guest-state { text-align: center; padding: 6px 0; }
.guest-state .state-icon { font-size: 2.6rem; line-height: 1; margin-block-end: 8px; }
.guest-state p { margin-block: 8px; }
.check-anim { width: 72px; height: 72px; margin: 0 auto 10px; display: block; }
.check-anim circle { fill: none; stroke: var(--st-yes); stroke-width: 3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .6s var(--ease) forwards; }
.check-anim path { fill: none; stroke: var(--st-yes); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .5s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Invitation settings ---------- */
.image-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.invite-thumb { width: 160px; max-height: 220px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); }
.image-form { flex: 1; min-width: 240px; }
.dropzone-sm { padding: 20px; }
.bubble-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; margin-block-end: 8px; }
.copy-field input { font-size: .85rem; background: var(--surface-2); }

/* ---------- Sending ---------- */
.btn-whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; border-color: #1ebe5b; color: #fff; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-block-end: 16px; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .35s var(--ease); }
.send-current { display: grid; gap: 16px; grid-template-columns: 1fr; margin-block-end: 8px; }
@media (min-width: 760px) { .send-current { grid-template-columns: 1fr 1.4fr; align-items: start; } }
.send-name { font-size: 1.35rem; font-weight: 800; }
.send-preview { min-height: 0; max-height: 340px; overflow-y: auto; }
.send-preview .bubble-photo { max-height: 170px; }
.send-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-block: 4px 12px; }
.send-attach > span:nth-child(2) { flex: 1 1 220px; }
.send-attach .btn { flex: none; }
.send-done { text-align: center; padding: 20px 0 8px; }
.send-done .state-icon { font-size: 2.4rem; }
tr.just-sent td { animation: flash-ok 1.4s ease; }
@keyframes flash-ok { 0% { background: var(--success-soft); } 100% { background: transparent; } }

/* ============================================================
   Stage 5 - seating
   ============================================================ */
.seat-stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .seat-stats { grid-template-columns: repeat(4, 1fr); } }
.seat-layout { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .seat-layout { grid-template-columns: 290px minmax(0, 1fr); } }
.seat-layout > .card { margin-block-end: 0; }
.seat-panel { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 980px) { .seat-panel { position: sticky; top: 76px; max-height: calc(100vh - 96px); } }
.seat-panel .card-head { margin-block-end: 0; }
.seat-filter { border-radius: 12px; }
.seat-filter button { padding: 5px 10px; font-size: .82rem; }
.seat-guests { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 60px; max-height: 50vh; padding: 2px; }
@media (min-width: 980px) { .seat-guests { max-height: none; flex: 1; } }
.seat-panel.drop-hover { box-shadow: 0 0 0 3px var(--primary-ring); }

/* Guest chip (draggable) */
.seat-guest {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); cursor: grab; user-select: none;
  touch-action: pan-y; font-size: .9rem; transition: box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}
.seat-guest:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.seat-guest:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.seat-guest .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--chart-pending); }
.seat-guest.st-yes .dot { background: var(--chart-yes); }
.seat-guest.st-maybe .dot { background: var(--chart-maybe); }
.seat-guest.st-no .dot { background: var(--chart-no); }
.seat-guest .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-guest .pp {
  flex: none; min-width: 24px; text-align: center; font-size: .78rem; font-weight: 700; color: var(--text-2);
  background: var(--surface-2); border-radius: 999px; padding: 1px 7px;
}
.seat-guest.is-dragging { opacity: .35; }
.seat-ghost {
  position: fixed; z-index: 300; pointer-events: none; transform: translate(-50%, -50%) rotate(-2deg);
  box-shadow: var(--shadow-lg); max-width: 240px; cursor: grabbing;
}

/* Hall map */
.seat-map-card { padding: 16px; }
.seat-map {
  position: relative; width: 100%; aspect-ratio: 10 / 7; border-radius: 12px; overflow: hidden;
  container-type: inline-size;
  background-color: #fbfaf7;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 5% 7.142857%;
  border: 1px solid var(--border);
}
/* Background image ("hall map") */
.seat-map.has-bg { background-image: none; background-color: #fff; }
.seat-map-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-repeat: no-repeat; background-position: center; background-size: contain;
  transition: background-size .2s ease;
}
.seat-map-bg.fit-stretch { background-size: 100% 100%; }
.seat-map.has-bg .seat-table { box-shadow: 0 2px 10px rgba(31, 35, 40, .25); }
.seat-bg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: -4px 12px; }
.seat-bg-bar label.btn { cursor: pointer; position: relative; }
.seat-fit button { padding: 5px 12px; font-size: .85rem; }
.seat-map-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: var(--muted);
}
.seat-table {
  position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--chart-yes); color: var(--text); cursor: grab; user-select: none; touch-action: none;
  box-shadow: 0 2px 8px rgba(31, 35, 40, .1); line-height: 1.1; text-align: center;
  transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
.seat-table.shape-round { border-radius: 50%; }
.seat-table.shape-rect { border-radius: 12px; }
.seat-table .tn { font-weight: 800; font-size: max(13px, 2.4cqw); }
.seat-table .to { font-size: max(10px, 1.35cqw); color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.seat-table .tm { font-size: max(9px, 1.05cqw); color: var(--st-maybe); }
.seat-table:hover { box-shadow: var(--shadow-lg); z-index: 5; }
.seat-table:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.seat-table.is-empty { border-color: var(--border-strong); border-style: dashed; }
.seat-table.is-full { background: var(--st-yes-soft); }
.seat-table.is-over { border-color: var(--danger); background: var(--danger-soft); }
.seat-table.is-dragging { cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 10; transition: none; }
/* Narrow map (phones): table number only */
@container (max-width: 560px) {
  .seat-table .to, .seat-table .tm { display: none; }
  .seat-table .tn { font-size: 12px; }
}
.seat-table.drop-hover { box-shadow: 0 0 0 4px var(--primary-ring); border-color: var(--primary); transform: translate(-50%, -50%) scale(1.06); }

/* Table cards */
.seat-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.seat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s ease;
}
.seat-card.is-over { border-color: var(--danger); }
.seat-card.drop-hover { box-shadow: 0 0 0 3px var(--primary-ring); border-color: var(--primary); }
.seat-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seat-card-title { font-weight: 700; color: var(--text); text-align: start; }
.seat-card-guests { display: flex; flex-direction: column; gap: 5px; min-height: 34px; }
.seat-bar { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.seat-bar span { display: block; height: 100%; background: var(--chart-yes); border-radius: 999px; transition: width .3s var(--ease); }
.seat-card.is-over .seat-bar span { background: var(--danger); }

.modal-wide { width: min(560px, calc(100% - 32px)); }
.st-badge-yes { background: var(--st-yes-soft); color: var(--st-yes); }
.st-badge-maybe { background: var(--st-maybe-soft); color: var(--st-maybe); }
.st-badge-no { background: var(--st-no-soft); color: var(--st-no); }
.st-badge-pending { background: var(--st-pending-soft); color: var(--st-pending); }

.print-only { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .subnav, .page-head, .back-link, .seat-layout, .seat-stats, .section-title, .toasts, .alert { display: none !important; }
  .print-only { display: block; order: -1; font-size: 1.3rem; margin-block-end: 12px; }
  #seating-app { display: flex; flex-direction: column; }
  .seat-cards { grid-template-columns: repeat(3, 1fr); }
  .seat-card { break-inside: avoid; box-shadow: none; }
  .seat-guest { border: none; padding: 2px 0; }
  .container > * { animation: none !important; }
}

/* ============================================================
   Stage 6 - "Which table am I?" lookup + QR sign
   ============================================================ */
.lookup-card { padding: 28px 22px; text-align: center; }
.lookup-icon { font-size: 2.6rem; line-height: 1; margin-block-end: 6px; }
.lookup-form { text-align: start; margin-block-start: 16px; }
.lookup-form input[type=tel] { font-size: 1.35rem; text-align: center !important; min-height: 56px; letter-spacing: .03em; }
.lookup-results { margin-block-start: 14px; display: flex; flex-direction: column; gap: 18px; }
.lookup-hello { font-size: 1.2rem; font-weight: 700; margin-block-end: 4px; }
.table-badge {
  width: 132px; height: 132px; margin: 10px auto 6px; border-radius: 50%;
  display: grid; place-items: center; font-size: 3.6rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #8b6dff, #6d4aff 55%, #4f2fe0);
  box-shadow: 0 10px 30px var(--primary-ring);
  animation: badge-in .55s var(--ease) both;
}
@keyframes badge-in { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.lookup-label { font-weight: 600; color: var(--text-2); }
.lookup-enjoy { font-size: 1.05rem; color: var(--primary); font-weight: 600; margin: 0; }

/* QR sign (screen preview = paper look) */
.qr-sign {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 44px 32px 32px; text-align: center; max-width: 560px; margin-inline: auto; aspect-ratio: 210 / 297;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.qr-sign [contenteditable] { outline: none; border-radius: 8px; padding: 2px 8px; transition: background-color .15s ease; }
.qr-sign [contenteditable]:hover { background: var(--primary-soft); }
.qr-sign [contenteditable]:focus { background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-ring); }
.qr-sign-icon { font-size: 3rem; line-height: 1; }
.qr-sign-title { font-size: 2.4rem; font-weight: 800; margin: 0; }
.qr-sign-sub { font-size: 1.3rem; color: var(--text-2); margin: 0; }
.qr-code { width: 62%; max-width: 330px; aspect-ratio: 1; margin: 14px 0; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-sign-text { font-size: 1.15rem; margin: 0; max-width: 90%; }
.qr-sign-url { font-size: .85rem; color: var(--muted); margin: 0; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.qr-page .topbar, body.qr-page .subnav, body.qr-page .page-head, body.qr-page .back-link,
  body.qr-page .no-print, body.qr-page .toasts { display: none !important; }
  body.qr-page .container { max-width: none; padding: 0; }
  body.qr-page .grid-main-side { display: block; }
  body.qr-page .qr-sign {
    box-shadow: none; border: none; border-radius: 0; max-width: none; width: 100%;
    height: calc(297mm - 24mm); aspect-ratio: auto; padding: 0; gap: 14px;
  }
  body.qr-page .qr-sign-title { font-size: 46pt; }
  body.qr-page .qr-sign-sub { font-size: 22pt; }
  body.qr-page .qr-sign-text { font-size: 18pt; }
  body.qr-page .qr-code { width: 115mm; max-width: none; }
  body.qr-page [contenteditable]:hover, body.qr-page [contenteditable]:focus { background: none; box-shadow: none; }
}

/* ============================================================
   Stage 7 - automatic sending: campaign progress, message statuses
   ============================================================ */
.progress-lg { height: 10px; margin-block-end: 10px; }
.campaign-line { font-weight: 600; color: var(--text-2); margin-block-end: 14px; min-height: 1.5em; }
.campaign-status { font-size: .9rem; padding: 4px 14px; }
.cs-queued, .cs-running { background: var(--info-soft); color: var(--info); }
.cs-running::before { animation: pulse 1.2s ease-in-out infinite; }
.cs-paused { background: var(--warning-soft); color: var(--warning); }
.cs-done { background: var(--success-soft); color: var(--success); }
.cs-cancelled { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { opacity: .2; } }

/* One message's status: waiting / on its way / sent / delivered / read / failed */
.msg-queued, .msg-processing { background: var(--st-pending-soft); color: var(--st-pending); }
.msg-processing { animation: pulse 1.4s ease-in-out infinite; }
.msg-sent { background: var(--info-soft); color: var(--info); }
.msg-delivered, .msg-read { background: var(--success-soft); color: var(--success); }
.msg-failed, .msg-undelivered { background: var(--danger-soft); color: var(--danger); }
.msg-cancelled, .msg-opened { background: var(--surface-2); color: var(--muted); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Stage 7b - connection to the sending server (admin settings) */
.gts-card h3 { color: var(--muted); font-size: .9rem; text-transform: none; }
.gts-card .field { margin-block-end: 14px; }
.reply-list li { align-items: flex-start; }
.reply-list .reply-body { display: block; margin-block-start: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.gts-card .field > .btn { align-self: flex-start; }

/* Stage 7c - automatic WhatsApp templates */

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .75; }
.bubble-button {
  max-width: 420px; margin-block-start: 4px; padding: 9px 12px; border-radius: 10px; background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); text-align: center; color: #0a7cff; font-weight: 600; font-size: .92rem;
}
.how-it-works summary { cursor: pointer; font-weight: 700; }
.how-it-works[open] summary { margin-block-end: 12px; }
.how-steps { margin: 0 0 10px; padding-inline-start: 22px; display: grid; gap: 8px; }
.how-steps li::marker { color: var(--primary); font-weight: 700; }
.wa-pending { animation: wa-pulse 1.8s ease-in-out infinite; }
@keyframes wa-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .wa-pending { animation: none; } }
.d-block { display: block; }

/* Stage 7d - automatic sending from the event */
.channel-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block-end: 16px; }
.channel-switch a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--border); color: var(--text); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.channel-switch a:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.channel-switch a.active { border-color: var(--primary); box-shadow: 0 2px 10px var(--primary-ring); }
.channel-switch span { color: var(--muted); font-size: .85rem; }
.send-summary { display: flex; align-items: baseline; gap: 10px; margin-block-end: 6px; }
.big-number { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1; transition: transform .15s ease; }

/* Automatic send: choosing guests one by one */
.pick-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 10px 8px; }
.pick-tools input[type=search] { flex: 1 1 220px; }
.pick-tools select { flex: 0 1 200px; }
.pick-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 10px; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pick-row + .pick-row { border-block-start: 1px solid var(--border); }
.pick-row label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 12px; cursor: pointer; transition: background-color .15s ease; }
.pick-row label:hover { background: var(--surface-2); }
.pick-row input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.pick-row:has(input:checked) label { background: var(--primary-soft, #f3f0ff); }
.pick-row.is-disabled label { cursor: not-allowed; opacity: .6; }
.pick-row.is-disabled label:hover { background: none; }
.pick-main { display: grid; min-width: 0; }
.pick-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { display: grid; justify-items: end; gap: 2px; text-align: end; }
@media (max-width: 560px) {
  .pick-row label { grid-template-columns: auto 1fr; }
  .pick-meta { grid-column: 2; justify-items: start; text-align: start; }
}
.list details summary { cursor: pointer; }
.reply-card { display: grid; gap: 6px; padding: 14px 16px; border-block-end: 1px solid var(--border); }
.reply-card:last-child { border-block-end: none; }
.reply-card.is-new { background: var(--primary-soft, #f3f0ff); }
.reply-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reply-text { white-space: pre-line; overflow-wrap: anywhere; font-size: 1rem; }
.reply-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nav-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .75rem; line-height: 18px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .channel-switch a { transition: none; } .channel-switch a:hover { transform: none; } }

/* Stage 7e - "how does it work?" */
.flow-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); counter-reset: flow; }
.flow-steps li {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; border-radius: var(--radius);
  background: var(--surface-2); text-align: center; font-size: .88rem; color: var(--muted);
  animation: flow-in .4s var(--ease, ease) both;
}
.flow-steps li:nth-child(2) { animation-delay: .08s; }
.flow-steps li:nth-child(3) { animation-delay: .16s; }
.flow-steps li:nth-child(4) { animation-delay: .24s; }
.flow-steps li strong { color: var(--text); font-size: .95rem; }
.flow-steps li + li::before {
  content: "←"; position: absolute; inset-inline-start: -16px; top: 50%; transform: translateY(-50%);
  color: var(--primary); font-weight: 700; font-size: 1.3rem; line-height: 1;
}
[dir=ltr] .flow-steps li + li::before { content: "→"; }
.flow-icon { font-size: 1.6rem; line-height: 1; }
@keyframes flow-in { from { opacity: 0; transform: translateY(6px); } }
.status-legend { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.status-legend li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: baseline; font-size: .9rem; }
.how-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: .92rem; }
@media (max-width: 640px) {
  .flow-steps { grid-template-columns: 1fr 1fr; }
  .flow-steps li:nth-child(3)::before { display: none; }
  .status-legend li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .flow-steps li { animation: none; } }

/* ---------- Statistics (admin/stats.php) ---------- */
.card-pad { padding: 16px 20px; }
.card-head.card-pad { margin: 0; padding-block-end: 10px; }
.stats-filters .filters { margin-block-end: 12px; }
.stats-filter-grid { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; margin-block-end: 10px; }
.stats-apply { align-self: end; }
.stat-pct { font-size: .95rem; font-weight: 600; color: var(--muted); }
.stat.stat-cost { background: var(--primary-soft); border-color: transparent; }
.stat.stat-cost .stat-value { color: var(--primary); }
.stats-breakdowns { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .stats-breakdowns { grid-template-columns: repeat(2, 1fr); } .stats-breakdowns > .card:last-child { grid-column: 1 / -1; } }
.stats-breakdowns > .card { margin-block-end: 0; }

/* Statistics: a message row opens its details */
.row-click { cursor: pointer; transition: background .15s ease; }
.row-click:hover, .row-click:focus-visible { background: var(--surface-2); outline: none; }
.row-click:focus-visible { box-shadow: inset 3px 0 0 var(--primary); }
.row-click.is-loading { opacity: .6; }
.log-detail { max-height: min(70vh, 640px); overflow-y: auto; }
.log-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-block-end: 12px; }
.log-head h3 { margin: 0 0 2px; }
.log-preview { min-height: 0; padding: 14px; }
.log-preview .bubble { max-width: 100%; }
.list-compact li { padding: 8px 0; font-size: .92rem; }
.list-compact li > span:last-child { text-align: end; }
.log-ref { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.log-ref code { font-size: .8rem; overflow-wrap: anywhere; }
.src-campaign { background: var(--primary-soft); color: var(--primary); }
.src-test { background: var(--warning-soft); color: var(--warning); }
.src-manual { background: var(--surface-2); color: var(--muted); }
.bars.bars-dense, .bars-labels.bars-dense { gap: 3px; }
.bars-labels.bars-dense span { white-space: nowrap; overflow: visible; }
@media (max-width: 560px) { .stats-breakdowns .col-opt { display: none; } }
