/* ==========================================================================
   Reset
   ========================================================================== */

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-3);
  line-height: var(--line-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  line-height: var(--line-tight);
  font-weight: var(--font-weight-6);
  letter-spacing: -0.015em;
}

/* A single visible focus treatment, applied only for keyboard interaction. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-1);
}

:focus:not(:focus-visible) {
  outline: none;
}

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

/* ==========================================================================
   Icons
   ========================================================================== */

/* The <defs> sprite must not occupy layout. */
.sprite {
  display: none;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Shell and header
   ========================================================================== */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--size-5);
  padding-inline: var(--size-5);
  background: color-mix(in oklab, var(--bg-raised) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--size-2);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: var(--font-weight-7);
  letter-spacing: -0.02em;
}

.brand .icon {
  width: 1.4em;
  height: 1.4em;
}

.brand-name {
  font-size: var(--font-size-4);
  color: var(--text);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--size-1);
  margin-inline-start: auto;
}

.nav-link {
  padding: var(--size-2) var(--size-3);
  border-radius: var(--radius-2);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-5);
  white-space: nowrap;
  transition: background var(--speed-1), color var(--speed-1);
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.header-user {
  margin-inline-start: var(--size-2);
}

.avatar-link {
  display: block;
  border-radius: var(--radius-round);
}

/* ==========================================================================
   Page scaffolding
   ========================================================================== */

.main {
  flex: 1;
  width: 100%;
}

.page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--size-7) var(--size-5) var(--size-10);
  display: flex;
  flex-direction: column;
  gap: var(--size-6);
}

.page-narrow {
  max-width: var(--page-narrow);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--size-4);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--font-size-6);
}

.page-sub {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  margin-top: var(--size-1);
  max-width: 52ch;
}

.list-owner-head {
  display: flex;
  align-items: center;
  gap: var(--size-4);
}

.list-owner-head .avatar {
  width: 3.25rem;
  height: 3.25rem;
  font-size: var(--font-size-4);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--size-3);
}

.grid {
  display: grid;
  gap: var(--size-3);
}

.grid-people {
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-4);
  padding: var(--size-5);
  box-shadow: var(--shadow-1);
}

.card-danger {
  border-color: color-mix(in oklab, var(--danger) 30%, var(--border));
}

.section-title {
  font-size: var(--font-size-4);
}

.section-sub {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  margin-top: var(--size-1);
  margin-bottom: var(--size-4);
}

.section-title + .form {
  margin-top: var(--size-4);
}

/* ==========================================================================
   Person cards
   ========================================================================== */

.person-card {
  display: flex;
  align-items: center;
  gap: var(--size-4);
  padding: var(--size-4);
  text-decoration: none;
  color: inherit;
  transition: transform var(--speed-1) var(--ease-out),
    box-shadow var(--speed-2), border-color var(--speed-1);
}

.person-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}

.person-body {
  flex: 1;
  min-width: 0;
}

.person-name-row {
  display: flex;
  align-items: center;
  gap: var(--size-2);
}

.person-name {
  font-weight: var(--font-weight-6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-count {
  display: block;
  font-size: var(--font-size-1);
  color: var(--text-muted);
}

.person-card > .icon {
  color: var(--text-subtle);
  transition: transform var(--speed-2) var(--ease-out);
}

.person-card:hover > .icon {
  transform: translateX(3px);
  color: var(--accent);
}

.avatar {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: var(--radius-round);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-6);
  letter-spacing: 0.02em;
  color: oklch(0.3 0.08 var(--avatar-hue, 340));
  background: oklch(0.88 0.08 var(--avatar-hue, 340));
}

@media (prefers-color-scheme: dark) {
  .avatar {
    color: oklch(0.92 0.06 var(--avatar-hue, 340));
    background: oklch(0.38 0.09 var(--avatar-hue, 340));
  }
}

/* ==========================================================================
   Items
   ========================================================================== */

.item {
  display: flex;
  align-items: flex-start;
  gap: var(--size-4);
  padding: var(--size-4);
  transition: border-color var(--speed-1), box-shadow var(--speed-2),
    opacity var(--speed-2);
}

.item:hover {
  box-shadow: var(--shadow-2);
}

.item.is-archived {
  opacity: 0.62;
  background: var(--bg-sunken);
  box-shadow: none;
}

.item.is-mine {
  border-color: color-mix(in oklab, var(--success) 40%, var(--border));
  background: linear-gradient(
    to right,
    color-mix(in oklab, var(--success-soft) 55%, var(--bg-raised)),
    var(--bg-raised) 40%
  );
}

.item.is-taken {
  opacity: 0.72;
}

.item.is-bought .item-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.item-thumb {
  width: 4.5rem;
  height: 4.5rem;
  flex: none;
  border-radius: var(--radius-3);
  object-fit: cover;
  background: var(--bg-sunken);
}

.item-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--text-subtle);
  border: 1px dashed var(--border-strong);
}

