/* McKinney Christmas List — one stylesheet for phone, tablet and desktop.
   Colours, fonts and sizes live in the variables below. Light = "Christmas day",
   dark = "Christmas night" (follows the device, or the moon button). */

@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-var.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-400italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --bg: #FBF6EC;         /* cream */
  --surface: #FFFFFF;    /* cards */
  --surface-2: #F4ECDD;  /* soft panels */
  --text: #1E2B24;
  --muted: #5B675F;
  --line: #E7DDCA;
  --green: #1F5C45;      /* pine */
  --on-green: #FFFFFF;
  --cran: #A61E3C;       /* cranberry */
  --on-cran: #FFFFFF;
  --gold: #E0B04A;
  --sec-line: #C3D3C9;
  --sec-fg: #1F5C45;
  --topbar: #1F5C45;
  --topbar-fg: #FBF6EC;
  --res-bg: #FCE3B6;  --res-fg: #6E3C00;   /* reserved */
  --bought-bg: #1F5C45; --bought-fg: #FFFFFF;
  --avail: #1F5C45;
  --ring: #2E8B62; --ring-track: #E7DDCA;
  --tile: #F4ECDD;       /* behind gift photos */
  --icon: #2A3A31;
  --overlay: rgba(20, 28, 24, .45);
  --toast-bg: #1E2B24; --toast-fg: #FBF6EC; --toast-action: #F2C661;
  --snow: #BFD0DC;
  --shadow: 0 1px 2px rgba(30, 43, 36, .06), 0 6px 18px rgba(30, 43, 36, .07);
  --radius: 20px;
  --font-head: "Fredoka", ui-rounded, system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* Christmas night: used when the device is dark (unless the person chose light), or when chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1A22; --surface: #162732; --surface-2: #1E3441; --text: #F4EDDF; --muted: #A7B4BC; --line: #2A4150;
    --green: #7FD3A8; --on-green: #0E1A22; --cran: #F28B9C; --on-cran: #22090F; --gold: #F2C661;
    --sec-line: #3A5566; --sec-fg: #F4EDDF; --topbar: #0A141A; --topbar-fg: #F4EDDF;
    --res-bg: #4A3610; --res-fg: #F8D488; --bought-bg: #7FD3A8; --bought-fg: #0E1A22; --avail: #9BE0BC;
    --ring: #7FD3A8; --ring-track: #2A4150; --tile: #1E3441; --icon: #F4EDDF; --overlay: rgba(0, 0, 0, .6);
    --toast-bg: #F4EDDF; --toast-fg: #0E1A22; --toast-action: #A61E3C; --snow: #FFFFFF;
    --shadow: 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1A22; --surface: #162732; --surface-2: #1E3441; --text: #F4EDDF; --muted: #A7B4BC; --line: #2A4150;
  --green: #7FD3A8; --on-green: #0E1A22; --cran: #F28B9C; --on-cran: #22090F; --gold: #F2C661;
  --sec-line: #3A5566; --sec-fg: #F4EDDF; --topbar: #0A141A; --topbar-fg: #F4EDDF;
  --res-bg: #4A3610; --res-fg: #F8D488; --bought-bg: #7FD3A8; --bought-fg: #0E1A22; --avail: #9BE0BC;
  --ring: #7FD3A8; --ring-track: #2A4150; --tile: #1E3441; --icon: #F4EDDF; --overlay: rgba(0, 0, 0, .6);
  --toast-bg: #F4EDDF; --toast-fg: #0E1A22; --toast-action: #A61E3C; --snow: #FFFFFF;
  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 17px; line-height: 1.45;
}
a { color: var(--green); text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.15rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem clamp(.75rem, 2vw, 1.75rem); background: var(--topbar); color: var(--topbar-fg);
}
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand svg { width: 30px; height: 30px; fill: var(--gold); stroke: var(--gold); stroke-width: 1; stroke-linejoin: round; flex: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name b { font-family: var(--font-head); font-weight: 600; font-size: 1.5rem; }
.brand-name small { font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; opacity: .85; margin-top: 3px; }
.topbar .spacer { flex: 1; }
.countdown {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  background: rgba(255, 255, 255, .12); border-radius: 999px; padding: .35rem .8rem; font-weight: 700; font-size: .85rem;
}
.countdown .icon { color: var(--gold); width: 1.1em; height: 1.1em; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); color: var(--topbar-fg); cursor: pointer; flex: none; font: inherit;
}
.icon-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .28); }
.icon-btn .icon { width: 20px; height: 20px; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
}
.me { display: inline-flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; font-weight: 700; min-height: 44px; padding: 0 .25rem; }
.me .avatar { box-shadow: 0 0 0 2px var(--topbar-fg); }

