:root {
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --text-page: 2.625rem;
  --text-board-title: 2.2rem;
  --text-dialog-title: 2.1rem;
  --text-empty-title: 1.125rem;
  --text-body: 1rem;
  --text-item-title: .9375rem;
  --text-label: .875rem;
  --text-meta: .8125rem;
  --text-caption: .75rem;
  --leading-heading: 1.08;
  --leading-item: 1.25;
  --leading-meta: 1.35;
  --leading-body: 1.45;
  --tracking-heading: -.045em;
  --tracking-item: -.012em;
  --weight-medium: 600;
  --weight-label: 650;
  --weight-heading: 700;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --page-gutter: 1.5rem;
  --tap-size: 2.75rem;
  --row-gutter: var(--space-3);
  color-scheme: light;
  font-family: var(--font-sans);
  font-size: 100%;
  color: #251d2d;
  background: #faf9f7;
  --paper: #fff;
  --line: #ded9e6;
  --section-surface: #f0edf2;
  --muted: #5e566c;
  --accent: #4f3277;
  --focus: #8552bc;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: var(--text-body); line-height: var(--leading-body); }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip:focus { position: absolute; z-index: 1; padding: .75rem; background: white; }
.wrap { width: min(100% - 2 * var(--page-gutter), 64rem); margin-inline: auto; }

.site-header { background: #2b2035; color: white; }
.header-inner { min-height: 3.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: white; font-size: var(--text-body); font-weight: var(--weight-heading); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .45rem; background: #efe3f9; color: #4b3170; font-size: 1.11rem; line-height: 1; }
.account { display: flex; align-items: center; gap: var(--space-3); min-width: 0; font-size: var(--text-label); }
.account span { overflow-wrap: anywhere; }
.quiet { color: #f2e9ff; background: transparent; border: 1px solid #806d95; border-radius: .45rem; min-height: 2.5rem; padding: .35rem .75rem; white-space: nowrap; }
.quiet:hover { background: #473557; }
.tabs { display: flex; gap: 1.3rem; border-bottom: 1px solid var(--line); }
.tabs a { display: grid; place-items: center; min-height: var(--tap-size); padding: .125rem .125rem 0; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: var(--text-label); font-weight: var(--weight-label); text-align: center; }
.tabs a:hover, .tabs a[aria-current] { color: var(--accent); }
.tabs a[aria-current] { border-color: var(--accent); }

.workspace { padding-block: 2.2rem 4rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: .85rem; margin-bottom: 1.5rem; }
h1 { font-size: var(--text-page); line-height: var(--leading-heading); font-weight: var(--weight-heading); letter-spacing: var(--tracking-heading); }
.page-heading p, .auth-card > p { margin-top: .45rem; color: var(--muted); }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; gap: var(--space-2); min-height: var(--tap-size); padding: .6rem 1rem; border: 1px solid transparent; border-radius: .55rem; font-weight: var(--weight-label); font-size: var(--text-item-title); line-height: var(--leading-item); text-align: center; text-decoration: none; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #3d245f; }
.primary span { font-size: 1.2rem; line-height: 1; }
.secondary { border-color: #cfc5da; background: var(--paper); color: var(--accent); }
.secondary:hover { background: #f3edf8; }
.add { flex: none; }
.notice { padding: .75rem 1rem; margin-bottom: 1.25rem; border: 1px solid #c2d6cb; border-radius: .55rem; background: #eaf4ee; color: #216044; }
.notice.error { border-color: #e4b9c1; background: #fbebee; color: #8b233b; }

.board-page .wrap { width: min(100% - 2 * var(--page-gutter), 77rem); }
.board-workspace { padding-top: 1.5rem; }
.board-workspace .page-heading { align-items: center; margin-bottom: .95rem; }
.board-workspace h1 { font-size: var(--text-board-title); }
.board-filters { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1);
  width: min(100%, 58rem); padding: var(--space-1); margin-block-end: var(--space-3); border: 1px solid var(--line);
  border-radius: .55rem; background: var(--paper); }
.board-search { flex: 1 1 12rem; }
.board-filters input[type=search] { margin: 0; padding: var(--space-1) var(--space-2); border: 0; background: transparent; }
.filter-pill { position: relative; min-width: 0; max-width: 12rem; }
.filter-pill summary { display: flex; align-items: center; gap: var(--space-1); min-height: 2.1rem;
  padding: var(--space-1) var(--space-2); border: 1px solid var(--line); border-radius: 2rem;
  background: var(--section-surface); color: var(--muted); font-size: var(--text-meta); font-weight: var(--weight-label); cursor: pointer; list-style: none; }
.filter-pill summary::-webkit-details-marker { display: none; }
.filter-pill summary::after { content: ''; width: .32rem; height: .32rem; flex: none; margin-block-end: .12rem;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.filter-pill summary [data-filter-label] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-pill[data-active] summary, .filter-pill[open] summary { background: #eee4f8; border-color: #cdb8de; color: var(--accent); }
.filter-options { position: absolute; z-index: 2; inset-block-start: calc(100% + var(--space-1)); inset-inline-end: 0;
  width: 15rem; max-height: min(19rem, 55dvh); margin: 0; padding: var(--space-1); overflow: auto;
  border: 1px solid var(--line); border-radius: .5rem; background: var(--paper); box-shadow: 0 .4rem 1rem #2b203520; }
.filter-options label { display: flex; align-items: center; gap: var(--space-2); min-height: 2.4rem; padding: var(--space-1) var(--space-2);
  border-radius: .3rem; color: var(--muted); font-size: var(--text-label); cursor: pointer; }
.filter-options label:has(:checked), .filter-options label:hover { background: var(--section-surface); color: var(--accent); }
.filter-options input[type=radio] { flex: none; width: 1rem; min-height: 1rem; margin: 0; padding: 0; accent-color: var(--accent); }
.search-submit, .clear-filters { display: grid; place-items: center; min-height: 2.1rem; padding-inline: var(--space-2);
  border: 0; border-radius: .35rem; background: transparent; color: var(--accent); font-size: var(--text-meta); font-weight: var(--weight-label); }
.search-submit:hover, .clear-filters:hover { background: var(--section-surface); }
.board-empty { padding: .65rem 0 1rem; color: var(--muted); }
.gift-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gift-board.single-stage { grid-template-columns: minmax(0, 23rem); }
.board-lane { display: flex; flex-direction: column; min-width: 0; min-height: 10rem; max-height: max(22rem, calc(100dvh - 17rem));
  border-block: 1px solid var(--line); }
.board-lane + .board-lane { border-inline-start: 1px solid var(--line); }
.board-lane.is-drop-target { background: #f3edf8; outline: 2px solid var(--focus); outline-offset: -2px; }
.board-lane.is-drop-target .lane-heading { background: #e9dbf3; }
.lane-heading { flex: none; display: flex; align-items: center; gap: var(--space-2); min-height: 2.4rem;
  padding: var(--space-1) var(--row-gutter); border-block-end: 1px solid var(--line); background: var(--section-surface); }
.lane-heading h2 { font-size: var(--text-label); font-weight: var(--weight-heading); overflow-wrap: anywhere; }
.stage-mark { width: .66rem; height: .66rem; flex: none; border: 2px solid #92703c; border-radius: 50%; }
.stage-mark.planned { border-color: #8154a0; background: #e5d7f0; }
.stage-mark.purchased { border-color: #526785; background: #526785; }
.stage-mark.given { border-color: #367555; background: #367555; }
.stage-count { color: var(--muted); margin-inline-start: auto; font-size: var(--text-caption); font-weight: var(--weight-label); font-variant-numeric: tabular-nums; }
.lane-gifts { min-height: 0; overflow-y: auto; }
.lane-empty { color: var(--muted); padding: var(--space-2) var(--row-gutter); font-size: var(--text-meta); }
.board-lane .gift-row-main { grid-column: 1 / -1; padding-inline-end: calc(var(--tap-size) + var(--space-1)); }
.board-lane .gift-row-content { min-block-size: 3.4rem; }
.gift-row[draggable=true] .gift-row-content { cursor: grab; }
.gift-row[draggable=true] a { cursor: pointer; }
.gift-row.is-dragging { opacity: .6; }
.gift-row.is-drop-before, .gift-row.is-drop-after { position: relative; }
.gift-row.is-drop-before::after, .gift-row.is-drop-after::after { content: ''; position: absolute; z-index: 1;
  inset-inline: 0; height: 2px; background: var(--focus); pointer-events: none; }
.gift-row.is-drop-before::after { inset-block-start: 0; }
.gift-row.is-drop-after::after { inset-block-end: 0; }
.drag-grip { position: absolute; inset-block-start: 1.75rem; inset-inline-end: var(--row-gutter); color: #715d80; cursor: grab; line-height: 1;
  padding: .125rem var(--space-1); font-size: var(--text-body); user-select: none; }
.drag-grip:active { cursor: grabbing; }
.plan-move { grid-column: 1 / -1; }
.plan-move summary { position: absolute; inset-block-start: var(--space-1); inset-inline-end: calc(var(--row-gutter) - var(--space-1));
  display: flex; align-items: center; justify-content: center; gap: .18rem; width: var(--tap-size); min-height: 1.65rem; border-radius: .3rem;
  color: var(--accent); font-size: var(--text-caption); font-weight: var(--weight-label); cursor: pointer; list-style: none; }
.plan-move summary:hover, .plan-move[open] summary { background: #f3edf8; }
.plan-move summary::-webkit-details-marker { display: none; }
.plan-move summary::after { content: ''; width: .35rem; height: .35rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-bottom: .24rem; }
.plan-move[open] summary::after { transform: rotate(225deg); margin-bottom: -.13rem; }
.plan-move form { display: grid; margin-block-start: var(--space-2); padding-block-start: var(--space-1); border-block-start: 1px solid var(--line); }
.plan-move button { min-height: var(--tap-size); padding: var(--space-1) var(--space-2); border: 0; border-radius: .35rem; color: var(--accent); background: transparent; text-align: left; font-size: var(--text-label); }
.plan-move button:hover { background: #f3edf8; }
.list-count { margin-block-end: var(--space-2); color: var(--muted); font-size: var(--text-label); font-weight: var(--weight-medium); }
.gift-list { padding: 0; margin: 0; list-style: none; }
.wish-list { border-block-start: 1px solid var(--line); }
.gift-row { border-block-end: 1px solid var(--line); }
.gift-row-content { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  column-gap: var(--space-2); min-block-size: var(--tap-size); padding: .375rem var(--row-gutter); }
.gift-row-main { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.gift-row-copy { min-width: 0; overflow-wrap: anywhere; }
.gift-thumbnail { position: relative; display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; overflow: hidden;
  border-radius: var(--space-1); background: #eee4f8; color: #674980; }
.gift-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; }
.gift-thumbnail img, .thumbnail-field img { object-fit: contain; max-width: 100%; background: var(--paper); }
.gift-title { font-size: var(--text-item-title); line-height: var(--leading-item); font-weight: var(--weight-heading); letter-spacing: var(--tracking-item); }
.gift-title a { color: inherit; text-decoration: none; }
.gift-title a:hover { color: var(--accent); text-decoration: underline; }
.gift-details, .gift-notes, .gift-product { margin-block-start: .125rem; font-size: var(--text-meta); line-height: var(--leading-meta); }
.gift-details, .gift-notes { color: var(--muted); }
.gift-details strong { color: #4c3863; font-weight: var(--weight-label); }
.gift-notes { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gift-product { display: flex; flex-wrap: wrap; column-gap: var(--space-2); }
.price { font-weight: var(--weight-label); font-variant-numeric: tabular-nums; }
.gift-row-actions { display: flex; align-items: center; gap: var(--space-1); }
.pill { padding: .125rem .375rem; border-radius: .3rem; background: #f0edf3; color: #51485e; font-size: var(--text-caption); font-weight: var(--weight-label); white-space: nowrap; }
.pill.shared { background: #eee4f8; color: #573578; }
.edit-link { display: grid; place-items: center; min-height: var(--tap-size); min-width: var(--tap-size); font-size: var(--text-label); }
.wish-group + .wish-group { margin-top: 1.75rem; }
.wish-group > h2 { margin-block-end: var(--space-2); font-size: var(--text-body); font-weight: var(--weight-heading); }
.empty { display: grid; justify-items: center; align-content: center; gap: .5rem; min-height: 15rem; padding: 1.5rem; border: 1px dashed #cbc0d6; border-radius: .85rem; text-align: center; }
.empty-mark { color: #73558d; font-size: 2rem; }
.empty h2 { font-size: var(--text-empty-title); }
.empty p { color: var(--muted); max-width: 30rem; }

.auth { padding-block: 5rem; }
.auth-card { max-width: 28rem; margin-inline: auto; padding: 2rem; background: var(--paper); border: 1px solid var(--line); border-radius: .9rem; }
.auth-card h1 { font-size: var(--text-dialog-title); }
.auth-form { display: grid; gap: 1rem; margin-top: 1.35rem; }
.auth-back { display: inline-block; padding-block: .65rem; margin-top: .35rem; font-size: var(--text-label); }
.auth-card .notice { margin: 1rem 0 0; }

.form-workspace { width: min(100% - 2 * var(--page-gutter), 42rem); padding-top: 2rem; }
.form-workspace .page-heading { margin-bottom: 1.5rem; }
.back { display: inline-block; padding-block: var(--space-1); margin-bottom: .9rem; font-size: var(--text-label); }
.gift-form { display: grid; gap: 1.15rem; padding: 1.5rem; background: white; border: 1px solid var(--line); border-radius: .8rem; }
label { display: block; min-width: 0; font-size: var(--text-label); font-weight: var(--weight-label); }
.optional { display: inline-block; margin-inline-start: .3rem; color: var(--muted); font-size: var(--text-caption); font-weight: normal; }
input:not([type=checkbox]), textarea, select { display: block; width: 100%; min-width: 0; min-height: var(--tap-size); padding: .55rem .65rem; margin-top: .32rem; border: 1px solid #cfc5da; border-radius: .45rem; background: var(--paper); color: inherit; font-size: var(--text-body); font-weight: normal; }
textarea { resize: vertical; }
input[type=file] { font-size: var(--text-label); }
input[type=file]::file-selector-button { border: 0; background: #eee4f8; color: #4f3277; border-radius: .25rem; margin-right: .45rem; padding: .25rem .4rem; cursor: pointer; }
.import-area { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.link-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .5rem; }
.import-message { font-size: var(--text-label); color: var(--muted); }
.import-message:not(:empty) { margin-top: .5rem; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-pair.money { grid-template-columns: minmax(0, 1fr) 6rem; }
.field-help { color: var(--muted); font-size: var(--text-meta); margin-top: -.8rem; }
.thumbnail-field { display: flex; align-items: center; gap: .75rem; }
.thumbnail-field label { flex: 1; }
.thumbnail-field img { border-radius: .4rem; }
.checkbox { display: flex; align-items: center; gap: .45rem; width: fit-content; min-height: var(--tap-size); }
.checkbox input { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0; }
.sharing .field-help { margin-top: 0; }
.form-actions { display: flex; align-items: center; gap: 1rem; }
.delete-area { margin-top: 1.5rem; }
.delete-area a { color: #8b233b; }
.danger { background: #8b233b; }
.danger:hover { background: #681628; }

@media (max-width: 767px) {
  :root { --page-gutter: 1rem; --row-gutter: var(--page-gutter); --text-page: 2.1rem; --text-board-title: 1.9rem; }
  .account { gap: var(--space-2); }
  .tabs { gap: var(--space-3); }
  .workspace { padding-block: 1.55rem 3rem; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 1.5rem; }
  .board-workspace .page-heading { flex-direction: row; align-items: center; margin-bottom: .7rem; }
  .board-search { flex-basis: 100%; }
  .filter-pill { position: static; max-width: 10rem; }
  .filter-options { inset-inline: var(--space-1); width: auto; }
  .filter-pill summary, .filter-options label, .search-submit, .clear-filters { min-height: var(--tap-size); }
  .gift-board, .wish-list { margin-inline: calc(-1 * var(--page-gutter)); }
  .gift-board, .gift-board.single-stage { grid-template-columns: minmax(0, 1fr); }
  .board-lane { min-height: 0; max-height: none; border-block-end: 0; }
  .board-lane + .board-lane { border-inline-start: 0; }
  .board-lane:not(:first-child) { border-block-start: 0; }
  .lane-gifts { overflow: visible; }
  .drag-grip { display: none; }
  .plan-move summary { min-height: var(--tap-size); }
  .auth { padding-block: 2.5rem; }
  .auth-card, .gift-form { padding: 1.15rem; }
}
