:root {
  --paper: #f8f1e7;
  --linen: #efe1cf;
  --champagne: #d7bd86;
  --gold: #b98d38;
  --sage: #6f826b;
  --rose: #a86470;
  --ink: #352b26;
  --muted: #786d66;
  --white: #fffaf3;
  --line: rgba(73, 51, 35, 0.16);
  --shadow: 0 22px 60px rgba(71, 47, 31, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(248, 241, 231, 0.9), rgba(239, 225, 207, 0.78)),
    url("https://images.unsplash.com/photo-1523438885200-e635ba2c371e?auto=format&fit=crop&w=2200&q=82")
      center / cover fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page-shell {
  min-height: 100vh;
  padding: 22px;
  backdrop-filter: blur(2px);
}

.topbar,
.stats-strip,
.panel,
.toolbar,
.floor-canvas {
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.86);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 18px 22px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--sage);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

h2 {
  font-size: 1.05rem;
}

.topbar-actions,
.guest-panel-actions,
.toolbar-group,
.form-row,
.quick-seat-grid {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.quick-seat-grid button {
  min-height: 38px;
  border-radius: 8px;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.icon-button {
  width: 40px;
  border: 1px solid rgba(185, 141, 56, 0.28);
  background: rgba(255, 250, 243, 0.72);
  color: var(--gold);
  font-weight: 900;
}

.ghost-button,
.primary-button,
.danger-button,
.quick-seat-grid button {
  padding: 0 14px;
  border: 1px solid rgba(82, 61, 46, 0.16);
}

.primary-button {
  background: var(--ink);
  color: var(--white);
}

.ghost-button,
.quick-seat-grid button {
  background: rgba(255, 250, 243, 0.76);
  color: var(--ink);
}

.danger-button {
  background: rgba(168, 100, 112, 0.1);
  color: #8d3345;
}

.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.danger-button:hover,
.quick-seat-grid button:hover {
  transform: translateY(-1px);
}

.file-button,
.file-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-button input,
.file-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 8px;
}

.stats-strip article {
  padding: 14px 18px;
  background: rgba(255, 250, 243, 0.6);
}

.stats-strip span {
  display: block;
  color: var(--rose);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.stats-strip small {
  color: var(--muted);
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(720px, 1fr) 292px;
  gap: 14px;
  margin-top: 14px;
  transition: grid-template-columns 0.2s ease;
}

.workspace.guests-hidden {
  grid-template-columns: minmax(840px, 1fr) 292px;
}

.workspace.settings-hidden {
  grid-template-columns: 300px minmax(840px, 1fr);
}

.workspace.guests-hidden.settings-hidden {
  grid-template-columns: minmax(980px, 1fr);
}

.workspace.guests-hidden .guest-panel,
.workspace.settings-hidden .settings-panel {
  display: none;
}

.panel {
  height: calc(100vh - 174px);
  min-height: 700px;
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.search-wrap,
.custom-guest-form,
.segmented,
.drop-zone,
.settings-form,
.assigned-list {
  margin: 12px 14px;
}

input,
select {
  width: 100%;
  min-height: 39px;
  border: 1px solid rgba(82, 61, 46, 0.18);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(185, 141, 56, 0.7);
  box-shadow: 0 0 0 3px rgba(185, 141, 56, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(82, 61, 46, 0.07);
}

.segmented button {
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.segmented button.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(71, 47, 31, 0.12);
}

.custom-guest-form {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(111, 130, 107, 0.2);
  border-radius: 8px;
  background: rgba(111, 130, 107, 0.08);
}

.custom-guest-form[hidden] {
  display: none;
}

.custom-guest-row {
  display: grid;
  grid-template-columns: 1fr 62px 76px;
  gap: 8px;
}

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px dashed rgba(168, 100, 112, 0.48);
  border-radius: 8px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
}

.drop-zone.drag-over {
  background: rgba(168, 100, 112, 0.12);
}

.guest-list {
  height: calc(100% - 314px);
  padding: 0 14px 16px;
  overflow: auto;
}

.guest-chip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  width: 100%;
  margin-bottom: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(82, 61, 46, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.78);
  color: var(--ink);
  text-align: left;
}

.guest-chip.assigned {
  opacity: 0.55;
}

.guest-name {
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-meta {
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.floor-section {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 62px;
  padding: 10px;
  border-radius: 8px;
}

.toolbar-group {
  flex-wrap: wrap;
}

.version-group {
  min-width: 320px;
  justify-content: flex-end;
}

.version-group select {
  width: 150px;
}

.version-group input {
  width: 170px;
}

.draw-help {
  display: none;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(111, 130, 107, 0.16);
  color: #445640;
  font-size: 0.85rem;
  font-weight: 800;
}

.draw-help.active {
  display: block;
}

.floor-canvas {
  position: relative;
  height: calc(100vh - 250px);
  min-height: 640px;
  margin-top: 14px;
  overflow: auto;
  border-radius: 8px;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(135deg, rgba(239, 225, 207, 0.92), rgba(248, 241, 231, 0.88));
}

.floor-stage {
  position: relative;
  width: 1380px;
  height: 940px;
  min-height: 100%;
}

.panel-toggle-button {
  min-width: 82px;
}

.panel-toggle-button.active {
  border-color: rgba(111, 130, 107, 0.36);
  background: rgba(111, 130, 107, 0.14);
  color: #445640;
}

.floor-photo {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    linear-gradient(rgba(255, 250, 243, 0.58), rgba(255, 250, 243, 0.78)),
    url("https://images.unsplash.com/photo-1519225421980-715cb0215aed?auto=format&fit=crop&w=1800&q=75")
      center / cover;
}

.floor-photo.custom {
  opacity: 0.42;
}

.hall-svg,
.tables-layer {
  position: absolute;
  inset: 0;
}

.hall-svg {
  pointer-events: none;
}

.floor-canvas.draw-mode .hall-svg {
  pointer-events: auto;
}

.table-wrap {
  position: absolute;
  width: var(--wrap-width);
  height: var(--wrap-height);
  transform: translate(-50%, -50%);
  user-select: none;
}

.table-wrap.selected {
  z-index: 20;
}

.table-core {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--table-width);
  height: var(--table-height);
  padding: 14px;
  border: 1px solid rgba(185, 141, 56, 0.34);
  border-radius: var(--table-radius);
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.9), rgba(250, 240, 226, 0.92) 52%, rgba(225, 204, 174, 0.92)),
    var(--white);
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.38),
    0 18px 32px rgba(66, 45, 30, 0.2);
  transform: translate(-50%, -50%);
  cursor: grab;
}