.item-thumb-empty .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--size-2);
}

.item-head {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  flex-wrap: wrap;
}

.item-title {
  font-weight: var(--font-weight-6);
  font-size: var(--font-size-4);
  line-height: var(--line-snug);
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  flex-wrap: wrap;
  font-size: var(--font-size-2);
}

.item-meta:empty {
  display: none;
}

.item-price {
  font-weight: var(--font-weight-6);
  font-variant-numeric: tabular-nums;
}

.item-qty {
  color: var(--text-muted);
  font-size: var(--font-size-1);
}

.item-notes {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  line-height: var(--line-snug);
  overflow-wrap: anywhere;
}

.item-link {
  display: inline-flex;
  align-items: center;
  gap: var(--size-2);
  align-self: flex-start;
  font-size: var(--font-size-1);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: var(--font-weight-5);
}

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

.item-link .icon {
  width: 1em;
  height: 1em;
}

.item-status {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  flex-wrap: wrap;
  margin-top: var(--size-1);
}

.item-status:empty {
  display: none;
}

.item-claimers {
  font-size: var(--font-size-1);
  color: var(--text-muted);
}

.item-claim-note {
  font-size: var(--font-size-1);
  color: var(--text-muted);
  font-style: italic;
  padding-inline-start: var(--size-3);
  border-inline-start: 2px solid var(--border-strong);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: var(--size-1);
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reorder {
  display: flex;
  flex-direction: column;
  margin-inline-start: var(--size-1);
}

/* The "already bought" toggle on the giving list. */
.check {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  margin-top: var(--size-1);
  display: grid;
  place-items: center;
  border-radius: var(--radius-round);
  border: 2px solid var(--border-strong);
  background: transparent;
  color: transparent;
  cursor: pointer;
  transition: all var(--speed-2) var(--ease-out);
}

.check:hover {
  border-color: var(--success);
  color: color-mix(in oklab, var(--success) 40%, transparent);
}

.check.is-checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.check .icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 3;
}

