:root {
  --ink: #1f2733;
  --ink-soft: #55617a;
  --line: #e3e7ef;
  --bg: #f6f8fb;
  --card: #ffffff;
  --brand: #2f6f5e;
  --brand-ink: #235446;
  --accent: #c9772d;
  --danger: #b23b3b;
  --ok: #2f8f5b;
  --warn-bg: #fff6e8;
  --radius: 12px;
}

* { box-sizing: border-box; }
*:focus { outline: none; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1, h4 { margin: 0; }
a { color: var(--brand-ink); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #eef1f6;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .9em;
}

.muted { color: #a3a3a3; font-size: 13px; }

/* -------- header -------- */
.site-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(14px, 3vw, 34px);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--brand), #3f8f79);
}
.site-head h1 { font-size: 19px; letter-spacing: .2px; }
.tagline { margin: 3px 0 0; font-size: 13px; color: var(--ink-soft); }
.back-link { font-size: 13px; text-decoration: none; white-space: nowrap; }
.live-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-soft);
  background: #f3f6fa; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #b7bfcc; flex: none; }
.live-pill .dot.live { background: var(--ok); box-shadow: 0 0 0 4px rgba(47, 143, 91, .15); }
.live-pill .dot.off { background: var(--danger); }

/* -------- tabs -------- */
.tabbar {
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: visible;
  gap: 4px;
  padding: 0 clamp(14px, 3vw, 34px);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tab {
  font: inherit; font-size: 14px; cursor: pointer;
  border: none; background: transparent; color: var(--ink-soft);
  padding: 12px 16px;
}
.tab.active { box-shadow: inset 0 -2px 0 var(--brand); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 34px) 80px; }
.panel { display: none; }
.panel.active { display: block; }
.sec-title { font-size: 14px; margin: 22px 0 12px; }
.sec-title:first-child { margin-top: 2px; }

