@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,500;1,600&display=swap');

:root {
  color-scheme: light;
  --ink: #173e34;
  --ink-soft: #42635a;
  --muted: #75877e;
  --line: #e2e9e1;
  --paper: #fbfcf8;
  --canvas: #f3f6f0;
  --white: #fff;
  --leaf: #b7df69;
  --coral: #de785d;
  --sky: #dcecf0;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--sans); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 31px 20px 20px; background: var(--paper); border-right: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 700; letter-spacing: 0; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; color: var(--accent-ink, var(--ink)); background: var(--leaf); border-radius: 9px 9px 9px 2px; font: 600 19px var(--serif); }
.nav-label, .eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.sidebar > .nav-label { margin: 54px 0 12px 10px; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-soft); text-align: left; cursor: pointer; }
.side-link.is-active { background: #e9f0e5; color: var(--ink); font-weight: 700; }
.nav-icon { width: 17px; font-size: 17px; text-align: center; }
.list-nav-heading { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 9px 10px; }
.list-nav { display: grid; gap: 3px; }
.list-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-soft); text-align: left; cursor: pointer; }
.list-nav-item:hover, .list-nav-item.is-selected { background: #f0f4ed; color: var(--ink); }
.list-nav-mark { display: grid; flex: none; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--sky); color: #365f66; font: 600 12px var(--serif); }
.list-nav-item:nth-child(3n + 2) .list-nav-mark { background: #f7e5da; color: #9d513d; }
.list-nav-item:nth-child(3n) .list-nav-mark { background: #e7eccf; color: #596d35; }
.list-nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-area { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 5.5%; border-bottom: 1px solid var(--line); background: rgba(251, 252, 248, .7); }
.topbar-spacer { flex: 1; }
.mobile-brand { display: none; align-items: center; gap: 8px; font-weight: 700; }
.role-badge { padding: 4px 8px; background: #e9efe6; border-radius: 3px; color: var(--ink-soft); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.user-name { font-weight: 600; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer; }
.text-button:hover { color: var(--coral); }
.page-content { position: relative; width: min(100%, 1100px); min-height: calc(100vh - 68px); margin: 0 auto; padding: 61px 7.5% 90px; }
.welcome { position: relative; max-width: 600px; padding-top: 86px; animation: arrive .55s ease both; }
.welcome .eyebrow { margin-bottom: 16px; }
h1, h2, h3, p { margin-top: 0; }
.welcome h1, .list-heading h1, .people-heading h1 { margin-bottom: 18px; font: 500 54px/1.1 var(--serif); letter-spacing: 0; }
.welcome h1 em { color: #72974c; font-weight: 500; }
.welcome .muted { max-width: 380px; margin-bottom: 28px; }
.muted { color: var(--muted); }
.welcome-stamp { position: absolute; top: 108px; right: -340px; display: grid; place-content: center; width: 185px; aspect-ratio: 1; border: 1px solid #cedec7; border-radius: 50%; color: #759268; font: italic 500 25px/1.1 var(--serif); text-align: center; transform: rotate(9deg); }
.welcome-stamp::before, .welcome-stamp::after { position: absolute; inset: 9px; border: 1px dashed #d3dfce; border-radius: 50%; content: ''; }
.welcome-stamp::after { inset: -7px; border: 0; background: radial-gradient(circle, #dceabc 1px, transparent 1.5px) 0 0 / 12px 12px; mask: radial-gradient(circle, transparent 66%, #000 68%, #000 71%, transparent 73%); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 4px; font-size: 12px; font-weight: 700; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-dark { background: var(--ink); color: white; }
.button-dark:hover { background: #245448; }
.button-light { border-color: #dce5d9; background: var(--paper); color: var(--ink); }
.button-light:hover { background: #eef3e9; }
.button-accent { background: var(--leaf); color: var(--accent-ink, var(--ink)); }
.button-accent:hover { filter: brightness(.93); }
.small-button { min-height: 33px; margin-top: 10px; padding: 0 12px; }

.list-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.list-heading .eyebrow, .people-heading .eyebrow { margin-bottom: 12px; }
.list-heading h1, .people-heading h1 { margin-bottom: 8px; font-size: 46px; }
.list-description { max-width: 540px; margin-bottom: 0; color: var(--muted); }
.heading-actions { display: flex; flex: none; gap: 8px; padding-bottom: 3px; }
.list-meta { display: flex; align-items: center; gap: 12px; padding: 17px 0; color: var(--muted); font-size: 11px; }
.meta-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--coral); }
.sharing-panel { padding: 0 0 15px; border-bottom: 1px solid var(--line); }
.sharing-panel summary { width: fit-content; color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.sharing-panel summary span { display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 5px; border-radius: 50%; background: #e6eee1; font-size: 10px; }
.share-options { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 12px; }
.check-row { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 12px; }
input[type="checkbox"] { accent-color: var(--ink); }
.small { font-size: 12px; }
.wish-list { margin-top: 8px; }
.wish-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 104px; padding: 17px 0; border-bottom: 1px solid var(--line); animation: arrive .4s ease both; }
.wish-number { align-self: start; padding-top: 3px; color: #9aac9f; font: 500 13px var(--serif); }
.wish-copy h3 { margin-bottom: 3px; font-size: 15px; font-weight: 600; }
.wish-copy p { margin: 2px 0 4px; color: var(--muted); font-size: 12px; }
.wish-copy .item-price { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.item-link { color: #577a53; font-size: 11px; text-decoration: none; }
.item-link:hover { text-decoration: underline; }
.wish-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { display: inline-grid; flex: none; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #71877b; font-size: 17px; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: white; color: var(--ink); }
.danger-icon:hover { border-color: #f0d4cb; background: #fff8f5; color: #b04d39; }
.gift-state { color: #607f49; font-size: 11px; white-space: nowrap; }
.gift-state.is-taken { color: var(--muted); }
.reserve-button { min-height: 34px; padding: 0 12px; white-space: nowrap; }
.empty-items { display: grid; justify-items: center; padding: 60px 20px; color: var(--muted); text-align: center; }
.empty-items p { margin: 10px 0 0; font: italic 16px var(--serif); }
.empty-spark { color: var(--coral); font-size: 23px; }
.delete-list { margin-top: 30px; color: #a46051; }

.people-heading { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.people-heading h1 { margin-bottom: 6px; }
.people-heading .muted { margin-bottom: 0; }
.people-count { padding-bottom: 5px; color: var(--muted); font-size: 11px; }
.people-layout { display: grid; grid-template-columns: minmax(0, 1fr) 275px; gap: 55px; padding-top: 30px; }
.section-caption { display: flex; justify-content: space-between; padding: 0 12px 10px; color: #93a198; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.person-row { display: flex; align-items: center; gap: 12px; min-height: 63px; padding: 9px 12px; border-top: 1px solid var(--line); }
.person-avatar { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sky); color: #315962; font: 500 15px var(--serif); }
.person-avatar.gifter { background: #f7e5da; color: #9d513d; }
.person-avatar.admin { background: var(--leaf); }
.person-details { display: grid; gap: 1px; min-width: 0; }
.person-details strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.person-details span { color: var(--muted); font-size: 10px; text-transform: capitalize; }
.person-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.person-actions .text-button { font-size: 11px; }
.protected-label { margin-left: auto; color: #97a39b; font-size: 10px; }
.create-user-form { align-self: start; display: grid; gap: 14px; padding: 20px; border: 1px solid #e1e8dc; border-top: 3px solid var(--leaf); background: #f9fbf6; }
.create-user-form .eyebrow { margin-bottom: -8px; }
.create-user-form h2 { margin-bottom: 2px; font: 500 23px var(--serif); }
fieldset.color-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.color-picker legend { margin-bottom: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
fieldset.owner-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.owner-picker legend { margin-bottom: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.owner-options { display: grid; gap: 7px; max-height: 180px; overflow: auto; }
.owner-picker input[type="checkbox"] { width: 16px; min-height: 16px; margin: 0; }
.color-palette { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.color-choice { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 43px; color: var(--muted); font-size: 10px; cursor: pointer; }
.color-choice input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.color-swatch { width: 26px; height: 26px; border: 2px solid var(--paper); border-radius: 50%; background: var(--swatch-color); box-shadow: 0 0 0 1px var(--line); }
.color-swatch[data-color-preset="blue"] { --swatch-color: #4f84c8; }
.color-swatch[data-color-preset="red"] { --swatch-color: #cf5754; }
.color-swatch[data-color-preset="violet"] { --swatch-color: #8061bb; }
.color-swatch[data-color-preset="green"] { --swatch-color: #4f9b78; }
.color-swatch[data-color-preset="orange"] { --swatch-color: #e69243; }
.color-swatch[data-color-preset="pink"] { --swatch-color: #d46e9d; }
.color-swatch[data-color-preset="custom"] { background: conic-gradient(#4f84c8, #cf5754, #4f9b78, #e69243, #4f84c8); }
.color-choice input:checked + .color-swatch { box-shadow: 0 0 0 2px var(--ink); }
.color-choice input:focus-visible + .color-swatch { outline: 2px solid #6e9a58; outline-offset: 3px; }
label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
input, textarea, select { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #dce5dc; border-radius: 3px; outline: none; background: white; color: var(--ink); font-size: 12px; font-weight: 400; }
input:focus, textarea:focus, select:focus { border-color: #789c6d; box-shadow: 0 0 0 2px #e5efdc; }
textarea { resize: vertical; }
.field-hint, .optional { color: #98a69d; font-size: 10px; font-weight: 400; }
.optional { margin-left: 5px; letter-spacing: .5px; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(380px, .9fr); background: var(--paper); }
.login-art { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 100vh; background: #173e34; }
.login-art::before { position: absolute; inset: 0; background: radial-gradient(ellipse at 32% 66%, rgba(183, 223, 105, .16), transparent 46%), repeating-linear-gradient(135deg, transparent 0 35px, rgba(255,255,255,.025) 36px 37px); content: ''; }
.login-art::after { position: absolute; right: -120px; bottom: -190px; width: 550px; height: 550px; border: 1px solid rgba(183,223,105,.24); border-radius: 50%; box-shadow: 0 0 0 30px rgba(183,223,105,.025), 0 0 0 75px rgba(183,223,105,.025), 0 0 0 120px rgba(183,223,105,.025); content: ''; }
.art-label { position: absolute; top: 39px; left: 42px; z-index: 1; color: #c4d3c1; font: italic 18px var(--serif); }
.art-gift { position: relative; z-index: 1; display: grid; place-items: center; width: min(33vw, 345px); aspect-ratio: 1; border: 1px solid rgba(216, 236, 177, .58); color: var(--leaf); font: 500 190px/.8 var(--serif); transform: rotate(-8deg); }
.art-gift::before, .art-gift::after { position: absolute; inset: 18px; border: 1px solid rgba(216, 236, 177, .3); content: ''; }
.art-gift::after { inset: auto; top: -1px; bottom: -1px; left: 50%; width: 22px; border: 0; border-right: 1px solid rgba(216,236,177,.5); border-left: 1px solid rgba(216,236,177,.5); background: #173e34; }
.login-panel { display: flex; flex-direction: column; justify-content: center; width: min(100%, 450px); margin: 0 auto; padding: 55px 48px; }
.login-panel .wordmark { align-self: flex-start; }
.login-copy { margin: 78px 0 29px; }
.login-copy .eyebrow { margin-bottom: 16px; }
.login-copy h1 { margin-bottom: 15px; font: 500 43px/1.13 var(--serif); }
.login-copy .muted { margin-bottom: 0; }
.form-stack { display: grid; gap: 15px; }
.form-stack .button { margin-top: 5px; }
.form-error { min-height: 18px; margin: 0; color: #aa4c38; font-size: 11px; }
.login-foot { margin: auto 0 0; padding-top: 42px; color: #96a39a; font-size: 10px; }

.editor-dialog { width: min(92vw, 470px); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 80px #10281d35; }
.editor-dialog::backdrop { background: #10281d75; backdrop-filter: blur(3px); }
.editor-dialog form { padding: 25px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-head .eyebrow { margin-bottom: 5px; }
.dialog-head h2 { margin: 0; font: 500 25px var(--serif); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 21px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: min(360px, calc(100vw - 44px)); padding: 12px 16px; border-radius: 4px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

:root[data-color-mode="dark"] {
  color-scheme: dark;
  --ink: #e6eee7;
  --ink-soft: #bdcbbf;
  --muted: #96a79a;
  --line: #39483e;
  --paper: #202a23;
  --canvas: #151c17;
  --white: #e6eee7;
  --leaf: #a3cb68;
  --coral: #e58b70;
  --sky: #2b4245;
}
:root[data-color-mode="dark"] body { background: var(--canvas); color: var(--ink); }
:root[data-color-mode="dark"] .topbar { background: rgba(32, 42, 35, .88); }
:root[data-color-mode="dark"] .side-link.is-active,
:root[data-color-mode="dark"] .list-nav-item:hover,
:root[data-color-mode="dark"] .list-nav-item.is-selected { background: #2b3a30; color: var(--ink); }
:root[data-color-mode="dark"] .list-nav-mark { background: #2b4245; color: #b7d7dc; }
:root[data-color-mode="dark"] .list-nav-item:nth-child(3n + 2) .list-nav-mark { background: #4a3434; color: #f1b3a2; }
:root[data-color-mode="dark"] .list-nav-item:nth-child(3n) .list-nav-mark { background: #3c452c; color: #c9dfa2; }
:root[data-color-mode="dark"] .welcome h1 em { color: #b3d778; }
:root[data-color-mode="dark"] .welcome-stamp { border-color: #53694e; color: #adc58b; }
:root[data-color-mode="dark"] .welcome-stamp::before { border-color: #53694e; }
:root[data-color-mode="dark"] .button-light { border-color: var(--line); background: #263229; color: var(--ink); }
:root[data-color-mode="dark"] .button-light:hover,
:root[data-color-mode="dark"] .icon-button:hover { background: #334238; }
:root[data-color-mode="dark"] .icon-button:hover { border-color: var(--line); color: var(--ink); }
:root[data-color-mode="dark"] input,
:root[data-color-mode="dark"] textarea,
:root[data-color-mode="dark"] select { border-color: var(--line); background: #1a241d; color: var(--ink); }
:root[data-color-mode="dark"] input:focus,
:root[data-color-mode="dark"] textarea:focus,
:root[data-color-mode="dark"] select:focus { border-color: #829c68; box-shadow: 0 0 0 2px #52643e; }
:root[data-color-mode="dark"] .sharing-panel summary span { background: #334432; }
:root[data-color-mode="dark"] .person-avatar { background: #2b4245; color: #b7d7dc; }
:root[data-color-mode="dark"] .person-avatar.gifter { background: #4a3434; color: #f1b3a2; }
:root[data-color-mode="dark"] .person-avatar.admin { background: #52693c; color: #f0f5e8; }
:root[data-color-mode="dark"] .create-user-form { border-color: var(--line); background: #1b251e; }
:root[data-color-mode="dark"] .editor-dialog { border-color: var(--line); background: var(--paper); color: var(--ink); }
:root[data-color-mode="dark"] .toast { background: #e6eee7; color: #173e34; }
:root[data-color-mode="dark"] .theme-toggle { color: #efcc79; }

.app-shell[data-list-color] { --leaf: var(--list-accent, #4f9b78); --accent-ink: var(--list-accent-ink, #102016); }
.active-list .wish-row {
  padding-left: 12px;
  border-left: 5px solid var(--leaf);
  border-bottom-color: color-mix(in srgb, var(--leaf) 46%, var(--line));
  background: color-mix(in srgb, var(--leaf) 8%, transparent);
}
.active-list .wish-number,
.active-list .gift-state:not(.is-taken),
.active-list .item-price,
.active-list .item-link,
.active-list .delete-list { color: var(--leaf); }
.active-list .list-meta .meta-divider { background: var(--leaf); }
.active-list .heading-actions .button-dark { background: var(--leaf); color: var(--accent-ink); }
.active-list .heading-actions .button-dark:hover { background: var(--leaf); filter: brightness(.94); }
.active-list .heading-actions .button-light { border-color: color-mix(in srgb, var(--leaf) 52%, var(--line)); color: var(--leaf); }
.active-list .heading-actions .button-light:hover { background: color-mix(in srgb, var(--leaf) 12%, var(--paper)); }
.active-list .wish-actions .icon-button:hover { border-color: color-mix(in srgb, var(--leaf) 50%, var(--line)); background: color-mix(in srgb, var(--leaf) 10%, var(--paper)); color: var(--ink); }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1000px) {
  .page-content { padding-right: 5%; padding-left: 5%; }
  .welcome-stamp { right: -230px; width: 150px; }
  .people-layout { grid-template-columns: minmax(0, 1fr) 245px; gap: 25px; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 3; top: 0; display: flex; flex-flow: row nowrap; align-items: center; gap: 4px; width: 100%; height: 58px; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .wordmark, .sidebar > .nav-label { display: none; }
  .side-link { flex: none; width: auto; gap: 6px; padding: 8px; font-size: 11px; }
  .nav-icon { width: auto; font-size: 14px; }
  .list-nav-heading { flex: none; margin: 0; }
  .list-nav-heading .nav-label { display: none; }
  .list-nav { display: flex; flex: 1; gap: 3px; min-width: 0; overflow-x: auto; }
  .list-nav-item { flex: none; width: auto; max-width: 145px; padding: 5px; }
  .list-nav-mark { width: 25px; height: 25px; }
  .list-nav-title { max-width: 90px; font-size: 11px; }
  .topbar { min-height: 59px; height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 18px; }
  .user-name { min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
  .mobile-brand { display: flex; margin-right: auto; }
  .mobile-brand .mark { width: 25px; height: 25px; font-size: 16px; }
  .topbar-spacer { display: none; }
  .page-content { min-height: calc(100vh - 59px); padding: 40px 22px 70px; }
  .welcome { padding-top: 64px; }
  .welcome h1 { font-size: 44px; }
  .welcome-stamp { top: 35px; right: 0; width: 86px; font-size: 13px; }
  .list-heading { display: block; }
  .list-heading h1, .people-heading h1 { font-size: 38px; overflow-wrap: anywhere; }
  .heading-actions { margin-top: 18px; }
  .heading-actions .button { flex: 1; }
  .wish-row { grid-template-columns: 27px minmax(0, 1fr); gap: 8px; }
  .wish-actions { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .people-heading { align-items: flex-start; }
  .people-layout { grid-template-columns: 1fr; gap: 28px; }
  .person-row { padding-right: 2px; padding-left: 2px; }
  .person-actions { gap: 5px; }
  .person-actions .text-button { max-width: 90px; text-align: right; }
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 35px 26px; }
  .login-copy { margin: 75px 0 28px; }
  .login-copy h1 { font-size: 39px; }
  .login-foot { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}