/* PlanMySeats. Look: wedding stationery. Cream paper, ink outlines with a hard
   offset shadow, one warm accent, a grotesque for the interface and an italic
   serif for the words that matter. The canvas reads as a venue floor plan. */

@font-face {
  font-family: "Bricolage";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
}

:root {
  --paper: #f6f0e4;
  --card: #fffdf7;
  --ink: #1c2622;
  --muted: #5f6a64;
  --line: #d8cfbd;
  --shade: #e3d7bf;
  --edge: #1c2622;
  --accent: #c4472d;
  --accent-dark: #a83a23;
  --accent-soft: #fbe6dd;
  --ok: #2e7353;
  --ok-soft: #dff0e6;
  --gold: #e3aa2f;
  --gold-soft: #fdf1cf;
  --bad: #b3261e;
  --bad-soft: #fbe4e1;
  --cloth: #f3eadb;
  --cloth-line: #c7b697;
  --stage: #fffdf8;
  --grid: rgba(28, 38, 34, .05);
  --grid2: rgba(28, 38, 34, .09);
  --sans: "Bricolage", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  font: 500 15px/1.5 var(--sans);
  background-color: var(--paper);
  /* paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent-dark); text-underline-offset: 3px; }

/* ---------- top bar ---------- */
header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 24px;
  border-bottom: 1.5px solid var(--edge);
}

header.top .brand a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.logo { flex: none; display: block; }
.wm { font: 800 19px/1 var(--sans); letter-spacing: -0.03em; }
.wm b { font: italic 400 1.22em/1 var(--serif); letter-spacing: 0; color: var(--accent); padding: 0 1px; }

header.top nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
header.top nav a { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
header.top nav a:hover { text-decoration: underline; }
header.top nav a.lang {
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}
header.top nav a.lang:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* ---------- buttons and fields ---------- */
button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: 650 14px/1.2 var(--sans);
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 11px;
  padding: 9px 13px;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--edge); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }

.btn.primary { background: var(--accent); color: #fff; box-shadow: 2px 2px 0 var(--edge); }
.btn.primary:hover { background: var(--accent-dark); box-shadow: 3px 3px 0 var(--edge); }
.btn.primary:active { box-shadow: none; }
.btn.gold { background: var(--gold-soft); }
.btn.icon { width: 38px; height: 38px; padding: 0; }
.btn.wide { width: 100%; }

.linkbtn {
  border: 0;
  background: none;
  padding: 4px 2px;
  font-weight: 650;
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--ink); }

textarea, input[type="text"], input[type="search"], select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--edge);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 104px; resize: vertical; display: block; }
select { min-width: 0; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.muted.ok { color: var(--ok); font-weight: 650; }
.muted.bad { color: var(--bad); font-weight: 650; }

/* ---------- hero: title on the left, live checklist on the right ---------- */
.hero {
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 24px 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px 48px;
}

.hero h1 {
  font: 800 clamp(30px, 3.7vw, 54px)/1.02 var(--sans);
  letter-spacing: -0.035em;
  margin: 0 0 10px;
  text-wrap: balance;
}

.hero h1 em {
  font: italic 400 1.13em/0.9 var(--serif);
  letter-spacing: -0.01em;
  color: var(--accent);
  padding-bottom: .1em;
  /* hand-drawn underline */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8c30-6 52 5 82 0s50-7 78-1 26 2 36-1' fill='none' stroke='%23e3aa2f' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") bottom / 100% .22em no-repeat;
}

.hero .sub { margin: 0; color: var(--muted); font-size: 16px; max-width: 60ch; }

.steps {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}

.steps li { position: relative; width: 132px; padding-right: 12px; }
.steps li:last-child { width: auto; padding-right: 0; }
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 34px;
  right: 6px;
  top: 14px;
  border-top: 1.5px dashed var(--cloth-line);
}