/* ==========================================================================
   Badges and chips
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--size-1);
  padding: 0.15rem var(--size-2);
  border-radius: var(--radius-round);
  font-size: var(--font-size-0);
  font-weight: var(--font-weight-6);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge .icon {
  width: 0.9em;
  height: 0.9em;
  stroke-width: 3;
}

.prio-1 {
  background: var(--bg-sunken);
  color: var(--text-muted);
}

.prio-2 {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.prio-3 {
  background: color-mix(in oklab, var(--accent) 88%, black);
  color: var(--text-on-brand);
}

@media (prefers-color-scheme: dark) {
  .prio-3 {
    background: var(--accent);
    color: oklch(0.16 0.03 var(--brand-hue));
  }
}

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

.badge-taken {
  background: var(--bg-sunken);
  color: var(--text-muted);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem var(--size-2);
  border-radius: var(--radius-round);
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: var(--font-size-0);
  font-weight: var(--font-weight-5);
  white-space: nowrap;
}

.chip-you {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--size-2);
  padding: var(--size-2) var(--size-4);
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-2);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-6);
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  transition: background var(--speed-1), border-color var(--speed-1),
    color var(--speed-1), transform var(--speed-1);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--accent);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-1);
}

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

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: oklch(0.16 0.03 var(--brand-hue));
  }
}

.btn-secondary {
  background: var(--bg-raised);
  border-color: var(--border-strong);
  color: var(--text);
}

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

.btn-ghost {
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

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

.btn-quiet:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

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

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-sm {
  min-height: 2rem;
  padding: var(--size-1) var(--size-3);
  font-size: var(--font-size-1);
}

.btn-lg {
  min-height: 3rem;
  padding: var(--size-3) var(--size-6);
  font-size: var(--font-size-3);
  border-radius: var(--radius-3);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background var(--speed-1), color var(--speed-1);
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

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

.icon-btn-sm {
  width: 1.5rem;
  height: 1.25rem;
}

.icon-btn-sm .icon {
  width: 1rem;
  height: 1rem;
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-text);
  font-weight: var(--font-weight-6);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--size-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--size-2);
  min-width: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--size-3);
}

.label {
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-5);
  color: var(--text-muted);
}

.input {
  width: 100%;
  padding: var(--size-3);
  min-height: 2.75rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  font-size: var(--font-size-3);
  transition: border-color var(--speed-1), box-shadow var(--speed-1);
}

.input::placeholder {
  color: var(--text-subtle);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: var(--line-snug);
}

.select {
  appearance: none;
  cursor: pointer;
  /* Chevron drawn in CSS so the control needs no extra markup or asset. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.1rem center, right 0.85rem center;
  background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
  background-repeat: no-repeat;
  padding-inline-end: var(--size-8);
}

.has-error .input {
  border-color: var(--danger);
}

.field-error {
  font-size: var(--font-size-1);
  color: var(--danger);
}

.form-hint {
  font-size: var(--font-size-1);
  color: var(--text-muted);
  margin-top: calc(var(--size-2) * -1);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  font-size: var(--font-size-2);
  cursor: pointer;
}

.checkbox {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--size-3);
  padding: var(--size-3) var(--size-4);
  border-radius: var(--radius-2);
  font-size: var(--font-size-2);
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ==========================================================================
   Auth screens
   ========================================================================== */

.auth {
  display: grid;
  place-items: center;
  padding: var(--size-9) var(--size-5) var(--size-10);
  min-height: calc(100dvh - var(--header-height));
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: var(--size-7);
  box-shadow: var(--shadow-2);
}

.auth-title {
  font-size: var(--font-size-5);
}

.auth-sub {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  margin-top: var(--size-2);
  margin-bottom: var(--size-6);
}

.auth-switch {
  margin-top: var(--size-5);
  text-align: center;
  font-size: var(--font-size-2);
  color: var(--text-muted);
}

/* ==========================================================================
   Landing hero
   ========================================================================== */

.hero {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--size-10) var(--size-5) var(--size-12);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: var(--size-9);
}

.hero-title {
  font-size: var(--font-size-8);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero-sub {
  margin-top: var(--size-5);
  font-size: var(--font-size-4);
  color: var(--text-muted);
  max-width: 42ch;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  gap: var(--size-3);
  margin-top: var(--size-7);
  flex-wrap: wrap;
}

.hero-art {
  position: relative;
  height: 20rem;
}

.hero-card {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: var(--radius-5);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  color: var(--accent);
  animation: float 6s var(--ease-out) infinite;
}

.hero-card .icon {
  width: 40%;
  height: 40%;
  stroke-width: 1.5;
}

.hero-card-1 {
  width: 11rem;
  height: 11rem;
  top: 2rem;
  left: 10%;
  rotate: -6deg;
}

.hero-card-2 {
  width: 7rem;
  height: 7rem;
  top: 0;
  right: 8%;
  rotate: 9deg;
  color: var(--success);
  animation-delay: -2s;
}

.hero-card-3 {
  width: 8.5rem;
  height: 8.5rem;
  bottom: 1rem;
  right: 14%;
  rotate: -3deg;
  animation-delay: -4s;
}

@keyframes float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -12px;
  }
}

/* ==========================================================================
   Profiles and avatars
   ========================================================================== */

