/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light dark;
  --bg: #f4f2ec;
  --page-top: #dfe9e6;
  --page-glow-1: rgba(23, 73, 92, .16);
  --page-glow-2: rgba(221, 113, 67, .07);
  --surface: #fffefb;
  --surface-2: #f0eee7;
  --ink: #16262e;
  --muted: #687b84;
  --line: #e4e1d8;
  --line-strong: #c9c5b9;
  --navy: #0e2a3a;
  --navy-2: #17495c;
  --accent: #dd7143;
  --accent-strong: #c45b2d;
  --accent-soft: #fbe9df;
  --accent-glow: rgba(197, 90, 44, .75);
  --green: #2f7d5c;
  --green-soft: #e3f2ea;
  --blue: #356b8c;
  --red: #bb4a37;
  --red-soft: #fbe7e3;
  --amber: #a76d18;
  --amber-soft: #f8edd8;
  --hero-a: #081d29;
  --hero-b: #0e2f3f;
  --hero-c: #164a59;
  --hero-glow-a: rgba(81, 156, 170, .55);
  --hero-glow-b: rgba(221, 113, 67, .18);
  --shadow: 0 18px 40px -18px rgba(14, 42, 58, .45);
  --shadow-soft: 0 2px 10px rgba(14, 42, 58, .06);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body[data-user="malu"] {
  --page-top: #f1dfe5;
  --page-glow-1: rgba(214, 95, 130, .15);
  --page-glow-2: rgba(90, 60, 120, .07);
  --accent: #d65f82;
  --accent-strong: #b83f63;
  --accent-soft: #fbe4eb;
  --accent-glow: rgba(184, 63, 99, .7);
  --hero-a: #240b17;
  --hero-b: #3d1327;
  --hero-c: #5b2039;
  --hero-glow-a: rgba(214, 106, 139, .42);
  --hero-glow-b: rgba(255, 198, 120, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1418;
    --page-top: #0f181c;
    --page-glow-1: rgba(56, 127, 145, .12);
    --page-glow-2: rgba(221, 113, 67, .07);
    --surface: #131e24;
    --surface-2: #1a2830;
    --ink: #e8eef0;
    --muted: #92a3ab;
    --line: #24343d;
    --line-strong: #3c4d57;
    --accent: #ec8557;
    --accent-strong: #f29a72;
    --accent-soft: #38221a;
    --accent-glow: rgba(236, 133, 87, .5);
    --green: #4fa77f;
    --green-soft: #172b23;
    --blue: #6aa3c4;
    --red: #e37b67;
    --red-soft: #331d19;
    --amber: #d4a04f;
    --amber-soft: #2e2617;
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
    --shadow-soft: 0 2px 10px rgba(0, 0, 0, .25);
  }

  body[data-user="malu"] {
    --page-top: #160f14;
    --page-glow-1: rgba(214, 95, 130, .13);
    --page-glow-2: rgba(100, 76, 130, .10);
    --accent: #e98aa6;
    --accent-strong: #f0a4ba;
    --accent-soft: #3a1824;
    --accent-glow: rgba(233, 138, 166, .45);
    --hero-a: #1c0812;
    --hero-b: #351023;
    --hero-c: #4d1b32;
    --hero-glow-a: rgba(214, 106, 139, .35);
    --hero-glow-b: rgba(255, 198, 120, .08);
  }
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 760px at 100% 0%, var(--page-glow-1), transparent 62%),
    radial-gradient(850px 620px at 0% 18%, var(--page-glow-2), transparent 58%),
    linear-gradient(180deg, var(--page-top) 0%, var(--bg) 1150px, var(--bg) 100%);
  background-repeat: no-repeat;
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease;
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
}
.boot-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #e88152, #c55a2c);
  animation: boot-pulse 1.4s ease-in-out infinite;
}
.boot-mark svg { width: 28px; height: 28px; }
@keyframes boot-pulse {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-3px); opacity: .78; }
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 1.25em; height: 1.25em; display: block; }
::selection { background: var(--accent-soft); color: var(--ink); }

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

.eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 650;
  background: transparent;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--line-strong); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { color: var(--red); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-with-icon svg { width: 16px; height: 16px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  flex: none;
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.icon-button svg { width: 19px; height: 19px; }
.icon-button-danger { color: var(--red); }
.icon-button-danger:hover { background: var(--red-soft); color: var(--red); }
.icon-button-light { color: rgba(255, 255, 255, .72); }
.icon-button-light:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.link-button {
  border: 0;
  background: none;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
}
.link-button:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- login */
.login {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: safe center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(1100px 520px at 82% -12%, rgba(72, 143, 159, .48), transparent 62%),
    linear-gradient(158deg, #081b27 0%, #0e2f3f 48%, #17505e 100%);
}
.login-art {
  position: absolute;
  inset: auto 0 0;
  height: 62%;
  pointer-events: none;
}
.login-art svg { width: 100%; height: 100%; }
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 408px;
  background: #fbfaf7;
  color: #16262e;
  border-radius: 24px;
  padding: 30px 28px 26px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7);
  border: 1px solid rgba(255, 255, 255, .5);
}
.login-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: #fff;
  background: linear-gradient(145deg, #e88152, #c55a2c);
  box-shadow: 0 10px 22px -10px rgba(197, 90, 44, .9);
}
.login-mark svg { width: 30px; height: 30px; }
.login-card .eyebrow { color: #7a8b93; }
.login-card h1 { font-size: 27px; letter-spacing: -.03em; line-height: 1.15; margin-top: 7px; }
.login-sub { color: #5f7078; font-size: 13.5px; line-height: 1.55; margin: 10px 0 24px; }
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #3a4d56;
}
.password-field { position: relative; }
.password-field input {
  width: 100%;
  padding: 13px 46px 13px 14px;
  border: 1px solid #dcd9cf;
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  color: #16262e;
}
.password-field input:focus { outline: 2px solid #dd7143; outline-offset: 1px; border-color: transparent; }
.password-field .icon-button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: #7a8b93; }
.password-field .icon-button:hover { background: #f0eee7; color: #16262e; }
.login-card .form-error { min-height: 20px; margin: 7px 0 4px; font-size: 12.5px; color: #b6402c; }
.login-card .btn-block { padding: 13px 16px; font-size: 15px; }
.login-foot { text-align: center; color: #8b9aa1; font-size: 11px; margin-top: 20px; letter-spacing: .02em; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: 20px 16px 18px;
  padding-top: calc(20px + env(safe-area-inset-top));
  color: #fff;
  background:
    radial-gradient(900px 380px at 88% -30%, var(--hero-glow-a), transparent 64%),
    radial-gradient(600px 260px at 0% 110%, var(--hero-glow-b), transparent 70%),
    linear-gradient(156deg, var(--hero-a) 0%, var(--hero-b) 52%, var(--hero-c) 100%);
  overflow: visible;
  transition: background .3s ease;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(transparent 96%, rgba(255, 255, 255, .035) 96%);
  background-size: 100% 7px;
  opacity: .35;
  pointer-events: none;
}
.hero::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 70px;
  background: linear-gradient(180deg, transparent, var(--page-top));
  opacity: .22;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--accent);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { min-width: 0; }
.hero .eyebrow { color: rgba(255, 255, 255, .58); font-size: 9.5px; }
.hero h1 {
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -.025em;
  font-weight: 680;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-actions { display: flex; gap: 2px; flex: none; }

.user-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 14px;
  padding: 4px 5px 4px 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.user-switch-label {
  margin-right: 3px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  white-space: nowrap;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, .66);
  font-size: 12.5px;
  font-weight: 650;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.user-pill:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.user-pill.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .17);
  border-color: rgba(255, 255, 255, .12);
}
.user-avatar {
  width: 23px;
  height: 23px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}
.user-pill.is-active .user-avatar {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .18);
}

/* ---------------------------------------------------------------- summary card */
.summary-card {
  background: var(--surface);
  color: var(--ink);
  border-radius: 20px;
  margin: 16px 0 0;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .35);
  border-top: 3px solid var(--accent);
  display: grid;
  overflow: hidden;
}
.summary-main { padding: 15px 18px 15px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-label {
  display: block;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.summary-cost {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.summary-numbers { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.summary-numbers strong {
  font-size: 36px;
  font-weight: 720;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--accent);
}
.summary-numbers span { font-size: 13px; color: var(--muted); font-weight: 550; }
progress {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 9px;
}
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff));
  border-radius: 999px;
  transition: width .35s ease;
}
progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff));
  border-radius: 999px;
}
.summary-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 12px 10px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(var(--surface), color-mix(in srgb, var(--surface-2) 55%, var(--surface)));
}
.stat { text-align: center; padding: 2px 4px; min-width: 0; }
.stat strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.stat span { display: block; font-size: 9.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 1px; }

