:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1f2428;
  --muted: #667078;
  --line: #d9dedb;
  --green: #23835f;
  --amber: #d89a22;
  --blue: #2485a7;
  --red: #b6463b;
  --shadow: 0 12px 30px rgba(31, 36, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aab4af;
}

button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

[hidden] { display: none !important; }
.loginPage { min-height:100vh; display:grid; place-items:center; background:#f3f6f7; }
.loginContent { width:min(100%,440px); padding:32px; }
.loginContent form { margin-top:28px; }
.loginContent button { width:100%; }
#loginMessage { min-height:40px; color:#a43b38; font-size:13px; }
.salesPanel { border-bottom:1px solid var(--line); margin-bottom:20px; padding-bottom:16px; }
.salesPanel > summary { cursor:pointer; padding:8px 0; font-size:19px; font-weight:600; }
.salesPanel[open] > summary { margin-bottom:12px; }
.salesHeading { display:flex; flex-wrap:wrap; align-items:center; gap:14px; }
.salesHeading h2 { font-size:19px; margin:8px 0; }
.salesHeading h3 { font-size:15px; }
.salesHeading label { display:flex; align-items:center; gap:8px; font-size:13px; }
.salesHeading select, .salesHeading input[type=date] { width:auto; }
.salesHeading .toggle { margin:0; }
.salesChartLegend { display:flex; gap:18px; font-size:12px; color:#52616a; }
.salesChart { display:flex; gap:8px; overflow:auto; padding:12px 0; min-height:176px; }
.salesColumn { min-width:85px; flex:0 0 85px; display:flex; flex-direction:column; align-items:center; gap:6px; border:0; border-bottom:1px solid var(--line); border-radius:0; padding:0 6px 6px; font-size:12px; background:transparent; }
.barPair { height:112px; display:flex; align-items:flex-end; gap:4px; }
.saleBar, .releaseBar { width:22px; min-height:2px; background:#218364; }
.releaseBar { background:#8262a6; }
.salesDays { max-height:240px; }
.salesEvents { max-height:230px; }
.salesDays table, .salesEvents table { min-width:560px; }
.liveBand { border-bottom: 1px solid var(--line); padding: 0 0 18px; margin-bottom: 18px; }
.liveHeading { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.liveHeading .toggle { margin: 0; }
.liveHeading a { color: #246e91; }
#liveConnection { color: #23775b; font-size: 13px; }
#liveConnection.connectionError { color: #a43b38; }
#liveTime { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.liveCounts { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.liveCounts div { border-left: 3px solid #c3ccd0; padding-left: 12px; }
.liveCounts span { display: block; font-size: 13px; color: var(--muted); }
.liveCounts strong { display: block; font-size: 26px; margin-top: 6px; }
.liveTools { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.liveTools select { width: 145px; }
.liveTools input[type=search] { flex: 1; min-width: 140px; }
.liveTools label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.liveTools input[type=range] { width: 90px; padding: 0; }
.liveLegend { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 14px; font-size: 12px; }
.liveLegend span { display: flex; align-items: center; gap: 5px; }
.liveLegend i { width: 11px; height: 11px; border-radius: 50%; }
.liveLegend .ourRing { border: 2px solid #168eb5; }
#liveMapScroll { overflow: auto; max-height: 700px; background: #fff; }
#liveCanvas { display: block; cursor: crosshair; }
.liveSeatDetail { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.liveResults { display: flex; gap: 6px; flex-wrap: wrap; max-height: 150px; overflow: auto; padding: 12px 14px; border-top: 1px solid var(--line); }
.liveResults > span { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.liveResults button { min-height: 30px; font-size: 12px; padding: 4px 8px; }
.liveChanges { padding: 0 14px; max-height: 70px; overflow: auto; }
.selectionBar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); }
.seatChosen { outline:2px solid #111; background:#e7eef0; }
button:disabled { opacity:0.45; cursor:default; }
#assignmentMessage { font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.workspace { grid-template-columns: 300px minmax(0, 1fr); }
.tablePanel { grid-column: 1 / -1; }
.panel, .mapArea, .tablePanel { box-shadow: none; }
.row { flex-wrap: wrap; }
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .liveCounts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .liveTools select { width: 100%; }
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.actions,
.row,
.tableTools,
.mapToolbar,
.legend {
  display: flex;
  align-items: center;
  gap: 10px;
}

main {
  padding: 22px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel,
.mapArea,
.tablePanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  background: #f5f7f5;
}

.tab.active {
  border-color: var(--green);
  background: #e6f3ec;
  color: #145a40;
  font-weight: 700;
}

.tabPanel {
  display: none;
}

.tabPanel.active {
  display: block;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span,
.toggle {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.toggle input {
  width: 16px;
}

.mapArea {
  overflow: hidden;
}

.mapToolbar {
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.mapToolbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.reserved,
.pin.unassigned {
  background: var(--amber);
}

.dot.assigned,
.pin.assigned {
  background: var(--green);
}

.dot.external,
.pin.externalSold {
  background: var(--blue);
}

.mapWrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 230px);
  background: #fbfbfa;
}

#seatMap {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.pinLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.pin.selected {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

.tablePanel {
  min-width: 0;
}

.tableTools {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.tableTools input {
  flex: 1;
}

.tableTools select {
  width: 150px;
}

.tableWrap {
  max-height: calc(100vh - 230px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #edf0ee;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f7f5;
  color: #4d5853;
  font-size: 12px;
}

tr.selected {
  background: #fff6df;
}

.status {
  display: inline-flex;
  align-items: center;
  min-width: 66px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  justify-content: center;
}

.status.unassigned {
  background: var(--amber);
}

.status.assigned {
  background: var(--green);
}

.status.externalSold {
  background: var(--blue);
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .tablePanel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .topbar,
  .actions,
  .mapToolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats,
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, .mapArea, .tablePanel { min-width: 0; }

  main {
    padding: 14px;
  }
}
