:root {
  --bg: #fbf7f4;
  --card: #ffffff;
  --ink: #2d2430;
  --muted: #7a6d78;
  --line: #eadfe3;
  --rose: #b5577a;
  --rose-dark: #94405f;
  --rose-soft: #f7e6ed;
  --gold: #c99a3c;
  --ok: #3f8a63;
  --warn: #c0532f;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea, .btn { font: inherit; color: inherit; }
button, .btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--rose); }
.primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.primary:hover { background: var(--rose-dark); }
.pro { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.ghost { background: transparent; }
.danger:hover { border-color: var(--warn); color: var(--warn); }
.wide { width: 100%; }
input, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--rose-soft); border-color: var(--rose); }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--rose-dark); text-decoration: none; }
.logo { width: 22px; height: 22px; border-radius: 50%; border: 6px solid var(--rose); }
.badge { font-size: 11px; background: var(--gold); color: #fff; padding: 2px 6px; border-radius: 4px; }
.event-title { flex: 1 1 180px; max-width: 320px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.hero { max-width: 1400px; margin: 0 auto; padding: 18px 16px 0; }
.hero h1 { margin: 0 0 4px; font-size: clamp(22px, 3.2vw, 30px); font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: var(--rose-dark); }
.hero p { margin: 0; color: var(--muted); max-width: 720px; }

.app {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px;
  padding: 16px; max-width: 1400px; margin: 0 auto;
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h2 { margin: 0 0 10px; font-size: 18px; }
.panel h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.panel small { color: var(--muted); font-weight: 400; font-size: 13px; }
.guests textarea { resize: vertical; margin-bottom: 8px; }
.guests input[type=search] { margin-top: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.chip { display: flex; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chip.selected { border-color: var(--rose); box-shadow: 0 0 0 2px var(--rose-soft); background: var(--rose-soft); }
.chip-name { flex: 1; border: 0; background: transparent; justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; gap: 0; white-space: normal; }
.chip-name small { font-size: 12px; }
.x { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; font-size: 18px; line-height: 1; }
.x:hover { color: var(--warn); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 2px; }

.tables-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.tables-head h2 { margin: 0; }
.add-table { display: flex; gap: 6px; flex-wrap: wrap; }
.add-table input:first-child { width: 190px; }
.add-table input[type=number] { width: 70px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.table-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff;
  display: flex; flex-direction: column; cursor: default; transition: box-shadow .15s, border-color .15s;
}
.table-card.target { cursor: pointer; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.table-card.full .cap { color: var(--ok); }
.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.table-head strong { font-size: 16px; overflow-wrap: anywhere; }
.cap { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seated { list-style: none; margin: 0 0 10px; padding: 0; flex: 1; }
.seated li { display: flex; align-items: center; border-bottom: 1px dashed var(--line); }
.seated li.selected { background: var(--rose-soft); }
.seated li.open { color: var(--muted); font-size: 13px; padding: 6px 0; border: 0; font-style: italic; }
.seat-name { flex: 1; border: 0; background: transparent; justify-content: flex-start; padding: 5px 2px; white-space: normal; text-align: left; }
.table-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.table-actions button { padding: 3px 8px; font-size: 12px; color: var(--muted); }

/* ---------- drag and drop ---------- */
.col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.chip-name, .seat-name { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  background: var(--rose); color: #fff; padding: 6px 12px; border-radius: 999px;
  font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: 0 8px 24px rgba(45, 36, 48, .25);
}
body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
body.dragging .guests { outline: 2px dashed #e3b9c9; outline-offset: -6px; }
.table-card.drop-hover, .guests.drop-hover { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); background: #fff8fb; }

/* ---------- hall map ---------- */
.hall-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.hall-head h2 { margin: 0; }
.hall-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.hall-tools label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.hall-tools input[type=checkbox] { width: auto; margin: 0; accent-color: var(--rose); }
.hall-box { margin-top: 10px; }
.hall-svg { display: block; width: 100%; height: auto; -webkit-user-select: none; user-select: none; }
.hall-svg .draggable { cursor: grab; }
.hall-svg .dragging { cursor: grabbing; opacity: .85; }
.hall-svg .tbl.target { cursor: pointer; }
.hall-svg .tbl.target .top { fill: #fbeef3; stroke-width: 5; }
.hall-svg .tbl.drop-hover .top { fill: #f7e6ed; stroke-width: 7; }

/* On phones the plan stays readable: it keeps a minimum size and scrolls sideways. */
@media (max-width: 760px) {
  .hall-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hall-svg { min-width: 640px; }
}

@media (min-width: 761px) {
  .guests {
    position: sticky; top: calc(var(--hdr, 64px) + 12px); align-self: start;
    max-height: calc(100vh - var(--hdr, 64px) - 24px); overflow: auto;
    /* tall enough to be an easy target for "drop here to unseat" */
    min-height: min(560px, calc(100vh - var(--hdr, 64px) - 24px));
  }
}

.seo { max-width: 820px; margin: 24px auto; padding: 0 16px; }
.seo h2 { font-size: 20px; margin-top: 28px; }
.seo li { margin-bottom: 8px; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
footer p { margin: 6px 0; }
footer a { color: var(--rose-dark); }
footer .langs a, footer .langs strong, footer .more a { margin: 0 6px; display: inline-block; }
footer .seller span + span::before { content: " · "; }
.agree { margin: 0; font-size: 12px; }
.agree a { color: var(--rose-dark); }

.doc-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-left: auto; font-size: 14px; }
.doc-nav a { color: var(--rose-dark); }
.doc {
  max-width: 820px; margin: 24px auto; padding: 24px 28px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow-wrap: anywhere;
}
.doc h1 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: var(--rose-dark); }
.doc h2 { font-size: 18px; margin: 24px 0 8px; }
.doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc p, .doc li { margin: 0 0 8px; }
.doc a { color: var(--rose-dark); }
.doc a.btn.primary { color: #fff; }
.doc .lead { font-size: 16px; }
.doc .muted { color: var(--muted); font-size: 13px; }
.doc .req { list-style: none; padding: 0; }
.doc .en { margin-top: 32px; padding-top: 8px; border-top: 2px solid var(--line); }
.doc .en-title { font-size: 20px; }
.doc .prices { border-collapse: collapse; width: 100%; margin: 8px 0 12px; }
.doc .prices th, .doc .prices td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
/* ---------- statistics consent bar ---------- */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; max-width: 760px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(45, 36, 48, .18); font-size: 14px;
}
.consent p { margin: 0; flex: 1 1 320px; color: var(--ink); }
.consent a { color: var(--rose-dark); }
.consent-actions { display: flex; gap: 8px; }

.article { line-height: 1.6; }
.article h2 { font-size: 20px; margin-top: 28px; }
.cta { margin: 28px 0; padding: 18px 20px; border-radius: 12px; background: var(--rose-soft); text-align: center; }
.cta p { margin: 0 0 12px; font-weight: 600; }
.doc .cta a.btn.primary { color: #fff; }
.article-list { padding-left: 20px; }
.article-list li { margin-bottom: 14px; }
.thanks { text-align: center; }
.thanks .code {
  display: inline-block; font: 700 24px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .06em;
  padding: 12px 18px; border: 2px dashed var(--gold); border-radius: 10px; background: #fffaf0; user-select: all;
}
@media (max-width: 760px) { .doc { margin: 16px; padding: 18px 16px; } }

dialog { border: 0; border-radius: 16px; padding: 0; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(45, 36, 48, .45); }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.dlg h2 { margin: 0; color: var(--rose-dark); }
.reason { margin: 0; color: var(--warn); font-weight: 600; }
.perks { margin: 0; padding-left: 20px; }
.price { margin: 4px 0; }
.code-label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.print-only { display: none; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; padding: 16px; }
  .chips { max-height: 40vh; }
  .event-title { max-width: none; }
  .add-table input:first-child { width: 100%; }
}

@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .no-print, dialog, #toast { display: none !important; }
  .print-only { display: block; }
  #print h1 { text-align: center; font-family: Georgia, serif; font-weight: 400; font-size: 30px; margin: 0 0 18px; }
  .p-map { break-after: page; break-inside: avoid; }
  .p-map h2 { text-align: center; font-family: Georgia, serif; font-weight: 400; margin: 0 0 10px; }
  .p-map svg { display: block; width: 100%; height: auto; max-height: 230mm; }
  .p-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .p-table { border: 1px solid #bbb; border-radius: 10px; padding: 10px 12px; break-inside: avoid; }
  .p-table h3 { margin: 0 0 6px; font-family: Georgia, serif; text-align: center; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
  .p-table ul { list-style: none; margin: 0; padding: 0; font-size: 13px; text-align: center; }
  .p-alpha { break-before: page; }
  .p-alpha h2 { text-align: center; font-family: Georgia, serif; font-weight: 400; }
  .p-alpha ul { list-style: none; padding: 0; columns: 2; column-gap: 32px; font-size: 13px; }
  .p-alpha li { display: flex; justify-content: space-between; border-bottom: 1px dotted #ccc; padding: 3px 0; break-inside: avoid; }
  .watermark { text-align: center; color: #999; font-size: 11px; margin-top: 20px; }
}
