:root {
  --bg: #fbf9f5;
  --surface: #ffffff;
  --surface-muted: #f3f1ec;
  --sage: #5d7a65;
  --sage-dark: #455e4c;
  --sage-tint: #eef3ef;
  --sage-border: #d3dfd6;
  --ink: #1f2a24;
  --ink-muted: #5b6860;
  --berry: #b84a39;
  --berry-dark: #983829;
  --berry-tint: #fdf2f0;
  --gold: #c49a45;
  --gold-tint: #fcf6e8;
  --border: #e5e1d8;
  --shadow: 0 2px 12px rgba(31, 42, 36, 0.06);
  --shadow-lg: 0 16px 40px rgba(31, 42, 36, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  font-size: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.page-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

/* Header */

.hero {
  text-align: center;
  margin-bottom: 24px;
}

.hero-sprig {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}

.hero h1 {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  line-height: 1.18;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.family-note {
  background: var(--sage-tint);
  border: 1px solid var(--sage-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: left;
  color: var(--ink);
  font-size: 0.96rem;
}

.family-note p {
  margin: 0;
}

.family-note p + p {
  margin-top: 8px;
}

.hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.list-summary {
  font-size: 0.9rem;
  color: var(--ink-muted);
  font-weight: 500;
}

/* Admin Banner */

.admin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--gold-tint);
  border: 1px solid #ead8aa;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-compact {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.86rem;
}

.btn-primary {
  background: var(--sage);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--sage-dark);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--sage-border);
  color: var(--sage-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--sage-tint);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--ink);
}

.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--berry);
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.82rem;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--berry-tint);
}

.link-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--ink);
}

.text-action-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 6px;
}

.text-action-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.text-action-btn.danger {
  color: var(--berry);
}

.text-action-btn.danger:hover {
  background: var(--berry-tint);
}

/* Wishlist Cards */

.wishlist-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loading-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--ink-muted);
}

.gift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}

.gift-card.scratched {
  background: var(--surface-muted);
  border-color: #dfd9cd;
  box-shadow: none;
  padding: 14px 18px;
}

.gift-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gift-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1 1 240px;
}

.check-badge {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--sage);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gift-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.gift-card.scratched .gift-title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sage-dark);
  color: #556159;
}

.gift-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-kid {
  background: var(--sage-tint);
  color: var(--sage-dark);
}

.badge-covered {
  background: #e3ece5;
  color: #354c3b;
}

.badge-added {
  background: var(--gold-tint);
  color: #7c5c19;
}

.gift-notes {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 0.94rem;
}

.gift-card.scratched .gift-notes {
  margin-left: 36px;
  font-size: 0.9rem;
}

.gift-meta-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sage-dark);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.ext-link:hover {
  text-decoration: underline;
}

/* Contributions block */

.contrib-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f9faf8;
  border: 1px solid #e6ebe7;
  border-radius: var(--radius-sm);
}

.contrib-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.contrib-total {
  font-weight: 700;
  color: var(--sage-dark);
}

.contrib-empty {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.progress-track {
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  background: #e3e9e4;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.contrib-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px dashed #dde4de;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contrib-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}

.contrib-main {
  flex: 1 1 auto;
}

.contrib-who {
  font-weight: 600;
  color: var(--ink);
}

.contrib-note {
  color: var(--ink-muted);
  font-style: italic;
}

/* Card Actions */

.gift-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gift-card.scratched .gift-actions {
  margin-left: 36px;
  margin-top: 10px;
}

.admin-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Add Gift Section */

.add-section {
  margin-top: 28px;
}

.add-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
}

.add-header h2 {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.38rem;
}

.muted {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.93rem;
}

/* Forms */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.req {
  color: var(--berry);
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d7d2c8;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(93, 122, 101, 0.18);
}

.money-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  pointer-events: none;
}

.money-input-wrap input {
  padding-left: 26px;
}

.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-choice {
  cursor: pointer;
}

.pill-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill-choice span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.15s ease;
}

.pill-choice input:checked + span {
  background: var(--sage-tint);
  border-color: var(--sage);
  color: var(--sage-dark);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seg-option {
  cursor: pointer;
}

.seg-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.15s ease;
}

.seg-option input:checked + span {
  background: var(--sage-tint);
  border-color: var(--sage);
  color: var(--sage-dark);
}

.quick-amounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.amt-pill {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--sage-border);
  background: var(--sage-tint);
  color: var(--sage-dark);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.amt-pill.active {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

.reassure-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--sage-tint);
  color: var(--sage-dark);
  font-size: 0.86rem;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--berry-tint);
  border: 1px solid #f0cbc4;
  color: var(--berry-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

/* Modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24, 32, 27, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.modal-card-sm {
  max-width: 360px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-kicker {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sage);
}

.modal-head h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.icon-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.icon-close:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Footer */

.site-footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.site-footer p {
  margin: 0;
}

/* Toast */

.toast-container {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 400px);
}

.toast {
  background: #223027;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast.error {
  background: var(--berry-dark);
}

@media (max-width: 600px) {
  .page-wrap {
    padding: 16px 12px 48px;
  }

  .form-row-two,
  .segmented {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    padding: 20px 16px 24px;
  }

  .gift-card.scratched .gift-notes,
  .gift-card.scratched .gift-actions {
    margin-left: 0;
  }

  .form-actions .btn {
    width: 100%;
  }
}
