:root {
  --ink: #18211f;
  --muted: #63716b;
  --paper: #fffdf8;
  --line: #dfe6df;
  --sage: #789283;
  --green: #2f7d58;
  --red: #a84040;
  --bg: #f5f2ea;
  --shadow: 0 18px 55px rgba(28, 35, 31, .13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }

.hero {
  min-height: 240px;
  background:
    linear-gradient(90deg, rgba(24, 33, 31, .76), rgba(24, 33, 31, .38), rgba(24, 33, 31, .16)),
    url("wedding-invite-hero.png") center / cover;
  color: white;
  display: flex;
  align-items: center;
  padding: 8px clamp(18px, 4vw, 56px);
}

.hero-inner {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 0 0 12px;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 4.6vw, 60px);
  line-height: .92;
  letter-spacing: -.025em;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .15);
}

h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 3px;
  margin-top: 16px;
  border-radius: 3px;
  background: #d4bd8b;
}

.subtitle {
  max-width: 680px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .88);
  font-size: 18px;
  line-height: 1.5;
}

.hero-wedding-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: rgba(255, 255, 255, .9);
  font-size: 14px;
  font-weight: 700;
}

.countdown {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 999px;
  background: rgba(24, 33, 31, .28);
  color: #fff;
  letter-spacing: .02em;
}

main {
  width: min(1160px, calc(100% - 28px));
  margin: -38px auto 46px;
  position: relative;
  z-index: 2;
}

.page-actions {
  margin-bottom: 18px;
}

.topbar, .panel {
  background: rgba(255, 253, 248, .96);
  border: 1px solid rgba(223, 230, 223, .9);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
  background: var(--paper);
}

.metric strong {
  display: block;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(290px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
  letter-spacing: 0;
}

.tables-title { margin-top: 22px; }
.details-form { margin-top: 14px; }

.details-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 22px;
  padding: 12px;
}

.details-box summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(120, 146, 131, .18);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.phone-row {
  display: grid;
  grid-template-columns: minmax(118px, 150px) 1fr;
  gap: 10px;
}

.field-spacer { display: block; }

.table-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}

.person-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
}

.table-inputs input:last-child {
  text-align: center;
}

.guest-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.guest-person-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 140px 116px;
  gap: 8px;
}

.seat-left {
  background: #f4f1e8;
  color: var(--muted);
  cursor: default;
}

.seat-warning {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(168, 64, 64, .12);
}

.attention {
  border: 1px solid rgba(168, 64, 64, .35);
  background: #fff4f1;
  color: var(--red);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 800;
}

.table-limit-list {
  display: grid;
  gap: 8px;
}

.table-limit-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  color: white;
  background: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn.secondary { background: var(--sage); }
.btn.light { background: #ece8dc; color: var(--ink); }
.btn.danger { background: var(--red); }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.tools {
  display: grid;
  grid-template-columns: 1fr 180px 160px;
  gap: 10px;
  margin-bottom: 14px;
}

.send-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}

