:root {
  color-scheme: light;
  --bg: #f7f4f1; --panel: #fff; --ink: #2b2530; --muted: #6f6675; --line: #e6dfe4;
  --accent: #5b4a6b; --accent-ink: #fff; --accent-soft: #efe8f4; --warn: #b4442f; --ok: #2f7a4b;
  --radius: 10px; --sheet-zoom: 1;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f-ui); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; color: var(--ink); }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tab.active { background: var(--accent); color: var(--accent-ink); }
.badge { font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 999px; }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.view { display: block; }
h1 { font: 600 30px/1.15 "Cormorant Garamond", Georgia, serif; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0; }
h3.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 6px; }
.intro { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.intro p { margin: 0 0 6px; color: var(--muted); max-width: 70ch; }

.event-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.event-row label, .print-controls label, dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.event-row input { width: 240px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }

.layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.guests-panel { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.count { color: var(--muted); font-weight: 400; font-size: 13px; }
.count.warn { color: var(--warn); font-weight: 600; }
#guestSearch { width: 100%; margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: end; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.check { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0; }
.empty { color: var(--muted); font-size: 14px; list-style: none; padding: 8px 2px; }

.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--warn); }
.btn[aria-disabled] { opacity: .5; pointer-events: none; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
.tools { margin-top: 12px; font-size: 13px; }
.tools summary { cursor: pointer; color: var(--muted); }
.tools[open] { display: flex; flex-direction: column; }
.tools .btn { margin-top: 6px; text-align: left; }

/* guests */
.guest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: grab; user-select: none; min-height: 36px; }
.chip:hover { border-color: #cbbfd3; }
.chip.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.selected .chip-meal, .chip.selected .chip-party { color: #e9e0ef; }
.chip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-meal, .chip-party { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.chip-party::before { content: "◆ "; opacity: .5; }
.icon { border: 0; background: none; cursor: pointer; padding: 2px 4px; color: inherit; opacity: .55; font-size: 14px; line-height: 1; }
.icon:hover { opacity: 1; }

/* tables */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.table-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #fcfbfa; min-height: 120px; position: relative; }
.table-card.target { cursor: pointer; border-style: dashed; border-color: var(--accent); }
.table-card.target:hover, .table-card.dragover, .guests-panel.dragover { background: var(--accent-soft); }
.table-card.over { border-color: var(--warn); }
.table-card.over .tc-cap { color: var(--warn); font-weight: 600; }
.tc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tc-name { flex: 1; font-weight: 600; border-color: transparent; padding: 4px 6px; background: transparent; }
.tc-name:hover { border-color: var(--line); }
.tc-cap { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tc-seats { width: 52px; padding: 3px 4px; }
.table-card { padding-bottom: 24px; }
.drop-hint { position: absolute; left: 0; right: 0; bottom: 5px; font-size: 12px; color: var(--accent); text-align: center; pointer-events: none; }

/* print controls */
.print-controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.paywall { background: #fff6e8; border: 1px solid #f0d7a8; border-radius: 8px; padding: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* dialogs */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 20, 40, .4); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { min-height: 1.2em; font-size: 14px; margin: 0; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--warn); }
code { background: var(--accent-soft); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); z-index: 50; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.faq { max-width: 760px; margin: 32px auto 0; padding: 0 16px; }
.faq h2 { font: 600 24px "Cormorant Garamond", Georgia, serif; margin-bottom: 8px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { color: var(--muted); margin: 8px 0 2px; }
body:has(#view-print:not([hidden])) .faq { display: none; }
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }

/* ---------- printable sheets (US Letter) ---------- */
.sheets { --serif: "Cormorant Garamond", Georgia, serif; --name-font: var(--serif); font-variant-numeric: lining-nums; }
.poster.roomy .az { columns: 2; column-gap: .6in; font-size: 15pt; line-height: .38in; }
.poster.roomy .az li b { font-size: 15pt; }
.poster.roomy h1 { font-size: 44pt; }
.poster.roomy header { margin: .4in 0 .45in; }
.sheets.font-script { --name-font: "Great Vibes", "Brush Script MT", cursive; }
.sheets.font-modern { --name-font: "Inter", Arial, sans-serif; }
.sheet { width: 8.5in; height: 11in; position: relative; background: #fff; color: #222; overflow: hidden;
  margin: 0 auto 16px; box-shadow: 0 2px 10px rgba(0,0,0,.12); zoom: var(--sheet-zoom); }
.sheets.locked .sheet { filter: blur(2.5px); }
.credit { position: absolute; bottom: .18in; left: 0; right: 0; text-align: center; font: 7pt var(--f-ui); color: #aaa; }
.grid { position: absolute; display: grid; }
.card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.name { font-family: var(--name-font); line-height: 1.1; padding: 0 .15in; }
.font-modern .name { text-transform: uppercase; letter-spacing: .12em; font-weight: 500; }
.cut .card { outline: .5pt dashed #c9c9c9; }

.escort { top: .5in; left: .75in; grid-template-columns: repeat(2, 3.5in); grid-auto-rows: 2in; }
.escort .name { font-size: 20pt; }
.font-script .escort .name { font-size: 26pt; }
.font-modern .escort .name { font-size: 12pt; }
.escort .table { font: 10pt var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: #555; margin-top: .12in; }

.place { top: 1.5in; left: .75in; grid-template-columns: repeat(2, 3.5in); grid-auto-rows: 4in; }
.place .card { justify-content: stretch; }
.place .half { height: 2in; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.place .back { transform: rotate(180deg); }
.cut .place .back { border-bottom: .5pt dotted #ddd; }
.place .name { font-size: 22pt; }
.font-script .place .name { font-size: 30pt; }
.font-modern .place .name { font-size: 13pt; }
.place .meal { font: 8.5pt var(--f-ui); color: #777; margin-top: .08in; letter-spacing: .08em; text-transform: uppercase; }

.tablenums { inset: 0; grid-template-rows: repeat(2, 5.5in); }
.tablenums .card { width: 8.5in; }
.small-label { font: 13pt var(--f-ui); letter-spacing: .3em; text-transform: uppercase; color: #666; }
.big { font-family: var(--name-font); font-size: 150pt; line-height: 1; }
.big.word { font-size: 54pt; padding: 0 .5in; }
.font-modern .big { font-weight: 300; }

.poster { padding: .6in .6in .5in; height: 100%; }
.poster header { text-align: center; margin-bottom: .25in; }
.poster h1 { font-family: var(--name-font); font-size: 34pt; font-weight: 500; margin: 0; }
.poster header p { font: 10pt var(--f-ui); letter-spacing: .2em; text-transform: uppercase; color: #777; margin: .05in 0 0; }
.az { columns: 3; column-gap: .35in; list-style: none; margin: 0; padding: 0; font: 10.5pt/.255in var(--serif); }
.font-modern .az { font-family: var(--f-ui); font-size: 9pt; }
.az li { display: flex; gap: 4px; break-inside: avoid; }
.az li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.az li::after { content: ""; order: 1; flex: 1; border-bottom: .5pt dotted #bbb; margin-bottom: .07in; }
.az li b { order: 2; font: 600 .85em/inherit var(--f-ui); align-self: center; }
.bytable { columns: 3; column-gap: .35in; }
.bytable section { break-inside: avoid; margin-bottom: .14in; }
.bytable h2 { font: 600 10pt var(--f-ui); letter-spacing: .14em; text-transform: uppercase; border-bottom: .5pt solid #ccc; padding-bottom: 2px; margin: 0 0 3px; }
.bytable ul { list-style: none; margin: 0; padding: 0; font: 10.5pt/.25in var(--serif); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .guests-panel { position: static; max-height: 45vh; }
  .tabs { margin-left: auto; }
  .brand { font-size: 0; gap: 0; }
  h1 { font-size: 26px; }
  .event-row input { width: 100%; }
  .event-row label { flex: 1 1 140px; }
}

@media print {
  @page { size: letter; margin: 0; }
  html, body { background: #fff; }
  .no-print, .topbar, .site-footer, .toast, dialog, #view-plan { display: none !important; }
  #view-print { display: block !important; }
  main { padding: 0; max-width: none; }
  .sheet { zoom: 1; margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .sheets.locked { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
