/* Wishlist — web client. Palette matches the iOS app; dark mode is automatic. */

:root {
  color-scheme: light dark;

  --accent: #1f7a6d;
  --accent-strong: #19665b;
  --on-accent: #ffffff;
  --accent-soft: rgba(31, 122, 109, 0.1);
  --accent-border: rgba(31, 122, 109, 0.28);

  --warm: #c98a2b;
  --warm-text: #8a5a10;
  --warm-soft: rgba(201, 138, 43, 0.15);

  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --text: #1b1f1e;
  --text-2: rgba(27, 31, 30, 0.64);
  --text-3: rgba(27, 31, 30, 0.45);
  --line: rgba(27, 31, 30, 0.1);
  --line-strong: rgba(27, 31, 30, 0.22);

  --bought: #2e8b57;
  --bought-text: #246f45;
  --bought-soft: rgba(46, 139, 87, 0.13);
  --danger: #c2473d;
  --danger-text: #b03c33;
  --danger-soft: rgba(194, 71, 61, 0.1);

  --shadow: 0 1px 2px rgba(27, 31, 30, 0.05), 0 6px 20px rgba(27, 31, 30, 0.06);
  --shadow-lift: 0 2px 4px rgba(27, 31, 30, 0.06), 0 12px 28px rgba(27, 31, 30, 0.1);
  --backdrop: rgba(20, 24, 23, 0.45);

  --radius: 16px;
  --radius-sm: 12px;
  --tap: 44px;
  --tabbar-h: 60px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #4fb8a8;
    --accent-strong: #6cc7b9;
    --on-accent: #0c1a17;
    --accent-soft: rgba(79, 184, 168, 0.14);
    --accent-border: rgba(79, 184, 168, 0.35);

    --warm: #e0a84c;
    --warm-text: #e0a84c;
    --warm-soft: rgba(224, 168, 76, 0.16);

    --bg: #121514;
    --surface: #1c2120;
    --surface-2: #252b29;
    --text: #ecefea;
    --text-2: rgba(236, 239, 234, 0.64);
    --text-3: rgba(236, 239, 234, 0.42);
    --line: rgba(236, 239, 234, 0.1);
    --line-strong: rgba(236, 239, 234, 0.24);

    --bought-text: #6fcf97;
    --bought-soft: rgba(46, 139, 87, 0.24);
    --danger-text: #ee8379;
    --danger-soft: rgba(194, 71, 61, 0.2);

    --shadow: 0 0 0 1px rgba(236, 239, 234, 0.05);
    --shadow-lift: 0 0 0 1px rgba(236, 239, 234, 0.1), 0 16px 40px rgba(0, 0, 0, 0.5);
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p,
ul,
fieldset,
legend {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

h1,
h2,
h3,
.brand-name,
.auth-wordmark,
.row-title,
.btn,
.tab {
  font-family: var(--font-rounded);
}

h1 {
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.15rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
}

.icon {
  flex: none;
  display: block;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

main:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.noscript {
  max-width: 480px;
  margin: 80px auto;
  padding: 0 16px;
  text-align: center;
}

/* ---------- spinner ---------- */

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.boot,
.state.loading {
  display: grid;
  place-items: center;
  min-height: 40vh;
}

.boot {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  min-height: 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  border-radius: 20px;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Bottom tab bar on phones… */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: 6px 4px;
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}

.tab[aria-current="page"] {
  color: var(--accent);
}

.tab:focus-visible {
  outline-offset: -4px;
}

.page {
  max-width: 672px;
  margin: 0 auto;
  padding: 20px calc(16px + env(safe-area-inset-right)) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

/* …a top nav on wide screens. */
@media (min-width: 720px) {
  .tabs {
    position: static;
    background: none;
    border: 0;
    padding: 0;
    gap: 4px;
  }

  .tab {
    flex: none;
    flex-direction: row;
    gap: 8px;
    min-height: var(--tap);
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .tab .icon {
    width: 20px;
    height: 20px;
  }

  .tab:hover {
    background: var(--line);
  }

  .tab[aria-current="page"] {
    background: var(--accent-soft);
  }

  .topbar-inner {
    min-height: 60px;
  }

  .page {
    padding-top: 32px;
    padding-bottom: 64px;
  }
}

.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fade-in 0.18s ease-out;
}

.view.soft {
  animation: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.page-head,
.hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lede {
  color: var(--text-2);
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: flex-start;
  min-height: var(--tap);
  margin: -8px 0 0 -6px;
  padding-right: 10px;
  font-weight: 600;
  text-decoration: none;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
}

.section-head .count {
  margin-right: auto;
  margin-left: -4px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- cards & rows ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card.pad {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.card.muted-card {
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--line-strong);
}

.card-title {
  font-size: 1.05rem;
}

.card.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px 14px 14px;
  color: inherit;
  text-decoration: none;
}

.card.row > .icon:last-child {
  color: var(--text-3);
}

.tappable {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

@media (hover: hover) {
  .tappable:hover {
    box-shadow: var(--shadow-lift);
    transform: translateY(-1px);
  }
}

.tappable:active {
  transform: scale(0.99);
}

.tappable:focus-visible {
  border-radius: var(--radius);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.row-title {
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.25;
}

.row-sub {
  color: var(--text-2);
  font-size: 0.92rem;
}

.row-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.warn-text {
  color: var(--warm-text);
}

.card.list {
  padding: 4px 0;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 10px 8px 14px;
}

.list-row + .list-row {
  border-top: 1px solid var(--line);
}

.you {
  color: var(--text-2);
  font-weight: 400;
}

/* ---------- avatars ---------- */

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  user-select: none;
}

.avatar.emoji {
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 1.35rem;
}

.avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 0.7rem;
}

.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 1.05rem;
}

.avatar.emoji.lg {
  border-radius: 16px;
  font-size: 1.7rem;
}

.avatar.xl {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
}

.avatar.emoji.xl {
  border-radius: 22px;
  font-size: 2.4rem;
}

.avatar.person {
  color: #fff;
}

.tone-0 { background: #1f7a6d; }
.tone-1 { background: #a8701c; }
.tone-2 { background: #4f6d9a; }
.tone-3 { background: #8a5a83; }
.tone-4 { background: #5d7a45; }
.tone-5 { background: #a2574a; }

.avatar-stack {
  display: flex;
  flex-wrap: wrap;
  padding-left: 6px;
}

.avatar-stack li {
  margin-left: -6px;
}

.avatar-stack .avatar {
  box-shadow: 0 0 0 2px var(--surface);
}

.people {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s ease, border-color 0.12s ease, opacity 0.12s ease, transform 0.08s ease;
}

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

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    border-color: var(--text-3);
  }

  .btn.primary:hover:not(:disabled) {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
  }
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

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

.btn.bought,
.btn.toggle.on {
  background: var(--bought-soft);
  border-color: transparent;
  color: var(--bought-text);
}

.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn.small {
  padding: 0 14px;
  font-size: 0.92rem;
  border-radius: 12px;
}

.btn.block {
  width: 100%;
}

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

.btn.is-busy {
  color: transparent !important;
  opacity: 1;
}

.btn.is-busy > * {
  visibility: hidden;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--text-3);
  border-top-color: var(--text);
  animation: spin 0.7s linear infinite;
}

.btn.primary.is-busy::after,
.btn.danger.is-busy::after {
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn.primary.is-busy::after {
    border-color: rgba(12, 26, 23, 0.3);
    border-top-color: var(--on-accent);
  }
}

.toggle .tick {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
}

.toggle.on .tick {
  background: var(--bought);
  border-color: var(--bought);
  color: #fff;
}

.icon-btn {
  appearance: none;
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

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

@media (hover: hover) {
  .icon-btn:hover {
    background: var(--line);
  }
}

.link-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  min-height: var(--tap);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-btn.small {
  min-height: 0;
  padding: 6px 4px;
  margin: -6px -4px;
  font-size: 0.9rem;
}

.button-row,
.state-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.item-actions {
  gap: 8px;
}

.item-actions .btn.small {
  padding: 0 12px;
}

.footer-actions {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ---------- chips, badges, banners ---------- */

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.chip.date.soon,
.badge.warm {
  background: var(--warm-soft);
  color: var(--warm-text);
}

.badge.warm .icon {
  fill: currentColor;
}

.chip.date.past {
  color: var(--text-3);
}

.badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.bought {
  background: var(--bought-soft);
  color: var(--bought-text);
}

.badge.premium {
  padding: 1px 8px;
  background: var(--warm-soft);
  color: var(--warm-text);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--line);
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.banner > .icon {
  margin-top: 2px;
}

.banner > span {
  flex: 1;
  min-width: 12ch;
}

.banner.accent,
.banner.calm {
  background: var(--accent-soft);
}

.banner.accent > .icon,
.banner.calm > .icon {
  color: var(--accent);
}

.banner.warn {
  background: var(--warm-soft);
}

.banner.warn > .icon {
  color: var(--warm-text);
}

.banner.compact {
  padding: 10px 12px;
  font-size: 0.9rem;
}

.banner .link-btn {
  min-height: 0;
}

/* ---------- states ---------- */

.state.empty,
.state.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
}

.state-emoji {
  font-size: 2.6rem;
  line-height: 1;
}

.state-title {
  font-size: 1.2rem;
}

.state-text {
  max-width: 42ch;
  color: var(--text-2);
}

.state-actions {
  justify-content: center;
  margin-top: 8px;
}

.boot-error {
  padding-top: 15vh;
}

/* ---------- forms ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label,
legend {
  font-weight: 600;
  font-size: 0.95rem;
}

legend {
  margin-bottom: 6px;
}

.optional {
  color: var(--text-2);
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea {
  appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* ≥16px so iOS Safari doesn't zoom */
}

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

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-border);
  border-radius: var(--radius-sm);
}

.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hint {
  color: var(--text-2);
  font-size: 0.9rem;
}

.form-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.form-actions .btn {
  flex: 1;
}

.check-list {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  font-weight: 500;
  cursor: pointer;
}

.check-list .check-row + .check-row {
  border-top: 1px solid var(--line);
}

.field > .check-row {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.check-row input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.check-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.check-label {
  font-size: 1rem;
}

.check-sub {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 400;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.emoji-option label {
  display: grid;
  place-items: center;
  height: 48px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.emoji-option input:checked + label {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1.5px var(--accent);
}

.emoji-option input:focus-visible + label,
.segmented input:focus-visible + label {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.segmented label {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
}

.segmented input:checked + label {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.preview-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.85rem;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ---------- dialogs (bottom sheet on phones) ---------- */

dialog.sheet {
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  overflow: auto;
  overscroll-behavior: contain;
}

dialog.sheet[open] {
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

dialog.sheet::backdrop {
  background: var(--backdrop);
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -12px -20px 0;
  padding: 10px 10px 6px 20px;
  background: var(--bg);
}

.sheet-head h2 {
  font-size: 1.25rem;
}

.dialog-text {
  color: var(--text-2);
}

@media (min-width: 560px) {
  dialog.sheet {
    width: min(480px, calc(100% - 32px));
    margin: auto;
    border-radius: 22px;
    max-height: min(86vh, 760px);
  }

  .sheet-inner {
    padding-bottom: 20px;
  }
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  padding: 11px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (min-width: 720px) {
  .toasts {
    bottom: 28px;
  }
}

/* ---------- auth ---------- */

.auth {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-wordmark {
  margin-top: 8px;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-tagline {
  color: var(--text-2);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 20px;
}

.auth-title {
  font-size: 1.35rem;
}

.auth-sub {
  margin-bottom: 12px;
  color: var(--text-2);
}

.auth-switch {
  text-align: center;
  color: var(--text-2);
}

/* ---------- items ---------- */

.card.item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.card.item.dim .thumb,
.card.item.dim .item-title,
.card.item.dim .item-meta,
.card.item.dim .item-note {
  opacity: 0.6;
}

.item-top {
  display: flex;
  gap: 14px;
}

.thumb {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  font-size: 1.05rem;
  line-height: 1.3;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
}

.price {
  font-weight: 650;
}

.item-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--tap);
  margin: -8px 0;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.item-link:hover span {
  text-decoration: underline;
}

.item-note {
  color: var(--text-2);
  font-size: 0.95rem;
  white-space: pre-line;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-2);
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
}

.status.mine.reserved {
  color: var(--accent);
}

.status.bought {
  color: var(--bought-text);
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.progress-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.progress-label {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.card.pad > .progress .progress-track {
  height: 8px;
}

/* ---------- group page ---------- */

.invite-code {
  display: flex;
}

.code {
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  font: 700 1.5rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.18em;
  user-select: all;
}

/* ---------- Secret Santa ---------- */

.draw-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reveal-cover {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 22px 16px;
  border: 1.5px dashed var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.reveal-emoji {
  font-size: 2rem;
  line-height: 1;
}

.reveal-cta {
  font: 700 1.1rem var(--font-rounded);
  color: var(--accent);
}

.reveal-sub {
  max-width: 34ch;
  color: var(--text-2);
  font-size: 0.88rem;
}

.reveal-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  text-align: center;
  animation: fade-in 0.25s ease-out;
}

.reveal-label {
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reveal-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal-name {
  font: 700 1.6rem/1.15 var(--font-rounded);
}

.reveal-lists {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.premium-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
  text-align: center;
}

.premium-notice .form-actions {
  align-self: stretch;
}

/* ---------- gifting ---------- */

.summary {
  flex-direction: row !important;
  gap: 0 !important;
  padding: 14px 8px !important;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat-n {
  font: 700 1.7rem/1 var(--font-rounded);
  color: var(--accent);
}

.stat.bought .stat-n {
  color: var(--bought-text);
}

.stat-l {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.person-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.list-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.list-group-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--tap);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.list-group-link .icon {
  color: var(--text-3);
}

/* ---------- account ---------- */

.profile {
  gap: 18px !important;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-row .badge {
  align-self: flex-start;
  margin-top: 4px;
}

/* ---------- themes (shared plumbing; the Christmas look lives in theme-christmas.css) ---------- */

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Decorations that only exist in festive themes. */
.festive {
  display: none;
}

.snow {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- motion & contrast preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .spinner,
  .btn.is-busy::after {
    animation-duration: 1.6s !important;
  }
}

@media (forced-colors: active) {
  .btn,
  .card,
  .chip,
  .badge {
    border: 1px solid CanvasText;
  }
}
