/* Lusive: a minimal dark interface. Every color is defined as a token here. */
:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-alt: #1d2024;
  --field: #121417;
  --border: #2a2d32;
  --border-soft: #1f2226;
  --text: #ececee;
  --text-muted: #9a9ea6;
  --text-subtle: #6f747c;
  --primary: #3f68d1;
  --primary-hover: #4a74df;
  --primary-text: #fff;
  --accent: #8cb4ff;
  --ok: #86d6a0;
  --ok-bg: rgb(134 214 160 / 10%);
  --err: #f19a92;
  --err-bg: rgb(241 154 146 / 10%);
  --warn: #e6cf7a;
  --warn-bg: rgb(230 207 122 / 10%);
  --info-bg: rgb(140 180 255 / 8%);
  --radius: 10px;
  --radius-sm: 8px;
  /* Every event poster uses this shape: the Events page, event details, the Add
     Event preview, and the Host tab. A 4:5 portrait poster (1080 x 1350) fits
     without cropping. */
  --poster-ratio: 4 / 5;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
::selection { background: var(--primary); color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--surface);
}
.skip-link:focus { top: 12px; }
.muted { color: var(--text-muted); }
.field-help { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }

/* App shell */
.app-window { display: flex; flex-direction: column; min-height: 100dvh; }
.app-header {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 28px;
  min-height: 60px; padding: 0 max(24px, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid var(--border-soft); background: rgb(14 15 17 / 92%);
  backdrop-filter: blur(8px);
}
.app-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
/* The Lusive logo, which includes the name, so no text follows it. */
.app-brand-logo { display: block; width: auto; height: 30px; }
.toolbar { display: flex; align-items: center; gap: 2px; min-width: 0; }
.toolbar-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0;
  border-radius: var(--radius-sm); background: none; color: var(--text-muted);
  font-size: 14px; white-space: nowrap;
}
.toolbar-button:hover { color: var(--text); }
.toolbar-button.is-active { background: var(--surface-alt); color: var(--text); }

