:root {
  --red: #e10600; --red-hover: #ff1a12; --blk: #0b0b0b; --panel: #151515; --panel-2: #1c1c1c; --line: #2c2c2c;
  --ink: #f5f5f5; --mute: #a8a8a8; --ok: #2ecc71; --warn: #f5a623;
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif; --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--blk); color: var(--ink); font-family: var(--body); line-height: 1.5; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
h1, h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 2.8rem); line-height: 1.05; }
h1 em { color: var(--red); font-style: normal; }
h2 { font-size: 1.5rem; }
.muted { color: var(--mute); }
small.muted { font-size: 0.8rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.logo-mark { font-family: var(--display); font-size: 1.6rem; letter-spacing: 0.06em; background: var(--red); color: #fff; padding: 2px 12px; line-height: 1.2; transform: skew(-8deg); display: inline-block; }
.btn, .ghost { font: inherit; font-weight: 700; border-radius: 4px; cursor: pointer; padding: 11px 20px; border: 2px solid var(--red); background: var(--red); color: #fff; text-decoration: none; text-align: center; display: inline-block; transition: transform 0.15s, background 0.15s; }
.btn:hover { background: var(--red-hover); border-color: var(--red-hover); transform: translateY(-1px); }
.btn:disabled, .ghost:disabled { opacity: 0.55; cursor: wait; transform: none; }
.ghost { background: transparent; border-color: #444; color: var(--ink); }
.ghost:hover { border-color: #fff; }
.sm { padding: 7px 12px; font-size: 0.8rem; }
.danger { border-color: #5a2020; color: #ff8d8d; }
.danger:hover { border-color: #ff5a5a; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(700px circle at 70% 20%, rgba(225,6,0,.25), transparent 60%), var(--blk); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 32px; display: grid; gap: 16px; }
.login-card h1 { margin-bottom: 4px; }
.back { color: var(--mute); font-size: 0.85rem; text-align: center; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.85rem; }
input, select, textarea { font: inherit; background: #101010; color: var(--ink); border: 1px solid #3a3a3a; border-radius: 4px; padding: 11px 12px; width: 100%; min-width: 0; }
input[type="range"] { padding: 0; }
textarea { resize: vertical; }
.err { color: #ff8d8d; background: #2a1212; border: 1px solid #5a2020; border-radius: 4px; padding: 10px 12px; margin: 0; font-size: 0.9rem; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: #111; border-bottom: 3px solid var(--red); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top-title { font-family: var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); margin-right: auto; }
.top-nav { display: flex; gap: 4px; order: 3; width: 100%; }
.top-nav button { font: inherit; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; background: transparent; color: var(--mute); border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; cursor: pointer; }
.top-nav button[aria-selected="true"] { color: #fff; border-bottom-color: var(--red); }
@media (min-width: 700px) { .top-nav { order: 0; width: auto; margin-right: auto; } .top-title { margin-right: 0; } }

.notice { max-width: 1040px; margin: 16px auto 0; padding: 14px 16px; background: #2a2208; border: 1px solid #6b5514; color: #ffd978; border-radius: 6px; width: calc(100% - 32px); }
.page { max-width: 1040px; margin: 0 auto; padding: 24px 16px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 6px 0 0; max-width: 56ch; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border-left: 4px solid var(--red); padding: 14px 16px; border-radius: 4px; }
.kpi b { font-family: var(--display); font-weight: 400; font-size: 2.2rem; display: block; line-height: 1; }
.kpi span { color: var(--mute); font-size: 0.8rem; }

/* list rows */
.list { display: grid; gap: 12px; }
.empty { background: var(--panel); border: 1px dashed #3a3a3a; border-radius: 8px; padding: 36px 20px; text-align: center; color: var(--mute); }
.row-card { display: grid; grid-template-columns: 150px 1fr; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; align-items: stretch; }
.row-card.is-past { opacity: 0.62; }
.row-card.is-past .thumb { filter: grayscale(1); }
.thumb { aspect-ratio: 16 / 10; border-radius: 5px; background: repeating-linear-gradient(135deg, #222 0 10px, #181818 10px 20px) center / cover; overflow: hidden; align-self: start; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info { min-width: 0; display: grid; gap: 4px; align-content: start; }
.info h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; border: 2px solid #555; color: #ddd; }
.badge.live { background: var(--red); border-color: var(--red); color: #fff; }
.badge.draft { border-color: var(--warn); color: var(--warn); }
.badge.past { border-color: #888; color: #bbb; }
.meta { color: var(--mute); font-size: 0.88rem; }
.rsvp-count { display: inline-flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.rsvp-count b { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1; color: #fff; }
.rsvp-count span { color: var(--mute); font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 560px) { .row-card { grid-template-columns: 1fr; } .thumb { max-width: none; } }

/* dialogs */
.dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid #3a3a3a; border-radius: 10px; background: var(--panel); color: var(--ink); overflow: hidden; }
.dlg.wide { width: min(820px, calc(100vw - 24px)); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: rgba(0,0,0,.78); }
.dlg form { display: contents; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.x { background: transparent; border: 0; color: var(--ink); font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 0 6px; }
.dlg-body { padding: 18px; overflow: auto; display: grid; gap: 14px; align-content: start; flex: 1; }
.dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row > * { min-width: 0; }
.field { display: grid; gap: 6px; }
.lbl { font-weight: 600; font-size: 0.85rem; }
.pic-box { aspect-ratio: 16 / 10; border: 2px dashed #4a4a4a; border-radius: 8px; display: grid; place-items: center; text-align: center; color: var(--mute); cursor: pointer; overflow: hidden; background: #101010; padding: 12px; }
.pic-box:hover { border-color: var(--red); }
.pic-box img { width: 100%; height: 100%; object-fit: cover; display: block; grid-area: 1 / 1; }
.pic-box span { grid-area: 1 / 1; }
.pic-box.has-img span { display: none; }

/* cropper */
.crop-stage { background: #000; border-radius: 6px; overflow: hidden; touch-action: none; cursor: grab; line-height: 0; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { width: 100%; display: block; }
.zoom { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }

/* RSVP table */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--mute); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.totals { display: flex; gap: 24px; flex-wrap: wrap; }
.totals b { font-family: var(--display); font-weight: 400; font-size: 2rem; margin-right: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #fff; color: #111; padding: 12px 18px; border-radius: 6px; font-weight: 700; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: calc(100vw - 32px); }
.toast.bad { background: #ff5a5a; }

.panel-form { display: grid; gap: 14px; max-width: 760px; }
.panel-form h2 { margin: 18px 0 0; font-size: 1.1rem; }
.row4 { display: grid; grid-template-columns: 70px 100px 80px 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: end; }
.ph-list { display: grid; gap: 10px; }
.ph-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.ph-row img { width: 110px; height: 76px; object-fit: cover; border-radius: 5px; display: block; background: #222; }
.ph-f { display: grid; gap: 8px; min-width: 0; }
.ph-b { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#tx-texts { display: grid; gap: 14px; }
@media (max-width: 640px) { .ph-row { grid-template-columns: 90px 1fr; } .ph-row img { width: 90px; height: 64px; } .ph-b { grid-column: 1 / -1; justify-content: flex-start; } }
.row4 > *, .row3 > * { min-width: 0; }
@media (max-width: 560px) { .row4 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 1fr; } }
