*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--void); color: var(--bone); font: 400 1rem/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--acid); }
:focus-visible { outline: 3px solid var(--acid); outline-offset: 2px; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line); background: rgb(6 4 14 / 0.94);
}
.brand { color: var(--bone); font: 800 1.0625rem/1 var(--display); text-decoration: none; }
.brand span { color: var(--acid); }
.brand em { margin-left: 6px; color: var(--muted); font: 400 0.75rem/1 var(--mono); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who span { overflow-wrap: anywhere; }

.view { width: 100%; max-width: 820px; margin-inline: auto; padding: 28px 16px 80px; }
.narrow { max-width: 420px; margin-inline: auto; }
.title { margin-block: 4px 14px; font: 800 clamp(1.6rem, 5vw, 2.2rem)/1.1 var(--display); }
.section { margin: 30px 0 10px; font: 700 1.0625rem/1.2 var(--display); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mt { margin-top: 16px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--bone); }
.empty { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 20px;
  border: 0; border-radius: 999px; background: var(--acid); color: var(--void);
  font: 700 0.875rem/1.2 var(--display); text-decoration: none; cursor: pointer;
}
.btn--full { display: flex; width: 100%; }
.btn--small { min-height: 40px; padding: 8px 14px; font-size: 0.75rem; }
.btn--ghost { background: none; color: var(--bone); box-shadow: inset 0 0 0 1px var(--bone); }
.btn--quiet { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.btn--danger { background: none; color: var(--plasma); box-shadow: inset 0 0 0 1px var(--plasma); }

.card { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--ink); }
.publish { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: 14px 0 18px; }
.publish__text { display: grid; gap: 4px; flex: 1 1 260px; }
.publish.is-waiting { border-color: var(--acid); }
.event { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.event__date { display: grid; place-items: center; padding: 8px 0; border-radius: 12px; background: var(--void); text-align: center; }
.event__date strong { font: 800 1.5rem/1 var(--display); color: var(--acid); }
.event__date span { font: 400 0.6875rem/1.3 var(--mono); color: var(--muted); text-transform: uppercase; }
.event__title { font-weight: 700; font-size: 1.0625rem; }
.event__actions { display: flex; flex-direction: column; gap: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { padding: 3px 9px; border-radius: 999px; background: rgb(243 238 223 / 0.1); font-size: 0.75rem; font-weight: 600; }
.badge--live { background: rgb(214 255 61 / 0.16); color: var(--acid); }
.badge--warn { background: rgb(255 47 146 / 0.18); color: #ff8cc0; }
@media (max-width: 560px) {
  .event { grid-template-columns: 56px minmax(0, 1fr); }
  .event__actions { grid-column: 1 / -1; flex-direction: row; }
}

fieldset { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; display: grid; gap: 12px; }
legend { padding: 0 6px; font: 700 0.9375rem/1 var(--display); }
.field { display: grid; gap: 5px; }
.field > span { color: var(--muted); font: 400 0.8125rem/1.3 var(--mono); }
input, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--void); color: var(--bone); font: 400 1rem/1.4 var(--body); color-scheme: dark;
}
input[readonly] { color: var(--muted); }
textarea { resize: vertical; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair--3 { grid-template-columns: 1.4fr 1fr 1fr; }
@media (max-width: 520px) { .pair--3 { grid-template-columns: 1fr 1fr; } .pair--3 > :first-child { grid-column: 1 / -1; } }
.actions { margin-top: 6px; }

.mono { font-family: var(--mono); overflow-wrap: anywhere; }
.tools { display: grid; gap: 10px; margin: 18px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--bone); font: 400 0.875rem/1 var(--body); cursor: pointer; }
.chip.is-on { border-color: var(--acid); background: var(--acid); color: var(--void); font-weight: 700; }
input[type="search"] { appearance: none; }
.slug-note { font: 400 0.8125rem/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.slug-note.is-good { color: var(--acid); }
.slug-note.is-bad { color: #ff8cc0; }

select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--void); color: var(--bone); font: 400 1rem/1.3 var(--body); }
.check { display: flex; align-items: center; gap: 10px; min-width: 0; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--acid); }

/* Shop */
.shop-panel { margin-top: 32px; padding-top: 8px; border-top: 1px solid var(--line); }
.shop-panel .section { margin: 18px 0 6px; }
.shop-panel > .muted { margin-bottom: 12px; }
.shop-panel form { margin-bottom: 12px; }
.tt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tt__main { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink); }
.stat strong { display: block; font: 800 1.5rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.875rem; }
.order { display: grid; gap: 10px; }
.order__amount { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.order__tickets { display: grid; gap: 6px; padding: 10px 0; border-block: 1px solid var(--line); }
.order__ticket { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.order__ticket .mono { grid-column: 1 / -1; padding-left: 30px; }
.door { margin-top: 18px; padding: 18px; border-radius: 16px; border: 2px solid var(--line); display: grid; gap: 10px; }
.door--ok { border-color: var(--acid); background: rgb(214 255 61 / 0.08); }
.door--bad { border-color: var(--plasma); background: rgb(255 47 146 / 0.1); }
.door__verdict { font: 800 1.375rem/1.2 var(--display); }
.door__video { width: 100%; margin-top: 12px; border-radius: 14px; background: #000; }
#door-code { flex: 1; min-width: 0; font-family: var(--mono); }

/* Top bar */
.top__bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; width: 100%; }
.top__bar .brand { grid-column: 2; justify-self: start; }
.top__bar #open-drawer { grid-column: 1; }
.top__bar .who { grid-column: 3; }
.who { position: relative; display: flex; align-items: center; gap: 4px; }
.icon-btn, .avatar-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--bone); cursor: pointer; }
.icon-btn:hover { background: var(--ink); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--void), 0 0 0 3px var(--line); }
.avatar--letter { display: grid; place-items: center; background: var(--uv); color: var(--bone); font: 800 0.9375rem/1 var(--display); }
.avatar-btn[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--void), 0 0 0 3px var(--acid); }
.dot-count { position: absolute; top: 5px; right: 3px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--plasma); color: var(--void); font: 700 0.6875rem/18px var(--body); font-style: normal; text-align: center; }

