/* DUB MIAMI — deep black + elegant orange. ALL visible text uppercase
   (visual only, via text-transform — stored data is never changed). */
:root {
  --bg: #050505;
  --panel: #101010;
  --panel2: #171717;
  --line: #262626;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --orange: #ff7a00;
  --orange-soft: #ff9a33;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: .02em;
  min-height: 100vh;
}
a { color: var(--orange-soft); text-decoration: none; }
button, input, select, textarea { text-transform: uppercase; font-family: inherit; }
input[type="date"], input[type="datetime-local"] { text-transform: none; }
.agreement-text { text-transform: none; white-space: pre-wrap; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(5,5,5,.92); z-index: 10;
}
.brand { font-weight: 900; font-size: 22px; color: var(--text); letter-spacing: .08em; }
.brand::after { content: ""; }
.topnav { display: flex; gap: 8px; }
.chip {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--orange); color: var(--orange-soft); }

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.footer {
  text-align: center; color: var(--muted); padding: 28px 16px 40px;
  border-top: 1px solid var(--line); font-size: 13px; letter-spacing: .3em;
}

.hero { text-align: center; padding: 48px 0 8px; }
.hero .logo { font-size: clamp(64px, 14vw, 120px); font-weight: 900; line-height: .95; letter-spacing: .02em; }
.hero .tagline { color: var(--orange); font-size: clamp(18px, 4.5vw, 30px); font-weight: 800; margin-top: 10px; }
.hero .byline { color: var(--muted); margin-top: 6px; font-size: 14px; }

.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 36px 0 8px; }
@media (max-width: 640px) { .paths { grid-template-columns: 1fr; } }
.path-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 22px; color: var(--text);
}
.path-card:hover { border-color: var(--orange); }
.path-card .big { font-size: 24px; font-weight: 900; color: var(--orange); }
.path-card .sub { color: var(--muted); margin-top: 8px; font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 30px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-align: center; }
.stat .num { font-size: 34px; font-weight: 900; color: var(--orange); }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 4px; }