/* ---- Avatars & family strip ---- */
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: block; flex: none; }
.avatar.sm { width: 36px; height: 36px; }
.avatar.md { width: 60px; height: 60px; }
.avatar.lg { width: 84px; height: 84px; }
.avatar.xl { width: 120px; height: 120px; }

.strip {
  display: flex; gap: .35rem; overflow-x: auto; padding: .6rem clamp(.75rem, 2vw, 1.5rem);
  background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: thin;
}
.person {
  flex: none; min-width: 70px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: .35rem .25rem; border-radius: 16px; color: var(--text); text-decoration: none; font-size: .85rem;
}
.person:hover { background: var(--surface-2); }
.person.current { background: var(--surface-2); font-weight: 700; }
.person span { max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The ring shows how much of someone's list is taken. You are never in your own strip. */
.ring {
  --pct: 0; padding: 4px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--ring-track) 0);
}
.ring .avatar { width: 46px; height: 46px; border: 2px solid var(--surface); }

/* ---- Page layout: sidebar on wide screens, tab bar on phones ---- */
.shell { display: flex; align-items: flex-start; }
.sidebar {
  flex: none; width: 250px; padding: 1.5rem 1rem 2.5rem 1.5rem; display: flex; flex-direction: column; gap: 1.4rem;
  border-right: 1px solid var(--line); align-self: stretch;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; min-height: 44px; border-radius: 12px;
  color: var(--text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--green); font-weight: 700; box-shadow: var(--shadow); }
