/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 40px; padding: 0 var(--s-4);
  border: 1px solid transparent; border-radius: var(--r-2);
  background: transparent; color: var(--text);
  font-weight: 700; font-size: 14px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap; cursor: pointer;
}
.btn--sm { height: 32px; padding: 0 var(--s-3); font-size: 13px; }
.btn--lg { height: 48px; padding: 0 var(--s-5); font-size: 15px; }
.btn--primary { background: var(--brand); color: var(--brand-fg); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--secondary { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.btn--secondary:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-warm); }
.btn--accent { background: var(--accent); color: var(--su-ink-900); }
.btn--danger { background: #b91c1c; color: #fff; box-shadow: var(--shadow-sm); }
.btn--danger:hover { background: #991b1b; }
.btn--danger-ghost { background: transparent; color: #b91c1c; border-color: var(--border); }
.btn--danger-ghost:hover { background: #fde8e8; border-color: #f3c9c9; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Modal (confirm dialog) */
.modal-scrim {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  background: rgba(27, 27, 47, 0.5);
  opacity: 0; transition: opacity 150ms ease;
}
.modal-scrim.is-open { opacity: 1; }
.modal-card {
  width: min(440px, 100%); background: var(--surface);
  border-radius: var(--r-4); box-shadow: var(--shadow-lg);
  padding: var(--s-6);
  max-height: 90vh; overflow-y: auto;
  transform: translateY(8px) scale(0.98); transition: transform 160ms ease;
}
.modal-scrim.is-open .modal-card { transform: none; }
.modal-card__head { display: flex; align-items: center; gap: var(--s-3); }
.modal-card__head h3 { font-size: 18px; }
.modal-card__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.modal-card__icon--danger { background: #fde8e8; color: #b91c1c; }
.modal-card__body { margin-top: var(--s-3); color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.modal-card__actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-6); }
@media (prefers-reduced-motion: reduce) {
  .modal-scrim, .modal-card, .toast { transition: none; }
}

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow-sm); }
.card__body { padding: var(--s-5); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: var(--s-1);
  height: 24px; padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
  background: var(--surface-warm); color: var(--text-strong);
}
.pill--brand { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }
.pill--accent { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-strong); }
.pill--success { background: #e6f4ea; color: #1d6b34; }
.pill--warning { background: #fef3cc; color: #7a4f00; }
.pill--danger { background: #fde8e8; color: #b91c1c; }

/* Official SU seal (red linework on transparency) — the white chip keeps it
   legible on dark velvet headers/footers and is invisible on light surfaces. */
.seal-chip { background: #fff; border-radius: 50%; padding: 3px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.field__input, .field__select {
  width: 100%; box-sizing: border-box;
  height: 44px; padding: 0 var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-2);
  background: var(--surface); color: var(--text);
}
.field__input:focus, .field__select:focus { border-color: var(--brand); }
.field__hint { font-size: 12px; color: var(--text-muted); }
.field__error { font-size: 13px; color: #b91c1c; }

/* Switch */
.switch {
  display: inline-block; position: relative;
  width: 44px; height: 26px; padding: 0; border: 0;
  border-radius: var(--r-pill); background: var(--border);
  transition: background 140ms ease;
}
.switch[aria-checked="true"] { background: var(--brand); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface);
  transition: transform 160ms ease;
}
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-4);
  padding: var(--s-9) var(--s-5); text-align: center;
  color: var(--text-muted);
}
.empty__title { font-size: 22px; font-weight: 800; color: var(--text); }
.empty__art { width: 96px; height: 96px; color: var(--accent); }

/* Toast */
.toast {
  position: fixed; right: var(--s-5); bottom: var(--s-5);
  z-index: 50; max-width: 360px;
  padding: var(--s-4); border-radius: var(--r-3);
  color: var(--brand-fg); background: var(--su-ink-900);
  box-shadow: var(--shadow-lg);
  transform: translateY(140%); transition: transform 180ms ease;
}
.toast.is-open { transform: translateY(0); }

/* Banners */
.banner { display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-2);
  font-size: 14px; font-weight: 500; }
