/* Design system — Resend-design-analysis (see DESIGN.md).
   True-black canvas, off-white ink, an editorial serif display headline as the
   signature, translucent-white hairline borders instead of shadows, a single
   bright-white primary button as the anchor, and soft atmospheric glow.
   Display serif: Fraunces (stand-in for Domaine Display). UI/body: Inter. */

:root {
  /* Text */
  --ink: #fcfdff;
  --body: rgba(252, 253, 255, 0.86);
  --charcoal: rgba(252, 253, 255, 0.7);
  --mute: #a1a4a5;
  --ash: #888e90;
  --stone: #464a4d;

  /* Surfaces */
  --canvas: #000000;
  --surface-card: #0a0a0c;
  --surface-elevated: #101012;
  --surface-deep: #06060a;

  /* The white anchor */
  --white: #fcfdff;
  --on-white: #000000;
  --white-pressed: #f1f7fe;

  /* Hairlines (depth comes from these, never shadows) */
  --hairline: rgba(255, 255, 255, 0.06);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --divider-soft: rgba(255, 255, 255, 0.04);

  /* Accents — used as glow/line/state colour, never as solid button fills */
  --accent-blue: #3b9eff;
  --accent-green: #11ff99;
  --accent-red: #ff2047;
  --accent-yellow: #ffc53d;
  --link: #3b9eff;

  /* Radius */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;

  /* Spacing (4px base) */
  --s-xs: 4px; --s-sm: 8px; --s-md: 12px; --s-lg: 16px; --s-xl: 24px; --s-xxl: 32px;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font: "Inter", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Geist Mono", SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* One soft atmospheric glow anchored at the top — pure CSS, no asset */
body::before {
  content: "";
  position: fixed; inset: 0 0 auto 0; height: 70vh; z-index: 0;
  background: radial-gradient(900px 460px at 50% -8%, rgba(0, 117, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.wrap, .global-nav { position: relative; z-index: 1; }

/* Global nav — slim hairline bar; wordmark in the editorial serif */
.global-nav {
  height: 64px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.global-nav .wordmark { font-family: var(--font-display); font-size: 19px; font-weight: 500; letter-spacing: -0.2px; color: var(--ink); }

.wrap { max-width: 620px; margin: 0 auto; padding: 40px 22px 96px; }

/* Page header — the signature editorial serif display headline */
header.app {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 28px;
}
header.app h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 68px);
  font-weight: 500; line-height: 1.0; letter-spacing: -0.02em;
  color: var(--ink);
}
header.app .sub { margin-top: 10px; color: var(--mute); font-size: 16px; }

/* First-run tip banner */
.tip {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface-elevated); border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 16px;
  color: var(--body); font-size: 14px; line-height: 1.5;
}
.tip strong { color: var(--ink); font-weight: 600; }
.tip-x {
  flex: none; background: transparent; border: none; color: var(--mute);
  font-size: 14px; line-height: 1; padding: 4px; cursor: pointer; border-radius: var(--r-sm);
}
.tip-x:hover { color: var(--ink); }

/* Custom tooltips */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface-elevated); color: var(--body);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-md);
  padding: 8px 10px; font-size: 12px; line-height: 1.4;
  width: max-content; max-width: 240px; white-space: normal; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .14s ease, transform .14s ease;
  z-index: 60;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Cards — surface step-up + hairline; depth without shadow */
.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg);
  padding: var(--s-xl);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 16px; font-size: 22px; font-weight: 500; line-height: 1.3; letter-spacing: -0.3px; color: var(--ink); }
.card h3 { margin: 22px 0 10px; font-size: 13px; font-weight: 500; letter-spacing: 0.2px; text-transform: uppercase; color: var(--mute); }
summary { color: var(--ink); }

label { display: block; margin: 16px 0 8px; font-size: 14px; font-weight: 500; color: var(--ink); }
label code { font-family: var(--font-mono); font-size: 12px; color: var(--mute); background: var(--surface-deep); padding: 1px 6px; border-radius: var(--r-xs); }
.hint { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--mute); }

/* Inputs — surface-card + strong hairline; focus thickens to ink */
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font); font-size: 15px;
  color: var(--ink);
  background: var(--surface-card);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--stone); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink);
}
input[type="checkbox"] {
  width: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  accent-color: var(--white); vertical-align: -2px;
}
input[type="checkbox"]:focus { box-shadow: none; }
code { font-family: var(--font-mono); font-size: .9em; }