.node {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 750 13px/1 var(--sans);
  background: var(--card);
  border: 1.5px solid var(--edge);
  transition: background .2s, transform .2s;
}
.node svg { display: none; width: 16px; height: 16px; }
.steps li.now .node {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.steps li.done .node { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.done .node span { display: none; }
.steps li.done .node svg { display: block; }
.steps li b { display: block; margin-top: 7px; font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.steps li i { display: block; min-height: 18px; font: italic 400 15px/1.2 var(--serif); color: var(--muted); }
.steps li.done i { color: var(--ok); }

/* ---------- editor layout ---------- */
main.layout {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 24px 30px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-areas: "guests work" "plan work";
  grid-template-rows: auto 1fr;
  gap: 20px;
  align-items: start;
}
.guests { grid-area: guests; }
.work { grid-area: work; min-width: 0; }
.plan { grid-area: plan; }

@media (min-width: 1700px) {
  .hero, main.layout { max-width: 1800px; }
  main.layout {
    grid-template-columns: 300px minmax(0, 1fr) 284px;
    grid-template-areas: "guests work plan";
    grid-template-rows: auto;
  }
}

.panel {
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shade);
  padding: 16px;
}

.panel h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  font: 800 18px/1.2 var(--sans);
  letter-spacing: -0.02em;
}
.panel h2 .count { font: italic 400 22px/1 var(--serif); letter-spacing: 0; color: var(--accent); }

.sec {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 10px;
  font: 700 11px/1 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.sec::after { content: ""; flex: 1; border-top: 1.5px solid var(--line); }

/* guests panel */
.composer .muted { margin: 8px 0 0; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 18px 0 10px;
  border: 1.5px solid var(--edge);
  border-radius: 11px;
  overflow: hidden;
}
.tabs button {
  border: 0;
  background: none;
  padding: 7px 6px;
  font: 650 13px/1.2 var(--sans);
}
.tabs button + button { border-left: 1.5px solid var(--edge); }
.tabs button b { font: italic 400 15px/1 var(--serif); margin-left: 3px; }
.tabs button.on { background: var(--ink); color: var(--paper); }

#search { margin-bottom: 8px; }

#pool { max-height: 372px; overflow: auto; margin: 0 -6px; padding: 0 2px; }
#pool > p { margin: 6px 6px 4px; }

.chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  font: 550 14px/1.25 var(--sans);
  cursor: grab;
}
.chip:hover { background: var(--accent-soft); }
.chip.sel { background: var(--ink); color: var(--paper); }
.chip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .note {
  flex: none;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #5d4708;
  font-size: 11px;
  font-weight: 650;
}
.chip .where { flex: none; font: italic 400 15px/1 var(--serif); color: var(--muted); }
.chip.sel .where { color: inherit; }
.chip .x, .x {
  flex: none;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: none;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.chip .x { opacity: 0; }
.chip:hover .x, .chip.sel .x { opacity: 1; }
.x:hover { background: var(--bad-soft); color: var(--bad); }

.av {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font: 750 10.5px/1 var(--sans);
  letter-spacing: .02em;
}

#autoSeat { margin-top: 12px; }

/* work area */
.workbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }

.docname {
  flex: 1 1 220px;
  width: auto !important;
  min-width: 0;
  border: 0 !important;
  border-bottom: 1.5px dashed var(--cloth-line) !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  padding: 0 2px 4px !important;
  font: italic 400 32px/1.15 var(--serif) !important;
}
.docname::placeholder { color: #a39c8c; }
.docname:focus { border-bottom-color: var(--accent) !important; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.toolbar .push { margin-left: auto; }

.dock {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 6px 4px 14px;
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shade);
}
.dock .lbl {
  margin-right: 6px;
  white-space: nowrap;
  font: 700 11px/1 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.dock button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  background: none;
  padding: 7px 11px;
  font: 650 13.5px/1 var(--sans);
}
.dock button:hover { background: var(--accent-soft); }
.dock button:active { background: var(--cloth); }

.shape {
  flex: none;
  width: 18px;
  height: 18px;
  background: var(--cloth);
  border: 1.5px solid var(--edge);
}
.shape.round { border-radius: 50%; }
.shape.rect { width: 26px; height: 13px; border-radius: 4px; }
.shape.head { width: 26px; height: 9px; border-radius: 3px; background: var(--gold-soft); }

.hint { margin: 0 0 8px; min-height: 20px; color: var(--muted); font-size: 13.5px; }
.hint.on { color: var(--accent-dark); font-weight: 700; }

.stage-frame {
  position: relative;
  border: 1.5px solid var(--edge);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shade);
  background: var(--stage);
  overflow: hidden;
}
.stage-wrap { overflow: auto; }
/* .stage-inner takes the scaled size; .stage-zoom holds the room at its real
   1000px and is scaled to fit the column (app.js, fit) */
.stage-inner { position: relative; width: 1000px; overflow: hidden; }
.stage-zoom { width: 1000px; transform-origin: 0 0; }

/* the room: architect paper with the walls drawn in */
#stage {
  position: relative;
  width: 1000px;
  height: 680px;
  background:
    linear-gradient(var(--grid2) 1px, transparent 1px) 0 0 / 100px 100px,
    linear-gradient(90deg, var(--grid2) 1px, transparent 1px) 0 0 / 100px 100px,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--stage);
}
#stage::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid var(--cloth-line);
  border-radius: 8px;
  opacity: .6;
  pointer-events: none;
}

