/* Naga Nights · admin
   A light, high-contrast working tool in the landing page's colours:
   warm off-white ground, near-black ink, deep gold for emphasis, teal for links. */

:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #15181b;
  --ink-soft: #4d5760;      /* tinted, ≥7:1 on bg */
  --muted: #5f6b73;         /* ≥4.5:1 on bg */
  --line: #d9d4c7;
  --line-strong: #8a8f96;   /* control outlines, ≥3:1 */
  --gold: #8f6a0b;          /* gold as text on light, ≥4.5:1 */
  --gold-core: #d4a017;     /* fills */
  --gold-soft: #fbf1cf;
  --teal: #0a7f8f;          /* links, ≥4.5:1 on white */
  --teal-soft: #dff6f8;
  --ok: #157347;  --ok-soft: #e3f4ea;
  --bad: #b42323; --bad-soft: #fbe6e6;
  --focus: #0a7f8f;
  --dark: #06090c; --dark-2: #0b1418; --dark-line: #1c2c34; --dark-ink: #f4f1e8; --dark-muted: #b7c3c8; --dark-gold: #f0c75e;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 8px; --r-sm: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: #075f6b; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1rem;
  background: var(--dark); color: var(--dark-ink);
  border-bottom: 3px solid var(--gold-core);
}
header a { color: inherit; text-decoration: none; }
header > a strong { color: var(--dark-gold); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; }
nav a { font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dark-muted); padding: .35rem 0; border-bottom: 2px solid transparent; }
nav a:hover, nav a:focus-visible { color: var(--dark-ink); border-bottom-color: var(--gold-core); }
nav button.link { color: var(--dark-muted); font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }
nav button.link:hover { color: var(--dark-ink); }