.nav .label { flex: 1; }
.badge { background: var(--cran); color: var(--on-cran); border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 1px 8px; line-height: 1.5; }
.side-title { margin: 0 0 .5rem; font-family: var(--font-head); font-weight: 600; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-list a { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 10px; color: var(--text); text-decoration: none; }
.side-list a:hover { background: var(--surface-2); }
.side-list .thumb-sm { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex: none; background: var(--tile); display: flex; align-items: center; justify-content: center; }
.side-list .thumb-sm .icon { width: 20px; height: 20px; color: var(--icon); stroke-width: 1.6; }
.side-list .txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side-list .txt b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-list .txt small { font-size: .82rem; color: var(--muted); }
.side-comments a { display: flex; flex-direction: column; gap: 2px; background: var(--surface); padding: .6rem .75rem; border-radius: 12px; font-size: .9rem; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.side-comments small { color: var(--muted); }

.content { flex: 1; min-width: 0; padding: 1.75rem 2rem 4rem; }
.content > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.content.narrow > * { max-width: 680px; }
.no-shell .content { padding-top: 0; }

.tabbar { display: none; }

@media (max-width: 899px) {
  .sidebar, .me, .topbar .snow-btn { display: none; }
  .brand-name b { font-size: 1.25rem; }
  .countdown .long { display: none; }
  .content { padding: 1rem .9rem calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .tab {
    flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font: inherit; font-size: .75rem; text-decoration: none; background: none; border: 0; cursor: pointer; position: relative;
  }
  .tab .icon { width: 24px; height: 24px; }
  .tab[aria-current="page"] { color: var(--cran); font-weight: 700; }
  .tab .badge { position: absolute; top: 4px; left: 50%; margin-left: 6px; font-size: .68rem; padding: 0 6px; }
}

/* ---- Headings, cards, messages ---- */
.page-head { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .grow { flex: 1; min-width: 170px; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h1 { margin-bottom: 1rem; }
.card > h2, .card > h3 { margin-bottom: .75rem; }
.card.center { text-align: center; }
.flash { background: var(--res-bg); color: var(--res-fg); padding: .7rem 1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 700; }
.error { color: var(--cran); font-weight: 700; }
.tip { display: flex; gap: .75rem; align-items: flex-start; background: var(--surface-2); border-radius: 16px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .95rem; }
.tip .icon { color: var(--green); margin-top: 2px; }
.tip p { margin: 0; }

/* ---- Forms & buttons ---- */
.stack { display: grid; gap: 1rem; }
.stack label, label.field { display: grid; gap: .35rem; font-weight: 700; }
.stack label .muted, label.field .muted { font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row input[type=text], .row input[type=search] { flex: 1 1 220px; width: auto; }
input[type=text], input[type=url], input[type=password], input[type=search], input[type=number], textarea, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  padding: .7rem .9rem; min-height: 48px; border: 1.5px solid var(--line); border-radius: 14px; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
textarea { resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }
input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--green); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  padding: .6rem 1.2rem; min-height: 46px; border-radius: 999px;
  background: var(--surface); color: var(--sec-fg); border: 1.5px solid var(--sec-line);
}
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--cran); color: var(--on-cran); border-color: var(--cran); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.green { background: var(--green); color: var(--on-green); border-color: var(--green); border-radius: 14px; }
.btn.danger { background: transparent; color: var(--cran); border-color: var(--cran); }
.btn.small { padding: .35rem .9rem; min-height: 40px; font-size: .9rem; }
.btn.big { min-height: 54px; font-size: 1.05rem; padding: .75rem 1.5rem; }
.btn.block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; cursor: default; }
.linklike { background: none; border: 0; font: inherit; color: var(--green); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; }

/* ---- Gift grid (photo first) ---- */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.25rem; }
@media (max-width: 599px) { .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } }
.gcard {
  display: flex; flex-direction: column; text-align: left; padding: 0; margin: 0; cursor: pointer;
  background: var(--surface); color: var(--text); border: 0; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); font: inherit; text-decoration: none; scroll-margin-top: 150px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.gcard:hover { transform: translateY(-2px); }