.avatar-photo {
  object-fit: cover;
  background: var(--bg-sunken);
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: var(--font-size-1);
}

.avatar-lg {
  width: 3.25rem;
  height: 3.25rem;
  font-size: var(--font-size-4);
}

.avatar-xl {
  width: 5.5rem;
  height: 5.5rem;
  font-size: var(--font-size-6);
}

.avatar-editor {
  display: flex;
  align-items: flex-start;
  gap: var(--size-5);
  padding-bottom: var(--size-5);
  margin-bottom: var(--size-5);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.avatar-actions {
  display: flex;
  align-items: center;
  gap: var(--size-2);
  flex-wrap: wrap;
}

/* The real file input is hidden but must stay focusable and in the a11y tree,
   so it is clipped rather than display:none -- a label triggers it. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: var(--size-3);
}

.profile-bio {
  font-size: var(--font-size-3);
  line-height: var(--line-snug);
  text-wrap: pretty;
}

.profile-avoid {
  font-size: var(--font-size-2);
  color: var(--text-muted);
  padding: var(--size-3) var(--size-4);
  border-radius: var(--radius-2);
  background: var(--warning-soft);
  color: var(--warning-text);
}

.detail-heading {
  font-size: var(--font-size-1);
  font-weight: var(--font-weight-6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-top: var(--size-2);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: var(--size-3);
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--size-3);
  border-radius: var(--radius-2);
  background: var(--bg-sunken);
}

.detail-label {
  font-size: var(--font-size-0);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-weight: var(--font-weight-6);
  font-size: var(--font-size-3);
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--size-3);
}

/* ---- public sharing toggle ---- */

.toggle-box {
  display: flex;
  flex-direction: column;
  gap: var(--size-3);
  padding: var(--size-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  background: var(--bg);
  transition: border-color var(--speed-2), background var(--speed-2);
}

.toggle-box.is-on {
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
}

.toggle-box .checkbox-row {
  align-items: flex-start;
}

.toggle-title {
  display: block;
  font-weight: var(--font-weight-6);
}

.toggle-sub {
  display: block;
  font-size: var(--font-size-1);
  color: var(--text-muted);
  margin-top: 2px;
}

.alert-warn {
  background: var(--warning-soft);
  color: var(--warning-text);
  align-items: flex-start;
  line-height: var(--line-snug);
}

/* ==========================================================================
   Claim attribution
   ========================================================================== */

.claimer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.claimer {
  display: inline-flex;
  align-items: center;
  gap: var(--size-1);
  padding: 0.1rem var(--size-2);
  border-radius: var(--radius-round);
  font-size: var(--font-size-0);
  font-weight: var(--font-weight-5);
  white-space: nowrap;
}

.claimer-member {
  background: var(--bg-sunken);
  color: var(--text-muted);
}

/* Guest claims are unverified -- anyone can type any name into a public page.
   The warning color is the signal to treat one with suspicion. */
.claimer-guest {
  background: var(--warning-soft);
  color: var(--warning-text);
  border: 1px solid color-mix(in oklab, var(--warning-text) 35%, transparent);
}

.claimer-guest .icon {
  width: 0.85em;
  height: 0.85em;
}

.claimer-tag {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.62rem;
  font-weight: var(--font-weight-7);
  opacity: 0.75;
}

/* ==========================================================================
   Public profile page
   ========================================================================== */

.public-page {
  max-width: var(--page-narrow);
}

.public-head {
  display: flex;
  align-items: center;
  gap: var(--size-5);
  flex-wrap: wrap;
}

.public-note {
  display: flex;
  align-items: flex-start;
  gap: var(--size-3);
  padding: var(--size-4);
  border-radius: var(--radius-3);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--font-size-2);
  line-height: var(--line-snug);
}

.public-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--size-3);
  padding-top: var(--size-6);
  margin-top: var(--size-4);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--font-size-2);
  flex-wrap: wrap;
}

/* ==========================================================================
   Setup wizard
   ========================================================================== */

.auth-wide .auth-card {
  max-width: 34rem;
}

.setup-card {
  padding: var(--size-8);
}