/* Buttons — primary white anchor; ghost + tinted state buttons */
button {
  font-family: var(--font); font-size: 15px; font-weight: 500; line-height: 1.2;
  padding: 11px 18px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--white); color: var(--on-white);
  cursor: pointer;
  transition: transform .1s ease, background .15s, border-color .15s, opacity .15s;
}
button:hover { background: #ffffff; }
button:active { transform: scale(0.98); background: var(--white-pressed); }
button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
button.block { width: 100%; }
button.ghost { background: var(--surface-elevated); color: var(--ink); border-color: var(--hairline-strong); }
button.ghost:hover { background: var(--surface-elevated); border-color: rgba(255, 255, 255, 0.26); }
button.success { background: rgba(17, 255, 153, 0.12); color: var(--accent-green); border-color: rgba(17, 255, 153, 0.35); }
button.success:hover { background: rgba(17, 255, 153, 0.18); }
button.danger { background: rgba(255, 32, 71, 0.12); color: var(--accent-red); border-color: rgba(255, 32, 71, 0.4); }
button.danger:hover { background: rgba(255, 32, 71, 0.18); }
button.sm { font-size: 13px; padding: 7px 12px; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Status badge (open / closed) — neutral pill, dot carries the state */
.badge {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 12px; font-weight: 500;
  padding: 5px 12px; border-radius: var(--r-full);
  background: var(--surface-elevated); color: var(--body); border: 1px solid var(--hairline-strong);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); }
.badge.open { color: var(--accent-green); }
.badge.open .dot { background: var(--accent-green); box-shadow: 0 0 8px rgba(17, 255, 153, 0.6); }
.badge.closed { color: var(--mute); }

/* Status pill (ticket state) — neutral chip, colored label */
.pill {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: var(--r-full);
  background: var(--surface-elevated); border: 1px solid var(--hairline-strong);
}
.pill.waiting { color: var(--accent-blue); }
.pill.serving { color: var(--accent-yellow); }
.pill.served { color: var(--accent-green); }
.pill.no-show { color: var(--accent-red); }
.pill.removed { color: var(--mute); }

/* Ticket card — the number is the editorial serif "display" moment */
.ticket-table { text-align: center; font-size: 20px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.ticket-label { text-align: center; color: var(--mute); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; }
.ticket-num {
  text-align: center; font-family: var(--font-display);
  font-size: clamp(72px, 22vw, 104px); font-weight: 500; line-height: 1.0; letter-spacing: -0.03em;
  color: var(--ink); margin: 6px 0 2px;
}
.ticket-status { text-align: center; margin: 16px 0; }

/* Table picker (attendee) */
.table-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.table-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--hairline-strong); border-radius: var(--r-md);
  background: var(--surface-card); cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s;
}
.table-option:hover { border-color: rgba(255, 255, 255, 0.26); }
.table-option.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--surface-elevated); }
.table-option .t-name { font-size: 16px; font-weight: 500; color: var(--ink); }
.table-option .t-count { font-size: 13px; color: var(--mute); }
.table-option.selected .t-count { color: var(--body); }

/* Stat tiles */
.stats { display: flex; gap: 10px; margin: 18px 0 4px; }
.stat { flex: 1; text-align: center; background: var(--surface-elevated); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 16px 8px; }
.stat .v { font-size: 28px; font-weight: 500; color: var(--ink); letter-spacing: -0.4px; }
.stat .k { margin-top: 4px; font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }

/* Now-serving line + the your-turn white inset (brightest pixel on the page) */
.now-serving {
  text-align: center; background: var(--surface-elevated); color: var(--body);
  border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 14px; margin-top: 16px; font-weight: 500;
}
.your-turn {
  text-align: center; background: var(--white); color: var(--on-white);
  border-radius: var(--r-lg); padding: 22px; margin: 16px 0;
  font-size: 20px; font-weight: 600; letter-spacing: -0.2px;
}

/* Messages */
.msg { display: none; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; line-height: 1.5; }
.msg.show { display: block; }
.msg.error { background: rgba(255, 32, 71, 0.1); color: var(--accent-red); border: 1px solid rgba(255, 32, 71, 0.3); }
.msg.info { background: rgba(59, 158, 255, 0.1); color: var(--accent-blue); border: 1px solid rgba(59, 158, 255, 0.3); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--hairline); font-size: 15px; color: var(--body); }
th { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
td.num { font-weight: 600; color: var(--ink); }
td.rowacts { text-align: right; white-space: nowrap; }
td.rowacts button { margin-left: 6px; }
.empty { color: var(--mute); text-align: center; padding: 20px; font-size: 14px; }

/* Role banner + staff PIN (admin) */
#roleBanner { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-elevated); border: 1px solid var(--hairline-strong); color: var(--ink); font-weight: 500; font-size: 14px; }
.pin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; background: var(--surface-deep); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.pin-row .pin { font-weight: 600; color: var(--ink); letter-spacing: .04em; font-family: var(--font-mono); }
.pin-row .pin small { margin-right: 8px; font-weight: 500; color: var(--mute); font-family: var(--font); letter-spacing: 0; }

/* Utilities */
.hidden { display: none !important; }
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid rgba(0, 0, 0, .25); border-top-color: rgba(0, 0, 0, .8); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footnote { margin-top: 28px; color: var(--ash); font-size: 13px; text-align: center; }
.footnote a { color: var(--link); }
a { color: var(--link); text-decoration: none; }

/* Responsive */
@media (max-width: 480px) {
  .wrap { padding: 28px 18px 72px; }
  .global-nav { padding: 0 18px; }
}
