/* SeatBook: a ticket-office look. Warm paper, ink, one red accent for taken seats and actions. */
:root {
  --bg: #f7f3ec;
  --panel: #fffdf9;
  --ink: #1f1b16;
  --ink-2: #5e564c;
  --ink-3: #8b8276;
  --line: #e4dccf;
  --line-2: #d3c8b7;
  --accent: #b4322a;
  --accent-ink: #ffffff;
  --accent-soft: #f7e1dc;
  --ok: #2f7a4b;
  --ok-soft: #dcefe2;
  --warn: #8a5a00;
  --warn-soft: #fbeccb;
  --focus: #2b62d9;
  --hall: #efe9df;
  --seat-free: #ffffff;
  --seat-taken: #6f6a64;
  --seat-selected: #2b62d9;
  --shadow: 0 1px 2px rgba(31, 27, 22, .06), 0 6px 18px rgba(31, 27, 22, .06);
  --radius: 10px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17140f; --panel: #211d17; --ink: #f3ede4; --ink-2: #c3b9ab; --ink-3: #91877a; --line: #3a332a; --line-2: #4b4337;
    --accent: #e0574c; --accent-soft: #42221d; --ok: #6cc28c; --ok-soft: #1f3527; --warn: #e6b450; --warn-soft: #3b2e14;
    --focus: #7ea4ff; --hall: #2a251e; --seat-taken: #5a544c; --seat-selected: #4f7ff0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; padding: 14px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.35rem/1 var(--display); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--accent-ink); border-radius: 2px; }
.brand-mark::before { left: 6px; right: 6px; top: 7px; height: 7px; }
.brand-mark::after { left: 6px; width: 4px; top: 14px; height: 6px; box-shadow: 10px 0 0 var(--accent-ink); }
.site-header nav { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; font-size: .95rem; }
.site-header nav a { text-decoration: none; color: var(--ink-2); padding: 6px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Page ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 8px 16px 64px; display: grid; gap: 24px; }
.narrow { max-width: 760px; }
.hero h1, .page-title { font: 650 clamp(1.9rem, 5vw, 2.8rem)/1.1 var(--display); letter-spacing: -.015em; }
.lede { color: var(--ink-2); font-size: 1.05rem; max-width: 46em; margin-top: 8px; }
.crumbs { font-size: .9rem; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: grid; gap: 16px; min-width: 0; }
.card > h2, .sec-title { font: 650 1.25rem/1.2 var(--display); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 24px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8125rem; color: var(--ink-3); font-weight: 400; }
input[type="text"], input[type="tel"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel);
}
textarea { min-height: 84px; resize: vertical; }
input[type="color"] { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; }
.row > .field { flex: 1 1 110px; }
.form { display: grid; gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.phone-line { display: flex; gap: 8px; }
.phone-line input { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: .875rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 6px 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.notice { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice.error { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.secret { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.secret code { font: 600 1.15rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 10px 12px; background: var(--panel); border: 1px dashed var(--line-2); border-radius: 8px; letter-spacing: .04em; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); max-width: calc(100% - 32px); background: var(--ink); color: var(--panel); padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow); transition: transform .25s ease; z-index: 2000; font-weight: 500; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--accent); color: var(--accent-ink); }

/* ---------- Lists and tables ---------- */
.event-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.event-card { display: grid; gap: 8px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; position: relative; overflow: hidden; }
.event-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.event-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.event-card h3 { font: 650 1.3rem/1.2 var(--display); }
.event-card .meta { color: var(--ink-2); font-size: .9rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--hall); color: var(--ink-2); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8125rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td .row { flex-wrap: nowrap; }
.empty { color: var(--ink-2); padding: 8px 0; }

/* ---------- Event page ---------- */
.event-head { display: grid; gap: 14px; }
.call-box { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.call-box .label { color: var(--ink); font-size: 1rem; }
.phones { display: flex; gap: 10px; flex-wrap: wrap; }
.phone-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.phone-btn svg { width: 18px; height: 18px; }
.session-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.session-tab { display: grid; gap: 2px; text-align: left; min-height: 56px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; }
.session-tab strong { font-size: 1.05rem; }
.session-tab span { font-size: .8125rem; color: var(--ink-2); }
.session-tab[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.map-layout { display: grid; gap: 20px; }
@media (min-width: 1000px) { .map-layout.with-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--hall); }
.seat-map { height: min(68vh, 640px); min-height: 360px; background: var(--hall); }
.editor .seat-map { height: calc(100vh - 210px); min-height: 420px; }
.map-tools { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.map-tools .btn { box-shadow: var(--shadow); }
/* The bar over the map while seats are selected, and the reserve dialog it opens. */
.select-bar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1500; width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap;
  padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 8px 28px rgba(31, 27, 22, .22); }
.select-bar-text { display: grid; min-width: 0; flex: 1 1 160px; }
.select-bar-text .small { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(20, 16, 12, .45); }
.dialog h2 { font: 650 1.25rem/1.2 var(--display); }
.legend { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: .875rem; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 6px; border: 1px solid rgba(0,0,0,.25); }
.legend .free { background: var(--seat-free); }
.legend .taken { background: var(--seat-taken); }
.legend .selected { background: var(--seat-selected); }
.side { display: grid; gap: 16px; align-content: start; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; background: var(--hall); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.booking { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.booking:last-child { border-bottom: 0; }
.booking-name { font-weight: 700; }
.booking button.open { all: unset; cursor: pointer; display: grid; gap: 4px; }
.booking button.open:focus-visible { outline: 3px solid var(--focus); }
.booking.current { background: color-mix(in srgb, var(--seat-selected) 8%, transparent); margin: 0 -10px; padding: 12px 10px; border-radius: 8px; }
.booking-list { max-height: 520px; overflow-y: auto; }
.stat-line { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--ink-2); }
.stat-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Seats on the map ---------- */
.leaflet-container { font: inherit; background: var(--hall); }
.leaflet-container.box-mode { cursor: crosshair; }
.sm-icon { width: 0 !important; height: 0 !important; background: none; border: 0; }
.seat-box, .hall-text-box, .area-label-box { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: grid; place-items: center; text-align: center; white-space: nowrap; user-select: none; }
.seat-box {
  width: calc(var(--u) * .92); height: calc(var(--u) * .92); border-radius: calc(var(--u) * .16);
  font-size: calc(var(--u) * .3); font-weight: 700; line-height: 1; letter-spacing: -.02em;
  background: var(--seat, var(--seat-free)); color: #1f1b16; border: max(1px, calc(var(--u) * .04)) solid rgba(31, 27, 22, .35);
  cursor: pointer; overflow: hidden;
}
.seat-box.is-booked { background: var(--seat-taken); color: rgba(255, 255, 255, .75); border-color: rgba(0, 0, 0, .4);
  background-image: repeating-linear-gradient(135deg, transparent 0 calc(var(--u) * .1), rgba(255, 255, 255, .13) calc(var(--u) * .1) calc(var(--u) * .2)); }
.public .seat-box.is-booked { cursor: not-allowed; }
.seat-box.is-selected { background: var(--seat-selected); color: #fff; border-color: #0f2f7a; box-shadow: 0 0 0 calc(var(--u) * .08) rgba(43, 98, 217, .35); }
.seat-box.is-current { box-shadow: 0 0 0 calc(var(--u) * .1) #f5b400; }
.seat-box.is-booked.is-selected { background: #8d2a8f; color: #fff; }
.seat-box:hover { filter: brightness(.95); }
.hall-text-box { font-size: calc(var(--u) * .5); font-weight: 700; color: var(--ink-2); }
.area-label-box { font-size: calc(var(--u) * .5); font-weight: 700; color: #3b2a1a; pointer-events: none; }
.editor .area-label-box { pointer-events: auto; cursor: move; padding: 0 calc(var(--u) * .2); border-radius: 4px; }
.editor .hall-text-box { cursor: move; }
.hall-text-box.is-selected, .area-label-box.is-selected { outline: 2px dashed var(--seat-selected); outline-offset: 2px; background: rgba(255,255,255,.5); }
.seat-box.is-dup { border-color: #e0574c; border-style: dashed; }
.leaflet-marker-icon.leaflet-marker-draggable { cursor: move; }
.select-box { position: absolute; z-index: 1000; border: 2px dashed var(--seat-selected); background: rgba(43, 98, 217, .1); pointer-events: none; }
.leaflet-control-zoom a { color: var(--ink) !important; }

/* ---------- Layout editor ---------- */
.editor-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.tool-group { display: flex; gap: 6px; flex-wrap: wrap; }
.editor-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .editor-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.panel { display: grid; gap: 14px; }
.kbd { font: 600 .75rem/1 ui-monospace, Consolas, monospace; padding: 2px 5px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--panel); }
.help { font-size: .8125rem; color: var(--ink-2); display: grid; gap: 4px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