.table {
  position: absolute;
  background: radial-gradient(circle at 34% 28%, #fff 0, var(--cloth) 72%);
  border: 1.5px solid var(--edge);
  box-shadow: 0 3px 0 var(--cloth-line), 0 14px 18px -10px rgba(28, 38, 34, .35);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow .15s;
}
.table::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(28, 38, 34, .22);
  border-radius: inherit;
  pointer-events: none;
}
.table.round { border-radius: 50%; }
.table.rect, .table.head { border-radius: 12px; }
.table.head { background: radial-gradient(circle at 34% 28%, #fff 0, var(--gold-soft) 80%); }
.table.done { background: radial-gradient(circle at 34% 28%, #fff 0, var(--ok-soft) 78%); border-color: var(--ok); box-shadow: 0 3px 0 #a9cdb8, 0 14px 18px -10px rgba(28, 38, 34, .35); }
.table.warn, .table.warn.done { background: radial-gradient(circle at 34% 28%, #fff 0, var(--bad-soft) 78%); border-color: var(--bad); box-shadow: 0 3px 0 #e2a9a3, 0 14px 18px -10px rgba(28, 38, 34, .35); }
.table.sel { outline: 3px solid var(--accent); outline-offset: 4px; }
.table.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 3px 0 var(--cloth-line), 0 26px 30px -12px rgba(28, 38, 34, .5); }
.table.flash { animation: flash .9s ease 2; }

@keyframes flash {
  50% { outline: 4px solid var(--gold); outline-offset: 8px; }
}

.table .tag {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}
.table .tag b {
  display: block;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  font: italic 400 18px/1.05 var(--serif);
}
.table .tag i { font: 700 10px/1 var(--sans); font-style: normal; letter-spacing: .06em; color: var(--muted); }
.table.done .tag i { color: var(--ok); }
.table.warn .tag i { color: var(--bad); }

.seat {
  position: absolute;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px dashed var(--cloth-line);
  background: var(--card);
  color: var(--muted);
  font: 750 10.5px/1 var(--sans);
  letter-spacing: .02em;
  transition: transform .12s ease, border-color .12s ease;
  z-index: 2;
}
.seat:not(.full)::before { content: "+"; font-size: 15px; font-weight: 500; opacity: 0; transition: opacity .12s; }
.seat:not(.full):hover { border-style: solid; border-color: var(--accent); color: var(--accent); transform: scale(1.12); }
.seat:not(.full):hover::before { opacity: 1; }
.seat.full {
  border: 2px solid #fff;
  color: #fff;
  box-shadow: 0 0 0 1.5px var(--edge), 0 3px 6px rgba(28, 38, 34, .3);
}
.seat.full:hover { transform: scale(1.1); }
.seat.pop { animation: pop .32s cubic-bezier(.3, 1.6, .5, 1); }
.seat.noted::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid var(--edge);
}
.seat.sel { border: 2px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); }
.seat.over { background: var(--accent); border-color: var(--accent); }

@keyframes pop {
  0% { transform: scale(.3); }
  100% { transform: scale(1); }
}

#stage.picking .seat:not(.full) {
  border-style: solid;
  border-color: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 71, 45, .45); }
  50% { box-shadow: 0 0 0 6px rgba(196, 71, 45, 0); }
}

