﻿:root {
  --bg: #f5efe7;
  --paper: #fffaf4;
  --surface: #fff;
  --ink: #2f2a26;
  --muted: #7b6e63;
  --accent: #c26a58;
  --accent-soft: #f2d5cb;
  --line: #e6d8c8;
  --seat: #fff;
  --seat-filled: #ffe8df;
  --table-bg: radial-gradient(circle at 35% 25%, #fff, #f7e9dc);
  --table-dash: #e0cdbc;
  --table-center-bg: #f1d2c6;
  --table-center-ink: #6d4437;
  --table-center-line: #dfb7a8;
  --seat-line: #d9c0af;
  --seat-filled-line: #dca796;
  --drop-ring: #eeb8a7;
  --focus-ring: #ecb8a9;
  --page-bg:
    radial-gradient(circle at 15% 10%, #fff6ee 0 18%, transparent 19%),
    radial-gradient(circle at 90% 20%, #f9e4da 0 16%, transparent 17%),
    linear-gradient(160deg, #f7efe4 0%, #f3e8db 100%);
  --shadow: 0 10px 28px rgba(63, 38, 22, 0.12);
}

[data-theme="dark"] {
  --bg: #121212;
  --paper: #1f1f1f;
  --surface: #272727;
  --ink: #f1e9df;
  --muted: #b7a89a;
  --accent: #e08e79;
  --accent-soft: #3a2b24;
  --line: #3c312a;
  --seat: #2d2d2d;
  --seat-filled: #4a3128;
  --table-bg: radial-gradient(circle at 35% 25%, #2f2f2f, #262626);
  --table-dash: #6a5246;
  --table-center-bg: #6b4437;
  --table-center-ink: #f6dfd2;
  --table-center-line: #8b6354;
  --seat-line: #6f5a4f;
  --seat-filled-line: #9f725f;
  --drop-ring: #d58a73;
  --focus-ring: #d58a73;
  --page-bg:
    radial-gradient(circle at 12% 12%, #2f2420 0 20%, transparent 21%),
    radial-gradient(circle at 86% 18%, #2b1f1b 0 18%, transparent 19%),
    linear-gradient(160deg, #171616 0%, #111111 100%);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 18px;
  padding: 16px;
}

.bank-panel,
.chart-area {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.bank-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  height: calc(100vh - 32px);
  min-height: 0;
}

.panel-head h1 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.field-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}

input:focus-visible,
button:focus-visible,
.seat:focus-visible,
.attendee-chip:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

button:not(.seat):active {
  transform: translateY(1px);
}

.ghost-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}

.counts {
  font-size: 0.84rem;
  color: var(--muted);
}

.attendee-bank {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.attendee-bank.drop-hover {
  box-shadow: inset 0 0 0 3px var(--drop-ring);
}

.attendee-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  font-size: 0.92rem;
}

.attendee-chip.dragging {
  opacity: 0.65;
}

.chart-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 32px);
  min-height: 0;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.tables-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 8px;
  align-content: start;
}

.table-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 2px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.table-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--table-center-ink);
}

.round-table {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 2px dashed var(--table-dash);
  background: var(--table-bg);
}

.table-center {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--table-center-bg);
  color: var(--table-center-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid var(--table-center-line);
}

.seat {
  position: absolute;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--seat-line);
  background: var(--seat);
  transform: translate(-50%, -50%);
  font-size: 0.62rem;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  touch-action: none;
  white-space: pre-line;
  display: grid;
  place-items: center;
}

.seat.empty {
  color: transparent;
}

.seat.filled {
  width: 52px;
  min-height: 34px;
  height: auto;
  border-radius: 12px;
  padding: 3px 4px;
  background: var(--seat-filled);
  color: var(--table-center-ink);
  border-color: var(--seat-filled-line);
  font-weight: 600;
}

.seat.drop-hover {
  box-shadow: 0 0 0 3px var(--drop-ring);
}

@media (max-width: 960px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .bank-panel {
    height: auto;
    max-height: 42vh;
  }

  .chart-area {
    height: auto;
  }

  .chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tables-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}
