/* tapbe admin. Brand: ink #101914, paper #F5F7EF, lime #E1F5A4, lilac #DDD2FB. No external fonts (strict CSP). */
:root {
  --ink:#101914; --paper:#F5F7EF; --surface:#FFFFFF; --sunk:#ECF0E4; --line:#D9DFD0; --line-strong:#B9C2AE;
  --muted:#5B675C; --lime:#E1F5A4; --lime-deep:#4E6A2C; --lilac:#DDD2FB; --danger:#A3402B; --danger-soft:#FBE7E1;
  --r-sm:8px; --r-md:12px; --r-lg:18px;
  font-family: ui-rounded, "SF Pro Rounded", Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--paper); color-scheme: light; font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--sunk); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ------------------------------------------------ top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--ink); color: var(--paper); }
.brand { display: inline-flex; align-items: baseline; font-size: 20px; letter-spacing: -.04em; }
.brand strong { font-weight: 800; }
.brand-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--lime); margin: 0 8px 0 3px; align-self: center; }
.brand-sub { font-size: 14px; letter-spacing: 0; color: #A8B2A5; }
#who { margin-left: auto; font-size: 13px; color: #A8B2A5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* ------------------------------------------------ controls */
button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: 999px; padding: 9px 16px; font-weight: 650; font-size: 14px; color: var(--ink); background: transparent; min-height: 40px; }
button:disabled { opacity: .4; cursor: not-allowed; }
.primary { background: var(--ink); color: var(--paper); }
.primary:hover:not(:disabled) { background: #26352c; }
.ghost { border-color: var(--line-strong); background: var(--surface); }
.ghost:hover:not(:disabled) { border-color: var(--ink); }
.ghost.on-dark { background: transparent; color: var(--paper); border-color: #3B4B40; min-height: 34px; padding: 6px 14px; }
.ghost.on-dark:hover { border-color: var(--paper); }
.danger { background: var(--danger-soft); color: var(--danger); border-color: #EBC2B6; }
.danger:hover { border-color: var(--danger); }
.wide { width: 100%; margin-top: 16px; }
.icon { min-width: 36px; min-height: 36px; padding: 0; border-radius: 10px; color: var(--muted); font-size: 15px; }
.icon:hover:not(:disabled) { background: var(--sunk); color: var(--ink); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
input, select { font: inherit; font-size: 15px; width: 100%; min-height: 42px; padding: 9px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
input:hover, select:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input:disabled { background: var(--sunk); color: var(--muted); }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--ink); margin: 0; flex-shrink: 0; }
label, .label { display: block; font-size: 13px; font-weight: 650; margin: 0 0 6px; }
.error { color: var(--danger); font-size: 14px; }
.error:empty { display: none; }
.error:not(:empty) { margin: 12px 0 0; }

/* switch */
.switch { position: relative; flex-shrink: 0; width: 46px; min-height: 28px; height: 28px; padding: 0; border-radius: 99px; background: var(--line-strong); border: 0; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 99px; background: #fff; box-shadow: 0 1px 2px #10191440; transition: transform .15s; }
.switch[aria-checked=true] { background: var(--ink); }
.switch[aria-checked=true] .knob { transform: translateX(18px); background: var(--lime); }

/* segmented control and chips */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border-radius: 99px; }
.segmented button { min-height: 30px; padding: 4px 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.segmented button:hover { color: var(--ink); }
.segmented [aria-pressed=true], .segmented [aria-checked=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #10191426, 0 0 0 1px var(--line); }
.wide-seg { display: flex; flex-wrap: wrap; border-radius: var(--r-md); }
.wide-seg button { flex: 1 1 auto; border-radius: 9px; min-height: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 4px 12px; font-size: 13px; font-weight: 600; background: var(--surface); border-color: var(--line); color: var(--muted); }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip[aria-pressed=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.count { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 6px; opacity: .65; }

/* ------------------------------------------------ pulse strip */
.pulse { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 28px; padding: 4px 2px 22px; }
.live-dot { width: 10px; height: 10px; border-radius: 99px; background: #8DBA3E; box-shadow: 0 0 0 4px var(--lime); animation: breathe 2.4s ease-in-out infinite; margin-right: -12px; }
.figure { display: inline-flex; align-items: baseline; gap: 7px; }
.figure b { font-size: 30px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.figure span { color: var(--muted); font-size: 14px; }
.figure:first-of-type b { color: var(--ink); }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px #E1F5A400; } }

/* ------------------------------------------------ layout and panels */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.side { display: grid; gap: 16px; }
.side .panel > h2 { margin-bottom: 4px; }
.side .panel > p.small { margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 22px; }
.note { margin: -4px 0 14px; padding: 10px 14px; background: var(--lilac); border-radius: var(--r-md); font-size: 13.5px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -20px 16px; padding: 0 20px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { flex-shrink: 0; border-radius: 0; padding: 10px 12px 12px; min-height: 44px; font-size: 14.5px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.tab.status-hidden { font-style: italic; }
.tab.status-preview::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 99px; background: #A898D8; vertical-align: middle; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.search { background: var(--sunk); border-color: transparent; }
.search:hover { border-color: var(--line-strong); }

.venue-list { list-style: none; margin: 0; padding: 0; }
.venue-list > li + li { border-top: 1px solid var(--line); }
.venue { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 8px; margin: 0 -8px; width: calc(100% + 16px); border-radius: var(--r-md); text-align: left; font-weight: 400; min-height: 64px; }
.venue:hover { background: var(--paper); }
.venue:hover .glyph-box { background: var(--surface); }
.venue.is-hidden .glyph-box, .venue.is-hidden .venue-main { opacity: .5; }
.glyph-box { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 48px; height: 48px; border-radius: 13px; background: var(--paper); border: 1px solid var(--line); }
.glyph-box.large { width: 68px; height: 68px; border-radius: 18px; }
.glyph { display: block; }
.venue-main { flex: 1; min-width: 0; }
.venue-main strong { display: block; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.stage-names { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { display: flex; gap: 6px; flex-shrink: 0; }
.badge { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--lime); }
.muted-badge { background: var(--sunk); color: var(--muted); }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); }
.empty p { margin-bottom: 12px; }

.flags, .cities { list-style: none; margin: 0; padding: 0; }
.flags li, .cities li, .row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; }
.flags li + li, .cities li + li { border-top: 1px solid var(--line); }
.flags strong, .cities strong, .row-between strong { display: block; font-size: 14.5px; }
.cities .segmented button { padding: 4px 9px; font-size: 12.5px; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form button { flex-shrink: 0; }
.side .panel > input { margin-bottom: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

/* ------------------------------------------------ editor drawer */
.backdrop { position: fixed; inset: 0; z-index: 10; background: #10191466; animation: fade .18s ease-out; }
.drawer { position: fixed; z-index: 11; top: 0; right: 0; bottom: 0; width: min(560px, 100%); display: flex; flex-direction: column; background: var(--paper); box-shadow: -20px 0 50px #10191430; animation: slide .22s cubic-bezier(.2,.7,.2,1); }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.drawer-head .glyph-box { background: var(--paper); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 18px; align-content: start; overscroll-behavior: contain; }
.drawer-foot { padding: 14px 20px; background: var(--surface); border-top: 1px solid var(--line); }
.drawer-foot .error:not(:empty) { margin: 0 0 10px; }
.field small { margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.swatches { display: flex; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border-color: var(--line); padding: 6px 14px 6px 8px; }
.swatch .dot { width: 22px; height: 22px; border-radius: 99px; border: 1px solid #10191440; }
.swatch-lime .dot { background: var(--lime); }
.swatch-lilac .dot { background: var(--lilac); }
.swatch[aria-checked=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.row-between { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.more { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 0 14px; }
.more summary { cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 650; }
.more[open] { padding-bottom: 14px; }
.more[open] summary { margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 14px; margin-bottom: 14px; }
.stages-head { margin-top: 6px; }
.stages-head h3 { font-size: 17px; }
.stages { list-style: none; margin: -8px 0 0; padding: 0; display: grid; gap: 8px; }
.stage { display: flex; gap: 10px; align-items: flex-start; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.stage-no { flex-shrink: 0; width: 26px; height: 26px; margin-top: 8px; border-radius: 99px; background: var(--lime); font-size: 12.5px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.stage-fields { flex: 1; min-width: 0; display: grid; gap: 6px; }
.stage-line { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 6px; }
.stage-line.translations { grid-template-columns: 1fr 1fr; }
.translations input { min-height: 34px; padding: 6px 10px; font-size: 13.5px; background: var(--paper); border-color: var(--line); }
.stage-tools { display: flex; flex-direction: column; gap: 2px; }
.add-stage { justify-self: start; border: 1px dashed var(--line-strong); border-radius: var(--r-md); width: 100%; background: transparent; color: var(--muted); }
.add-stage:hover { color: var(--ink); border-color: var(--ink); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------ sign in */
.auth { max-width: 400px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px; display: grid; gap: 12px; }
.auth-mark { width: 72px; height: 72px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.auth form { margin-top: 8px; }
.auth form label { margin-top: 12px; }
.captcha { margin-top: 16px; min-height: 65px; }
.otp { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: block; background: #fff; padding: 10px; border-radius: var(--r-md); border: 1px solid var(--line); width: 220px; height: 220px; margin: 4px auto; }

/* ------------------------------------------------ toast */
#toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 99px; font-weight: 650; font-size: 14px; box-shadow: 0 10px 30px #10191440; }
#toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--lime); margin-right: 10px; vertical-align: middle; }
#toast.bad { background: var(--danger); }
#toast.bad::before { background: #fff; }

/* ------------------------------------------------ responsive and motion */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 560px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; gap: 10px; }
  #who { display: none; }
  #signout { margin-left: auto; }
  .panel { padding: 16px; border-radius: 16px; }
  .tabs { margin: 0 -16px 14px; padding: 0 16px; }
  .figure b { font-size: 24px; }
  .pulse { gap: 6px 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .cities li { flex-direction: column; align-items: flex-start; gap: 8px; }
  .stage-line { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------ bulk import */
textarea { font: 14px/1.6 ui-monospace, Menlo, monospace; width: 100%; min-height: 200px; padding: 12px; resize: vertical; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
textarea:disabled { background: var(--sunk); color: var(--muted); }
.import-preview { list-style: none; margin: -8px 0 0; padding: 0; display: grid; gap: 6px; }
.import-preview li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.import-preview li.skip { opacity: .55; }
.import-preview li.bad { border-color: var(--danger); background: var(--danger-soft); }
.import-preview li.bad small { color: var(--danger); }
.import-preview .venue-main strong { font-size: 14.5px; }
.glyph-box.small { width: 36px; height: 36px; border-radius: 10px; font-weight: 800; color: var(--danger); }
.panel-head .actions { flex-wrap: nowrap; }
@media (max-width: 560px) { .panel-head { flex-wrap: wrap; } }