/* popover of the selected table */
.pop {
  position: absolute;
  z-index: 8;
  width: 264px;
  padding: 12px;
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--edge);
}
.pop label { display: block; margin-bottom: 4px; font: 700 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pop .line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-weight: 650; font-size: 14px; }
.pop .count { display: inline-flex; align-items: center; gap: 6px; }
.pop .count button { width: 30px; height: 30px; padding: 0; font-size: 17px; }
.pop .count b { min-width: 22px; text-align: center; font-size: 16px; }
.pop ul { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1.5px solid var(--line); max-height: 150px; overflow: auto; }
.pop li { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 13.5px; }
.pop li span.nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .del { margin-top: 10px; color: var(--bad); }

/* empty room */
.empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
.empty > * { pointer-events: auto; }
.empty h3 { margin: 0 0 6px; font: italic 400 38px/1.05 var(--serif); }
.empty p { margin: 0 0 18px; max-width: 440px; color: var(--muted); }
.empty .cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 18px; }
.empty .card {
  flex-direction: column;
  gap: 4px;
  width: 150px;
  padding: 14px 12px 12px;
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shade);
}
.empty .card:hover { box-shadow: 5px 5px 0 var(--edge); }
.empty .card svg { width: 96px; height: 56px; margin-bottom: 6px; }
.empty .card strong { font: 800 16px/1.1 var(--sans); letter-spacing: -0.02em; }
.empty .card small { font: italic 400 15px/1.1 var(--serif); color: var(--muted); }
.empty .or { margin: 10px 0 0; font-size: 13px; }

.under { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 10px 2px 0; }
.under p { margin: 0; }

/* plan panel */
.ringrow { display: flex; align-items: center; gap: 14px; }
.ring { position: relative; flex: none; width: 86px; height: 86px; }
.ring svg { width: 86px; height: 86px; display: block; }
.ring circle { fill: none; stroke-width: 8; }
.ring .bg { stroke: var(--cloth); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 207.35; stroke-dashoffset: 207.35; transition: stroke-dashoffset .4s ease, stroke .3s; }
.ring.done .fg { stroke: var(--ok); }
.ring .txt { position: absolute; inset: 0; display: grid; place-items: center; font: 800 22px/1 var(--sans); letter-spacing: -0.03em; }
.ring .txt small { font: italic 400 15px/1 var(--serif); letter-spacing: 0; color: var(--muted); }
#progressText { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }

#stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 6px; margin-top: 16px; }
.stat { text-align: left; padding-left: 9px; border-left: 2px solid var(--line); }
.stat b { display: block; font: 800 20px/1.1 var(--sans); letter-spacing: -0.03em; }
.stat span { font: 650 10px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.rulebox { display: grid; gap: 6px; }
#rules { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13.5px; }
#rules li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 0; border-top: 1.5px solid var(--line); }
#rules li.bad { color: var(--bad); font-weight: 700; }
#rulesState { margin: 10px 0 0; }

.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.extras .btn { padding: 9px 6px; font-size: 13px; text-align: center; text-decoration: none; }
.extras .btn:nth-child(3):last-child { grid-column: 1 / -1; }
.modal-box .extras { margin: 10px 0 4px; }

/* ---------- floating bits ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 24px);
  padding: 10px 16px;
  border: 1.5px solid var(--edge);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 3px 3px 0 var(--shade);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#tip {
  position: absolute;
  z-index: 70;
  transform: translate(-50%, -100%);
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(28, 38, 34, .5);
}
.modal-box {
  width: 100%;
  max-width: 450px;
  padding: 22px 24px;
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 18px;
  box-shadow: 7px 7px 0 var(--edge);
}
.modal-box h2 { margin: 0 0 8px; font: 800 22px/1.15 var(--sans); letter-spacing: -0.02em; }
.modal-box ul { margin: 8px 0 12px; padding-left: 20px; }
.modal-box li { margin: 4px 0; }

.confetti { position: fixed; inset: 0; z-index: 80; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  animation: fall 2.3s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes fall {
  to { transform: translate(var(--dx), 108vh) rotate(var(--rot)); opacity: .85; }
}

#legend, #printTitle { display: none; }

/* ---------- reading pages and the text under the editor ---------- */
.doc {
  max-width: 780px;
  margin: 34px auto 48px;
  padding: 0 22px;
  font-size: 16px;
  line-height: 1.62;
}
.doc h1 { font: 800 clamp(30px, 4.4vw, 46px)/1.05 var(--sans); letter-spacing: -0.035em; margin: 0 0 16px; text-wrap: balance; }
.doc h2 { font: 800 25px/1.2 var(--sans); letter-spacing: -0.025em; margin: 40px 0 12px; }
.doc h2::before { content: ""; display: block; width: 38px; height: 4px; margin-bottom: 12px; border-radius: 2px; background: var(--accent); }
.doc h3 { font: 700 17.5px/1.3 var(--sans); letter-spacing: -0.01em; margin: 24px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 7px; }
.doc ol { list-style: none; padding-left: 0; counter-reset: n; }
.doc ol li { position: relative; padding-left: 44px; counter-increment: n; }
.doc ol li::before { content: counter(n); position: absolute; left: 0; top: -5px; width: 32px; font: italic 400 30px/1.1 var(--serif); color: var(--accent); text-align: center; }

/* drawing of a layout, made by app.js with the editor's own geometry */
.preview {
  display: block;
  margin: 20px 0 8px;
  padding: 16px;
  border: 1.5px solid var(--edge);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shade);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--stage);
}
.preview:hover { box-shadow: 7px 7px 0 var(--edge); }
.pv { display: block; width: 100%; max-height: 300px; }
.pv-table { fill: var(--cloth); stroke: var(--edge); stroke-width: 1.5; }
.pv-table.head { fill: var(--gold-soft); }
.pv-seat { fill: var(--card); stroke: var(--cloth-line); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pv-num { font: italic 400 26px var(--serif); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }

.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; margin: 20px 0 24px; }
.tcard {
  display: block;
  padding: 12px 12px 14px;
  border: 1.5px solid var(--edge);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--shade);
  background: var(--card);
  color: var(--ink) !important;
  text-decoration: none;
}
.tcard:hover { box-shadow: 6px 6px 0 var(--edge); transform: translate(-1px, -1px); }
.tcard [data-preview] { display: block; margin-bottom: 8px; }
.tcard .pv { height: 118px; }
.tcard strong { display: block; font: 800 15.5px/1.2 var(--sans); letter-spacing: -0.02em; }
.tcard strong + span { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }

.cta {
  display: inline-block;
  margin: 6px 0 10px;
  padding: 11px 17px;
  border: 1.5px solid var(--edge);
  border-radius: 11px;
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--edge);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
}
.cta:hover { background: var(--accent-dark); }