.banner--success { background: #e6f4ea; color: #1d6b34; }
.banner--error   { background: #fde7e9; color: #91152a; }
.banner--info    { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-strong); }

/* Seat map */
.seatmap { display: flex; flex-direction: column; gap: var(--s-3); }
.seatmap__toolbar {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-3);
  background: var(--surface);
}
.seatmap__viewport {
  position: relative; max-height: 76vh; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--r-3);
  background: var(--surface-warm);
}
.seatmap__plan { position: relative; width: 980px; max-width: 100%; transition: transform 120ms ease; }
.seatmap__plan img { display: block; width: 100%; height: auto; user-select: none;
  aspect-ratio: 1604 / 2104; /* reserve space — re-renders must not collapse the page (CLS) */ }
.seatmap__overlay { position: absolute; inset: 0; }
.seat {
  position: absolute; padding: 0;
  border: 1px solid transparent; border-radius: 3px;
  background: transparent; color: transparent;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.seat:hover { border-color: var(--text); background: color-mix(in srgb, var(--c) 30%, transparent); }
.seat.is-selected { border-color: var(--text); background: color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px color-mix(in srgb, var(--text) 35%, transparent); }
/* Tier tinting: show each seat's effective tier colour (sold/hold rules
   below still override). Hover darkens so the target stays obvious, and a
   selected seat goes near-solid so it reads above the ambient tint. */
.seat.is-tinted { background: color-mix(in srgb, var(--c) 50%, transparent);
  border-color: color-mix(in srgb, var(--c) 85%, var(--su-ink-700)); }
.seat.is-tinted:hover { background: color-mix(in srgb, var(--c) 78%, transparent); border-color: var(--text); }
.seat.is-tinted.is-selected { background: color-mix(in srgb, var(--c) 92%, transparent); border-color: var(--text); }
.seat.sold {
  cursor: not-allowed;
  background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255,255,255,0.6) 3px 4px), var(--su-ink-700);
  border-color: var(--su-ink-900); opacity: 0.85;
}
.seat.hold { background: color-mix(in srgb, var(--accent-strong) 45%, transparent); }
.seatmap__legend {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4);
  padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 700;
}
.seatmap__swatch { display: inline-flex; align-items: center; gap: var(--s-2); }
.seatmap__swatch::before {
  content: ""; width: 14px; height: 14px; border-radius: var(--r-1);
  border: 1px solid rgba(0,0,0,0.08); background: var(--c, var(--brand));
}
.seatmap__swatch--sold::before {
  background: repeating-linear-gradient(45deg, transparent 0 2px, rgba(255,255,255,0.7) 2px 3px), var(--su-ink-700);
  border-color: var(--su-ink-900);
}
.seatmap__swatch--hold::before { background: color-mix(in srgb, var(--accent-strong) 45%, transparent); }

/* Seat map — admin paint palette */
.seatmap__toolbar--admin { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.seatmap__toolbar--sub { margin-top: var(--s-2); font-size: 13px; }
.seatmap__zoom { display: inline-flex; gap: 4px; }
.seatmap__palette { display: flex; gap: var(--s-2); flex-wrap: wrap; flex: 1; }
.tier-chip { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface);
  padding: 5px var(--s-3); font-size: 13px; font-weight: 600; color: var(--text-strong); transition: all 120ms ease; }
.tier-chip:hover { border-color: var(--brand); }
.tier-chip.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.tier-chip__dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.tier-chip__price { color: var(--text-muted); font-weight: 700; }
.tier-chip__count { min-width: 22px; text-align: center; padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--surface-warm); color: var(--text-muted); font-size: 12px; font-weight: 700; }
.tier-chip.is-active .tier-chip__count { background: var(--brand); color: var(--brand-fg); }
.seatmap__revenue { margin-left: auto; font-weight: 800; color: var(--brand); white-space: nowrap; }
.seatmap__revenue small { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.seatmap__section { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 600; color: var(--text-strong); }
.seatmap__section select { height: 32px; }
.seatmap__divider { width: 1px; height: 22px; background: var(--border); }
.seatmap__avail { color: var(--text-muted); font-weight: 700; }
.seatmap__overlay .seat { touch-action: none; }