.photo { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1 / 1; background: var(--tile); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .icon { width: 38%; height: 38%; color: var(--icon); stroke-width: 1.2; opacity: .8; }
.gcard.taken .photo img, .gcard.taken .photo .icon { opacity: .45; }
.tag-new, .tag-top {
  position: absolute; top: 10px; border-radius: 999px; padding: 3px 10px; font-size: .72rem; font-weight: 700;
}
.tag-new { left: 10px; background: var(--cran); color: var(--on-cran); letter-spacing: .06em; text-transform: uppercase; }
.tag-top { right: 10px; background: var(--surface); color: var(--cran); }
.gcard .info { padding: .75rem .9rem .9rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.gcard .name { font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard .price { color: var(--muted); font-size: .95rem; }
.chip {
  align-self: flex-start; margin-top: auto; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  border: 1.5px solid transparent; line-height: 1.4;
}
.chip.available { color: var(--avail); border-color: var(--avail); }
.chip.reserved { background: var(--res-bg); color: var(--res-fg); }
.chip.bought { background: var(--bought-bg); color: var(--bought-fg); }
.add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 200px;
  border: 2px dashed var(--sec-line); border-radius: var(--radius); color: var(--green); font-weight: 700; text-decoration: none;
}
.add-card .icon { width: 36px; height: 36px; }
.empty { padding: 2rem; text-align: center; background: var(--surface); border-radius: var(--radius); color: var(--muted); }

/* ---- Gift details: bottom sheet on phones, dialog on bigger screens ---- */
dialog.sheet {
  padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--text);
  width: min(800px, calc(100vw - 48px)); max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
dialog.sheet::backdrop { background: var(--overlay); }
.sheet-inner { display: flex; flex-wrap: wrap; position: relative; }
.sheet .photo { flex: 0 1 340px; align-self: flex-start; aspect-ratio: 1 / 1; }
.sheet .photo img { object-fit: contain; }
.sheet .photo .icon { width: 120px; height: 120px; }
.sheet-body { flex: 999 1 320px; min-width: 0; padding: 1.4rem 1.4rem 1.6rem; display: flex; flex-direction: column; gap: .9rem; }
.sheet-close {
  position: absolute; right: 12px; top: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.sheet .kicker { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0; padding-right: 44px; }
.sheet h2 { font-size: 1.6rem; }
.sheet .desc { margin: 0; white-space: pre-line; }
.sheet .shop-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; align-self: flex-start; min-height: 40px; }
.status-box { border-radius: 16px; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.status-box.reserved { background: var(--res-bg); color: var(--res-fg); }
.status-box.bought { background: var(--bought-bg); color: var(--bought-fg); }
.status-box.taken { background: var(--surface-2); font-weight: 700; }
.status-box .btn.on-color { background: transparent; color: inherit; border-color: currentColor; }
.status-box form { display: flex; gap: .5rem; flex-wrap: wrap; }
.status-box form .btn.primary { flex: 1 1 auto; }
.hint { margin: 0; font-size: .9rem; color: var(--muted); text-align: center; }
.sheet-comments { border-top: 1px solid var(--line); padding-top: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.sheet-comments .head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.sheet-comments .head small { color: var(--muted); }
.comment { background: var(--surface-2); border-radius: 14px; padding: .6rem .8rem; }
.comment p { margin: 0; white-space: pre-line; }
.comment small { display: block; color: var(--muted); margin-top: 2px; }
.sheet-comments form { display: flex; gap: .5rem; }
.sheet-comments input { border-radius: 999px; }
.lock { display: flex; gap: .5rem; align-items: flex-start; background: var(--surface-2); border-radius: 14px; padding: .75rem; font-size: .95rem; margin: 0; }
.lock .icon { color: var(--green); }
.owner-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 599px) {
  dialog.sheet {
    width: 100vw; max-width: 100vw; max-height: 90vh; margin: auto 0 0; border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.sheet[open] { animation: sheet-up .22s ease-out; }
  .sheet .photo { flex-basis: 100%; aspect-ratio: auto; height: 260px; }
  .sheet .photo::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 999px; background: rgba(0, 0, 0, .25); }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* "More" menu on phones */
dialog.more { padding: 14px 12px 22px; margin: auto 0 0; width: 100vw; max-width: 100vw; border: 0; border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text); }
dialog.more::backdrop { background: var(--overlay); }
dialog.more .nav a, dialog.more .nav button { min-height: 52px; font-weight: 700; }
dialog.more .nav .icon { color: var(--green); }
.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
[aria-checked="true"] .switch { background: var(--green); }
[aria-checked="true"] .switch::after { left: 21px; }

/* ---- Sign in ---- */
.login-page { min-height: 100vh; background: var(--topbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem 1rem; }
.login-page > .card { width: 100%; max-width: 480px; }
.login-card { width: 100%; max-width: 640px; background: var(--surface); border-radius: 28px; padding: 2rem 1.5rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); text-align: center; }
.login-card.small { max-width: 400px; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.login-logo svg { width: 48px; height: 48px; fill: var(--gold); stroke: var(--gold); stroke-linejoin: round; }
.login-logo h1 { color: var(--green); font-size: 2rem; line-height: 1.05; }
.login-logo p { margin: 0; color: var(--muted); }
.login-card .stack { text-align: left; margin-top: 1rem; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .75rem; margin-top: 1rem; }
.who { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .6rem .25rem; border-radius: 16px; color: var(--text); text-decoration: none; font-weight: 700; }
.who:hover { background: var(--surface-2); }

/* ---- Pictures ---- */
.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 14px; vertical-align: middle; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin-top: 1rem; }
.pick { padding: 0; border: 3px solid transparent; border-radius: 16px; overflow: hidden; background: var(--tile); cursor: pointer; aspect-ratio: 1; }
.pick:hover { border-color: var(--green); }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.avatar-grid button { background: none; border: 0; border-radius: 14px; padding: .5rem .2rem .35rem; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.avatar-grid button:hover:not([disabled]) { background: var(--surface-2); }
.avatar-grid button.current { background: var(--surface-2); }
.avatar-grid button.current .avatar { box-shadow: 0 0 0 3px var(--green); }
.avatar-grid button[disabled] { opacity: .4; cursor: not-allowed; }
.avatar-grid small { font-size: .75rem; font-weight: 700; color: var(--muted); min-height: 1.1em; }
.current-avatar { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.current-avatar .avatar { box-shadow: 0 0 0 3px var(--green); }
.file-btn, .stack label.file-btn { position: relative; overflow: hidden; display: inline-flex; justify-self: start; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#cropper { max-width: 320px; }
#crop-area p { margin: 0 0 .5rem; }
.avatar-results { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.avatar-results .pick.chosen { border-color: var(--cran); }

/* ---- Comments / messages ---- */
.gift-summary { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.chat { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .75rem; }
.chat li { display: flex; gap: .6rem; align-items: flex-end; }
.chat li.mine { flex-direction: row-reverse; }
.bubble { background: var(--surface-2); border-radius: 18px 18px 18px 4px; padding: .55rem .9rem; max-width: 80%; }
.chat li.mine .bubble { background: var(--bought-bg); color: var(--bought-fg); border-radius: 18px 18px 4px 18px; }
.bubble p { margin: .15rem 0 0; white-space: pre-line; }
.bubble small { opacity: .75; }
.convo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.convo-list a { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.convo-list .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-list .txt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Shopping list & tables ---- */
.shop-group { background: var(--surface); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.shop-group header { display: flex; align-items: center; gap: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.shop-group header h2 { flex: 1; font-size: 1.25rem; }
.shop-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; }
.shop-row + .shop-row { border-top: 1px solid var(--line); }
.shop-row .photo { width: 52px; height: 52px; flex: none; border-radius: 12px; }
.shop-row .photo .icon { width: 28px; height: 28px; }
.shop-row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.shop-row .txt a { font-weight: 700; color: var(--text); }
.shop-row .txt small { color: var(--muted); }
.shop-row.done .txt a { text-decoration: line-through; }
.shop-row .state { font-size: .85rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.admin { border-collapse: collapse; width: 100%; }
table.admin th, table.admin td { border-bottom: 1px solid var(--line); padding: .6rem .5rem; text-align: left; vertical-align: top; }
table.admin th { font-family: var(--font-head); font-weight: 600; color: var(--muted); }
.danger-zone { border: 2px solid var(--cran); }
.danger-zone ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
input.copy { font-size: .8rem; width: 280px; min-height: 36px; padding: .3rem .6rem; margin-bottom: .3rem; }

/* ---- Phase 2: prices, budget, order, toasts, confetti ---- */
.badge-slot { display: contents; }
.js .no-js-only { display: none !important; }
.small { font-size: .9rem; }
.price-line { margin: 0; display: flex; align-items: center; gap: .75rem; font-size: 1.25rem; }
.top-label, .tag-top { font-weight: 700; color: var(--cran); }
.top-label { font-size: 1rem; }
.money-input { position: relative; display: inline-block; width: 150px; }
.money-input > span { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; }
.money-input input { padding-left: 1.8rem; }
.budget .row { gap: .75rem; }
.budget .spacer { flex: 1; }
.budget-line { font-weight: 700; color: var(--green); }
.budget-line.over { color: var(--cran); }
.bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: .8rem; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar.over span { background: var(--cran); }
.budget p { margin: .6rem 0 0; }
.shop-row input[type=checkbox] { flex: none; cursor: pointer; }
.shop-row .amount { font-weight: 700; white-space: nowrap; }
.item-photo { width: 96px; height: 96px; border-radius: 16px; flex: none; }
.item-photo .icon { width: 48px; height: 48px; }
.item-photo img { object-fit: cover; }
.autofill .row .btn { flex: 1 0 auto; }
.autofill-status:empty { display: none; }
.autofill-status { margin: 0; font-weight: 700; color: var(--green); }

.reorder > p { margin: 0 0 .9rem; max-width: 680px; }
.reorder-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; max-width: 680px; }
.reorder-list li { display: flex; align-items: center; gap: .6rem; background: var(--surface); border-radius: 16px; padding: .5rem .5rem .5rem .6rem; box-shadow: var(--shadow); }
.reorder-list li.dragging { opacity: .5; outline: 2px dashed var(--green); outline-offset: 2px; }
.reorder-list .grip { cursor: grab; touch-action: none; color: var(--muted); padding: .5rem .25rem; display: flex; }
.reorder-list .grip .icon { stroke-width: 3.2; }
.reorder-list .pos { width: 1.6rem; text-align: center; font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; color: var(--green); flex: none; }
.reorder-list .photo { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.reorder-list .photo .icon { width: 26px; height: 26px; }
.reorder-list .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.reorder-list .txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reorder-list .txt small { color: var(--muted); }
.round {
  width: 44px; height: 44px; border-radius: 50%; flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--sec-fg); border: 1.5px solid var(--sec-line); font: inherit;
}
.round[disabled] { opacity: .35; cursor: default; }

.toasts {
  position: fixed; inset: auto auto 24px 50%; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100vw - 24px);
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible;
}
.toasts:not(:popover-open) { display: block; }   /* without popover support it's just a fixed box */
.toast {
  display: flex; align-items: center; gap: .5rem; background: var(--toast-bg); color: var(--toast-fg);
  border-radius: 16px; padding: .4rem .4rem .4rem 1.1rem; box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  animation: toast-in .2s ease-out;
}
.toast > span { padding: .4rem 0; }
.toast form { margin: 0; }
.toast form button, .toast-close {
  background: transparent; border: 0; color: var(--toast-action); font: inherit; font-weight: 700; cursor: pointer;
  min-height: 40px; padding: .3rem .8rem; border-radius: 12px;
}
.toast-close { color: inherit; opacity: .7; padding: .3rem .5rem; display: inline-flex; align-items: center; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 899px) { .toasts { inset: auto auto calc(84px + env(safe-area-inset-bottom)) 50%; } }

.confetti { position: fixed; inset: 0; width: auto; height: auto; margin: 0; padding: 0; border: 0; background: transparent; pointer-events: none; overflow: hidden; z-index: 70; }
.confetti:not(:popover-open) { display: block; }
.confetti i { position: absolute; top: -20px; display: block; border-radius: 2px; }

/* ---- Snow (off for anyone whose device asks for less motion) ---- */
.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 15; }
.snow i {
  position: absolute; top: -12px; display: block; border-radius: 50%; background: var(--snow);
  animation: snowfall linear infinite;
}
@keyframes snowfall { to { transform: translate(var(--drift, 0px), 105vh); } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } .gcard { transition: none; } dialog.sheet[open] { animation: none; } }

/* ---- Printing the shopping list ---- */
@media print {
  .topbar, .strip, .sidebar, .tabbar, .snow, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .content { padding: 0; }
  .card, .shop-group { box-shadow: none; border: 1px solid #ccc; }
}