.foot {
  padding: 22px 18px 28px;
  border-top: 1.5px solid var(--edge);
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.foot p { margin: 0 0 6px; }
.foot a { color: var(--ink); }

/* ---------- after-party mode (dark) ---------- */
html[data-theme="dark"] {
  --paper: #14111c;
  --card: #211b2e;
  --ink: #f4eff9;
  --muted: #aaa1bb;
  --line: #3b3251;
  --shade: #0a0810;
  --edge: #7b6c9a;
  --accent: #f08a5d;
  --accent-dark: #ffa97f;
  --accent-soft: #3b2630;
  --ok: #86d6a6;
  --ok-soft: #1d3a2d;
  --gold: #f0c05a;
  --gold-soft: #3a2f1a;
  --bad: #ff8f85;
  --bad-soft: #4a1f24;
  --cloth: #30274a;
  --cloth-line: #5d4f7a;
  --stage: #1a1526;
  --grid: rgba(244, 239, 249, .035);
  --grid2: rgba(244, 239, 249, .07);
  color-scheme: dark;
}
html[data-theme="dark"] .btn.primary, html[data-theme="dark"] .cta { color: #1c1526 !important; }
html[data-theme="dark"] .chip .note { color: #f3dca1; }
html[data-theme="dark"] .steps li.done .node, html[data-theme="dark"] .steps li.now .node { color: #14111c; }
html[data-theme="dark"] .tabs button.on, html[data-theme="dark"] .chip.sel, html[data-theme="dark"] #toast, html[data-theme="dark"] #tip { color: #14111c; }
html[data-theme="dark"] .table,
html[data-theme="dark"] .table.head { background: radial-gradient(circle at 34% 28%, #4a3d6b 0, var(--cloth) 75%); }
html[data-theme="dark"] .table.done { background: radial-gradient(circle at 34% 28%, #2c5a43 0, var(--ok-soft) 78%); }
html[data-theme="dark"] .table.warn, html[data-theme="dark"] .table.warn.done { background: radial-gradient(circle at 34% 28%, #7a2f37 0, var(--bad-soft) 78%); }
html[data-theme="dark"] .table::after { border-color: rgba(244, 239, 249, .2); }
html[data-theme="dark"] .seat.full { border-color: #14111c; }
html[data-theme="dark"] .docname::placeholder { color: #6d6384; }
html[data-theme="dark"] #stage {
  background:
    radial-gradient(circle, rgba(240, 192, 90, .55) 1.2px, transparent 1.8px) 0 0 / 60px 60px,
    radial-gradient(circle, rgba(240, 138, 93, .5) 1.2px, transparent 1.8px) 30px 30px / 60px 60px,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--stage);
}

/* ---------- small screens ---------- */
@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  main.layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "guests" "work" "plan";
    grid-template-rows: auto;
  }
  #pool { max-height: 250px; }
}

@media (max-width: 620px) {
  header.top, .hero, main.layout { padding-left: 14px; padding-right: 14px; }
  .steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; }
  .steps li { width: auto; }
  .steps li::after { display: none; }
  .docname { font-size: 26px !important; }
  .dock .lbl { display: none; }
  .dock { padding-left: 6px; }
  .empty h3 { font-size: 30px; }
  .empty .card { width: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- print: the plan, then the lists ---------- */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  header.top, .hero, .panel, .workbar, .toolbar, .hint, .empty, .pop, .under, #toast, #tip, .noprint, .foot, .confetti { display: none !important; }
  body { background: #fff; }
  main.layout { display: block; max-width: none; padding: 0; }
  #printTitle { display: block; margin: 0 0 3mm; font: italic 400 20pt/1.1 var(--serif); color: #000; }
  .stage-frame { border: 0; border-radius: 0; box-shadow: none; overflow: visible; background: none; }
  .stage-wrap { overflow: visible; }
  .stage-inner { width: auto !important; height: auto !important; overflow: visible; }
  .stage-zoom { transform: none !important; }
  #stage { background: none; zoom: var(--pz, .95); margin: 0 auto; }
  #stage::before { display: none; }
  .table, .table.done, .table.warn, .table.warn.done, .table.head { background: #fff; border-color: #555; box-shadow: none; outline: 0; }
  .table::after { display: none; }
  .table .tag b, .table .tag i { color: #000 !important; }
  .seat { border: 1px dashed #999; background: #fff !important; animation: none !important; box-shadow: none !important; }
  .seat::before, .seat::after { display: none !important; }
  .seat.full { border: 1px solid #333; color: #000 !important; }

  /* leyenda: nombres completos por mesa, solo al imprimir */
  #legend { display: block; break-before: page; color: #000; font-size: 10pt; }
  #legend h2 { font-size: 15pt; margin: 0 0 2mm; }
  #legend .legend-sub { font-size: 9pt; color: #444; margin: 0 0 5mm; }
  #legend .legend-grid { columns: 3; column-gap: 10mm; }
  #legend .legend-table { break-inside: avoid; margin: 0 0 5mm; }
  #legend h3 { font-size: 10.5pt; margin: 0 0 1mm; }
  #legend > h3 { margin-top: 5mm; }
  #legend ul { margin: 0; padding-left: 4mm; }
  #legend li { font-size: 9.5pt; line-height: 1.35; }
  #legend li.legend-none { color: #777; font-style: italic; list-style: none; }
  #legend .legend-pending { font-size: 9.5pt; }
  #legend .legend-az { break-before: page; }
  #legend .legend-az h2 { font: italic 400 26pt/1.1 var(--serif); text-align: center; margin: 0 0 8mm; }
  #legend .legend-az-grid { columns: 3; column-gap: 12mm; }
  #legend .legend-az-grid div {
    display: flex;
    justify-content: space-between;
    gap: 4mm;
    padding: 0.9mm 0;
    border-bottom: 0.2mm dotted #999;
    font-size: 10.5pt;
    break-inside: avoid;
  }
  #legend .legend-brand { font-size: 8pt; color: #888; margin: 6mm 0 0; }
}