/* ---------- Layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
section { margin: 1.75rem 0 2.25rem; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); border-bottom: 2px solid var(--gold-core); padding-bottom: .3rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-weight: 600; }
.inline { display: inline; }
p { margin: .5rem 0; }

/* ---------- Tables ---------- */
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 600; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); background: var(--bg); position: sticky; top: 0; }
tbody tr:hover td, table tr:hover td { background: #fbfaf6; }
td a { font-weight: 600; }

/* Tickets table: dense, scrolls sideways inside its own box */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1rem; padding: 0 1rem; }
table.tickets { min-width: 900px; font-size: .9rem; }
table.tickets th, table.tickets td { padding: .4rem .5rem; white-space: nowrap; }
table.tickets td:first-child { font-family: var(--mono); font-size: .9rem; }
table.tickets td:nth-child(5) { white-space: normal; min-width: 10rem; }
tr.st-sold td { background: var(--gold-soft); }
tr.st-sold td:first-child { border-left: 4px solid var(--gold-core); }
tr.st-void td { background: var(--bad-soft); color: var(--muted); }
tr.st-void td:first-child { border-left: 4px solid var(--bad); text-decoration: line-through; }
tr.st-sold:hover td { background: #f6e9b8; }
tr.st-void:hover td { background: #f6dcdc; }

/* Scan results: colour plus the word */
.r-admitted { color: var(--ok); font-weight: 600; }
.r-already_used, .r-void, .r-invalid { color: var(--bad); font-weight: 600; }
td.r-admitted::before, td.r-already_used::before, td.r-void::before, td.r-invalid::before {
  content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: currentColor; margin-right: .4em; vertical-align: .05em;
}

/* ---------- Forms ---------- */
details { margin: .75rem 0; }
summary { cursor: pointer; font-weight: 600; color: var(--teal); padding: .4rem 0; list-style-position: inside; }
summary:hover { color: #075f6b; }
details[open] > summary { margin-bottom: .25rem; }
details > form { padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
form label { display: block; margin: .5rem 0; font-size: .9rem; color: var(--ink-soft); }
form label input, form label select { margin-left: .3rem; }
input, select {
  font: inherit; font-size: 16px;                    /* ≥16px so iOS doesn't zoom */
  min-height: 40px; padding: .35rem .55rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); max-width: 100%;
}
input:hover, select:hover { border-color: var(--gold); }
input::placeholder { color: #7c858c; }
button {
  font: inherit; font-size: 16px; font-weight: 600;
  min-height: 40px; padding: .4rem .95rem;
  border: 0; border-radius: var(--r-sm);
  background: var(--gold-core); color: #1a1400; cursor: pointer;
}
button:hover { background: #e0ae24; }
button.danger { background: var(--bad); color: #fff; }
button.danger:hover { background: #9a1c1c; }
button.quiet { background: transparent; border: 1px solid var(--gold-core); color: var(--gold); }
button.quiet:hover { background: var(--gold-soft); }
button.sm { min-height: 32px; padding: .2rem .6rem; font-size: 14px; }
td.actions { white-space: nowrap; }
td.actions form { margin-left: .5rem; }
button.link { background: none; color: var(--teal); padding: 0; min-height: 0; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
button.link:hover { background: none; color: #075f6b; }
section > form:not(.inline):not(.filters) { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin-top: .75rem; }
section > form:not(.inline):not(.filters) label { margin: 0; }

/* Tickets filter bar */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; padding: .6rem .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.filters select { flex: 1 1 8rem; }

/* per-row mini-forms in the tickets table */
details.inline { display: inline-block; margin: 0 .5rem 0 0; }
details.inline > summary { display: inline; padding: 0; }
details.inline > form { position: relative; display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; padding: .5rem; white-space: normal; }
details.inline input { width: 11rem; }

/* ---------- Scanner key ---------- */
code.key {
  display: block; font-family: var(--mono); font-size: 1.35rem; line-height: 1.5; letter-spacing: .04em;
  padding: 1.25rem; background: var(--surface); color: var(--ink);
  border: 2px dashed var(--gold-core); border-radius: var(--r); word-break: break-all; user-select: all;
}

/* ---------- Login ---------- */
body.center main { max-width: 420px; margin: 3rem auto; text-align: center; }
body.center h1 { font-size: 1.6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
body.center form { display: grid; gap: .75rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--gold-core); border-radius: var(--r); text-align: left; }
body.center form label input { display: block; width: 100%; margin: .35rem 0 0; }
body.center form button { width: 100%; min-height: 48px; }

/* ---------- Ticket page (buyer, dark) ---------- */
body.dark { background: var(--dark); color: var(--dark-ink); }
body.dark main { max-width: 560px; }
body.dark h1 { color: var(--dark-gold); font-size: 1.35rem; margin-top: 1rem; }
body.dark p { color: var(--dark-muted); }
body.dark .muted { color: #8a9aa1; font-size: .9rem; }
img.ticket { width: 100%; height: auto; border-radius: var(--r); box-shadow: 0 0 0 1px var(--dark-line), 0 12px 40px rgba(212,160,23,.18); }
a.button {
  display: inline-block; min-height: 48px; padding: .75rem 1.5rem;
  background: linear-gradient(180deg, #f5d061, #d4a017 60%, #b8860b); color: #1a1400;
  font-weight: 600; text-decoration: none; border-radius: var(--r);
  box-shadow: 0 8px 28px rgba(212,160,23,.28);
}
a.button:hover { color: #1a1400; filter: brightness(1.05); }
body.dark :focus-visible { outline-color: var(--dark-gold); }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  header { flex-direction: column; align-items: flex-start; }
  main { padding: .75rem; }
  .scroll { margin: 0 -.75rem; padding: 0 .75rem; }
  /* dashboard tables on a phone: tighter cells; a table wider than the screen scrolls inside its own box */
  table { font-size: .85rem; }
  th, td { padding: .35rem .4rem; }
  th { font-size: .68rem; letter-spacing: .03em; }
  section > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  section > table td:nth-child(2) { white-space: normal; min-width: 9rem; }
  table.tickets { font-size: .88rem; }
  table.tickets th { font-size: .7rem; white-space: nowrap; }
  table.tickets th, table.tickets td { padding: .4rem .5rem; }
  button.danger { padding: .3rem .6rem; font-size: 14px; min-height: 36px; }
  nav a, nav button.link { font-size: 13px; }
  section > form:not(.inline):not(.filters) label { flex: 1 1 100%; }
  section > form:not(.inline):not(.filters) input, section > form:not(.inline):not(.filters) select { width: 100%; margin-left: 0; display: block; margin-top: .25rem; }
  details > form label input, details > form label select { width: 100%; margin-left: 0; display: block; margin-top: .25rem; }
}