.setup-head {
  text-align: center;
  margin-bottom: var(--size-8);
}

.setup-head .icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto var(--size-4);
  color: var(--accent);
  stroke-width: 1.5;
}

.setup-section {
  padding-bottom: var(--size-6);
  border-bottom: 1px solid var(--border);
}

.setup-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.setup-section-head {
  display: flex;
  align-items: flex-start;
  gap: var(--size-4);
  margin-bottom: var(--size-5);
}

.setup-number {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: var(--radius-round);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--font-size-1);
  font-weight: var(--font-weight-7);
}

.setup-section-title {
  font-size: var(--font-size-4);
}

.setup-section-blurb {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  margin-top: var(--size-1);
}

.setup-section-body {
  display: flex;
  flex-direction: column;
  gap: var(--size-4);
}

/* ---- accent color picker ---- */

.hue-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);
}

.hue-swatch {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-round);
  border: 2px solid transparent;
  background: oklch(0.62 0.16 var(--swatch-hue, 344));
  cursor: pointer;
  transition: transform var(--speed-1) var(--ease-spring),
    box-shadow var(--speed-2);
}

.hue-swatch:hover {
  transform: scale(1.1);
}

/* The selected ring sits outside the swatch so the color stays unobscured. */
.hue-swatch.is-selected {
  border-color: var(--bg-raised);
  box-shadow: 0 0 0 2px oklch(0.62 0.16 var(--swatch-hue, 344));
}

/* ==========================================================================
   Rows (admin lists)
   ========================================================================== */

.stack-tight {
  gap: var(--size-2);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--size-3);
  padding: var(--size-3) var(--size-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  background: var(--bg);
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-head {
  display: flex;
  align-items: center;
  gap: var(--size-2);
  flex-wrap: wrap;
}

.row-title {
  font-weight: var(--font-weight-6);
  font-size: var(--font-size-2);
}

.row-detail {
  display: block;
  font-size: var(--font-size-1);
  color: var(--text-muted);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--size-4);
  margin-bottom: var(--size-5);
  flex-wrap: wrap;
}

.section-head .section-sub {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--size-2);
  flex-wrap: wrap;
}

/* ==========================================================================
   New invite banner
   ========================================================================== */

.invite-new {
  display: flex;
  flex-direction: column;
  gap: var(--size-3);
  padding: var(--size-4);
  margin-bottom: var(--size-4);
  border: 1px solid color-mix(in oklab, var(--success) 40%, var(--border));
  border-radius: var(--radius-3);
  background: var(--success-soft);
}

.invite-new-head {
  display: flex;
  align-items: center;
  gap: var(--size-2);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-6);
  color: var(--success);
}

.invite-link-row {
  display: flex;
  gap: var(--size-2);
}

.invite-link {
  font-family: ui-monospace, monospace;
  font-size: var(--font-size-1);
  background: var(--bg-raised);
}

.invite-new .link {
  align-self: flex-start;
  font-size: var(--font-size-1);
}

.hero-note {
  margin-top: var(--size-4);
  font-size: var(--font-size-2);
  color: var(--text-muted);
}

/* ==========================================================================
   Segmented control
   ========================================================================== */

.segmented {
  display: inline-flex;
  padding: var(--size-1);
  gap: var(--size-1);
  background: var(--bg-sunken);
  border-radius: var(--radius-3);
  align-self: flex-start;
}

.segment {
  padding: var(--size-2) var(--size-4);
  border: none;
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-5);
  cursor: pointer;
  transition: background var(--speed-1), color var(--speed-1);
}

.segment:hover {
  color: var(--text);
}

.segment.is-active {
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

/* ==========================================================================
   States
   ========================================================================== */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--size-3);
  padding: var(--size-10) var(--size-5);
  text-align: center;
}

.state .icon {
  width: 2rem;
  height: 2rem;
  color: var(--text-subtle);
}

.state-error .icon {
  color: var(--danger);
}

.state-title {
  font-size: var(--font-size-4);
  font-weight: var(--font-weight-6);
}

.state-body {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  max-width: 42ch;
  text-wrap: pretty;
}