.table-wrap.selected .table-core {
  outline: 3px solid rgba(168, 100, 112, 0.28);
}

.table-core:active {
  cursor: grabbing;
}

.table-name {
  max-width: 84%;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-role {
  max-width: 84%;
  overflow: hidden;
  margin-top: 2px;
  color: var(--sage);
  font-size: 0.54rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.floral-piece {
  display: flex;
  gap: 2px;
  margin-top: 6px;
}

.floral-piece span {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #fbf2e2;
  box-shadow:
    8px 0 0 #d8a7a9,
    16px 0 0 #efe7d3,
    24px 0 0 #8b9a78;
}

.plate {
  position: absolute;
  left: var(--seat-x);
  top: var(--seat-y);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--seat-size);
  height: var(--seat-size);
  border: 1px solid rgba(82, 61, 46, 0.2);
  border-radius: 999px;
  background:
    radial-gradient(circle, #fffdf7 0 42%, #ded0bd 43% 48%, #fff7ec 49% 100%);
  box-shadow: 0 7px 18px rgba(66, 45, 30, 0.14);
  transform: translate(-50%, -50%);
}

.plate::before,
.plate::after {
  position: absolute;
  top: 50%;
  width: 2px;
  height: calc(var(--seat-size) * 0.58);
  border-radius: 99px;
  background: rgba(185, 141, 56, 0.78);
  content: "";
  transform: translateY(-50%);
}

.plate::before {
  left: -5px;
}

.plate::after {
  right: -5px;
}

.seat-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--seat-size) - 8px);
  height: calc(var(--seat-size) - 8px);
  border: 1px dashed rgba(82, 61, 46, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.78);
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 900;
  text-align: center;
}

.seat-drop.has-guest {
  border-style: solid;
  background: linear-gradient(135deg, #fff9ed, #f4dfd4);
  color: var(--ink);
}

.seat-drop.drag-over {
  background: rgba(111, 130, 107, 0.18);
  border-color: rgba(111, 130, 107, 0.78);
}

.seat-name {
  display: -webkit-box;
  max-width: calc(var(--seat-size) - 14px);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 18px 14px;
  padding: 28px 16px;
  border: 1px dashed rgba(82, 61, 46, 0.18);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-form[hidden],
.empty-state[hidden] {
  display: none;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.quick-seat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.assigned-list {
  height: calc(100% - 430px);
  overflow: auto;
}

.assigned-person {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.75);
}

.assigned-person strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assigned-person button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(168, 100, 112, 0.1);
  color: #8d3345;
}

.print-page {
  display: none;
}

@media (max-width: 1180px) {
  body {
    min-width: 1000px;
  }

  .workspace {
    grid-template-columns: 270px minmax(620px, 1fr) 260px;
  }

  .workspace.guests-hidden {
    grid-template-columns: minmax(720px, 1fr) 260px;
  }

  .workspace.settings-hidden {
    grid-template-columns: 270px minmax(720px, 1fr);
  }

  .workspace.guests-hidden.settings-hidden {
    grid-template-columns: minmax(860px, 1fr);
  }
}

@media print {
  body {
    min-width: 0;
    background: #fff;
  }

  .page-shell {
    display: none;
  }

  .print-page {
    display: block;
    color: #211b17;
  }

  .print-cover {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #d7bd86;
  }

  .print-cover p {
    margin: 0;
    color: #6f826b;
    font-weight: 900;
    text-transform: uppercase;
  }

  .print-cover h2 {
    margin: 4px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 28px;
  }

  #printVisual {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
  }

  .print-table {
    break-inside: avoid;
    border: 1px solid #d9c9af;
    border-radius: 8px;
    padding: 9px;
  }

  .print-table strong {
    display: block;
    margin-bottom: 5px;
    font-family: Georgia, "Times New Roman", serif;
  }

  #printLists {
    columns: 2;
    column-gap: 22px;
  }

  .print-list {
    break-inside: avoid;
    margin: 0 0 14px;
  }

  .print-list h3 {
    margin: 0 0 6px;
    font-size: 14px;
  }

  .print-list ol {
    margin: 0;
    padding-left: 20px;
    font-size: 11px;
  }
}
