:root {
  --bg: #f5f3ee;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --panel-muted: #f8f8f8;
  --border: rgba(10, 31, 59, 0.12);
  --text: #333333;
  --muted: #5e6470;
  --navy: #0a1f3b;
  --navy-soft: rgba(10, 31, 59, 0.08);
  --gold: #c9a042;
  --gold-strong: #b88a1a;
  --gold-soft: rgba(201, 160, 66, 0.12);
  --copper: #b87333;
  --sage: #2f6b4f;
  --sage-soft: rgba(47, 107, 79, 0.12);
  --sage-deep: #184e38;
  --blue: #355b7e;
  --blue-soft: rgba(53, 91, 126, 0.12);
  --danger: #b85d4d;
  --success: #2d6a4f;
  --warning: #c98e43;
  --warning-soft: rgba(201, 142, 67, 0.13);
  --danger-soft: rgba(184, 93, 77, 0.12);
  --input-bg: #ffffff;
  --chip-bg: rgba(10, 31, 59, 0.05);
  --shadow: 0 16px 30px rgba(10, 31, 59, 0.08);
}

body.dark {
  --bg: #111a26;
  --panel: rgba(16, 24, 35, 0.96);
  --panel-strong: #142033;
  --panel-muted: #1a2739;
  --border: rgba(201, 160, 66, 0.14);
  --text: #edf2f7;
  --muted: #b5c0ce;
  --navy: #e5eef8;
  --navy-soft: rgba(229, 238, 248, 0.08);
  --gold: #d8b469;
  --gold-strong: #f0c971;
  --gold-soft: rgba(216, 180, 105, 0.12);
  --copper: #d19961;
  --danger: #e58f7b;
  --success: #75c79a;
  --warning: #efc17a;
  --warning-soft: rgba(239, 193, 122, 0.12);
  --danger-soft: rgba(229, 143, 123, 0.12);
  --input-bg: rgba(10, 31, 59, 0.25);
  --chip-bg: rgba(201, 160, 66, 0.08);
  --shadow: 0 18px 32px rgba(3, 7, 12, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(201, 160, 66, 0.12), transparent 24%),
    linear-gradient(180deg, #f7f5f3 0%, var(--bg) 100%);
  color: var(--text);
}

body.dark {
  background:
    radial-gradient(circle at top left, rgba(201, 160, 66, 0.15), transparent 22%),
    linear-gradient(180deg, #0d1621 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

#app {
  width: min(1500px, calc(100% - 20px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(10, 31, 59, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 28px rgba(10, 31, 59, 0.15);
}

.brand-copy strong,
.brand-copy span,
.topbar-actions,
.global-search input,
.icon-button,
.primary-button,
.secondary-button,
.ghost-button,
.small-button,
.danger-button,
.nav-tab,
.list-item,
.badge,
.panel,
.field label {
  color: var(--text);
}

body.dark .topbar {
  background: rgba(10, 31, 59, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), var(--copper));
  color: var(--navy);
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.brand-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.74rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.global-search {
  min-width: min(420px, 100%);
  position: relative;
}

.global-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--text);
  padding: 11px 14px 11px 38px;
  border-radius: 12px;
  outline: none;
}

.global-search::before {
  content: "⌕";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.2rem;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.icon-button:hover,
.small-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--gold), var(--copper));
  color: var(--navy);
  box-shadow: 0 12px 22px rgba(201, 160, 66, 0.2);
  font-weight: 700;
}

.secondary-button {
  background: var(--panel-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.small-button {
  background: var(--panel-muted);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--panel-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(208, 109, 109, 0.25);
}

.section-card,
.panel,
.list-card,
.event-card,
.table-card,
.checklist-card,
.notes-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.event-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 16px;
  min-height: 220px;
  position: relative;
}

.event-card .entry-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.event-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.event-date {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 4px 0 0;
}

.event-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.rsvp-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: var(--panel-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--copper));
}

.event-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.new-event-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  border: 1.5px dashed var(--border);
  background: rgba(255, 255, 255, 0.3);
}

.new-event-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.new-event-cta .plus {
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--gold-soft), var(--navy-soft));
  color: var(--navy);
  font-size: 2rem;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--muted);
  padding: 28px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.workspace-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.5rem);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.nav-tab {
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--gold-soft), var(--navy-soft));
  border-color: rgba(201, 160, 66, 0.32);
  color: var(--navy);
  font-weight: 700;
}

.panel {
  padding: 18px;
}

.filter-row,
.toolbar-row,
.action-row,
.inline-grid,
.stats-grid,
.stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 140px;
}