/* -------- catalog -------- */
.catalog { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.filters h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.filters label { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.filters input, .filters select {
  font: inherit; font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.filters .chk {
  display: flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.filters .chk input { width: 15px; height: 15px; }

.count-line { font-size: 12.5px; color: #a3a3a3; margin: 0 0 12px; }

.wsgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.ws-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.ws-card .level-badge {
  display: inline-block;
  width: 74px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--brand-ink); background: #e7f1ee; border: 1px solid #cfe4dd;
  border-radius: 999px; padding: 2px 8px; margin-bottom: 8px;
}
.ws-card .ws-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.3; cursor: pointer;
}
.ws-card .ws-sub { font-size: 12px; color: var(--ink-soft); margin: 6px 0; }
.ws-card .ws-blurb { font-size: 12px; color: var(--ink-soft); margin: 6px 0 10px; line-height: 1.45; }
.ws-card .price { font-size: 16px; font-weight: 700; color: var(--brand-ink); margin: 8px 0 4px; }
.ws-card .seats { font-size: 12px; }
.ws-card .book-btn {
  margin-top: 10px; display: inline-block; cursor: pointer;
  background: var(--brand); color: #fff; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
}
.ws-card .book-btn:hover { background: var(--brand-ink); }
.ws-card.sold .book-btn { background: #9aa3b2; pointer-events: none; }

/* -------- booking panel -------- */
.booking {
  margin-top: 26px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.booking-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; margin-top: 12px; }
.booking-form { display: flex; flex-direction: column; gap: 6px; }
.booking-form label { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.booking-form input {
  font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
}
#attendeeFields { display: flex; flex-direction: column; gap: 4px; }
.promo-row { display: flex; gap: 8px; margin-top: 10px; }
.promo-row input { flex: 1; }
.warn {
  margin-top: 12px; font-size: 12.5px; color: #8a5a12;
  background: var(--warn-bg); border: 1px solid #f0dcbb;
  border-radius: 8px; padding: 8px 10px;
}

.summary-box {
  width: 100%;
  min-width: 360px;
  background: #fbfcfe; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; height: fit-content;
}
.srow { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 0; }
.srow.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 15px; }
.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 14px;
}
.btn:hover { background: #f1f4f9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; width: 100%; margin-top: 2px; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { border-color: #e6c3c3; color: var(--danger); background: #fdf3f3; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.confirm-banner {
  margin-top: 16px; border: 1px solid #bfe3cd; background: #eef8f1;
  border-radius: 10px; padding: 14px; font-size: 13.5px;
}

/* -------- my bookings -------- */
.mb-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg {
  font: inherit; font-size: 12.5px; cursor: pointer; border: none;
  background: #fff; color: var(--ink-soft); padding: 7px 14px;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg.active { background: var(--brand); color: #fff; }
.mb-sortlbl { font-size: 12px; color: var(--ink-soft); }
#mbSort { font: inherit; font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.mb-summary { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 14px; }

.mybookings { display: flex; flex-direction: column; gap: 10px; }
.mb {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.mb:hover { border-color: #c7d2e2; }
.mb .mb-main { flex: 1; min-width: 0; }
.mb .mb-title { font-size: 13.5px; font-weight: 600; }
.mb .mb-sub { font-size: 12px; color: var(--ink-soft); }
.mb .mb-status { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; }
.mb .mb-status.confirmed { color: var(--ok); background: #e8f6ee; }
.mb .mb-status.cancelled { color: var(--danger); background: #fbeaea; }
.mb .mb-x {
  cursor: pointer; border: none; background: transparent; color: var(--ink-soft);
  font-size: 14px; width: 22px; height: 22px; line-height: 1;
}

/* -------- modal -------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 27, 38, .42);
  display: grid; place-items: start center; padding: 8vh 16px 20px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: 560px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(20, 27, 38, .25);
  padding: 20px 22px;
}
.modal-card.wide { width: min(720px, 92vw); }
.modal-card h4 { font-size: 15px; display: flex; align-items: flex-start; gap: 10px; }
.modal-card h4 .mc-close {
  margin-left: auto; cursor: pointer; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; width: 26px; height: 26px; font-size: 14px; line-height: 1; flex: none; color: var(--ink-soft);
}
.mc-sub { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }
.mc-seatrow { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.mc-seatrow input { width: 70px; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.mc-actions { display: flex; gap: 8px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }

/* -------- brief / api -------- */
.brief-steps { font-size: 13.5px; line-height: 1.6; padding-left: 18px; }
.panel[data-panel="brief"] p { font-size: 13.5px; line-height: 1.6; margin: 8px 0; }
.panel[data-panel="brief"] ul { font-size: 13.5px; line-height: 1.6; padding-left: 20px; margin: 6px 0 10px; }
.panel[data-panel="brief"] li { margin: 3px 0; }
.promo-ref { list-style: none; padding-left: 0 !important; }
.promo-ref li { padding: 2px 0; }
.script-box {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 14px;
  background: #eef1f6; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
.script-box code {
  flex: 1; background: none; border: none; padding: 0; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word;
}
.script-box .btn.tiny { flex: none; padding: 5px 12px; font-size: 12px; }
.tpl-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.tpl-textarea {
  width: 100%; height: 52vh; resize: vertical; margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55;
  color: var(--ink); background: #fbfcfe; border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 14px; white-space: pre;
}
.api-table, .api-tasks {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card);
}
.api-row {
  display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: baseline;
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.api-row:last-child { border-bottom: none; }
.api-row .m {
  font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 11px;
  text-align: center; border-radius: 5px; padding: 2px 0;
}
.m.GET { color: #1f5fae; background: #e8f0fb; }
.m.POST { color: #1c7a4a; background: #e6f5ec; }
.m.PUT { color: #8a6d1f; background: #fbf3df; }
.m.PATCH { color: #6b3fa0; background: #f1e9fb; }
.m.DELETE { color: #a5342f; background: #fbe9e8; }
.api-ep { font-family: ui-monospace, Menlo, monospace; }
.api-note { color: var(--ink-soft); }
.task { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.5; }
.task:last-child { border-bottom: none; }
.task b.tk { color: var(--brand-ink); }
.task .hint { color: var(--ink-soft); font-size: 12px; }
.task-group {
  background: #eef1f6; padding: 8px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--ink-soft);
}

/* -------- log -------- */
.log { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.log .lrow {
  display: grid; grid-template-columns: 70px 54px 1fr auto; gap: 12px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
}
.log .lrow:last-child { border-bottom: none; }
.log .sc.s2 { color: var(--ok); font-weight: 700; }
.log .sc.s4 { color: var(--accent); font-weight: 700; }
.log .sc.s5 { color: var(--danger); font-weight: 700; }
.log .sc.s3 { color: #1f5fae; font-weight: 700; }
.log-empty { padding: 22px; text-align: center; color: var(--ink-soft); font-size: 13px; }

/* -------- toast -------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(14px);
  background: #1f2733; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------- live-update flash -------- */
@keyframes examFlash {
  0% { box-shadow: 0 0 0 0 rgba(47, 143, 91, .5); border-color: var(--brand); }
  100% { box-shadow: 0 0 0 12px rgba(47, 143, 91, 0); }
}
.flash { animation: examFlash 1s ease-out; border-color: var(--brand) !important; }

/* -------- responsive -------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .filters { position: absolute; width: 250px; z-index: 2; }
}
@media (max-width: 620px) {
  .booking-grid { grid-template-columns: 1fr; }
}
