:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #5c6978;
  --navy: #102033;
  --navy-soft: #1b3348;
  --cream: #f3ede3;
  --paper: #fffdf8;
  --line: rgba(16, 32, 51, 0.12);
  --gold: #c6a15b;
  --gold-deep: #8a5a12;
  --pine: #1e6b45;
  --berry: #8e2f39;
  --shadow: 0 16px 40px rgba(16, 32, 51, 0.06);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(198, 161, 91, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f3ec 0%, var(--cream) 40%, #efe6d8 100%);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

button, input, textarea { font: inherit; }

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--navy);
  color: #f7f1e4;
  border-bottom: 3px solid var(--gold);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #e4c98a;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }

h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 0.95; }

h2 { margin: 0 0 8px; font-size: 1.7rem; }

.site-header .btn-ghost {
  color: #f7f1e4;
  border-color: rgba(247, 241, 228, 0.35);
}

.site-header .btn-ghost:hover { background: rgba(247, 241, 228, 0.08); }

main { padding: 28px 0 48px; }

.site-footer {
  padding: 0 0 36px;
  color: var(--muted);
  font-size: 0.92rem;
}

.loading { color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat, .panel, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stat { padding: 16px 18px; }

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 560;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 8px 0 14px;
}

.lede { margin: 0; color: var(--muted); max-width: 62ch; }

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}

.card::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 999px;
  margin-bottom: 14px;
  background: #e4d3b4;
}

.card.complete::before { background: var(--pine); }
.card.incomplete::before { background: repeating-linear-gradient(90deg, var(--gold-deep) 0 8px, transparent 8px 13px); }

.card-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #f3e6c8;
  font-family: var(--serif);
}

.card h3 { margin: 0; font-size: 1.25rem; }

.job {
  margin: 2px 0 0;
  color: var(--muted);
}

.email, .muted { color: var(--muted); }

.email {
  margin: 8px 0 0;
  font-size: 0.86rem;
  word-break: break-word;
}

.pill {
  display: inline-flex;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill.ready { background: #e5f4ec; color: var(--pine); }
.pill.waiting { background: #f8efdc; color: var(--gold-deep); }

.wishlist {
  margin: 12px 0 0;
  padding-left: 10px;
  border-left: 2px solid #e4d3b4;
  white-space: pre-wrap;
  max-height: 7.4em;
  overflow: hidden;
}

.missing-line { margin: 12px 0 0; color: var(--gold-deep); }
.profile-status { margin: 8px 0 0; color: var(--gold-deep); font-size: 0.88rem; }
.profile-status.submitted { color: var(--pine); }

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.panel { padding: 20px; margin-top: 18px; }
.login-panel { max-width: 520px; margin: 48px auto; }
.login-panel label { display: grid; gap: 6px; margin: 18px 0; }
.profile-main { width: min(680px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 56px; }
.profile-main .panel { margin: 0; }
.profile-main .fields { margin-top: 20px; }
.profile-main .email { margin: 4px 0 0; }
.profile-main .profile-result { margin: 16px 0 0; }
.draw-result { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.draw-result h2 { margin-bottom: 8px; }
.draw-result h3 { margin: 18px 0 6px; }
.draw-result .wishlist { max-height: none; overflow: visible; }

.checklist { list-style: none; padding: 0; margin: 14px 0; }
.checklist li { padding: 6px 0 6px 26px; position: relative; }
.checklist li::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 10px;
  box-shadow: inset 0 0 0 2px var(--line);
}
.checklist li.done::before { background: var(--pine); box-shadow: none; }

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.notice.ok { background: #e5f4ec; color: #145233; }
.notice.err { background: #fdecef; color: var(--berry); }
.notice.warn { background: #f8efdc; color: #6d4710; }

.lock-note {
  margin: 0 0 14px;
  color: var(--muted);
}

.deliveries { list-style: none; padding: 0; margin: 16px 0 0; }
.delivery {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.delivery p { margin: 4px 0 0; }
.status { font-size: 0.85rem; font-weight: 600; }
.status.sent { color: var(--pine); }
.status.failed, .error-text { color: var(--berry); }
.status.pending { color: var(--gold-deep); }
.error-text { grid-column: 1 / -1; margin: 0; font-size: 0.9rem; }

.empty {
  padding: 28px;
  border: 1px dashed rgba(16, 32, 51, 0.25);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.7);
}
.empty ol { margin: 12px 0 0; padding-left: 18px; }
.empty li + li { margin-top: 6px; }

.btn {
  appearance: none;
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: var(--navy); color: #f7f1e4; }
.btn-primary:hover { background: var(--navy-soft); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-primary:disabled { background: #c5ced6; color: #f7f8f8; }
.btn:focus-visible, .site-header .btn-ghost:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
body.modal-open { overflow: hidden; }
.btn-ghost { background: transparent; color: var(--navy); border-color: rgba(16, 32, 51, 0.2); }
.btn-ghost:hover { background: rgba(16, 32, 51, 0.04); }
.btn-danger { background: transparent; color: var(--berry); padding-inline: 10px; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 32, 51, 0.58);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(560px, 100%);
  max-height: min(92vh, 840px);
  overflow: auto;
  background: var(--paper);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(16, 32, 51, 0.28);
}

.modal h2 { margin-top: 0; }
.modal p.help { color: var(--muted); margin-top: 0; }

.fields { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.optional { font-weight: 400; color: var(--muted); }

input, textarea {
  width: 100%;
  border: 1px solid rgba(16, 32, 51, 0.18);
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus {
  outline: 2px solid var(--navy);
  border-color: var(--navy);
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }

.form-error { color: var(--berry); min-height: 1.2em; }

.seal {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--gold-deep);
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .stats, .delivery { grid-template-columns: 1fr; }
  .toolbar, .header-inner { align-items: stretch; flex-direction: column; }
  .delivery .btn { justify-self: start; }
  .login-panel { margin: 28px auto; }
  .profile-main { padding-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
