*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #9b7dba;
  --accent-dark: #7c5da0;
  --bg: #f8f7fb;
  --surface: #ffffff;
  --border: #e2dce8;
  --text: #2d2235;
  --text-muted: #7a6b8a;
  --danger: #c0392b;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
header h1 { font-size: 1.2rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: .5rem; }

/* ── Main ───────────────────────────────────────────────── */
main { padding: 1.25rem; max-width: 1100px; margin: 0 auto; }

/* ── Dashboard ──────────────────────────────────────────── */
#dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 600px) {
  #dashboard { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.card-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.card-value { font-size: 1.5rem; font-weight: 700; }
.card-value small { font-size: .75rem; font-weight: 400; color: var(--text-muted); }

/* ── Controls ───────────────────────────────────────────── */
#controls {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (min-width: 600px) {
  #controls { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .controls-actions { margin-left: auto; }
}

.controls-filters, .controls-sort, .controls-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.controls-sort label { font-size: .85rem; color: var(--text-muted); }

/* ── Table ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
thead { background: var(--bg); }
th {
  text-align: start;
  padding: .65rem 1rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #faf8fd; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-bride { background: #fde8f0; color: #b5256e; }
.badge-groom { background: #e8effe; color: #2555b5; }

.empty { color: var(--text-muted); text-align: center; padding: 2rem; }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* ── Buttons ────────────────────────────────────────────── */
button, select, input[type="text"], input[type="number"] {
  font-family: inherit;
  font-size: .9rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .45rem .9rem;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .9rem;
  cursor: pointer;
  font-weight: 500;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .3rem .55rem;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  transition: border-color .15s, color .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

select, input[type="text"], input[type="number"] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .75rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
select:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: var(--accent);
}

/* ── Modals ─────────────────────────────────────────────── */
dialog {
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  padding: 0;
  max-width: 90vw;
  width: 100%;
}
@media (min-width: 520px) { dialog { max-width: 460px; } }

dialog::backdrop { background: rgba(0,0,0,.35); }

#guest-form, #relations-modal-inner {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#guest-form h2, #relations-modal-inner h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

#guest-form label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
}
#guest-form label input, #guest-form label select {
  color: var(--text);
  font-size: .95rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .25rem;
}

/* Relations list */
#relations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 260px;
  overflow-y: auto;
}
#relations-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
}
#relations-list li span { flex: 1; font-size: .9rem; }
#relations-list li input[type="text"] { flex: 1; font-size: .9rem; }

#relation-add-form {
  display: flex;
  gap: .5rem;
}
#relation-add-form input { flex: 1; }
