:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #213b32;
  background: #f3f6f4;
  font-size: 16px;
  line-height: 1.5;
  --pine: #143e32;
  --green: #236c50;
  --muted: #596c63;
  --line: #dce5df;
  --red: #a53336;
  --gold: #946218;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
a {
  color: var(--green);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #d99b36;
  outline-offset: 3px;
}
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  background: white;
  color: var(--pine);
  font-weight: 650;
}
button.primary {
  background: var(--pine);
  color: #fff;
  border-color: var(--pine);
}
button.danger {
  color: var(--red);
}
button.quiet {
  background: transparent;
}
button.small {
  font-size: 0.875rem;
  padding: 0.45rem 0.7rem;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  letter-spacing: -0.05rem;
  margin-bottom: 0.5rem;
}
h2 {
  font-size: 1.2rem;
  line-height: 1.35;
}
h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
p {
  margin-bottom: 0.8rem;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0.07rem;
  text-transform: uppercase;
}
.skip {
  position: fixed;
  top: -100px;
  left: 1rem;
  background: #fff;
  z-index: 100;
  padding: 1rem;
}
.skip:focus {
  top: 1rem;
}
.topbar {
  background: var(--pine);
  color: white;
  padding: 1rem max(1rem, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.125rem;
  font-weight: 700;
  flex: 1;
}
.brand-mark {
  font-size: 1.65rem;
  color: #dcd6ac;
}
.topbar select {
  background: #244e41;
  border-color: #507264;
  color: white;
  width: auto;
  min-width: 85px;
}
.user {
  color: #e1eee5;
  font-size: 0.875rem;
}
.topbar button {
  color: white;
  border-color: #507264;
  background: transparent;
}
.preview {
  background: #fff1ce;
  padding: 0.6rem 1rem;
  text-align: center;
  color: #664b17;
  font-size: 0.875rem;
}
.preview select {
  width: auto;
  min-height: 36px;
  padding: 0.2rem 0.5rem;
  margin-left: 0.5rem;
}
.nav-wrap {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
nav {
  max-width: 1120px;
  margin: auto;
  display: flex;
  overflow-x: auto;
  padding: 0 0.5rem;
  scrollbar-width: thin;
}
nav button {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 0.85rem 0.75rem;
}
nav button[aria-current="page"] {
  color: var(--pine);
  border-bottom-color: var(--pine);
}
main {
  max-width: 1120px;
  margin: auto;
  padding: 1.5rem 1rem 5rem;
}
.heading {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.heading p {
  margin: 0;
}
.heading button {
  flex-shrink: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.metric .value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04rem;
  line-height: 1.4;
}
.metric .caption {
  font-size: 0.875rem;
  color: var(--muted);
}
.metric.warn {
  border-color: #d6ae66;
  background: #fffaf0;
}
.section {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.section-title h2 {
  margin: 0;
}
.two-col {
  display: grid;
  gap: 1rem;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: 0;
}
.row p {
  margin: 0;
}
.row .end {
  text-align: right;
  flex-shrink: 0;
}
.recipient-name {
  font-weight: 700;
}
.progress {
  height: 6px;
  background: #e7ede9;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress span {
  display: block;
  background: var(--green);
  height: 100%;
  width: var(--progress, 0%);
}
.empty {
  padding: 1.8rem 1rem;
  text-align: center;
  border: 1px dashed #bdcfc3;
  border-radius: 12px;
  background: #fbfdfb;
}
.empty p {
  max-width: 440px;
  margin: 0 auto 1rem;
}
.empty h2 {
  margin-bottom: 0.6rem;
}
.empty button {
  margin-top: 0.3rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  background: #edf3ef;
  color: #3d5a4b;
}
.badge.amber {
  background: #fff0d6;
  color: #795315;
}
.badge.green {
  background: #e2f2e7;
  color: #225639;
}
.badge.red {
  background: #fcebed;
  color: #96333a;
}
.badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.65rem 0;
}
.toolbar {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.toolbar input,
.toolbar select {
  background: #fff;
}
.toolbar .filters {
  display: flex;
  gap: 0.5rem;
  overflow: auto;
  padding-bottom: 0.3rem;
}
.filters button {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.875rem;
}
.filters button.active {
  background: var(--pine);
  color: white;
  border-color: var(--pine);
}
.gift-list {
  display: grid;
  gap: 0.8rem;
}
.gift-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.gift-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.gift-top h2 {
  margin-bottom: 0.2rem;
  overflow-wrap: anywhere;
}
.gift-top p {
  margin: 0;
}
.gift-price {
  font-weight: 700;
  white-space: nowrap;
}
.gift-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.6rem 0;
  overflow-wrap: anywhere;
}
.gift-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  margin-top: 0.8rem;
}
.gift-actions .edit {
  margin-left: auto;
}
.wrap-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  flex: 1;
  cursor: pointer;
}
.wrap-check:has(input:checked) {
  background: #e7f2e9;
  border-color: #92b49c;
}
.wrap-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--green);
  flex-shrink: 0;
}
.wrap-check:has(input:disabled) {
  opacity: 0.6;
  cursor: default;
}
.tag-preview {
  background: #f2f6f0;
  border-left: 3px solid #8cad80;
  border-radius: 0 7px 7px 0;
  padding: 0.7rem 1rem;
  margin: 0.8rem 0;
  overflow-wrap: anywhere;
}
.tag-preview strong {
  display: inline-block;
  min-width: 3rem;
}
.note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.wrap-summary {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.wrap-summary p {
  flex: 1;
  margin: 0;
}
.budget-line {
  color: var(--muted);
  font-size: 0.875rem;
}
.budget-line.over {
  color: var(--red);
}
.person-card {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.person-card:last-child {
  border: 0;
}
.person-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.person-title h3 {
  margin: 0;
}
.person-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.person-grid span {
  display: block;
}
.person-grid small {
  color: var(--muted);
  font-size: 0.875rem;
}
.help {
  font-size: 0.875rem;
  color: var(--muted);
}
.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.section > p:last-child {
  margin-bottom: 0;
}
.signin {
  max-width: 500px;
  margin: 10vh auto;
  padding: 2rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.signin .brand-mark {
  font-size: 3rem;
  color: var(--green);
}
.signin h1 {
  margin-top: 1rem;
}
.signin button {
  width: 100%;
  margin-top: 0.6rem;
}
.signin p {
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  background: #fff;
  border: 1px solid #aabeb0;
  border-radius: 8px;
  color: #213b32;
  padding: 0.65rem 0.75rem;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23596c63' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
label.field {
  display: block;
  font-weight: 600;
  margin-bottom: 1rem;
}
label.field input,
label.field select,
label.field textarea {
  display: block;
  margin-top: 0.4rem;
  font-weight: 400;
}
label .help {
  display: block;
  font-weight: 400;
  margin-top: 0.3rem;
}
.form-grid {
  display: grid;
  gap: 0 1rem;
}
.check-field {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0;
  min-height: 44px;
}
.check-field input {
  width: 22px;
  min-height: 22px;
  height: 22px;
  accent-color: var(--green);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  margin: 0 0 1rem;
  min-width: 0;
}
legend {
  font-weight: 600;
  padding: 0 0.3rem;
}
.giver-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
}
.giver-choices label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
}
.giver-choices input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--green);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(620px, calc(100% - 1rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  color: #213b32;
}
dialog::backdrop {
  background: #0a271fb3;
}
dialog .dialog-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
dialog h2 {
  margin: 0;
}
dialog .form-body {
  padding: 1.2rem;
}
dialog .form-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
  flex-wrap: wrap;
}
dialog .form-footer .danger {
  margin-right: auto;
}
.form-error {
  color: var(--red);
  margin-bottom: 1rem;
  font-weight: 600;
}
.form-error:empty {
  display: none;
}
#notice {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  margin: auto;
  max-width: 600px;
  background: #143e32;
  color: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 5px 25px #0003;
  z-index: 30;
  display: none;
}
#notice.visible {
  display: block;
}
#notice.error {
  background: #8b2e35;
}
#print-sheet {
  display: none;
}
noscript {
  padding: 1rem;
}
@media (min-width: 640px) {
  h1 {
    font-size: 2.2rem;
  }
  main {
    padding-top: 2rem;
  }
  .toolbar {
    grid-template-columns: 1fr 220px;
  }
  .toolbar .filters {
    grid-column: 1/-1;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .metric {
    padding: 1.2rem;
  }
  .gift-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section {
    padding: 1.25rem;
  }
  .two-col {
    grid-template-columns: 1.2fr 1fr;
  }
  nav button {
    padding: 1rem 1.25rem;
  }
  .topbar {
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
  }
  .brand {
    font-size: 1.3rem;
  }
}
@media (max-width: 400px) {
  .heading {
    flex-wrap: wrap;
  }
  .heading > button {
    width: 100%;
  }
  .user {
    display: none;
  }
  .metric .value {
    font-size: 1.45rem;
  }
  .gift-actions .edit {
    margin-left: 0;
  }
  main {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .topbar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .wrap-check {
    padding: 0.45rem;
  }
  .form-footer button {
    flex: 1;
  }
  dialog .form-body {
    padding: 1rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s,
      border-color 0.15s;
  }
  dialog[open] {
    animation: appear 0.15s ease-out;
  }
  @keyframes appear {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
.gift-photo-button { display: block; padding: 0; width: 100%; min-height: 180px; background: #fff; overflow: hidden; margin-bottom: 1rem; }
.gift-photo { display: block; width: 100%; height: 180px; object-fit: contain; }
.photo-preview { display: block; max-width: 100%; width: 240px; max-height: 220px; object-fit: contain; margin: 0 auto 1rem; }
.photo-preview[hidden] { display: none; }
.gift-photo[hidden], .full-gift-photo[hidden], .photo-load-status[hidden] { display: none; }
.photo-load-status { display: block; padding: 1.5rem; text-align: center; font-weight: 400; color: var(--muted); }
.full-gift-photo { display: block; max-width: 100%; max-height: 75dvh; object-fit: contain; margin: auto; }
.share-banner { padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--green); border-radius: 12px; background: #e9f5ed; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.share-banner p { margin: 0; flex: 1 1 140px; }
.field input[type=file] { max-width: 100%; padding: .5rem; }
@media print {
  body {
    background: #fff;
  }
  #app,
  #notice,
  dialog,
  .skip {
    display: none !important;
  }
  #print-sheet {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12mm;
  }
  .print-tag {
    border: 1px dashed #888;
    padding: 10mm;
    break-inside: avoid;
    font-size: 18pt;
  }
  .print-tag p {
    margin: 0.3rem 0;
  }
  .print-tag small {
    font-size: 11pt;
  }
  @page {
    margin: 12mm;
  }
}