.account-controls { display: flex; align-items: center; gap: 12px; min-width: 0; margin-left: auto; }
.account-email {
  max-width: 200px; overflow: hidden; padding: 0; border: 0; background: none; color: var(--text-muted);
  font: inherit; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.account-email:hover { color: var(--text); }
.window-body { flex: 1; }
.workspace { width: 100%; max-width: 1128px; margin: 0 auto; padding: 40px 24px 64px; }
.workspace:focus { outline: none; }
.app-credits { width: 100%; max-width: 1128px; margin: 0 auto; padding: 0 24px 28px; color: var(--text-subtle); font-size: 12px; }

/* Page structure */
.view-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.workspace > .page-heading { margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.page-heading p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.section-caption {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 8px; color: var(--text-muted); font-size: 13px;
}
.section-caption strong { color: var(--text); font-size: 14px; font-weight: 600; }
.text-button { padding: 0; border: 0; background: none; color: var(--text-muted); font-size: 13px; }
.text-button:hover { color: var(--text); }
.empty-state { padding: 56px 0; color: var(--text-muted); text-align: center; }
.empty-state h2, .empty-state h3 { margin-bottom: 8px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 0 16px; }
.empty-state p:last-child { margin-bottom: 0; }
.notice {
  margin: 0 0 20px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted); font-size: 14px;
}
.notice p { margin: 0; }
.notice strong { color: var(--text); }
.notice.info { background: var(--info-bg); }
.notice.success { background: var(--ok-bg); color: var(--ok); }
.notice.success strong { color: var(--ok); }
.notice.error { background: var(--err-bg); color: var(--err); }
.pending-payment { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* Buttons */
.win-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; line-height: 1.2; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
.win-button:hover:not(:disabled) { background: var(--surface-alt); }
.win-button.primary { border-color: var(--primary); background: var(--primary); color: var(--primary-text); }
.win-button.primary:hover:not(:disabled) { border-color: var(--primary-hover); background: var(--primary-hover); }
.win-button.small { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.win-button.danger { color: var(--err); }
.win-button.danger:hover:not(:disabled) { border-color: var(--err); background: var(--err-bg); }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 16px; }
.field > label, label.field { color: var(--text-muted); font-size: 13px; }
.field input, .field select, .field textarea, .manual-input-row input {
  width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--field); color: var(--text); font-size: 15px;
}
.field textarea { min-height: 128px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .manual-input-row input:focus-visible {
  border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgb(140 180 255 / 18%);
}
.field input:disabled, .field select:disabled { opacity: 0.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full-width { grid-column: 1 / -1; }
.win-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.venue-address > .field-help { margin-bottom: 12px; }

/* Events */
.event-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 24px; }
.event-card { min-width: 0; }
.poster-button { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: none; }
.event-art {
  position: relative; width: 100%; aspect-ratio: var(--poster-ratio); overflow: hidden;
  border-radius: var(--radius); background: var(--surface-alt);
}
.photo-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.poster-button:hover .photo-poster img { transform: scale(1.02); }
.placeholder-art { display: grid; place-items: center; padding: 20px; color: var(--text-muted); font-weight: 600; text-align: center; }
.event-card-body { padding-top: 14px; }
.event-card h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.35; }
.event-meta { margin: 0; color: var(--text-muted); font-size: 14px; }
.event-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.event-price { font-size: 20px; font-weight: 600; }
/* Show fee dollars below the more prominent total. */
.event-price-block { display: grid; gap: 2px; }
.event-price-note { color: var(--text-muted); font-size: 13px; }
.price-detail { display: block; margin-top: 2px; color: var(--text-muted); font-size: 13px; }
.event-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.event-details { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 12px; margin: 0 0 20px; font-size: 14px; }
.event-details dt { color: var(--text-muted); }
.event-details dd { margin: 0; }
.event-description { color: var(--text-muted); font-size: 14px; white-space: pre-wrap; }
.event-detail-copy .dialog-actions { justify-content: flex-start; }

/* Dialogs */
.dialog-window {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto;
  padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgb(0 0 0 / 50%);
}
.wide-dialog { width: min(820px, calc(100vw - 32px)); }
.dialog-window:focus { outline: none; }
.dialog-window::backdrop { background: rgb(0 0 0 / 60%); }
.titlebar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 0 24px; background: var(--surface);
}
.titlebar-text { flex: 1; min-width: 0; overflow: hidden; font-size: 17px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dialog-close {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0;
  border-radius: var(--radius-sm); background: none; color: var(--text-muted); font-size: 22px; line-height: 1;
}
.dialog-close:hover { background: var(--surface-alt); color: var(--text); }
.dialog-content { padding: 16px 24px 24px; }
.dialog-content > p { color: var(--text-muted); }
.dialog-content > h2 { font-size: 17px; }

/* Tickets */
.ticket-list { display: grid; gap: 16px; }
/* The Tickets tab lists past events' tickets under their own heading. */
.past-tickets { margin-top: 40px; }
.past-tickets h2 { margin-bottom: 16px; color: var(--text-muted); font-size: 17px; }
.ticket-card {
  display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 24px; align-items: start;
  padding: 20px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
}
.dialog-content .ticket-card { margin-bottom: 12px; background: var(--bg); }
/* QR codes stay black on white so door scanners can read them. */
.ticket-qr { padding: 10px; border-radius: var(--radius-sm); background: #fff; color: #333; text-align: center; }
.ticket-qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.ticket-qr span { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.ticket-qr p { margin: 24px 0; font-size: 12px; }
.ticket-info { min-width: 0; }
.ticket-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.ticket-topline h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.ticket-status {
  flex-shrink: 0; padding: 2px 9px; border-radius: 999px; background: var(--ok-bg);
  color: var(--ok); font-size: 12px; font-weight: 500;
}
.ticket-status.used { background: var(--surface-alt); color: var(--text-muted); }
.ticket-tier { margin: 2px 0 4px; color: var(--text); font-size: 14px; font-weight: 500; }
.ticket-person { margin: 10px 0 2px; font-weight: 500; }
.ticket-id { color: var(--text-muted); font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; overflow-wrap: anywhere; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.confirmation-summary { color: var(--text-muted); }

/* Sign-in and host password panels */
.password-panel {
  max-width: 400px; padding: 24px; border: 1px solid var(--border-soft);
  border-radius: var(--radius); background: var(--surface);
}
.password-panel h2 { margin-bottom: 6px; font-size: 17px; }
.password-panel > p { margin: 0; color: var(--text-muted); font-size: 14px; }
.password-panel .dialog-actions { margin-top: 20px; }
.password-panel form .dialog-actions { margin-top: 4px; }

/* Scanner */
.scanner-event-select { max-width: 420px; }
/* A scanner link shows only its scanner: no tabs and no account controls. */
.scan-only .toolbar, .scan-only .account-controls { display: none; }
.scanner-link-event { margin: 6px 0 0; color: var(--text-muted); overflow-wrap: anywhere; }
.scanner-link-event strong { color: var(--text); font-weight: 500; }
/* The Scanner tab's link for door staff */
.scanner-share { display: grid; gap: 10px; max-width: 720px; margin: 4px 0 24px; padding: 16px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.scanner-share:empty { display: none; }
.scanner-share-copy { display: grid; gap: 2px; }
.scanner-share-copy strong { font-weight: 500; }
.scanner-share .field-help { margin: 0; }
.scanner-share-reset { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.scanner-share-reset .text-button { font-size: 13px; }
/* Connection and offline guest list status */
.scanner-connection { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -4px 0 20px; color: var(--text-muted); font-size: 13px; }
.scanner-connection:empty { display: none; }
.scanner-connection strong { color: var(--text); font-weight: 600; }
.scanner-connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.scanner-connection.is-offline .scanner-connection-dot { background: var(--warn); }
.scanner-connection .text-button { font-size: 13px; }
.scanner-conflicts { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--warn); border-radius: var(--radius); background: var(--warn-bg); }
.scanner-conflicts .recent-row span { color: var(--warn); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 28px; }
.stat-box { padding: 16px 18px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.stat-number { display: block; font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { display: block; margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.scanner-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); gap: 32px; align-items: start; }
.scanner-camera-box {
  position: relative; display: grid; place-items: center; min-height: 280px;
  overflow: hidden; border-radius: var(--radius); background: #000;
}
.scanner-camera-box video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.scanner-placeholder { color: var(--text-subtle); font-size: 14px; }
.scan-frame {
  position: absolute; width: 56%; max-width: 220px; aspect-ratio: 1;
  border: 2px solid rgb(255 255 255 / 70%); border-radius: 16px; pointer-events: none;
}
.camera-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#camera-error { margin: 12px 0 0; }
.scanner-manual { margin-top: 20px; }
.manual-input-row { display: flex; gap: 8px; }
.manual-input-row input { flex: 1; font-family: var(--mono); text-transform: uppercase; }
.manual-input-row input::placeholder { font-family: var(--sans); text-transform: none; }
.checkin-result {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; padding: 14px 16px;
  border-radius: var(--radius-sm); background: var(--ok-bg);
}
.checkin-result.error { background: var(--err-bg); }
.checkin-result.offline { background: var(--warn-bg); }
.checkin-result.offline strong { color: var(--warn); }
.checkin-result.offline .result-symbol { background: var(--warn); }
.checkin-result > div { min-width: 0; }
.checkin-result strong { display: block; color: var(--ok); font-size: 16px; }
.checkin-result.error strong { color: var(--err); }
.checkin-result p { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.result-symbol {
  display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px;
  border-radius: 50%; background: var(--ok); color: var(--bg); font-size: 15px; font-weight: 700;
}
.checkin-result.error .result-symbol { background: var(--err); }
.scanner-sidebar { min-width: 0; }
.recent-list, .checkin-log { border-top: 1px solid var(--border-soft); }
.recent-list > .field-help, .checkin-log > .field-help { margin: 12px 0; }
.recent-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 14px;
}
.recent-row > div { display: grid; min-width: 0; }
.recent-row code, .checkin-log-row code { color: var(--text-subtle); font-size: 12px; overflow-wrap: anywhere; }
.recent-row time { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.checkin-log-panel { margin-top: 40px; }
.checkin-log-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px;
}
.checkin-log-row > div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.checkin-log-row span { color: var(--text-muted); font-size: 13px; }
.checkin-log-row.is-undone strong { color: var(--text-muted); text-decoration: line-through; }
.checkin-log-row .checkin-log-undone { flex-shrink: 0; color: var(--warn); text-align: right; }

/* Notifications */
.app-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(380px, calc(100vw - 32px));
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-alt); color: var(--text); font-size: 14px; box-shadow: 0 12px 32px rgb(0 0 0 / 40%);
}

@media (max-width: 900px) {
  .event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scanner-layout, .event-detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .app-header { flex-wrap: wrap; gap: 0; padding: 0 16px; }
  .app-brand { padding: 14px 0; }
  .account-controls { gap: 8px; }
  .account-email { max-width: 150px; }
  .toolbar {
    order: 3; width: calc(100% + 16px); margin: 0 -8px; padding-bottom: 8px;
    overflow-x: auto; scrollbar-width: none;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar-button { padding: 6px 9px; }
  .workspace { padding: 28px 16px 48px; }
  .app-credits { padding-inline: 16px; }
  .page-heading h1 { font-size: 24px; }
  .event-grid, .form-grid, .ticket-card { grid-template-columns: minmax(0, 1fr); }
  .ticket-qr { width: 180px; }
  .stats-grid { gap: 8px; }
  .stat-box { padding: 12px; }
  .stat-number { font-size: 22px; }
  .checkin-log-row { flex-direction: column; align-items: flex-start; }
  .checkin-log-row .checkin-log-undone { text-align: left; }
  .titlebar { padding: 14px 12px 0 18px; }
  .dialog-content { padding: 12px 18px 20px; }
  .app-toast { right: 16px; bottom: 16px; }
}

/* Printed tickets use a light palette so text stays legible on paper. */
@media print {
  :root {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-alt: #f3f3f3; --field: #fff;
    --border: #ccc; --border-soft: #ddd; --text: #111; --text-muted: #444; --text-subtle: #666;
  }
  .app-header, .app-credits, .ticket-actions, .app-toast { display: none !important; }
  .workspace { max-width: none; padding: 0; }
  .ticket-card { break-inside: avoid; }
}
