:root {
  color-scheme: dark;
  --bg: #121214;
  --surface: #1b1b1f;
  --surface-2: #24242a;
  --border: #34343c;
  --text: #f1f1f3;
  --muted: #98979f;
  --accent: #2647c7;
  --accent-2: #3f63e6;
  --danger: #e14c4c;
  --ok: #6ee7a8;
  --gold: #e6c27a;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: Inter, sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(63, 99, 230, 0.22), transparent 60%),
    radial-gradient(700px 380px at -10% 20%, rgba(38, 71, 199, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

button, input, textarea { font: inherit; color: inherit; }

a { color: inherit; }

.wrap {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand img {
  width: 92px;
  height: auto;
  mix-blend-mode: lighten;
}

.brand small {
  display: block;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.desk-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid transparent;
}

.desk-link:hover { color: var(--text); border-color: var(--border); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 22px;
  align-items: stretch;
  padding: 18px 0 8px;
}
.hero:has(.poster[hidden]) { grid-template-columns: 1fr; }

.poster {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 190px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(230, 194, 122, 0.45);
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(230, 194, 122, 0.38), transparent 70%),
    linear-gradient(165deg, #1c1e2a, #12141c 58%, #1a2438);
}
.poster[hidden] { display: none !important; }
.poster-kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
.poster h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.9;
}
.poster p { margin: 10px 0 14px; color: var(--muted); }
.poster .ghost { align-self: flex-start; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.lede {
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.panel {
  background: rgba(27, 27, 31, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: end;
  padding: 18px;
  margin: 22px 0;
}

label.field { display: flex; flex-direction: column; gap: 8px; }

.field span, .block-title {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="date"],
input[type="text"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="time"],
select,
textarea {
  max-width: 100%;
  background-color: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
  color-scheme: dark;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%2398979f' stroke-width='1.6' d='M1 1.5 6 6.5 11 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  font-family: var(--font-display);
  font-size: 18px;
}

select option { background: var(--surface); color: var(--text); }

input::placeholder, textarea::placeholder { color: #6f6e76; }

input:focus, textarea:focus, select:focus { border-color: var(--accent-2); }

.controls > *, .field, .times, .zones, .hero > * { min-width: 0; }
.times, .zones { display: flex; flex-wrap: wrap; gap: 8px; max-width: 100%; }

.chip, .table, .primary, .ghost, .danger {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.chip:disabled { opacity: 0.32; cursor: default; }

.chip.on, .zone.on {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #f1f1f3;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
  padding-bottom: 48px;
}

.floor-card, .summary { padding: 18px; min-width: 0; }
.layout > * { min-width: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.floor {
  position: relative;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #101014;
}

.plan-sizer { position: relative; }

.plan {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  background-color: #141418;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: var(--cell, 40px) var(--cell, 40px);
}

.plan .table {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  border-radius: 10px;
  border: 2px solid #3c3c46;
  background: #24242a;
  padding: 4px;
  min-height: 0;
  overflow: hidden;
  line-height: 1.05;
  touch-action: none;
}

.plan .table .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan .table.compact .name { font-size: 12px; }
.plan .table .count {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: -0.03em;
}
.plan .table.compact .count { font-size: 13px; }
.plan .table.compact .pip { width: 6px; height: 6px; }
.plan .table .count small { color: var(--muted); font-size: 11px; }
.plan .table .price {
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
}
.plan .table.compact .price { font-size: 10px; }
.plan .table.compact .pips { display: none; }
.plan.tight .table { padding: 1px; gap: 0; border-width: 3px; }
.plan.tight .table .name { font-size: calc(13px / var(--scale, 1)); }
.plan.tight .table .count { font-size: calc(12px / var(--scale, 1)); }
.plan.tight .table .count small { font-size: 0.75em; }
.plan.tight .table .price,
.plan.tight .pips { display: none; }
.plan .table .pips { justify-content: center; }
.table.selected {
  border-color: var(--accent-2);
  background: rgba(38, 71, 199, 0.35);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}
.table.short { opacity: 0.45; }
.table.closed { opacity: 0.35; }

.pips { display: flex; flex-wrap: wrap; gap: 4px; }
.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #8d93a8;
  background: transparent;
}
.pip.taken { background: #5c6070; border-color: #5c6070; }
.pip.yours { background: var(--accent-2); border-color: var(--accent-2); }

.summary h2 {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -0.03em;
}

.seats-big {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.seats-big span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
}

.price-line {
  margin: 8px 0 0;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 22px;
}
.price-line span {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
}

.sheet-total {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.03em;
}

.primary {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  font-weight: 700;
}

.primary:disabled { opacity: 0.45; cursor: default; }

.note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.pan-hint { margin: 8px 2px 0; }
.pan-hint[hidden] { display: none; }

dialog {
  width: min(440px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 22px;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.62); }

dialog h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
}

.form { display: flex; flex-direction: column; gap: 12px; }
.controls input, .form input, .form select, .form textarea, .table-editor input { width: 100%; }
.form textarea { min-height: 88px; resize: vertical; }
.row { display: flex; gap: 8px; }
.ghost, .danger { border-radius: 12px; }
.danger { color: #ffb4b4; border-color: rgba(225, 76, 76, 0.5); }

.success {
  display: none;
  padding: 28px 0 64px;
}
.success.show { display: block; }
.booking.hide { display: none; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge.new { color: #d7defc; }
.badge.reserved { color: var(--gold); }
.badge.paid { color: var(--ok); }
.badge.cancelled { color: var(--muted); }

.board {
  display: grid;
  gap: 12px;
  padding-bottom: 40px;
}

.ticket {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  padding: 16px;
  align-items: center;
}

.ticket h3 { margin: 0; font-family: var(--font-display); font-size: 22px; }
.ticket p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-screen[hidden],
#desk[hidden] { display: none !important; }

.login-card { width: min(420px, 100%); padding: 28px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 16px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 110px;
}
.stat b { display: block; font-family: var(--font-display); font-size: 24px; }
.stat span { color: var(--muted); font-size: 12px; }

.table-editor {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 110px 130px minmax(190px, 1.3fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin: 0 0 22px;
}
.table-editor[hidden] { display: none !important; }
.schedule { padding: 16px 18px 18px; margin: 8px 0 22px; }
.schedule h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
}
.schedule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.schedule-row .primary { width: auto; margin-top: 0; padding-inline: 18px; }
.schedule .field { margin-top: 14px; }
.schedule-row .field { margin-top: 0; }
#dateNote { grid-column: 1 / -1; margin: 0; }
#dateNote[hidden], .zone-paused-note[hidden] { display: none; }
.zone-paused-note { color: #ffb4b4; margin: 8px 0; }
.floor.zone-paused { outline: 1px dashed rgba(225, 76, 76, 0.55); outline-offset: 3px; }
.empty-hall { padding: 28px 8px; }
#desk .floor { margin: 12px 0; }
#desk .table { cursor: grab; }
#desk .table:active { cursor: grabbing; }
.error { color: #ffb4b4; min-height: 1.2em; font-size: 14px; }

@media (max-width: 980px) {
  .controls, .layout, .ticket, .table-editor, .hero { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  body { overflow-x: hidden; }
  .wrap { width: min(1280px, calc(100% - 20px)); }
  .top { padding: 14px 0 4px; }
  .brand { gap: 10px; }
  .brand img { width: 72px; }
  .hero { gap: 14px; padding-top: 10px; }
  .poster { min-height: 0; }
  .poster h2 { font-size: 40px; }
  .controls, .summary, .schedule { padding: 14px; }
  .floor-card { padding: 12px 8px; }
  .controls { margin: 14px 0; }
  .times {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-padding-inline: 8px;
  }
  .chip { min-height: 40px; }
  .seats-big { font-size: 44px; }
  .sheet-total { font-size: 22px; }
  .layout { padding-bottom: 28px; }
  dialog {
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    margin: auto;
    padding: 16px;
    overflow: auto;
  }
  .row { flex-direction: column; }
  .row .primary, .row .ghost { width: 100%; }
  .schedule-row { flex-direction: column; align-items: stretch; }
  .schedule-row .field, .schedule-row input, .schedule-row .primary, .schedule-row .ghost { width: 100%; }
  .ticket h3 { font-size: 18px; }
  input, select, textarea { font-size: 16px; }
}
