:root {
  --paper: #f3eee6;
  --paper-deep: #e7e0d4;
  --card: #fbf8f3;
  --ink: #2a2422;
  --ink-soft: #5e564f;
  --line: #ddd4c6;
  --accent: #8f4d55;
  --good: #2f5d50;
  --warn: #8a5a2a;
  --shadow: 0 18px 40px rgba(42, 36, 34, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
}

h1, h2, h3, .household {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: 3rem; margin: 0 0 8px; }
h2 { font-size: 1.7rem; margin: 0 0 8px; }
h3 { font-size: 1.35rem; margin: 0; }

p { margin: 0 0 10px; }
a { color: var(--ink); }

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.lede, .hint { color: var(--ink-soft); }
#lede:empty { display: none; }
.hint { font-size: 0.92rem; margin-top: 6px; }
.optional { font-weight: 400; color: var(--ink-soft); }
.error { color: var(--accent); margin: 8px 0; font-weight: 560; }
.banner {
  background: #f6eadc;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 14px;
}

body.guest {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px;
}
.shell { width: min(460px, 100%); }
body.admin { padding: 28px 18px 64px; }
.admin-wrap { width: min(1080px, 100%); margin: 0 auto; }
body.admin:has(#tracker[hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero {
  height: 210px;
  border-radius: 22px;
  margin: 8px 0 22px;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  background:
    linear-gradient(160deg, rgba(42, 36, 34, 0.16), rgba(42, 36, 34, 0.02)),
    var(--photo, none) center/cover no-repeat,
    linear-gradient(160deg, #e7d2cc, #efe6d6 52%, #d9e0d6);
}
body.has-photo .hero {
  background:
    linear-gradient(to top, rgba(42, 36, 34, 0.42), rgba(42, 36, 34, 0.05)),
    var(--photo) center 35%/cover no-repeat;
}
.hero-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 4rem;
  line-height: 0.8;
  color: rgba(42, 36, 34, 0.55);
}
body.has-photo .hero-mark { display: none; }

@media (min-width: 900px) {
  body.guest { padding: 40px; }
  body.guest .shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    column-gap: 72px;
    align-items: center;
  }
  body.guest .hero {
    position: sticky;
    top: 40px;
    align-self: start;
    height: calc(100vh - 80px);
    min-height: 520px;
    margin: 0;
    padding: 32px;
    border-radius: 28px;
  }
  body.guest .hero-mark { font-size: 8rem; }
  body.guest .panel { padding: 24px 0; }
}

.household { font-size: 1.8rem; margin: 4px 0 6px; }

label, legend {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
}
legend { padding: 0; }
fieldset.person {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 12px 0;
  padding: 14px;
  background: white;
}
fieldset.person > legend {
  float: left;
  width: 100%;
  margin: 0 0 10px;
}
fieldset.person > legend + * { clear: both; }
.person.missing { border-color: var(--accent); }

input, textarea, select, button { font: inherit; font-size: 16px; color: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px;
}
textarea { min-height: 88px; resize: vertical; }
input[type="color"] { width: 72px; height: 46px; padding: 4px; }
.code-input {
  font-size: 1.45rem;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.button, .text-button { cursor: pointer; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
}
.button.secondary, .button.danger {
  background: transparent;
  color: var(--ink);
}
.button.danger { color: var(--accent); border-color: var(--accent); }
.button:disabled { opacity: 0.55; cursor: wait; }
.text-button {
  display: inline-block;
  width: auto;
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  text-decoration: underline;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .button, .download-row .button { width: auto; margin-top: 0; }
.download-row { margin-top: 16px; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label {
  position: relative;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  font-weight: 560;
  cursor: pointer;
  background: var(--card);
}
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0.02;
  cursor: pointer;
}
.choice label:has(input:checked) {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button {
  width: auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 6px 10px;
  cursor: pointer;
}
.chips button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.diet-other { margin-top: 8px; }

.well {
  background: #f3ebe3;
  border-radius: 16px;
  padding: 14px 16px;
  margin: 16px 0;
}
.well strong { display: block; font-family: var(--serif); font-size: 1.3rem; font-weight: 500; margin-bottom: 6px; }
.name-list { list-style: none; padding: 0; margin: 8px 0 14px; }
.name-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }

.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 8px; }
.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.stat span { color: var(--ink-soft); font-size: 0.92rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.hlist { display: grid; gap: 10px; margin-top: 12px; }
.hcard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.hcard p { margin: 0; color: var(--ink-soft); }
.invite-code {
  font-family: var(--sans);
  letter-spacing: 0.08em;
  background: var(--paper);
  padding: 4px 8px;
  border-radius: 8px;
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.pill.coming { background: #e5f0ea; color: var(--good); }
.pill.waiting { background: #f6eadc; color: var(--warn); }
.code-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.guest-row { display: grid; grid-template-columns: 1.3fr 0.8fr 1fr auto; gap: 8px; margin-top: 8px; }
.qr-block { margin-top: 18px; }
.qr-block img { display: block; width: 180px; height: 180px; background: white; border-radius: 12px; }
#photo-preview { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }

dialog {
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: var(--card);
  color: var(--ink);
  width: min(640px, calc(100% - 24px));
}
dialog::backdrop { background: rgba(42, 36, 34, 0.45); }
.dialog-body { padding: 20px; }

.couple { width: min(720px, 100%); }
.couple .stats { grid-template-columns: repeat(3, 1fr); }
.stat-button {
  border: 2px solid transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
}
.stat-button::after {
  content: "View";
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.stat-button.open { border-color: var(--ink); }
.stat-button.open::after { content: "Hide"; }
.stat-button:hover { border-color: var(--line); }
.stat-button.open:hover { border-color: var(--ink); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.family-group { padding: 14px 0 4px; border-bottom: 1px solid var(--line); }
.family-group:last-child { border-bottom: 0; }
.family-group h3 { font-size: 1.2rem; }
.family-group h3 .hint { font-family: var(--sans); font-size: 0.85rem; margin-left: 4px; }
.people-list { margin: 4px 0 8px; }
.people-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0 6px 14px; border-bottom: 0; }
.diet-tag { color: var(--accent); font-size: 0.92rem; text-align: right; }
.print-only { display: none; }

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2, .guest-row, .hcard { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 2.4rem; }
}

@media print {
  body.admin { background: white; padding: 0; }
  .no-print { display: none !important; }
  .print-only { display: block; }
  #print-sheet { box-shadow: none; margin: 0; }
  .invite-code { font-size: 14pt; }
}