/* ---------------------------------------------------------------- content */
.content {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 16px calc(104px + env(safe-area-inset-bottom));
}
.toolbar {
  position: static;
  padding: 0;
  margin: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.search-field { position: relative; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.toolbar-row .search-field { flex: 1 1 240px; min-width: 0; }
.store-filter {
  flex: 1 1 160px;
  min-width: 150px;
  max-width: 230px;
  min-height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687b84' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  color: var(--muted);
  font-size: 16px;
  box-shadow: var(--shadow-soft);
  appearance: none;
  -webkit-appearance: none;
}
.store-filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search-field svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px;
  box-shadow: var(--shadow-soft);
  -webkit-appearance: none;
}
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 1px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-count {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  font-variant-numeric: tabular-nums;
}
.chip.is-active .chip-count { background: rgba(255, 255, 255, .22); color: #fff; }

.results-note {
  min-height: 18px;
  margin: 12px 2px 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.results-note strong { color: var(--ink); font-weight: 650; }

/* ---------------------------------------------------------------- categories */
.categories { display: grid; gap: 11px; }
.category {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 9px 0 0;
}
.cat-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 6px 14px 15px;
  background: none;
  border: 0;
  text-align: left;
}
.cat-toggle:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.cat-add {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.cat-add:hover { background: var(--surface-2); color: var(--accent); }
.cat-add svg { width: 17px; height: 17px; }
.cat-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cat-meta .cat-total { font-weight: 650; color: var(--ink); }
.cat-chevron { flex: none; color: var(--muted); transition: transform .2s ease; }
.cat-chevron svg { width: 17px; height: 17px; }
.category.is-open .cat-chevron { transform: rotate(180deg); }
.cat-items { display: none; border-top: 1px solid var(--line); }
.category.is-open .cat-items { display: block; }
.is-filtering .cat-chevron { visibility: hidden; }

.item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 11px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  transition: background-color .13s ease;
}
.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.item-row[data-status="bought"] { border-left-color: var(--green); }
.item-row[data-status="owned"] { border-left-color: var(--blue); }
.item-row[data-status="skipped"] { border-left-color: var(--line-strong); }

.item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 1px 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}
.item-name {
  display: block;
  font-size: 14px;
  font-weight: 580;
  line-height: 1.3;
  letter-spacing: -.005em;
  overflow-wrap: break-word;
}
.item-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.note-flag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.5;
}

.item-price {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: var(--ink);
}

