:root {
  color-scheme: light;
  --blue: #156aaf;
  --surface: #f2f2f2;
  --ink: #262626;
  --muted: color-mix(in srgb, var(--ink) 72%, var(--surface));
  --line: color-mix(in srgb, var(--ink) 18%, var(--surface));
  --blue-wash: color-mix(in srgb, var(--blue) 7%, var(--surface));
  --blue-line: color-mix(in srgb, var(--blue) 36%, var(--surface));
  font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 13px;
  background: var(--surface);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--blue); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.primary { color: var(--surface); background: var(--blue); border-color: var(--blue); border-radius: 999px; padding-inline: 21px; }
.primary:hover { background: color-mix(in srgb, var(--blue) 90%, var(--ink)); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 21px; font-weight: 650; letter-spacing: -.045em; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
nav button { min-height: 36px; font-size: 13px; }
nav button:not(.primary) { background: transparent; border-color: transparent; }
nav button:not(.primary):hover:not(:disabled) { background: var(--blue-wash); color: var(--blue); }
nav .primary { margin-inline-start: 8px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(215px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4vw, 64px);
  width: min(100%, 1450px);
  margin-inline: auto;
  padding: clamp(30px, 4vw, 58px) clamp(18px, 4vw, 58px) 24px;
  flex: 1;
}
.panel { min-width: 0; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.04em; }
.plan h2 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.055em; line-height: 1.13; }
.roster .panel-heading { padding: 5px 0 15px; border-bottom: 1px solid var(--line); }
.pill { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hint { margin: 12px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.teams { max-height: 68vh; overflow: auto; padding: 4px 3px 12px; }
.team + .team { border-top: 1px solid var(--line); margin-top: 12px; }
.team h3 { padding: 12px 4px 8px; font-size: 14px; font-weight: 650; }
.empty { padding: 2px 4px; color: var(--muted); font-size: 13px; }
.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-bottom: 5px;
  background: var(--blue-wash);
  border-color: transparent;
  text-align: left;
  font-size: 13px;
  cursor: grab;
}
.person small { color: var(--muted); text-align: right; }
.person span, .person small, .table-top strong, .seat { overflow-wrap: anywhere; }

.floor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 310px));
  justify-content: center;
  gap: clamp(26px, 4vw, 52px);
  padding: clamp(22px, 4vw, 52px) clamp(12px, 4vw, 48px);
  border-radius: 18px;
  background: var(--blue-wash);
}
.table-unit { display: grid; grid-template: 1fr auto 1fr / minmax(0, 1fr); gap: 8px; }
.table-top {
  display: grid;
  place-content: center;
  gap: 6px;
  width: 100%;
  min-height: 88px;
  border-color: var(--blue-line);
  border-radius: 12px;
  text-align: center;
}
.table-top strong { font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.table-top small { color: var(--muted); font-size: 12px; }
.seat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(64px, 100%), 1fr));
  align-content: end;
  gap: 6px;
  padding-inline: 7px;
}
.seat-row:last-child { align-content: start; }
.seat-wrap { min-width: 0; display: flex; gap: 2px; }
.seat {
  position: relative;
  width: 100%;
  min-height: 35px;
  padding: 8px 3px 4px;
  border-color: var(--blue-line);
  border-radius: 10px 10px 5px 5px;
  font-size: 11px;
}
.seat::before {
  content: "";
  position: absolute;
  inset: 3px 7px auto;
  border-top: 2px solid var(--blue-line);
  border-radius: 2px;
  pointer-events: none;
}
.seat-row:last-child .seat { padding: 4px 3px 8px; border-radius: 5px 5px 10px 10px; }
.seat-row:last-child .seat::before { inset: auto 7px 3px; }
.seat.occupied { background: var(--blue); border-color: var(--blue); color: var(--surface); cursor: grab; }
.seat.occupied::before { border-color: var(--surface); }
.release { padding: 3px; font-size: 12px; }
.selected { outline: 2px solid var(--blue); outline-offset: 1px; }
.drop-ready { outline: 1px dashed var(--blue); outline-offset: 1px; }
.drop-over { outline: 2px solid var(--blue); outline-offset: 2px; }
.table-top.drop-over { background: var(--blue); color: var(--surface); }
.table-top.drop-over small { color: var(--surface); }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px clamp(18px, 4vw, 58px) 18px;
  color: var(--muted);
  font-size: 13px;
}
dialog {
  width: min(550px, 95vw);
  max-height: 85dvh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop { background: color-mix(in srgb, var(--ink) 54%, transparent); }
.dialog-heading, .dialog-actions { display: flex; align-items: center; }
.dialog-heading { justify-content: space-between; margin-bottom: 12px; }
.dialog-actions { justify-content: flex-end; gap: 8px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 9px; margin: 10px 0; }
label { display: grid; gap: 4px; margin: 5px 0; font-size: 13px; }
input, select { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
#settings-message { margin: 8px 0; font-size: 13px; }
[data-person] { user-select: none; }
.dragging [data-person] { cursor: grabbing; }
.drag-preview {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: min(285px, 60vw);
  overflow-wrap: anywhere;
  padding: 8px 14px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue-wash);
  font-size: 13px;
  font-weight: 600;
}
.drag-preview small { color: var(--muted); text-align: right; font-weight: 400; }
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .teams { max-height: 32vh; }
}
@media (max-width: 480px) {
  .floor { grid-template-columns: minmax(0, 310px); }
}