h2.section { font-size: 20px; font-weight: 900; margin: 36px 0 14px; }
h2.section .accent { color: var(--orange); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card .meta { color: var(--muted); font-size: 13px; line-height: 1.5; }
.card a.card-link { color: inherit; display: block; }
.venue-address { margin: 6px 0 0; }
a.addr-link { color: var(--muted); }
a.addr-link:hover { color: var(--orange); }
.card img.cover, .panel img.cover { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; background: #000; }
.event-flyer { width: 100%; display: block; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 18px; }
.mode-tag { display: inline-block; border: 1px solid var(--orange); color: var(--orange-soft); border-radius: 999px; padding: 3px 10px; font-size: 11px; margin-top: 8px; }

.btn {
  display: inline-block; background: var(--orange); color: #000; font-weight: 800;
  border: none; border-radius: 10px; padding: 12px 18px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--orange-soft); }
.btn.ghost { background: transparent; color: var(--orange-soft); border: 1px solid var(--orange); }
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: transparent; color: #ff5252; border: 1px solid #662222; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

form .field { margin-bottom: 14px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 12px; font-size: 14px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--orange); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.orange { color: var(--orange); }
.err { background: #2a0f0f; border: 1px solid #662222; color: #ff9a9a; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.ok-note { background: #0f2412; border: 1px solid #1f5c2a; color: #9fe8ab; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.warn-note { background: #2a2008; border: 1px solid #6b5518; color: #ffd97a; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.scan-overlay { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; padding: 16px; overflow-y: auto; }
.scan-overlay video { flex: 1; width: 100%; min-height: 0; object-fit: cover; border-radius: 12px; background: #111; }
.scan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.scan-overlay #scanMsg:empty { display: none; }
.scan-overlay #scanMsg { margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: #000; vertical-align: middle; }
.avatar-lg { width: 110px; height: 110px; border-radius: 12px; object-fit: cover; background: #000; }

.ticket { background: #0b0b0b; border: 1px dashed var(--orange); border-radius: 14px; padding: 22px; text-align: center; }
.ticket canvas { background: #fff; border-radius: 8px; padding: 6px; }
.ticket .code { font-size: 22px; font-weight: 900; color: var(--orange); letter-spacing: .1em; }

.lineup-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lineup-item .who { flex: 1; }
.lineup-item .set-time { color: var(--orange-soft); font-weight: 700; }
.lineup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 14px; }
@media (max-width: 640px) { .lineup-grid { grid-template-columns: repeat(2, 1fr); } }
.dj-tile { text-align: center; }
.dj-tile .dj-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #000; display: block; }
.dj-tile .dj-initials { display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: repeating-linear-gradient(45deg, #0b0b0b 0 10px, #141414 10px 20px); color: var(--orange); font-weight: 800; font-size: 42px; }
.dj-tile .dj-name { margin-top: 8px; font-weight: 700; text-transform: uppercase; }
.dj-tile .dj-set { color: var(--muted); font-size: 12px; margin-top: 2px; }
.going-grid { display: flex; flex-wrap: wrap; gap: 16px 12px; }
.going-chip { width: 76px; text-align: center; }
.going-chip .avatar { width: 52px; height: 52px; }
.going-chip .initials { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: #000; border: 1px solid var(--orange); color: var(--orange-soft); font-weight: 800; font-size: 17px; }
.going-name { font-size: 12px; color: var(--muted); margin-top: 6px; text-transform: uppercase; }

.agreement-box { background: #0a0a0a; border: 1px solid var(--line); border-radius: 10px; padding: 16px; max-height: 340px; overflow: auto; font-size: 13px; line-height: 1.55; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs .chip.active { background: var(--orange); color: #000; border-color: var(--orange); font-weight: 800; }
details summary { cursor: pointer; color: var(--orange-soft); font-size: 13px; margin: 8px 0; }

/* ================= v5 — WARM / ALIVE BACKGROUND =================
   Real DUB event photos under a dark treatment, film grain, faint
   orange glows and glassier cards. Brand (black + orange) unchanged. */

/* faint warm glows floating behind the page sections */
body {
  background:
    radial-gradient(900px 480px at 10% -80px, rgba(255,122,0,.08), transparent 62%),
    radial-gradient(820px 540px at 90% 32%, rgba(255,122,0,.05), transparent 62%),
    radial-gradient(760px 520px at 50% 110%, rgba(255,122,0,.05), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* subtle film grain over everything (non-interactive) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* hero: real crowd photo, dark-treated, melting into black */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; z-index: -2;
  top: -24px; bottom: -72px; left: -16px; right: -16px;
  background: url("/img/hero.jpg") center 36% / cover no-repeat;
  filter: brightness(.42) saturate(1.08);
}
.hero::after {
  content: ""; position: absolute; z-index: -1;
  top: -24px; bottom: -72px; left: -16px; right: -16px;
  background:
    radial-gradient(58% 46% at 50% 40%, rgba(255,122,0,.17), transparent 70%),
    linear-gradient(to bottom, rgba(5,5,5,.42) 0%, rgba(5,5,5,.16) 34%, rgba(5,5,5,.60) 74%, var(--bg) 100%);
}
.hero .logo { text-shadow: 0 2px 34px rgba(0,0,0,.6); }
.hero .tagline { text-shadow: 0 2px 18px rgba(0,0,0,.65); }
.hero .byline { color: #c4c4c4; text-shadow: 0 1px 10px rgba(0,0,0,.7); }
@media (max-width: 640px) {
  .hero::before, .hero::after { bottom: -56px; }
  .hero::before { background-position: center 30%; }
}

/* cards: dark glass with a hairline top highlight */
.path-card, .stat, .card, .panel {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.012) 55%), var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 12px 32px rgba(0,0,0,.35);
}

/* footer: second photo band behind the sign-off line */
.footer { position: relative; isolation: isolate; color: #d9d9d9; text-shadow: 0 1px 12px rgba(0,0,0,.8); }
.footer::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url("/img/band.jpg") center 42% / cover no-repeat;
  filter: brightness(.33) saturate(1.06);
}
.footer::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, var(--bg) 0%, rgba(5,5,5,.40) 46%, rgba(5,5,5,.74) 100%);
}

/* v8 fix: stats row paints above the hero photo fade (numbers were clipped) */
.stats { position: relative; z-index: 2; }

/* ================= v17 — DJ PROFILE LINKS + GUEST DRILL-DOWN =================
   Functional rules for the new interactive elements (all widths). */
a.dj-tile { display: block; color: var(--text); }
a.dj-tile:hover .dj-name { color: var(--orange-soft); }
.guest-link { cursor: pointer; }
.guest-link:hover strong { color: var(--orange-soft); text-decoration: underline; }

/* ================= v17 — DESKTOP SCALE-DOWN =================
   Owner feedback: on a computer everything renders too big (the event
   flyer especially). Tighten the desktop layout ~10–15% across the
   board. Mobile (<1024px) is intentionally untouched. */
@media (min-width: 1024px) {
  main { max-width: 880px; padding-top: 18px; }
  .hero { padding: 34px 0 4px; }
  .hero .logo { font-size: 96px; }
  .hero .tagline { font-size: 25px; }
  .paths { margin-top: 26px; }
  .path-card { padding: 22px 18px; }
  .path-card .big { font-size: 21px; }
  .stats { margin: 22px 0; }
  .stat { padding: 14px; }
  .stat .num { font-size: 29px; }
  h1 { font-size: 27px; }
  h2.section { font-size: 18px; margin: 28px 0 12px; }
  .card { padding: 15px; }
  .card h3 { font-size: 16px; }
  .card img.cover, .panel img.cover { height: 128px; }
  .event-flyer { max-width: 600px; margin-left: auto; margin-right: auto; }
  .panel { padding: 17px; }
  .avatar-lg { width: 92px; height: 92px; }
  .btn { padding: 10px 16px; }
}

/* ================= v18 — READABLE AGREEMENTS =================
   The agreement texts used to render as one raw pre-wrap wall inside
   .agreement-box. agreementHtml() now emits structured blocks (titles,
   clause headings, paragraphs, dividers) styled here. Natural case is
   forced: the legal text reads as written, not in the app's caps voice. */
.agreement-doc { font-size: 13.5px; line-height: 1.6; text-transform: none; }
.agreement-doc .agr-sec { margin-bottom: 1.1em; }
.agreement-doc .agr-sec:last-child { margin-bottom: 0; }
.agreement-doc .agr-title { font-size: 15px; font-weight: 900; letter-spacing: .06em; color: var(--text); margin: 2px 0 8px; }
.agreement-doc .agr-h { font-size: 13px; font-weight: 800; letter-spacing: .05em; color: var(--orange-soft); margin: 1.4em 0 .45em; }
.agreement-doc .agr-sec > .agr-h:first-child { margin-top: .15em; }
.agreement-doc .agr-p { margin: 0 0 .9em; }
.agreement-doc .agr-p:last-child { margin-bottom: 0; }
.agreement-doc .agr-li { padding-left: 14px; }
.agreement-doc .agr-div { border: none; border-top: 1px solid var(--line); margin: 1.3em 0; }

/* ---- v19: long-form body copy (event descriptions, guest-list /
   reservation notes, release descriptions) reads in NATURAL case with
   friendly body typography. Brand caps stay on titles, headings, buttons,
   labels and stats — this class is the only exception. */
.body-copy { text-transform: none; font-size: 15.5px; line-height: 1.6; letter-spacing: 0; }
p.body-copy { margin: 0 0 12px; }

/* ================= v20 — HEADING BALANCE, EVENT TITLE, LINK CHIPS ======
   Owner feedback, two layout fixes:
   (1) Big headings wrapped with a lone orphan token dangling ("…THU NOV /
   19"). Large headings now balance their lines, and the event/venue page
   title gets a responsive clamp() size so typical titles sit evenly on
   mobile widths. Layout only — brand caps and wording untouched.
   (2) The DJ profile link chips were inline pills inside a <p>: their
   vertical padding overflows the line box, so wrapped rows piled onto each
   other and long labels clipped at the card edge. They now live in a
   wrapped flex row where each chip is a real box that flows to the next
   line and ellipsizes instead of pushing out of the card. */
h1, h2.section, .card h3, .path-card .big { text-wrap: balance; }
.event-title { font-size: clamp(24px, 6.2vw, 34px); line-height: 1.12; }
@media (min-width: 1024px) { .event-title { font-size: 28px; } }
.link-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 100%; margin: 16px 0 2px;
}
.link-chips .chip {
  flex: 0 1 auto; min-width: 0; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ================= v21 — ORGANIZER MOBILE PASS + TRACK LINKS ============
   Owner screenshots from his iPhone (~390px): the DJs table forced the
   whole page to desktop width (iOS zoomed out, form cards squeezed to
   ~55%), two-column form rows overlapped (the event form's MODO select
   over the FECHA field), and lineup editor controls clipped off-screen.
   Fixes: wide tables scroll INSIDE their own box, form rows become
   shrink-safe grids that stack on phones, lineup rows wrap, and the
   panel can never push the page sideways. */

/* backstop: content may scroll inside components, never the page itself */
main { overflow-x: clip; }

/* wide admin tables live in a horizontal scroller */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-scroll > table { width: 100%; }
.table-scroll.wide > table { min-width: 640px; }

/* form rows: equal grid columns that can actually shrink (minmax 0),
   so selects/inputs stop overlapping; controls never exceed the row */
.frow {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 12px; margin-bottom: 14px;
}
.frow .field { margin-bottom: 0; min-width: 0; }
.frow input, .frow select, .frow textarea { min-width: 0; width: 100%; }
input, select, textarea { max-width: 100%; }

/* event detail header row (door list title + download button) */
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}

/* Posh-style track links (organizer event detail) */
.track-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.track-row:last-child { border-bottom: none; }
.track-who { flex: 1; min-width: 0; }
.track-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; }
.track-nums strong { color: var(--orange-soft); }
.track-link {
  text-transform: none; font-size: 12.5px; color: var(--muted);
  word-break: break-all; user-select: all; -webkit-user-select: all; margin-top: 6px;
}

@media (max-width: 640px) {
  /* every organizer form row stacks: one full-width field per line */
  .frow { grid-auto-flow: row; grid-auto-columns: unset; grid-template-columns: minmax(0, 1fr); }
  /* lineup / door / application rows wrap instead of clipping buttons */
  .lineup-item { flex-wrap: wrap; row-gap: 8px; }
  .lineup-edit .who { flex: 1 1 100%; }
  .lineup-edit input.setTimeInput { flex: 1 1 110px; width: auto !important; min-width: 0; }
  .track-row { gap: 10px; }
}