.item-expected {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  line-height: 1.15;
  white-space: nowrap;
}
.expected-label {
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.expected-value {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.item-expected.is-empty .expected-value { color: var(--muted); }
.item-side { display: flex; align-items: center; gap: 8px; flex: none; }

.cost-editor {
  flex-basis: 100%;
  margin: 1px 0 1px;
  padding: 9px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
}
.cost-editor-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
}
.cost-label {
  flex: none;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.cost-money { min-width: 0; max-width: none; }
.cost-money input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px 6px 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
}
.cost-input:focus,
.cost-input:focus-visible {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: none;
}
.cost-money > span { font-size: 12px; }
.btn-cost { padding: 8px 11px; font-size: 12.5px; border-radius: 9px; }
.cost-editor .icon-button { width: 30px; height: 30px; }
.cost-editor-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--muted);
}
.cost-editor-foot .link-button { font-size: 11px; }

.quick-actions { display: flex; gap: 3px; flex: none; }
.quick {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.quick svg { width: 15px; height: 15px; }
.quick:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.quick[data-status="bought"].is-active { background: var(--green); border-color: var(--green); color: #fff; }
.quick[data-status="owned"].is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.quick[data-status="skipped"].is-active { background: var(--line-strong); border-color: var(--line-strong); color: var(--surface); }

.item-priority {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.item-priority svg { width: 15px; height: 15px; }
.item-priority:hover { border-color: var(--accent); color: var(--accent); }
.item-priority.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
}

.item-row[data-status="bought"] .item-name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.item-row[data-status="owned"] .item-name { color: var(--muted); }
.item-row[data-status="skipped"] { opacity: .62; }
.item-row[data-status="skipped"] .item-name { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.cat-empty {
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
}
.empty-icon svg { width: 28px; height: 28px; color: var(--muted); }
.empty-state h2 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

.app-footer {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------------- inline add actions */
.list-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.inline-add {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease;
}
.inline-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}
.inline-add svg { width: 15px; height: 15px; flex: none; }

/* ---------------------------------------------------------------- sheets */
dialog.sheet {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(560px, 100%);
  max-width: none;
  max-height: none;
  margin: auto;
  color: var(--ink);
}
dialog.sheet::backdrop {
  background: rgba(5, 17, 24, .58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
dialog.sheet[open] { animation: sheet-in .22s cubic-bezier(.2, .9, .3, 1); }
.sheet-compact { width: min(420px, 100%); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.sheet > form, .sheet-shell {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 760px);
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .55);
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheet-heading { min-width: 0; }
.sheet-head h2 {
  font-size: 19px;
  letter-spacing: -.02em;
  line-height: 1.25;
  margin-top: 2px;
  overflow-wrap: break-word;
}
.sheet-head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sheet-body { padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}
.save-state { font-size: 10.5px; color: var(--muted); min-width: 44px; text-align: right; }
.save-state.is-error { color: var(--red); }

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  margin-bottom: 18px;
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 620;
  color: var(--muted);
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); }
.segmented button[data-status="bought"].is-active { background: var(--green); color: #fff; }
.segmented button[data-status="owned"].is-active { background: var(--blue); color: #fff; }
.segmented button[data-status="skipped"].is-active { background: var(--line-strong); color: var(--surface); }

.field { display: block; margin-bottom: 13px; }
.field > label, .field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 680;
  color: var(--muted);
  margin-bottom: 5px;
}
.field-note {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  opacity: .85;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
  min-height: 42px;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { resize: vertical; line-height: 1.5; min-height: 64px; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687b84' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid .field { margin-bottom: 13px; }
.field-help { font-size: 11px; color: var(--muted); margin: -4px 0 12px; line-height: 1.5; }

.stepper { display: flex; align-items: stretch; }
.stepper button {
  width: 40px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.stepper button:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.stepper button:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.stepper button:hover { background: var(--line); }
.stepper input {
  flex: 1;
  min-width: 0;
  text-align: center;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.money-field { position: relative; }
.money-field > span {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}
.money-field input { padding-left: 30px; }
.money-field input::-webkit-outer-spin-button, .money-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.item-hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-left: 3px solid var(--line-strong);
  padding: 9px 11px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 14px;
}
.inline-success { min-height: 18px; margin: 2px 0 8px; font-size: 12px; color: var(--green); }
.muted-note { font-size: 12px; line-height: 1.5; color: var(--muted); }

.category-manager { display: grid; margin-bottom: 10px; }
.category-manage-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.category-manage-row:last-child { border-bottom: 0; }
.category-manage-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 560;
  overflow-wrap: break-word;
}
.category-manage-count {
  flex: none;
  min-width: 20px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.category-manage-row .icon-button { width: 30px; height: 30px; border-radius: 8px; }
.category-manage-row .icon-button svg { width: 15px; height: 15px; }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
  min-height: 40px;
}
.inline-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.inline-form .btn { width: auto; flex: none; padding-left: 14px; padding-right: 14px; }
.settings-section .inline-form .btn { width: auto; }

.settings-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 2px; }
.settings-section h3 {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 11px;
}
.settings-section form { margin: 0; }
.settings-section .btn { width: 100%; }
.settings-danger { padding-top: 2px; }

/* ---------------------------------------------------------------- offline */
.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--amber) 28%, var(--line));
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}
.offline-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

/* ---------------------------------------------------------------- converter */
.converter-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.converter-fab:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.converter-fab svg { width: 16px; height: 16px; flex: none; color: var(--accent); }

.converter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 15px; }
.converter-chips button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 620;
}
.converter-chips button:hover { border-color: var(--accent); color: var(--accent); }
.converter-sheet .money-field input { padding-left: 12px; padding-right: 42px; }
.converter-reset {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.converter-reset:hover { background: var(--surface-2); color: var(--ink); }
.converter-reset svg { width: 16px; height: 16px; }
.converter-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 12px;
}
.converter-result {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.converter-result strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.converter-rates {
  margin-bottom: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.converter-note { font-size: 11px; line-height: 1.5; color: var(--muted); }
.converter-sheet .sheet-foot { justify-content: flex-end; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  z-index: 60;
  max-width: min(90vw, 420px);
  padding: 10px 15px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red); color: #fff; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 640px) {
  .hero { padding: 26px 24px 24px; padding-top: calc(26px + env(safe-area-inset-top)); }
  .hero h1 { font-size: 24px; }
  .brand-mark { width: 46px; height: 46px; }
  .summary-card { grid-template-columns: 1.25fr .85fr; margin: 18px 0 0; }
  .summary-main { padding: 18px 22px 16px; }
  .summary-stats {
    grid-template-columns: 1fr 1fr;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 14px 8px;
    align-content: center;
  }
  .stat strong { font-size: 19px; }
  .content { padding: 34px 24px 104px; }
  .search-field { max-width: 420px; }
  .item-row { padding: 12px 14px 12px 12px; }
  .cat-toggle { padding: 15px 6px 15px 17px; }
  .converter-fab { right: 24px; bottom: 24px; }
  dialog.sheet { margin: auto; }
}

@media (max-width: 639px) {
  .item-side { flex-basis: 100%; justify-content: flex-end; }
  .item-main { flex-basis: calc(100% - 38px); }
  .converter-fab { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%; }
  .converter-fab span { display: none; }
  .store-filter { flex-basis: 100%; max-width: none; }
  dialog.sheet {
    width: 100%;
    margin: auto 0 0;
  }
  dialog.sheet > form, .sheet-shell {
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
  }
}

@media (max-width: 420px) {
  .summary-numbers strong { font-size: 31px; }
  .field-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .item-price { font-size: 11px; }
  .quick { width: 30px; height: 30px; }
  .quick svg { width: 14px; height: 14px; }
}

@media (max-width: 380px) {
  .user-switch-label { display: none; }
  .user-switch { padding-left: 4px; }
  .hero h1 { font-size: 17px; }
  .hero .eyebrow { font-size: 8.5px; letter-spacing: .1em; }
  .brand { gap: 9px; }
  .brand-mark { width: 38px; height: 38px; }
}

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