.field label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guests-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.sheet-panel {
  padding: 14px;
}

.list-manager {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.list-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compact-list-manager {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  margin-bottom: 12px;
}

.toolbar-compact {
  gap: 8px;
}

.compact-field {
  min-width: 120px;
}

.list-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-item.primary {
  border-color: rgba(116, 144, 122, 0.25);
  background: rgba(155, 180, 164, 0.08);
}

.list-item-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge.primary {
  background: var(--gold-soft);
  color: var(--navy);
}

.badge.rsvp-yes {
  background: rgba(79, 157, 110, 0.12);
  color: var(--success);
}

.badge.rsvp-no {
  background: rgba(208, 109, 109, 0.12);
  color: var(--danger);
}

.badge.rsvp-unknown {
  background: rgba(212, 165, 109, 0.16);
  color: var(--warning);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.18);
}

.spreadsheet-wrap {
  border-width: 1px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

th,
td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(10, 31, 59, 0.04);
  position: sticky;
  top: 0;
  z-index: 1;
}

.spreadsheet-table tbody tr:nth-child(even) {
  background: rgba(10, 31, 59, 0.02);
}

.spreadsheet-table td {
  min-width: 120px;
}

.spreadsheet-table td:nth-child(1),
.spreadsheet-table th:nth-child(1) {
  min-width: 42px;
  width: 42px;
}

.spreadsheet-table td:nth-child(2),
.spreadsheet-table th:nth-child(2) {
  min-width: 180px;
}

.spreadsheet-table td:nth-child(11),
.spreadsheet-table th:nth-child(11) {
  min-width: 140px;
  width: 150px;
}

.spreadsheet-table .placeholder-cell {
  color: var(--muted);
  opacity: 0.7;
}

.spreadsheet-table tbody tr {
  transition: background 0.18s ease;
}

.spreadsheet-table tbody tr:hover {
  background: rgba(201, 160, 66, 0.06);
}

.guest-hover-details {
  position: relative;
}

.guest-hover-details .details-popup {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 15;
  min-width: 240px;
  max-width: 300px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.guest-hover-details:hover .details-popup,
.guest-hover-details:focus-within .details-popup {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.details-popup strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
}

.details-popup .detail-grid {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
}

tbody tr:hover {
  background: rgba(155, 180, 164, 0.04);
}

.person-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.person-name small {
  color: var(--muted);
  font-weight: 500;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 0.74rem;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.checkbox-col {
  width: 42px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-strong);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 24px;
}

.modal {
  width: min(760px, 100%);
  max-height: min(85vh, 820px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-body,
.modal-footer {
  padding: 18px 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.modal-grid .full {
  grid-column: 1 / -1;
}

.modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-muted);
}

.stat-card .number {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  margin-top: 8px;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.seating-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
}

.unassigned-list,
.table-grid,
.checklist-list,
.notes-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.person-chip {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  cursor: grab;
}

.person-chip.dragging {
  opacity: 0.5;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.table-card {
  padding: 16px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.04));
}

.table-card.over-capacity {
  border-color: rgba(208, 109, 109, 0.38);
  background: rgba(208, 109, 109, 0.04);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shape-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.table-occupants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 8px;
  flex: 1;
}

.table-occupants.empty {
  justify-content: center;
  color: var(--muted);
}

.checklist-card {
  padding: 16px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-item.done .item-text {
  text-decoration: line-through;
  color: var(--muted);
}

.checklist-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-muted);
  overflow: hidden;
  margin: 10px 0 16px;
}

.checklist-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--copper));
}

.notes-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.notes-card {
  padding: 18px;
  min-height: 280px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card-compact {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-muted);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .guests-layout,
  .seating-layout,
  .notes-stack {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  #app {
    width: min(100% - 12px, 100%);
    padding-top: 12px;
  }

  .topbar {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .brand-copy span {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .global-search {
    min-width: 0;
    width: 100%;
  }

  .stats-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .workspace-nav,
  .workspace-actions,
  .row-actions,
  .global-search,
  .modal-backdrop,
  .hidden-print,
  .toolbar-row button,
  .toolbar-row input,
  .toolbar-row select,
  .field,
  .panel .row-actions {
    display: none !important;
  }

  .app-shell,
  .panel,
  .table-card,
  .checklist-card,
  .notes-card,
  .list-card,
  .event-card {
    box-shadow: none !important;
    border-color: #d0d0d0 !important;
    background: white !important;
    color: black !important;
  }

  .section-card,
  .panel {
    break-inside: avoid;
  }
}
