:root {
  --wine: #5b1a2c;
  --wine-2: #7a2a40;
  --wine-soft: #f4e7ea;
  --gold: #c99a3c;
  --gold-soft: #fbf1db;
  --gold-deep: #8a6416;
  --rose: #c25b77;
  --rose-soft: #fbe9ee;
  --ink: #261e21;
  --ink-2: #5f5459;
  --ink-3: #8f8488;
  --line: #e7dfd8;
  --line-2: #d6ccc4;
  --paper: #f6f1ea;
  --card: #fffdfa;
  --board: #fbfaf7;
  --dot: #e3ddd5;
  --std: #3f4a5a;
  --buf: #8b8f96;
  --ok: #2f7d4f;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgba(38, 30, 33, .06), 0 4px 14px rgba(38, 30, 33, .07);
  --radius: 12px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--sans); color: var(--ink); background: var(--paper); display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }

/* ---------- header ---------- */
.top { flex: none; height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 18px; background: var(--wine); color: #fff; }
.brand { font: 600 24px/1 var(--serif); color: #fff; text-decoration: none; white-space: nowrap; }
.brand i { color: var(--gold); font-style: normal; }
.brand .mark { color: var(--gold); font-size: 18px; margin-right: 4px; }
.top nav { display: flex; gap: 4px; margin: 0 auto; }
.top nav a { color: #f1dfe4; text-decoration: none; padding: 7px 14px; border-radius: 999px; font-weight: 500; }
.top nav a:hover { background: rgba(255, 255, 255, .08); }
.top nav a[aria-current] { background: rgba(255, 255, 255, .14); color: #fff; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.saved { font-size: 12px; color: #e5c9d1; }
.saved.warn { color: #ffd38a; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:focus-visible, .seg button:focus-visible, .chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn.primary:hover { background: var(--wine-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.ghost-light:hover { border-color: #fff; }
.btn.icon { padding: 0 10px; min-width: 34px; }
.btn.small { height: 28px; padding: 0 9px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--wine); text-decoration: underline; cursor: pointer; }

/* ---------- stat bar ---------- */
.statbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
.statbar > .btn { flex: none; }
.stat { flex: none; display: flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--paper); white-space: nowrap; }
.stat b { font-size: 15px; }
.stat small { color: var(--ink-2); font-size: 12px; }
.stat.good b { color: var(--ok); }
.stat.warn b { color: var(--bad); }
.stat .bar { width: 70px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; align-self: center; }
.stat .bar span { display: block; height: 100%; background: var(--ok); }
.statbar .spacer { flex: 1; }

/* ---------- board view layout ---------- */
.view { flex: 1; min-height: 0; }
#view-board { display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; }
.panel { background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.guests-panel { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); overflow-y: auto; }
.panel-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.panel-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.panel-foot .btn { flex: 1; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; height: 36px; padding: 0 10px 0 32px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; }
.search input:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
.tabs { display: flex; background: var(--paper); border-radius: 9px; padding: 3px; }
.tabs button { flex: 1; white-space: nowrap; border: 0; background: none; padding: 5px 4px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.tabs button b { font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.guest-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.guest-scroll.drop-ok { background: #f3f8f4; outline: 2px dashed var(--ok); outline-offset: -6px; }
.group { margin-top: 6px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: grab; user-select: none; font-weight: 600; font-size: 13px; }
.group-head:hover { background: var(--paper); }
.group-head .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.group-head .cnt { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.group-head .chev { color: var(--ink-3); transition: transform .15s; font-size: 10px; }
.group.closed .chev { transform: rotate(-90deg); }
.group.closed .chips { display: none; }
.group-head .grip, .chip .grip { color: var(--ink-3); font-size: 12px; letter-spacing: -2px; touch-action: none; }
.chips { display: grid; gap: 3px; padding: 2px 0 4px 6px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line-2)); border-radius: 7px; cursor: grab; user-select: none; min-height: 34px; }
.chip:hover { border-color: var(--line-2); border-left-color: var(--c); box-shadow: var(--shadow); }
.chip .nm-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .nm-text b { font-weight: 600; }
.chip .tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--paper); color: var(--ink-2); flex: none; }
.chip .tag.at { background: var(--wine-soft); color: var(--wine); }
.chip .pri { font-size: 11px; color: var(--gold-deep); flex: none; }
.chip.seated { opacity: .72; }
.chip.picked { background: var(--gold-soft); border-color: var(--gold); border-left-color: var(--c); box-shadow: 0 0 0 1px var(--gold); opacity: 1; }
.chip.hit .nm-text { background: linear-gradient(transparent 55%, #ffe58a 55%); }
.empty-state { padding: 26px 14px; text-align: center; color: var(--ink-2); }
.empty-state h3 { font: 600 22px/1.2 var(--serif); margin: 0 0 6px; color: var(--ink); }
.empty-state .btn { margin-top: 10px; }

/* ---------- board ---------- */
.board-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #ece6de; }
.board { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none; }
.board.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.hall { position: absolute; left: 0; top: 0; background-color: var(--board); background-image: radial-gradient(var(--dot) 1.4px, transparent 1.4px); background-size: 20px 20px; border: 2px solid #d9d1c7; border-radius: 6px; box-shadow: 0 10px 40px rgba(60, 40, 30, .12); }
.hall-label { position: absolute; left: 18px; top: 14px; font: 600 13px var(--sans); letter-spacing: .14em; color: #b5aba1; text-transform: uppercase; }

/* tables */
.tnode { position: absolute; width: 0; height: 0; }
.tsvg { position: absolute; overflow: visible; pointer-events: none; }
.tsvg .hit { fill: transparent; pointer-events: visiblePainted; cursor: pointer; }
.tsvg .body { fill: #fff; stroke: var(--std); stroke-width: 2.5; pointer-events: visiblePainted; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(40, 30, 30, .12)); }
.tsvg .seat { fill: #fff; stroke: #b9b0a8; stroke-width: 1.5; pointer-events: visiblePainted; }
.tsvg .seat.on { stroke: rgba(0, 0, 0, .25); }
.k-priority .body { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 3.5; }
.k-buffer .body { fill: url(#hatch); stroke: var(--buf); stroke-dasharray: 7 5; }
.k-head .body { fill: var(--wine-soft); stroke: var(--wine); stroke-width: 3; }
.k-couple .body { fill: var(--rose-soft); stroke: var(--rose); stroke-width: 3; }
.tnode.sel .body { stroke: var(--gold); stroke-width: 5; }
.tnode.sel.k-priority .body { stroke: var(--wine); }
.tnode.drop-ok .body { stroke: var(--ok); stroke-width: 6; fill: #eef8f1; }
.tnode.drop-full .body { stroke: var(--bad); stroke-width: 6; fill: #fdeceb; }
.tnode.swap .body { stroke: #2563eb; stroke-width: 6; stroke-dasharray: 10 6; }
.tnode.lift { z-index: 20; }
.tnode.lift .tsvg { filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .18)); }
.tnode.has-hit .body { stroke: #e0a800; stroke-width: 6; }
.tnode.flash .body { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0%, 100% { stroke-width: 3; } 30% { stroke: #e0a800; stroke-width: 12; } }

.tlabel { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); text-align: center; pointer-events: none; display: grid; justify-items: center; line-height: 1.1; white-space: nowrap; }
.tlabel b { font: 700 17px/1 var(--sans); letter-spacing: .02em; }
.tlabel .tn { font-size: 10.5px; color: var(--ink-2); max-width: var(--lw, 80px); overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tlabel .ct { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; font-weight: 600; }
.tlabel .ct.full { color: var(--ok); }
.tlabel .badge { font-size: 8.5px; font-weight: 700; letter-spacing: .12em; padding: 1px 5px; border-radius: 4px; margin-bottom: 3px; }
.k-priority .tlabel .badge { background: var(--gold); color: #fff; }
.k-buffer .tlabel .badge { background: var(--buf); color: #fff; }
.k-buffer .tlabel b { color: var(--buf); }
.k-head .tlabel b { color: var(--wine); }
.k-couple .tlabel b { color: var(--rose); }
.tlabel.pill { background: rgba(255, 255, 255, .92); padding: 3px 8px; border-radius: 7px; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); flex-direction: row; display: flex; gap: 6px; align-items: baseline; }
.tlabel.pill .tn, .tlabel.pill .ct { margin: 0; }
.tlabel.pill .badge { margin: 0; }

/* name cards — the "clips" on the whiteboard */
.tcard { position: absolute; background: #fff; border: 1px solid #e4dcd3; border-radius: 6px; padding: 9px 7px 5px; box-shadow: 0 2px 6px rgba(40, 30, 30, .08); column-gap: 6px; font-size: 10.5px; line-height: 15px; }
.tcard::before { content: ""; position: absolute; top: -5px; left: 50%; width: 26px; height: 9px; margin-left: -13px; border-radius: 3px; background: linear-gradient(#c9ccd1, #9aa0a8); box-shadow: 0 1px 1px rgba(0, 0, 0, .2); }
.tcard .nm { display: flex; align-items: center; gap: 4px; break-inside: avoid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; border-radius: 3px; padding: 0 2px; }
.tcard .nm::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tcard .nm span { overflow: hidden; text-overflow: ellipsis; }
.tcard .nm:hover { background: var(--paper); }
.tcard .nm.hit { background: #ffe58a; font-weight: 600; }
.tcard .nm.picked { background: var(--gold-soft); outline: 1px solid var(--gold); }

/* fixtures */
.fx { position: absolute; display: grid; place-items: center; border-radius: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); background: #f1ece6; border: 2px solid #d3c8bd; }
.fx span { pointer-events: none; text-align: center; padding: 4px; }
.fx.sel { outline: 3px solid var(--gold); outline-offset: 3px; }
.fx-stage { background: linear-gradient(#6b2236, var(--wine)); color: #fff; border: 0; font-size: 18px; letter-spacing: .3em; box-shadow: 0 6px 16px rgba(91, 26, 44, .3); }
.fx-stage.st-half { border-radius: 8px 8px 50% 50% / 8px 8px 100% 100%; }
.fx-stage.st-round { border-radius: 50%; }
.fx-stage.led::before { content: "LED WALL"; position: absolute; left: 6%; right: 6%; top: -30px; height: 20px; border-radius: 4px; background: linear-gradient(90deg, #2b3a8c, #6d28d9, #db2777, #f59e0b, #10b981, #2b3a8c); color: #fff; font-size: 10px; letter-spacing: .3em; display: grid; place-items: center; box-shadow: 0 0 18px rgba(109, 40, 217, .45); }
.fx-dance { background-color: #efe2cf; background-image: linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.35) 75%), linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.35) 75%); background-size: 40px 40px; background-position: 0 0, 20px 20px; border-color: #c9b18f; color: #7b5c34; }
.fx-entrance { background: #fff; border: 2px dashed #a99e93; border-radius: 6px; font-size: 12px; }
.fx-buffet, .fx-bar { background: #eef3ee; border-color: #b7c8b9; color: #3f5d45; }
.fx-band { background: #ecebf6; border-color: #bdb9de; color: #4c4686; }
.fx-cake { border-radius: 50%; background: #fff2f5; border-color: #e8b4c3; color: var(--rose); font-size: 11px; }
.fx-photo { background: #f2eefa; border-color: #c9bde6; color: #5b4a8b; font-size: 12px; }
.fx-note { background: #fff8c5; border-color: #e7d77a; color: #6b5d12; text-transform: none; letter-spacing: 0; font-weight: 500; }
.rz { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: #fff; border: 2px solid var(--gold); border-radius: 4px; cursor: nwse-resize; }

/* far zoom: hide name cards, enlarge labels so codes stay readable */
.board.far .tcard { display: none; }
.board.far .tlabel b { font-size: min(calc(13px * var(--inv, 1)), 38px); }
.board.far .tlabel .tn { display: none; }
.board.far .tlabel .ct { font-size: min(calc(10px * var(--inv, 1)), 24px); }
.board.far .tlabel .badge { display: none; }
.board.far .tlabel.pill b { font-size: min(calc(12px * var(--inv, 1)), 26px); }
.board.moving .tcard, .board.moving .tlabel { pointer-events: none; }

/* floating UI over board */
.floating { position: absolute; z-index: 5; display: flex; align-items: center; gap: 6px; background: rgba(255, 253, 250, .95); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.toolbar { left: 12px; top: 12px; flex-wrap: wrap; max-width: calc(100% - 24px); }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); }
#lock[aria-pressed="true"], #select-mode[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); }
.zoombar { right: 12px; bottom: 12px; }
.zoombar .pct { min-width: 58px; font-variant-numeric: tabular-nums; }
.legend { left: 12px; bottom: 12px; gap: 12px; padding: 7px 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--std); background: #fff; display: inline-block; }
.lg.priority { border-color: var(--gold); background: var(--gold-soft); }
.lg.buffer { border: 2px dashed var(--buf); background: repeating-linear-gradient(45deg, #fff 0 2px, #e3e4e6 2px 4px); }
.lg.head { border-radius: 3px; width: 20px; height: 10px; border-color: var(--wine); background: var(--wine-soft); }
.lg.couple { border-radius: 3px; width: 14px; height: 10px; border-color: var(--rose); background: var(--rose-soft); }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); padding: 5px; display: grid; }
.menu button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--paper); }
.ic { width: 16px; height: 16px; border: 2.5px solid var(--std); background: #fff; display: inline-block; }
.ic.round { border-radius: 50%; }
.ic.rect { width: 22px; height: 11px; border-radius: 3px; }
.ic.pri { border-color: var(--gold); background: var(--gold-soft); }
.ic.buf { border: 2px dashed var(--buf); }

.pickbar { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 6; background: var(--ink); color: #fff; padding: 9px 10px 9px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); white-space: nowrap; }
.pickbar .btn { height: 28px; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.peek { position: fixed; z-index: 40; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16); padding: 10px 12px; min-width: 180px; max-width: 280px; font-size: 12.5px; }
.peek h4 { margin: 0 0 4px; font-size: 13px; }
.peek ol { margin: 4px 0 0; padding-left: 20px; columns: 2; column-gap: 18px; }
.peek ol.one { columns: 1; }
.hint-first { position: absolute; right: 12px; top: 12px; z-index: 6; width: 270px; background: var(--ink); color: #fff; border-radius: 12px; padding: 14px; display: grid; gap: 6px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.hint-first .btn { justify-self: end; background: var(--gold); border: 0; color: #fff; height: 30px; }

/* drag ghost */
.ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; background: #fff; border: 1px solid var(--line-2); border-left: 4px solid var(--c, var(--gold)); border-radius: 8px; padding: 6px 10px; box-shadow: 0 12px 28px rgba(0, 0, 0, .22); font-weight: 600; font-size: 13px; white-space: nowrap; }
.ghost small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.ghost small.ok { color: var(--ok); }
.ghost small.bad { color: var(--bad); }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }

/* ---------- inspector ---------- */
.insp-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.insp-sec h3 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.insp-title { display: flex; gap: 12px; align-items: center; }
.tile { flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 3px solid var(--std); background: #fff; }
.tile.priority { border-color: var(--gold); background: var(--gold-soft); }
.tile.buffer { border: 2.5px dashed var(--buf); color: var(--buf); }
.tile.head { border-color: var(--wine); background: var(--wine-soft); color: var(--wine); border-radius: 10px; }
.tile.couple { border-color: var(--rose); background: var(--rose-soft); color: var(--rose); border-radius: 10px; }
.tile.fixture { border-radius: 10px; border-color: var(--line-2); font-size: 20px; }
.insp-title .name-in { flex: 1; min-width: 0; }
.name-in input { width: 100%; border: 1px solid transparent; border-radius: 7px; padding: 4px 6px; margin-left: -6px; font: 600 22px/1.2 var(--serif); background: transparent; }
.name-in input:hover { border-color: var(--line); }
.name-in input:focus { border-color: var(--gold); outline: none; background: #fff; }
.name-in p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.progress { height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .2s; }
.seats { display: grid; gap: 4px; padding: 6px; margin: 0 -6px; border-radius: 10px; }
.seats.drop-ok { background: #eef8f1; outline: 2px dashed var(--ok); }
.seats.drop-full { background: #fdeceb; outline: 2px dashed var(--bad); }
.seat-row { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 6px 4px 8px; border-radius: 7px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c); cursor: grab; }
.seat-row .no { width: 18px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.seat-row .who { flex: 1; min-width: 0; }
.seat-row .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .who small { color: var(--ink-3); font-size: 11.5px; }
.seat-row .x { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 16px; width: 26px; height: 26px; border-radius: 6px; }
.seat-row .x:hover { background: var(--paper); color: var(--bad); }
.seat-row.empty { border: 1.5px dashed var(--line-2); background: transparent; color: var(--ink-3); cursor: default; font-size: 12.5px; }
.seat-row.empty .no { color: var(--line-2); }
.field { display: grid; gap: 5px; margin-bottom: 12px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field:last-child { margin-bottom: 0; }
.field input, .field select, .field textarea, dialog input, dialog select, dialog textarea { height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: #fff; width: 100%; color: var(--ink); font-size: 14px; }
.field textarea, dialog textarea { height: auto; padding: 8px 10px; resize: vertical; }
.seg { display: flex; background: var(--paper); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px 6px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; width: max-content; }
.stepper button { width: 34px; height: 34px; border: 0; background: none; cursor: pointer; font-size: 16px; }
.stepper button:hover { background: var(--paper); }
.stepper input { width: 46px; height: 34px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rot-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rot-row .btn { height: 32px; padding: 0 9px; font-size: 13px; }
.insp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset { border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 6px 4px 6px; cursor: pointer; display: grid; justify-items: center; gap: 2px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.preset svg { width: 72px; height: 46px; }
.preset:hover { border-color: var(--ink-3); }
.preset[aria-pressed="true"] { border-color: var(--wine); background: var(--wine-soft); color: var(--wine); }
.hall-shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.hall-shapes button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px; cursor: pointer; display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); }
.hall-shapes button i { display: block; border: 2px solid var(--ink-3); border-radius: 3px; background: var(--board); }
.hall-shapes button[aria-pressed="true"] { border-color: var(--wine); color: var(--wine); background: var(--wine-soft); }
.hall-shapes button[aria-pressed="true"] i { border-color: var(--wine); }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--paper); border-radius: 8px; padding: 9px 11px; margin: 10px 0 0; }
.tips { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; display: grid; gap: 5px; }
kbd { font: 600 11px var(--sans); background: #fff; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.group-key { display: grid; gap: 4px; font-size: 12.5px; }
.group-key div { display: flex; align-items: center; gap: 8px; }
.group-key i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.group-key span { margin-left: auto; color: var(--ink-3); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; margin-top: 10px; }

/* ---------- list & print pages ---------- */
.page { overflow-y: auto; padding: 24px clamp(14px, 3vw, 40px) 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font: 600 38px/1.1 var(--serif); margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions select { height: 34px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 10px; background: #fff; }
.list-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.list-tools input, .list-tools select { height: 36px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 10px; background: #fff; }
.list-tools input { width: min(340px, 100%); }
.list-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.list-wrap table { width: 100%; border-collapse: collapse; }
.list-wrap th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; }
.list-wrap td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.list-wrap td input, .list-wrap td select { width: 100%; height: 32px; border: 1px solid transparent; border-radius: 6px; padding: 0 6px; background: transparent; }
.list-wrap td input:hover, .list-wrap td select:hover { border-color: var(--line); }
.list-wrap td input:focus, .list-wrap td select:focus { border-color: var(--gold); outline: none; background: #fff; }
.list-wrap td .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.list-wrap tr:hover td { background: #fffaf2; }
.list-wrap .del { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 16px; }
.list-wrap .del:hover { color: var(--bad); }

.sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 1100px; }
.sheet h2 { font: 600 30px/1.1 var(--serif); margin: 0; }
.sheet .sub { color: var(--ink-2); margin: 4px 0 18px; }
.lookup { columns: 3 220px; column-gap: 28px; font-size: 13px; }
.lookup .letter { font: 700 18px var(--serif); color: var(--wine); border-bottom: 1px solid var(--line); margin: 10px 0 4px; break-after: avoid; }
.lookup .row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; break-inside: avoid; border-bottom: 1px dotted #eee; }
.lookup .row b { font-variant-numeric: tabular-nums; }
.rosters { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.roster { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; break-inside: avoid; font-size: 12.5px; }
.roster h4 { margin: 0; font-size: 15px; }
.roster p { margin: 0 0 4px; color: var(--ink-3); font-size: 11.5px; }
.roster ol { margin: 0; padding-left: 20px; }
.print-floor { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.print-floor .tcard { display: none; }

/* ---------- dialog / toast ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); color: var(--ink); }
dialog::backdrop { background: rgba(38, 30, 33, .45); }
dialog form { padding: 22px; display: grid; gap: 12px; }
dialog h2 { margin: 0; font: 600 26px/1.15 var(--serif); }
dialog p { margin: 0; color: var(--ink-2); }
dialog label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
dialog .error { color: var(--bad); font-weight: 500; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
dialog .actions .left { margin-right: auto; }
dialog .two { gap: 10px; }
dialog code { background: var(--paper); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; background: var(--ink); color: #fff; padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 24px); }
.toast button { background: none; border: 0; color: var(--gold); font-weight: 700; cursor: pointer; padding: 4px 6px; }

/* ---------- iOS / touch ---------- */
html, body { height: 100%; height: 100dvh; }
body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
.top { height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
.board, .chip, .group-head, .seat-row, .tcard, .fx, .tnode { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, .btn, .chip, .seg button, .tabs button, .preset { touch-action: manipulation; }
.guest-scroll, .inspector, .page { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.panel-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.zoombar { bottom: max(12px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); }
.legend { bottom: max(12px, env(safe-area-inset-bottom)); }
.pressing { transform: scale(.97); transition: transform .25s; }
.chip.pressing, .seat-row.pressing { background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold); }
.for-touch { display: none; }
.present-exit { display: none; }
.peek.pinned { pointer-events: auto; }

/* fingers need bigger targets; inputs at 16px stop iPhone from zooming in on focus */
@media (pointer: coarse) {
  .btn { height: 40px; min-width: 40px; }
  .btn.small { height: 36px; }
  .chip { min-height: 44px; padding: 8px 10px; font-size: 15px; }
  .group-head { padding: 10px 8px; font-size: 14px; }
  .seat-row { min-height: 44px; }
  .seat-row .x { width: 36px; height: 36px; font-size: 20px; }
  .tabs button { padding: 8px 4px; }
  .seg button { padding: 9px 6px; }
  .stepper button { width: 42px; height: 40px; }
  .stepper input { height: 40px; }
  .menu button { padding: 12px 12px; }
  input, select, textarea, .search input, .field input, .field select, dialog input, dialog select, dialog textarea, .list-wrap td input, .list-wrap td select { font-size: 16px !important; }
  .search input { height: 42px; }
  .for-touch { display: inline; }
  .for-mouse { display: none; }
  .legend { display: none; }
  .tcard { font-size: 11.5px; line-height: 16px; }
}

/* ---------- iPad landscape / small laptops: guest list stays, details slide in ---------- */
.show-le-920, .show-le-1180 { display: none !important; }
@media (max-width: 1180px) {
  #view-board { grid-template-columns: 280px minmax(0, 1fr); }
  .show-le-1180 { display: inline-flex !important; }
  .inspector { position: fixed; z-index: 50; right: 0; top: var(--chrome, calc(100px + env(safe-area-inset-top))); bottom: 0; width: min(360px, 92vw); box-shadow: -10px 0 40px rgba(0, 0, 0, .18); transform: translateX(105%); transition: transform .22s ease; padding-bottom: env(safe-area-inset-bottom); }
  body.show-insp .inspector { transform: none; }
  .legend { display: none; }
}

/* ---------- iPad portrait & phones: both panels slide in ---------- */
@media (max-width: 920px) {
  .top { gap: 10px; }
  .top nav a { padding: 6px 10px; font-size: 13.5px; }
  .saved { display: none; }
  .brand { font-size: 21px; }
  #view-board { grid-template-columns: minmax(0, 1fr); }
  .show-le-920 { display: inline-flex !important; }
  .guests-panel { position: fixed; z-index: 50; left: 0; top: var(--chrome, calc(100px + env(safe-area-inset-top))); bottom: 0; width: min(340px, 88vw); box-shadow: 10px 0 40px rgba(0, 0, 0, .18); transform: translateX(-105%); transition: transform .22s ease; }
  body.show-guests .guests-panel { transform: none; }
  .toolbar #lock span, .toolbar #present span, .toolbar #select-mode span { display: none; }
  .hint-first { left: 12px; right: 12px; width: auto; top: auto; bottom: 70px; }
  .pickbar { white-space: normal; width: max-content; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; text-align: center; bottom: 70px; }
  .page-head h1 { font-size: 32px; }
}

/* ---------- iPhone: details become a bottom sheet so the board stays visible ---------- */
@media (max-width: 600px) {
  .top { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .brand .mark, .brand i, .top #backup { display: none; }
  .top-actions { gap: 6px; }
  .brand { font-size: 19px; }
  .top nav { margin-right: 0; }
  .top nav a { padding: 6px 8px; font-size: 13px; }
  .statbar { padding: 6px 10px; gap: 6px; }
  .stat { padding: 4px 9px; }
  .stat small { font-size: 11px; }
  .stat .bar { display: none; }
  .inspector { top: auto; left: 0; right: 0; width: 100%; height: 64dvh; border-radius: 18px 18px 0 0; transform: translateY(105%); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); border-left: 0; }
  .inspector::before { content: ""; position: sticky; top: 0; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; z-index: 2; }
  .toolbar { left: 8px; top: 8px; gap: 4px; padding: 4px; max-width: calc(100% - 16px); flex-wrap: nowrap; overflow-x: auto; }
  .toolbar .sep { display: none; }
  #add-item-btn { font-size: 0; gap: 0; }
  #add-item-btn::before { content: "＋ Item"; font-size: 14px; }
  .menu { position: fixed; left: 8px; right: 8px; top: auto; bottom: max(8px, env(safe-area-inset-bottom)); min-width: 0; }
  .zoombar { padding: 4px; }
  .page { padding: 16px 12px 40px; }
  .sheet { padding: 16px; }
  .list-wrap table { min-width: 720px; }
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 30px); }
  .two { grid-template-columns: 1fr; }
  .insp-sec .two { grid-template-columns: 1fr 1fr; }
}

/* ---------- Present mode: just the room ---------- */
body.present .top, body.present .statbar, body.present .guests-panel, body.present .inspector, body.present .toolbar, body.present .pickbar, body.present .hint-first { display: none !important; }
body.present #view-board { grid-template-columns: minmax(0, 1fr); }
body.present .present-exit { display: inline-flex; position: absolute; z-index: 7; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); box-shadow: var(--shadow); }
body.present .legend { display: flex; }
body.present .tnode.sel .body { stroke: var(--std); stroke-width: 2.5; }
body.present .peek { min-width: 220px; font-size: 14px; }

/* ---------- cloud sync ---------- */
.sync-btn { gap: 6px; }
.sync-btn.on { border-color: rgba(255, 255, 255, .55); }
.sync-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; display: inline-block; }
.sync-btn.ok .dot { background: #4ade80; }
.sync-btn.busy .dot { background: #fbbf24; animation: pulse 1s infinite; }
.sync-btn.off .dot { background: #f87171; }
@keyframes pulse { 50% { opacity: .3; } }
.code-box { font: 600 20px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; background: var(--paper); border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px; text-align: center; user-select: all; -webkit-user-select: all; word-break: break-all; }
.sync-meta { font-size: 13px; color: var(--ink-2); }
dialog .stack { display: grid; gap: 8px; }
dialog .or { text-align: center; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
@media (max-width: 600px) { .sync-btn span { display: none; } }

/* ---------- print ---------- */
@media print {
  body { overflow: visible; display: block; background: #fff; height: auto; }
  .top, .statbar, .no-print, #view-board, #view-list, .toast { display: none !important; }
  #view-print { display: block !important; padding: 0; overflow: visible; }
  .sheet { border: 0; padding: 0; max-width: none; }
  .roster, .lookup .row { break-inside: avoid; }
  @page { margin: 12mm; }
}

/* multi-select */
.marquee { position: absolute; z-index: 30; pointer-events: none; border: 1.5px dashed var(--wine); background: rgba(91, 26, 44, .07); border-radius: 4px; }
.board.selecting { cursor: crosshair; }
body.present .multibar { display: none !important; }
.tnode.msel .tsvg { filter: drop-shadow(0 0 calc(5px * var(--inv, 1)) rgba(201, 154, 60, .95)) drop-shadow(0 0 calc(2px * var(--inv, 1)) rgba(201, 154, 60, 1)); }
.tnode.msel .body { stroke: var(--gold); stroke-width: calc(4px * var(--inv, 1)); }
.multibar { white-space: normal; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 24px); }
.mb-twin { color: var(--gold); font-weight: 600; }

/* real units, spacing checks */
.len { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.len input { border: 0; width: 100%; min-width: 0; padding: 7px 8px; font: inherit; background: transparent; }
.len span { padding: 0 9px; color: var(--muted, #8a8178); font-size: 12px; }
.sum { font-size: 13px; line-height: 1.45; margin: 4px 0 6px; }
.sum .ok { color: #2b8a3e; } .sum .bad { color: #c92a2a; }
.warnbox { background: #fff4f4; border: 1px solid #f3c1c1; color: #8c1d1d; border-radius: 8px; padding: 8px 10px; font-size: 13px; display: grid; gap: 4px; margin-top: 8px; }
.okline { color: #2b8a3e; font-size: 13px; margin: 8px 0 0; }
.hall-label { text-transform: none; letter-spacing: .04em; }
.scalebar { position: absolute; left: 18px; bottom: 16px; height: 8px; border: 2px solid #b5aba1; border-top: 0; pointer-events: none; }
.scalebar span { position: absolute; left: 0; bottom: 10px; font: 600 min(calc(12px * var(--inv, 1)), 40px) var(--sans); color: #a0958a; white-space: nowrap; }
.fx .dim { display: block; font: 500 11px var(--sans); opacity: .75; margin-top: 2px; }
.board.far .fx .dim { font-size: min(calc(11px * var(--inv, 1)), 30px); }
.gaps { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 15; }
.gap-line { position: absolute; height: 0; border-top: max(2px, calc(2px * var(--inv, 1))) dashed #e03131; transform-origin: 0 0; }
.gap-tag { position: absolute; transform: translate(-50%, -50%); background: #e03131; color: #fff; font: 700 min(calc(10px * var(--inv, 1)), 30px)/1.3 var(--sans); padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.tnode.tight .body { stroke: #e03131; stroke-dasharray: 6 4; stroke-width: max(2.5px, calc(2px * var(--inv, 1))); }
body.present .gaps { display: none; }
body.present .tnode.tight .body { stroke-dasharray: none; }

/* guest groups */
.panel-foot { flex-wrap: wrap; }
.panel-foot .btn { flex: 1 1 40%; white-space: nowrap; }
.panel-foot #import { flex-basis: 100%; }
.group-head .gact { border: 0; background: transparent; color: var(--muted, #8a8178); width: 26px; height: 26px; border-radius: 6px; font-size: 14px; cursor: pointer; opacity: .55; padding: 0; flex: none; }
.group-head .gact:hover, .group-head .gact:focus-visible { opacity: 1; background: rgba(0, 0, 0, .06); color: var(--ink); }
@media (pointer: coarse) { .group-head .gact { opacity: .8; width: 34px; height: 34px; } }
.group-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.group-pick button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.group-pick button:hover { border-color: var(--gold); background: var(--gold-soft); }
.group-pick i { width: 10px; height: 10px; border-radius: 50%; }
