:root {
  /* Brand palette (yours) */
  --color-blue-dark: #0a1f3a;
  --color-blue-mid: #1e3a5f;
  --color-gold: #f5c242;
  --color-gold-dark: #d1a21a;
  --color-text-light: #f4f9ff;
  --color-text-dark: #0a1f3a;
  --color-gray-light: #eaecef;
  --color-gray-mid: #bdc3cc;

  --elev-1: 0 6px 20px rgba(0, 0, 0, 0.25);

  /* App theme */
  --bg: var(--color-blue-dark);
  --surface: var(--color-blue-mid);
  --surface-2: #173456;
  --text: var(--color-text-light);
  --muted: #cfe0ffcc;
  --accent: var(--color-gold);
  --accent-2: var(--color-gold-dark);
  --danger: #e65a5a;
  --ok: #2db974;
  --seat-bg: #fff1bf;

  --radius: 12px;
  --gutter: 12px;
  --sidebar-w: 320px;

  /* Seat width stored as vw in state; CSS var used when rendering */
  --seat-size-vw: 8;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  display: grid;
  grid-template-rows: auto auto 1fr auto; /* navbar | tabs | main | footer */
}

/* Tabs */
.topbar {
  width: 96vw;
  margin: 6px auto 0;
  display: flex;
  justify-content: center;
}
.tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
.tab {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.tab.active {
  background: var(--accent);
  color: var(--color-text-dark);
  border-color: transparent;
}

/* Main 2-col layout */
.shell {
  width: 96vw;
  margin: 8px auto;
  display: grid;
  gap: var(--gutter);
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 220px); /* leave space for navbar/tabs/footer */
}

/* Sidebar — single, shared */
.sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--elev-1);
  overflow: auto;
}
.sidebar .section {
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.sidebar h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
}
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row + .row {
  margin-top: 6px;
}
.spacer {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: var(--elev-1);
  background: var(--accent);
  color: var(--color-text-dark);
  font-weight: 700;
}
.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: none;
  color: var(--text);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.ok {
  background: var(--ok);
  color: #fff;
}

input,
select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--color-gray-mid);
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
}

/* Stage & panels */
.stage {
  min-width: 0;
}
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--elev-1);
  overflow: hidden;
  padding: 10px;
  min-height: 60vh;
}
.panel.hidden {
  display: none;
}
.placeholder {
  color: var(--muted);
  opacity: 0.9;
  display: grid;
  place-items: center;
  height: 60vh;
}

/* Canvas */
.canvas {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 420px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  overflow: hidden;
}

/* Seat cards (2:3 height:width) with centered big name */
.seat {
  position: absolute;
  width: calc(var(--seat-size-vw) * 1vw);
  aspect-ratio: 3 / 2; /* width : height */
  background: var(--seat-bg);
  border: 2px solid var(--accent);
  border-radius: 12px;
  color: #1a1a1a;
  display: grid;
  grid-template-rows: auto 1fr;
  touch-action: none;
  user-select: none;
  box-shadow: var(--elev-1);
}
.seat .seat-handle {
  font-size: 12px;
  color: #333;
  padding: 4px 8px;
  opacity: 0.7;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.15);
}
.seat .name {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6px 8px;
  font-size: clamp(14px, 1.3vw, 22px); /* large name in the middle */
  font-weight: 800;
}
.seat.selected {
  outline: 2px solid var(--accent-2);
  outline-offset: -2px;
}
.seat.swap-target {
  outline: 3px solid var(--ok);
  outline-offset: -2px;
}
.seat.dragging {
  opacity: 0.9;
  cursor: grabbing;
}

/* Modal for groups */
.modal {
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  width: min(840px, 92vw);
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.modal-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  justify-content: flex-end;
}
.modal-body {
  padding: 12px 16px;
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
}
.label {
  font-size: 12px;
  color: var(--muted);
}
.names-list {
  display: grid;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
}
.name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.name-row .del {
  width: 44px;
}
.name-row .add {
  width: 44px;
}

/* Footer */
.site-footer {
  width: 96vw;
  margin: 8px auto 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
