/* Wedding Dashboard — modern romantic theme */
:root {
  color-scheme: light;
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-alt: #f6efe6;
  --border: #eadfd2;
  --text: #3d2f28;
  --text-muted: #8a7868;
  --primary: #b87a7a;
  --primary-dark: #9d5f5f;
  --primary-light: #f0dddd;
  --accent: #b8935b;
  --accent-light: #f0e4d0;
  --success: #6b8e6b;
  --success-light: #dcead8;
  --danger: #b55a5a;
  --danger-light: #f2dcdc;
  --warning: #c99a4a;
  --warning-light: #f4e6c8;
  --neutral: #8a8a8a;
  --neutral-light: #e9e7e3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(61,47,40,.05), 0 4px 14px rgba(61,47,40,.06);
  --shadow-md: 0 8px 30px rgba(61,47,40,.14);
  --ring: 0 0 0 3px var(--primary-light);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(184,122,122,.10), transparent 60%),
    radial-gradient(800px 500px at 95% 0%, rgba(184,147,91,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
}
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ===== Header ===== */
.header { text-align: center; padding: 26px 0 20px; margin-bottom: 16px; }
.header .eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-light); border-radius: 999px; padding: 5px 14px; margin-bottom: 14px;
}
.header h1 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(30px, 5vw, 44px); font-weight: 400;
  color: var(--primary-dark); letter-spacing: .3px;
}
.header .ampersand { color: var(--accent); font-style: italic; margin: 0 12px; }
.header .subtitle { color: var(--text-muted); font-size: 14px; margin-top: 8px; }
.undo-bar { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.undo-bar .btn { font-size: 12px; padding: 5px 14px; border-radius: 999px; }
.undo-bar .btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ===== Tabs ===== */
.tabs {
  position: sticky; top: 10px; z-index: 50;
  display: flex; gap: 4px; margin: 0 auto 26px; padding: 5px;
  width: fit-content; max-width: 100%; overflow-x: auto;
  background: rgba(255,255,255,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
}
.tab {
  background: transparent; border: none; padding: 9px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-radius: 999px; white-space: nowrap;
  transition: all .16s;
}
.tab:hover { color: var(--text); background: var(--surface-alt); }
.tab.active { color: #fff; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); box-shadow: 0 3px 10px rgba(184,122,122,.35); }

.panel { display: none; }
.panel.active { display: block; animation: panelIn .22s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Stat cards ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 700; }
.card .value { font-family: 'Georgia', serif; font-size: 28px; font-weight: 500; margin-top: 6px; color: var(--text); }
.card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.card.primary { border-top: 3px solid var(--primary); }
.card.success { border-top: 3px solid var(--success); }
.card.warning { border-top: 3px solid var(--warning); }
.card.accent  { border-top: 3px solid var(--accent); }

.progress-wrap { background: var(--neutral-light); height: 6px; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 3px; transition: width .3s; }
.progress-bar.over { background: var(--danger); }

/* ===== Sections ===== */
.section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.section-title { font-family: 'Georgia', serif; font-size: 19px; font-weight: 500; color: var(--text); }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); border-color: var(--text-muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(184,122,122,.3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: var(--danger-light); }
.btn.danger:hover { background: var(--danger-light); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.icon { padding: 4px 8px; background: transparent; border: none; color: var(--text-muted); font-size: 13px; }
.btn.icon:hover { color: var(--danger); background: var(--danger-light); border-radius: 8px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; background: var(--surface-alt); color: var(--text-muted);
  font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fdf9f4; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--text-muted); font-style: italic; }

.amount-good { color: var(--success); font-weight: 600; }
.amount-due { color: var(--danger); font-weight: 600; }
.source-note { font-size: 11px; color: var(--text-muted); margin-left: 4px; font-style: italic; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.yes, .badge.paid { background: var(--success-light); color: var(--success); }
.badge.no { background: var(--danger-light); color: var(--danger); }
.badge.pending, .badge.partial { background: var(--warning-light); color: var(--warning); }
.badge.invited, .badge.unpaid { background: var(--neutral-light); color: var(--neutral); }
.badge.maybe { background: var(--accent-light); color: var(--accent); }
.badge.side-a { background: var(--primary-light); color: var(--primary-dark); }
.badge.side-b { background: var(--accent-light); color: var(--accent); }
.badge.side-both { background: var(--neutral-light); color: var(--neutral); }

/* ===== Charts / overview ===== */
.chart-container { position: relative; height: 260px; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mini-list { font-size: 13px; }
.mini-list .row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.mini-list .row:last-child { border-bottom: none; }
.mini-list .name { color: var(--text); }
.mini-list .val { color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.info-text { color: var(--text-muted); font-size: 13px; }

/* ===== Forms / inputs ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea,
.filter-bar input, .filter-bar select,
.quick-add-bar input, .quick-add-bar select {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.field input, .field select, .field textarea { width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus,
.filter-bar input:focus, .filter-bar select:focus,
.quick-add-bar input:focus, .quick-add-bar select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filter-bar input { min-width: 200px; }

.quick-add-bar {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center;
  padding: 12px; background: var(--surface-alt); border-radius: 12px; border: 1px dashed var(--border);
}

.inline-edit {
  width: 100%; padding: 5px 8px; border: 1px solid transparent; background: transparent;
  border-radius: 8px; font-size: 13px; font-family: inherit; color: var(--text);
  transition: border-color .1s, background .1s;
}
.inline-edit:hover { border-color: var(--border); background: var(--surface); }
.inline-edit:focus { border-color: var(--primary); background: var(--surface); outline: none; box-shadow: var(--ring); }
select.inline-edit { padding-right: 4px; cursor: pointer; }

/* ===== To-dos ===== */
.todo-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--success); margin: 0; vertical-align: middle; }
tr.todo-done td input.todo-title-input { color: var(--text-muted); text-decoration: line-through; }
tr.todo-done { opacity: .65; }
.overdue-badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--danger-light); color: var(--danger); margin-left: 6px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ===== Seating ===== */
.seating-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.unassigned-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; max-height: calc(100vh - 140px); overflow-y: auto; position: sticky; top: 70px;
  box-shadow: var(--shadow); transition: background .15s, border-color .15s;
}
.unassigned-panel.drop-hover { background: var(--primary-light); border-color: var(--primary); border-style: dashed; }
.unassigned-title { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .08em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.floor-plan {
  position: relative; min-height: 640px;
  background-color: #fdfaf5;
  background-image: linear-gradient(rgba(184,122,122,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(184,122,122,.08) 1px, transparent 1px);
  background-size: 30px 30px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow);
}
.floor-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--text-muted); font-style: italic; pointer-events: none; text-align: center; font-size: 14px; }

.room-table {
  position: absolute; width: 220px; background: var(--surface); border: 2px solid var(--primary);
  border-radius: 16px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; user-select: none;
  transition: border-color .15s, box-shadow .15s;
}
.room-table.over-capacity { border-color: var(--danger); }
.room-table.moving { opacity: .92; z-index: 100; box-shadow: 0 16px 36px rgba(61,47,40,.3); }
.room-table.drop-hover { border-style: dashed; transform: scale(1.02); }
.room-table-handle {
  padding: 8px 10px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); color: #fff;
  border-radius: 13px 13px 0 0; display: flex; justify-content: space-between; align-items: center;
  cursor: grab; font-weight: 600; font-size: 13px; gap: 4px;
}
.room-table.over-capacity .room-table-handle { background: var(--danger); }
.room-table-handle:active { cursor: grabbing; }
.room-table-handle .htitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.room-table-handle .drag-dots { font-size: 14px; opacity: .7; padding-right: 4px; letter-spacing: -1px; }
.room-table-handle .h-actions { display: flex; gap: 2px; flex-shrink: 0; }
.room-table-handle button.h-action { background: transparent; border: none; color: rgba(255,255,255,.85); cursor: pointer; padding: 2px 6px; font-size: 12px; border-radius: 4px; line-height: 1; }
.room-table-handle button.h-action:hover { background: rgba(255,255,255,.25); color: #fff; }
.room-table-body { padding: 10px; min-height: 70px; display: flex; flex-direction: column; gap: 4px; background: var(--bg); pointer-events: none; }
.room-table-body > * { pointer-events: auto; }
.room-table.drop-hover .room-table-body { background: var(--primary-light); }
.room-empty-hint { text-align: center; color: var(--text-muted); font-size: 12px; font-style: italic; padding: 14px 0; }
.room-table-footer { padding: 6px 10px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--surface-alt); border-radius: 0 0 13px 13px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.room-table.over-capacity .room-table-footer { color: var(--danger); background: var(--danger-light); }

.guest-chip {
  display: flex; align-items: center; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 8px; font-size: 13px; cursor: grab; user-select: none;
  transition: background .1s, box-shadow .1s, transform .1s; gap: 8px;
}
.guest-chip:hover { background: #fff; box-shadow: var(--shadow); }
.guest-chip:active { cursor: grabbing; }
.guest-chip.dragging { opacity: .4; }
.guest-chip.side-yours { border-left-color: var(--primary); }
.guest-chip.side-partners { border-left-color: var(--accent); }
.guest-chip.side-both { border-left-color: var(--neutral); }
.guest-chip .rsvp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.guest-chip .rsvp-dot.rsvp-yes { background: var(--success); }
.guest-chip .rsvp-dot.rsvp-maybe { background: var(--warning); }
.guest-chip .rsvp-dot.rsvp-pending { background: var(--neutral); border: 1px solid var(--border); }
.guest-chip .g-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-chip .party-size { font-size: 10px; color: var(--text-muted); background: var(--neutral-light); padding: 2px 6px; border-radius: 8px; font-weight: 700; flex-shrink: 0; }
.unassigned-panel .guest-chip { margin-bottom: 5px; background: var(--surface-alt); }

.seating-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); align-items: center; margin-top: 10px; flex-wrap: wrap; }
.seating-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.seating-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.seat-row { display: flex; align-items: stretch; gap: 4px; margin-bottom: 5px; }
.seat-row .guest-chip { flex: 1; margin-bottom: 0 !important; }
.seat-picker { padding: 4px 6px; font-size: 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; max-width: 110px; flex-shrink: 0; }
.seat-picker:hover { border-color: var(--primary); }
.seat-picker:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.chip-unseat { border: none; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 8px; font-size: 16px; line-height: 1; flex-shrink: 0; align-self: center; border-radius: 6px; font-weight: bold; }
.chip-unseat:hover { color: var(--danger); background: var(--danger-light); }

/* ===== Modal / toast ===== */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(61,47,40,.4);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.active { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); animation: panelIn .18s ease; }
.modal h3 { font-family: 'Georgia', serif; font-size: 20px; font-weight: 500; margin-bottom: 18px; color: var(--primary-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

#save-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 8px);
  background: var(--text); color: #fff; padding: 8px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md);
  opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none; z-index: 500;
}
#save-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .container { padding: 14px; }
  .overview-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .seating-layout { grid-template-columns: 1fr; }
  .unassigned-panel { position: static; max-height: 260px; }
  .tabs { width: 100%; justify-content: flex-start; }
}