.todo-panel {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.todo-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.todo-heading h2 { margin: 0; }
.todo-hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.todo-filter { min-width: 150px; }

.todo-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.todo-counts > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.todo-counts strong { font-size: 20px; color: var(--ink); }
.todo-counts span { color: var(--muted); font-size: 12px; line-height: 1.25; }

.todo-list { display: grid; gap: 8px; }
.todo-row {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) minmax(170px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.todo-guest, .todo-tasks, .todo-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.todo-guest strong { overflow-wrap: anywhere; }
.todo-task { padding: 5px 8px; border-radius: 999px; background: #f2eee4; color: #655b43; font-size: 11px; font-weight: 800; }
.todo-task.reply { background: #f7eee1; color: #80612f; }
.todo-task.table { background: #eaf1eb; color: #42654f; }
.todo-actions { justify-content: end; }
.todo-actions .btn { padding: 8px 10px; font-size: 12px; }
.todo-done { margin: 0; padding: 12px; color: var(--green); font-weight: 800; }
button:disabled { opacity: .62; cursor: default; }

.guest-list {
  display: grid;
  gap: 10px;
}

.guest {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  display: block;
  align-items: start;
}

.guest-summary {
  width: 100%;
  padding: 0;
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  text-align: left;
}

.guest-toggle,
.guest-name-button,
.name-edit-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.guest-toggle {
  color: var(--sage);
  font-weight: 900;
  font-size: 17px;
  padding: 2px 4px;
}

.guest-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.guest-name-button {
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
  padding: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.name-edit-btn {
  color: var(--muted);
  font-size: 13px;
  padding: 2px 4px;
}

.name-edit-btn:hover,
.guest-name-button:hover {
  color: var(--sage);
}

.guest-name-edit {
  max-width: 320px;
  min-width: 180px;
  padding: 7px 9px;
  font-size: 18px;
  font-weight: 900;
}

.guest-details {
  margin-top: 14px;
  display: block;
}

.guest.collapsed .guest-details {
  display: none;
}

.guest-meta {
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #f0eee6;
  color: var(--muted);
}

.pill.accepted { color: white; background: var(--green); }
.pill.declined { color: white; background: var(--red); }
.pill.mixed { color: white; background: var(--gold, #b39155); }
.pill.bride { background: #f8e4df; color: #8f5048; }
.pill.groom { background: #e3ece6; color: #456b55; }

.guest-controls {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 90px minmax(130px, 1fr);
  gap: 8px;
  min-width: 0;
  align-items: start;
  margin-top: 14px;
}

.guest-controls .guest-tables {
  grid-column: 1 / -1;
}

.main-name {
  max-width: 360px;
}

.control-field {
  display: grid;
  gap: 5px;
}

.control-field span,
.guest-tables-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.table-board {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.table-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.table-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.map-section {
  margin-top: 18px;
  display: none;
}

body.map-page-open main {
  margin-top: -38px;
}

body.map-page-open .topbar,
body.map-page-open .page-actions,
body.map-page-open .layout {
  display: none;
}

body.map-page-open .map-section {
  display: block;
}

.map-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  flex-wrap: wrap;
}

.map-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-tools {
  display: grid;
  grid-template-columns: 1fr 140px 150px 90px 160px auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
}

.hotel-map {
  position: relative;
  width: min(100%, 794px);
  aspect-ratio: 210 / 297;
  min-height: 0;
  margin: 0 auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(120, 146, 131, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 146, 131, .12) 1px, transparent 1px),
    #fffdf8;
  background-size: 32px 32px;
}

.hotel-map.landscape {
  width: min(100%, 1123px);
  aspect-ratio: 297 / 210;
}

.unplaced-tables {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 12px;
}

.unplaced-tables strong {
  color: var(--muted);
  font-size: 13px;
}

.map-item {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 36px;
  border: 2px solid var(--sage);
  background: #eef4ed;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  cursor: move;
  user-select: none;
  padding: 6px;
}

.map-item-content {
  position: relative;
  z-index: 2;
}

.map-item small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.chair {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold, #b39155);
}

.chair.accepted { background: var(--green); }
.chair.pending { background: #9ca69f; }
.chair.empty-seat { background: #d8d3c5; }

.chair-round {
  left: 50%;
  top: 50%;
  margin: -5px;
  transform: rotate(var(--angle)) translate(calc(var(--seat-radius, 40px) + 14px)) rotate(calc(-1 * var(--angle)));
  transform-origin: center;
}

.chair-top {
  top: -16px;
  transform: translateX(-50%);
}

.chair-bottom {
  bottom: -16px;
  transform: translateX(-50%);
}

.chair-left {
  left: -16px;
  transform: translateY(-50%);
}

.chair-right {
  right: -16px;
  transform: translateY(-50%);
}

.map-item.table {
  border-radius: 999px;
}

.map-item.table.square {
  border-radius: 8px;
}

.map-item.table.rectangle {
  border-radius: 8px;
}

.map-item.stage {
  border-color: var(--rose, #c9877b);
  background: #f9e7e2;
  border-radius: 8px;
}

.map-item.label {
  border-style: dashed;
  background: rgba(255,255,255,.86);
  border-radius: 6px;
}

.map-item.selected {
  outline: 3px solid var(--gold, #b39155);
  z-index: 3;
}

.map-legend {
  width: min(100%, 794px);
  margin: 12px auto 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.accepted { background: var(--green); }
.legend-dot.pending { background: #9ca69f; }
.legend-dot.empty-seat { background: #d8d3c5; }

.map-report {
  width: min(100%, 794px);
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.map-report-row {
  border-top: 1px solid rgba(120, 146, 131, .22);
  padding-top: 6px;
}

.map-report-row strong {
  color: var(--ink);
}

.map-report-person {
  display: inline-block;
  margin: 2px 5px 0 0;
  color: var(--ink);
}

.map-report-person em {
  color: var(--muted);
  font-style: normal;
}

.map-report-person.accepted::before,
.map-report-person.pending::before,
.map-report-person.empty-seat::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: 1px;
  background: #d8d3c5;
}

.map-report-person.accepted::before { background: var(--green); }
.map-report-person.pending::before { background: #9ca69f; }
.map-report-empty {
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 26px;
  border-radius: 8px;
  text-align: center;
  background: rgba(255,255,255,.55);
}

@media (max-width: 880px) {
  .layout, .topbar, .tools { grid-template-columns: 1fr; }
  .guest-summary, .guest-details { grid-template-columns: 1fr; }
  .map-tools { grid-template-columns: 1fr; }
  .todo-counts { grid-template-columns: 1fr; }
  .todo-row { grid-template-columns: 1fr; }
  .todo-actions { justify-content: flex-start; }
  main { margin-top: -22px; }
  .hero { min-height: 220px; }
  h1 { white-space: normal; }
  .phone-row { grid-template-columns: 1fr; }
  .guest-controls {
    min-width: 0;
    grid-template-columns: 1fr;
  }
  .person-row, .guest-person-row, .table-limit-row { grid-template-columns: 1fr; }
}

@media print {
  body {
    background: white;
  }

  body > *:not(main),
  main > *:not(.map-section),
  .map-header .map-actions,
  .map-tools,
  .map-section .send-note {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .map-section {
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .hotel-map {
    width: 190mm;
    aspect-ratio: 210 / 297;
    border-color: #111;
  }

  .hotel-map.landscape {
    width: 277mm;
    aspect-ratio: 297 / 210;
  }

  .map-legend {
    width: 190mm;
  }
}

[hidden]{display:none!important}

.invite-types{border:1px solid var(--line);border-radius:6px;padding:10px;display:grid;gap:9px}.invite-types legend{font-weight:700;font-size:13px}.invite-types label{display:flex;align-items:center;gap:8px;font-size:14px}.invite-types input{width:auto;margin:0}
