:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --fg: #1c1b19;
  --muted: #6f6b63;
  --line: #e4e0d8;
  --accent: #c8891a;
  --accent-ink: #1b1404;
  --good: #2f7d4f;
  --danger: #b4392f;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1b1b1e;
    --fg: #f1eee8;
    --muted: #a19c92;
    --line: #2d2c2f;
    --accent: #f2b544;
    --good: #5cc28a;
    --danger: #ff7a6e;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

.appbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.appbar nav { display: flex; gap: 12px; align-items: center; min-width: 0; }
#account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

button, .button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  padding: 8px 14px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 18px; }
.event-card { text-decoration: none; display: block; }
.event-card:hover { border-color: var(--accent); }
.event-card h2 { margin: 0 0 2px; }
.meter { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.live { color: var(--good); border-color: var(--good); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--fg); border-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 760px) { .overview { grid-template-columns: 1fr; } }
.qr img { width: 100%; aspect-ratio: 1; background: #fff; border-radius: 8px; display: block; }
dl.settings { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.settings dt { color: var(--muted); }
dl.settings dd { margin: 0; }
.linkbox { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { flex: 1; min-width: 0; }

form.event-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
form.event-form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 12px; color: var(--muted); }
input, select { font: inherit; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.check { flex-direction: row; align-items: center; gap: 10px; }
.error { color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { min-width: 140px; }
.bulk { position: sticky; top: 58px; z-index: 4; margin: 12px 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; border: 2px solid transparent; }
.tile.selected { border-color: var(--accent); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.tile.hidden-shot img, .tile.hidden-shot video { opacity: .45; }
.tile .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px; font-size: 12px; color: #fff;
  background: linear-gradient(#0000, #000c); display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.tile .select { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; accent-color: var(--accent); }
.tile .star { position: absolute; top: 4px; right: 4px; border: 0; background: #0008; color: #fff; padding: 4px 8px; border-radius: 99px; font-size: 13px; }
.tile .star.on { background: var(--accent); color: var(--accent-ink); }
.tile .kind { position: absolute; top: 34px; right: 6px; font-size: 11px; color: #fff; background: #000a; border-radius: 6px; padding: 1px 6px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.lightbox { position: fixed; inset: 0; z-index: 20; background: #000e; display: flex; flex-direction: column; color: #fff; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; }
.lightbox .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 56px 16px; position: relative; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); background: #fff2; color: #fff; border: 0; font-size: 22px; width: 44px; height: 44px; border-radius: 50%; justify-content: center; }
.lightbox .prev { left: 8px; } .lightbox .next { right: 8px; }
.lightbox button { color: #fff; background: #fff2; border-color: transparent; }
.lightbox button.on { background: var(--accent); color: var(--accent-ink); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 30; }
.empty { text-align: center; padding: 48px 16px; }
.signin { max-width: 420px; margin: 10vh auto; text-align: center; }

.badge.unpaid { color: var(--danger); border-color: var(--danger); }
.pay-card { margin-top: 16px; border-color: var(--accent); }
.pay-card input { padding: 7px 9px; }
.danger-card { margin-top: 24px; border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); max-width: 560px; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