.state .btn {
  margin-top: var(--size-2);
}

.spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: var(--radius-round);
  animation: spin 700ms linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
  border-top-color: currentColor;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

.boot {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

.boot-message {
  max-width: 28rem;
  margin: var(--size-12) auto;
  padding: var(--size-5);
  text-align: center;
}

.boot-message h1 {
  font-size: var(--font-size-5);
  margin-bottom: var(--size-3);
}

.boot-message p {
  color: var(--text-muted);
  font-size: var(--font-size-2);
}

.boot-detail {
  margin-top: var(--size-3);
  font-family: ui-monospace, monospace;
  font-size: var(--font-size-1);
  color: var(--text-subtle);
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--size-4);
  background: oklch(0.15 0.02 var(--brand-hue) / 0.55);
  backdrop-filter: blur(3px);
  animation: fade var(--speed-2) var(--ease-out);
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 32rem;
  margin-block: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-3);
  padding: var(--size-6);
  animation: pop var(--speed-3) var(--ease-spring);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--size-4);
  margin-bottom: var(--size-5);
}

.modal-title {
  font-size: var(--font-size-5);
}

.modal-lead {
  font-weight: var(--font-weight-6);
  font-size: var(--font-size-4);
}

.modal-body {
  color: var(--text-muted);
  font-size: var(--font-size-2);
  margin-top: var(--size-3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--size-2);
  margin-top: var(--size-5);
  flex-wrap: wrap;
}

.modal-actions .btn-block {
  width: auto;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    translate: 0 12px;
    scale: 0.97;
  }
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toasts {
  position: fixed;
  z-index: 80;
  bottom: var(--size-5);
  right: var(--size-5);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--size-2);
  pointer-events: none;
}

.toast {
  padding: var(--size-3) var(--size-5);
  border-radius: var(--radius-3);
  background: var(--gray-10);
  color: var(--gray-1);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-5);
  box-shadow: var(--shadow-3);
  max-width: 24rem;
  animation: toast-in var(--speed-3) var(--ease-spring);
  transition: opacity var(--speed-2), translate var(--speed-2);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: var(--gray-2);
    color: var(--gray-10);
  }
}

.toast-success {
  border-inline-start: 3px solid var(--green-5);
}

.toast-error {
  border-inline-start: 3px solid var(--red-5);
}

.toast.is-leaving {
  opacity: 0;
  translate: 0 8px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: 0 16px;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 60rem) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: var(--size-8);
    gap: var(--size-7);
  }

  .hero-title {
    font-size: var(--font-size-7);
  }

  .hero-art {
    display: none;
  }
}

@media (max-width: 40rem) {
  .header {
    padding-inline: var(--size-4);
    gap: var(--size-3);
  }

  .brand-name {
    display: none;
  }

  .nav-link {
    padding-inline: var(--size-2);
  }

  .page {
    padding: var(--size-5) var(--size-4) var(--size-9);
  }

  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  /* The priority select is the widest control, so give it the full row. */
  .field-row > .field:first-child {
    grid-column: 1 / -1;
  }

  .item {
    flex-wrap: wrap;
  }

  .item-thumb {
    width: 3.25rem;
    height: 3.25rem;
  }

  .item-actions {
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--border);
    padding-top: var(--size-3);
  }

  .reorder {
    flex-direction: row;
    margin-inline-start: auto;
  }

  .icon-btn-sm {
    width: 2rem;
    height: 2rem;
  }

  .toasts {
    left: var(--size-4);
    right: var(--size-4);
    bottom: var(--size-4);
  }

  .toast {
    max-width: none;
  }

  .modal {
    padding: var(--size-5);
  }

  .setup-card {
    padding: var(--size-5);
  }

  .row {
    flex-wrap: wrap;
  }

  .invite-link-row {
    flex-direction: column;
  }

  .avatar-editor {
    gap: var(--size-4);
  }

  .avatar-xl {
    width: 4rem;
    height: 4rem;
    font-size: var(--font-size-5);
  }

  .size-grid {
    grid-template-columns: 1fr 1fr;
  }
}