.panel-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 8; width: min(380px, calc(100vw - 24px)); max-height: min(70svh, 560px); overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--ink); box-shadow: 0 18px 48px rgb(0 0 0 / 0.55); }
.panel-pop__title { padding: 4px 8px 10px; font: 700 1rem/1.2 var(--display); }
.panel-pop__who { display: flex; align-items: center; gap: 12px; padding: 4px 8px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.panel-pop__who div { display: grid; min-width: 0; }
.panel-pop ul { display: grid; gap: 2px; }
.panel-pop a, .panel-pop li > button { display: block; width: 100%; min-height: 44px; padding: 11px 12px 11px 24px; border: 0; border-radius: 12px; background: none; color: var(--bone); font: 400 0.9375rem/1.35 var(--body); text-align: left; text-decoration: none; cursor: pointer; }
.panel-pop a:hover, .panel-pop li > button:hover { background: var(--void); }
.panel-pop a.is-new { position: relative; font-weight: 600; }
.panel-pop a.is-new::before { content: ""; position: absolute; left: 9px; top: 19px; width: 7px; height: 7px; border-radius: 50%; background: var(--acid); }
.panel-pop a.is-hot.is-new::before { background: var(--plasma); }

.drawer { position: fixed; inset: 0 auto 0 0; width: min(330px, 88vw); max-width: none; height: 100%; max-height: none; margin: 0; padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-right: 1px solid var(--line); background: var(--void); color: var(--bone); overflow-y: auto; }
.drawer::backdrop { background: rgb(0 0 0 / 0.6); }
.drawer[open] { animation: drawer-in 0.2s ease-out; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer__label { margin: 18px 0 4px; color: var(--muted); font: 400 0.75rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.drawer__link { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 12px; color: var(--bone); text-decoration: none; }
.drawer__link span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer__link:hover { background: var(--ink); }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }

/* Sidebar menu (Firebase-console style) */
.shell { display: block; }
.sidebar { display: none; }
.nav { display: grid; gap: 4px; }
.nav-group { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.nav-group:last-child { border-bottom: 0; }
.nav-group__label { margin: 4px 12px 6px; color: var(--muted); font: 400 0.6875rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 0 999px 999px 0; background: none; color: var(--bone); font: 400 0.9375rem/1.2 var(--body); text-align: left; text-decoration: none; cursor: pointer; }
.nav-item:hover { background: var(--ink); }
.nav-item.is-on { background: rgb(214 255 61 / 0.14); color: var(--acid); font-weight: 600; }
.nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drawer .nav-item { border-radius: 12px; }
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
  .sidebar:not([hidden]) { display: block; position: sticky; top: 65px; height: calc(100svh - 65px); overflow-y: auto; padding: 8px 12px 24px 0; border-right: 1px solid var(--line); background: var(--void); }
  #open-drawer { display: none; }
  .view { margin-inline: 0; padding-inline: clamp(24px, 4vw, 56px); }
}

/* Menu */
.menu { display: flex; gap: 4px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.menu a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.menu a:hover { color: var(--bone); background: var(--ink); }
.menu a.is-on { color: var(--void); background: var(--bone); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: rgb(243 238 223 / 0.14); color: inherit; font: 700 0.75rem/20px var(--body); text-align: center; }
.count--hot { background: var(--plasma); color: var(--void); }

/* Rides */
.tabs-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 16px; }
.tab-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--bone); text-decoration: none; }
.tab-link.is-on { border-color: var(--acid); background: var(--acid); color: var(--void); font-weight: 700; }
.tab-link.is-on .count { background: rgb(6 4 14 / 0.15); }
.portrait { flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--uv); }
.portrait--large { width: 100%; max-width: 320px; height: auto; aspect-ratio: 1; border-radius: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.photo-card { display: grid; gap: 8px; align-content: start; }
.member { display: flex; gap: 14px; align-items: flex-start; }
.member__main { display: grid; gap: 6px; min-width: 0; }

/* Coupons */
.coupon { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.coupon__main { display: grid; gap: 4px; min-width: 0; }
.coupon__code { font-size: 1.125rem; font-weight: 700; color: var(--acid); letter-spacing: 0.04em; }
fieldset[hidden] { display: none; }

/* Developer docs */
.docs .section { margin-top: 32px; }
.docs__list { display: grid; gap: 6px; padding-left: 1.1em; list-style: disc; }
.docs__diagram { overflow-x: auto; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink); }
.docs__diagram pre { margin: 0; }
.mermaid--raw { white-space: pre; font: 400 0.75rem/1.4 var(--mono); color: var(--muted); }
.docs__table { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.docs table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.docs th, .docs td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.docs th { font: 400 0.75rem/1.3 var(--mono); color: var(--muted); text-transform: uppercase; }
.docs td.mono { white-space: nowrap; }
.docs__flow { margin-bottom: 10px; }
.docs__flow h3 { margin: 0 0 8px; font: 700 1rem/1.2 var(--display); }
.docs__flow ol { display: grid; gap: 6px; padding-left: 1.2em; }
.docs__cmd { margin-bottom: 12px; }
.docs__cmd pre { overflow-x: auto; margin: 4px 0 0; padding: 12px; border-radius: 12px; background: var(--ink); border: 1px solid var(--line); white-space: pre; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 9;
  width: min(92vw, 460px); padding: 12px 16px; border-radius: 14px;
  background: var(--bone); color: var(--void); font-weight: 600; text-align: center; transform: translateX(-50%);
}
