:root {
  --bg: #f7f4e4; --green: #e3fae3; --tabletop: #d8cfb4; --accent: #82755b;
  --empty: #eef0f2; --warn: #ffd24d;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, -apple-system, sans-serif; color: #222; }

.topnav { background: var(--accent); padding: 0 14px; display: flex; gap: 4px; }
.topnav a { color: #fff; text-decoration: none; padding: 12px 14px; font-weight: 600; }
.topnav a:hover { background: rgba(255,255,255,.15); }

main { padding: 0; }

/* ---- seating page ---- */
#banner {
  display: none; position: sticky; top: 0; z-index: 20;
  background: var(--warn); border-bottom: 1px solid #d4a017;
  padding: 10px 16px; font-weight: 600;
  justify-content: space-between; align-items: center;
}
#banner.show { display: flex; }
#banner button { font: inherit; font-weight: 700; padding: 6px 18px; cursor: pointer;
  border: 1px solid #b8860b; border-radius: 5px; background: #fff; }

.seating-layout { display: flex; height: calc(100vh - 46px); }
#tray {
  width: 250px; flex: none; border-right: 1px solid #ccc; padding: 12px;
  background: #fafafa; overflow-y: auto;
}
#tray.drophover { background: #ffe; outline: 2px dashed #cc0; outline-offset: -4px; }
#tray h2 { font-size: 13px; text-transform: uppercase; color: #555; margin: 0 0 8px; }
#tray-search { width: 100%; padding: 6px; margin-bottom: 8px; border: 1px solid #ccc; border-radius: 4px; }
#tray .hint { color: #999; font-size: 11px; margin-top: 10px; }
#tray kbd { background: #eee; border: 1px solid #ccc; border-radius: 3px; padding: 0 3px; font-size: 10px; }

/* pan/zoom stage */
#stage { position: relative; flex: 1; overflow: hidden; background: var(--bg);
  touch-action: none; cursor: grab; }
#stage.panning { cursor: grabbing; }
#world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#world > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; }

#search, #search *, #hud, #hud * { touch-action: auto; }
#search { position: absolute; top: 12px; left: 12px; z-index: 7; width: min(300px, 62vw);
  font: 14px system-ui, -apple-system, sans-serif; }
#search-input { width: 100%; padding: 10px 12px; border: 1px solid #b7ab8b; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); background: #fff; }
#search-results { margin-top: 4px; background: #fff; border: 1px solid #ccc; border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,.2); overflow: hidden; max-height: 60vh; overflow-y: auto; }
#search-results[hidden] { display: none; }
.search-item { display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0efe6; }
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: #f5f3e8; }
.search-item.disabled { color: #999; cursor: default; }
.search-item.disabled:hover { background: #fff; }
.si-where { color: #8a8570; font-size: 12px; white-space: nowrap; }

.seat.flash { animation: seatflash .55s ease-in-out 4; z-index: 3; }
@keyframes seatflash {
  0%, 100% { background: transparent; outline: 0 solid transparent; }
  50% { background: rgba(255,120,60,.55); outline: 4px solid #e8451f; outline-offset: -2px; border-radius: 6px; }
}

#hud { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 6; }
#hud button { font: inherit; font-weight: 700; font-size: 16px; width: 38px; height: 38px;
  border: 1px solid var(--accent); background: #fff; border-radius: 7px; cursor: pointer; }
#hud button#zoom-fit { width: auto; padding: 0 12px; font-size: 13px; }

/* seat = transparent hit area (number tag + name box); name shown in the yellow */
.seat { position: absolute; box-sizing: border-box; border-radius: 6px; }
.namebox {
  position: absolute; box-sizing: border-box; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #14141b; line-height: 1.02; overflow: hidden; text-align: center; padding: 1px;
}
.namebox .nm { font-size: 34px; font-weight: 800; white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 0 5px #fff, 0 0 4px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.namebox .sec { font-size: 24px; font-weight: 700; font-style: italic; color: #a1372a;
  text-shadow: 0 0 4px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.seat.lang-fr .nm { color: #1f4e9c; }
.seat.lang-en .nm { color: #14141b; }
.seat.drop { background: rgba(40,175,85,.5); outline: 3px dashed #178a3e; outline-offset: -2px; }
.seat.drop .namebox { background: rgba(255,255,255,.35); }
.mode-edit .seat.occupied, .mode-edit .chip { cursor: grab; }
.mode-view .seat .sec { display: none; }

#guest-popover {
  position: fixed; z-index: 50; max-width: 260px; pointer-events: none;
  background: #fff; border: 1px solid #c9c2a8; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22); padding: 10px 12px;
  font: 13px/1.35 system-ui, -apple-system, sans-serif; color: #222;
}
#guest-popover[hidden] { display: none; }
#guest-popover .gp-name { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
#guest-popover .gp-meta { color: #555; margin-bottom: 4px; }
#guest-popover .gp-group { color: #777; font-size: 12px; margin-bottom: 4px; }
#guest-popover .gp-diet { font-size: 12px; color: #999; }
#guest-popover .gp-diet.has {
  color: #7a2e12; background: #fff2e8; border-radius: 6px; padding: 5px 7px;
  font-weight: 600; white-space: pre-wrap;
}

.chip {
  background: #fff; border: 1px solid var(--accent); border-radius: 4px;
  padding: 5px 7px; margin: 3px 0; user-select: none;
}
.chip.lang-fr { border-left: 4px solid #3b6fb0; }
.chip.lang-en { border-left: 4px solid #b04a3b; }
.chip.type-infant { border-style: dashed; font-style: italic; }

.mode-view #tray, .mode-view #tray .hint, .mode-view #banner { display: none; }
.mode-view .seating-layout { height: 100vh; }

/* ---- guest tables ---- */
.guests-wrap { padding: 20px; }
table.guests { border-collapse: collapse; width: 100%; }
table.guests th, table.guests td { border-bottom: 1px solid #e2e2e2; padding: 6px 10px; text-align: left; vertical-align: top; }
table.guests th { background: #f0ede0; position: sticky; top: 0; }
table.guests tr:hover { background: #fafaf0; }
.diet { max-width: 380px; font-size: 12px; color: #555; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eee; }
.badge.fr { background: #dce8f7; } .badge.en { background: #f7dcd8; }
.badge.child { background: #fff3bf; } .badge.infant { background: #ffe0ec; }

form.edit { max-width: 560px; padding: 20px; display: grid; gap: 12px; }
form.edit label { display: grid; gap: 3px; font-weight: 600; font-size: 13px; }
form.edit input, form.edit select, form.edit textarea { font: inherit; padding: 7px; border: 1px solid #bbb; border-radius: 4px; }
form.edit textarea { min-height: 90px; }
form.edit .row { display: flex; gap: 12px; }
form.edit .row > label { flex: 1; }
.btn { font: inherit; font-weight: 600; padding: 8px 16px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: #fff; color: #b03030; border-color: #b03030; }
