/* ==========================================================================
   Product Search — design system
   Fonts: Bricolage Grotesque (display) + Plus Jakarta Sans (text), self-hosted.
   Theme: warm sun gradient on a calm warm-neutral / deep-navy base.
   ========================================================================== */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-text: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-text);

  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f5f2ec;
  --surface-3: #efeae2;
  --text: #15171c;
  --text-2: #3b3f49;
  --muted: #6c707b;
  --line: #ebe5dc;
  --line-strong: #ddd5c9;

  /* Colour theme ("accent") — Sunset by default. A [data-accent] block below swaps only these
     seven; everything brand-coloured is derived from them, in light and dark mode alike. */
  --sun-1: #fbbf24;
  --sun-2: #f97316;
  --sun-3: #ea580c;
  --accent: #f2780f;
  --accent-ink: #9a3412;
  --accent-dark: #fb923c;
  --accent-ink-dark: #fdba74;

  --brand: var(--accent);
  --brand-ink: var(--accent-ink);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --grad: linear-gradient(135deg, var(--sun-1) 0%, var(--sun-2) 55%, var(--sun-3) 100%);

  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --bad: #dc2626;
  --bad-soft: #fdeceb;

  --glow-a: color-mix(in srgb, var(--sun-1) 35%, transparent);
  --glow-b: rgba(56, 189, 248, 0.18);

  --shadow-sm: 0 1px 2px rgba(23, 20, 15, 0.05), 0 2px 8px rgba(23, 20, 15, 0.04);
  --shadow-md: 0 4px 14px rgba(23, 20, 15, 0.07), 0 1px 3px rgba(23, 20, 15, 0.05);
  --shadow-lg: 0 24px 60px -12px rgba(23, 20, 15, 0.25);
  --shadow-brand: 0 10px 24px -8px color-mix(in srgb, var(--brand) 55%, transparent);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  --header-h: 64px;
  --tabbar-h: 0px;

  color-scheme: light;
}

/* Colour themes. Only the accent changes; :root[...] outranks the plain :root defaults. */
:root[data-accent="ocean"]    { --sun-1: #7dd3fc; --sun-2: #3b82f6; --sun-3: #1d4ed8; --accent: #2563eb; --accent-ink: #1e40af; --accent-dark: #60a5fa; --accent-ink-dark: #93c5fd; }
:root[data-accent="emerald"]  { --sun-1: #6ee7b7; --sun-2: #10b981; --sun-3: #047857; --accent: #059669; --accent-ink: #065f46; --accent-dark: #34d399; --accent-ink-dark: #6ee7b7; }
:root[data-accent="violet"]   { --sun-1: #c4b5fd; --sun-2: #8b5cf6; --sun-3: #6d28d9; --accent: #7c3aed; --accent-ink: #5b21b6; --accent-dark: #a78bfa; --accent-ink-dark: #c4b5fd; }
:root[data-accent="rose"]     { --sun-1: #fda4af; --sun-2: #f43f5e; --sun-3: #be123c; --accent: #e11d48; --accent-ink: #9f1239; --accent-dark: #fb7185; --accent-ink-dark: #fda4af; }
:root[data-accent="graphite"] { --sun-1: #94a3b8; --sun-2: #475569; --sun-3: #1e293b; --accent: #334155; --accent-ink: #1e293b; --accent-dark: #cbd5e1; --accent-ink-dark: #e2e8f0; }

/* Dark mode — declared after the colour themes so its --brand (the dark-mode accent) wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e16;
    --surface: #111827;
    --surface-2: #172033;
    --surface-3: #1d2840;
    --text: #edf0f6;
    --text-2: #c9cfdc;
    --muted: #94a0b6;
    --line: #222c41;
    --line-strong: #2d3a55;
    --brand: var(--accent-dark);
    --brand-ink: var(--accent-ink-dark);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.12);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.12);
    --glow-a: color-mix(in srgb, var(--sun-2) 18%, transparent);
    --glow-b: rgba(56, 189, 248, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 70px -10px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e16;
  --surface: #111827;
  --surface-2: #172033;
  --surface-3: #1d2840;
  --text: #edf0f6;
  --text-2: #c9cfdc;
  --muted: #94a0b6;
  --line: #222c41;
  --line-strong: #2d3a55;
  --brand: var(--accent-dark);
  --brand-ink: var(--accent-ink-dark);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);
  --glow-a: color-mix(in srgb, var(--sun-2) 18%, transparent);
  --glow-b: rgba(56, 189, 248, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 70px -10px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* Smooth page-to-page fade (Chrome/Edge; others just navigate). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 160ms var(--ease) both vt-out; }
::view-transition-new(root) { animation: 260ms var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-text);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--sun-1) 45%, transparent); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Soft animated sun-glow behind everything */
.bg-glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-glow::before, .bg-glow::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
  animation: drift 22s ease-in-out infinite alternate;
}
.bg-glow::before { width: 520px; height: 520px; top: -180px; right: -140px; background: var(--glow-a); }
.bg-glow::after { width: 460px; height: 460px; bottom: -200px; left: -160px; background: var(--glow-b); animation-delay: -9s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.08); }
  100% { transform: translate(30px, -20px) scale(0.96); }
}

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }

/* -------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(170%) blur(16px);
  -webkit-backdrop-filter: saturate(170%) blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.topbar .wrap { height: var(--header-h); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.logo-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; box-shadow: var(--shadow-brand); transition: transform 0.5s var(--spring); }
.brand:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.brand small { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { display: block; font-family: var(--font-text); font-size: 0.7rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: -2px; }

.nav { display: none; gap: 4px; margin-left: 18px; }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; font-weight: 600; font-size: 0.92rem; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.nav a[aria-current="page"] .ic { color: var(--brand); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
@media (min-width: 761px) { .nav { display: flex; } }

/* -------------------------------------------------------------- buttons */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; font-size: 0.94rem; white-space: nowrap; user-select: none;
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-brand); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-soft { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-soft:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-sm { --h: 36px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background 0.2s, color 0.2s, transform 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.install-btn[hidden] { display: none; }

/* -------------------------------------------------------------- hero + search */
.hero { padding-block: 34px 18px; text-align: center; transition: padding 0.45s var(--ease); }
@media (min-width: 720px) { .hero { padding-block: 56px 24px; } }
.hero-intro { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.45s var(--ease), opacity 0.3s var(--ease); }
.hero-intro > div { overflow: hidden; padding: 6px 4px; margin: -6px -4px; }
.is-searching .hero { padding-top: 14px; }
.is-searching .hero-intro { grid-template-rows: 0fr; opacity: 0; }
.is-searching .searchbox { margin-top: 4px; }
h1, h2 { text-wrap: balance; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 0.8rem; font-weight: 650; color: var(--text-2);
  animation: rise 0.6s var(--ease) both;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--sun-2); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--sun-2); animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.8); opacity: 0; } }
.hero h1 {
  margin: 16px auto 10px; max-width: 760px;
  font-size: clamp(2rem, 4.2vw + 1rem, 3.5rem); font-weight: 750;
  animation: rise 0.7s 0.06s var(--ease) both;
}
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--muted); font-size: clamp(0.98rem, 0.5vw + 0.9rem, 1.12rem); max-width: 560px; margin: 0 auto; animation: rise 0.7s 0.12s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.searchbox {
  position: relative; max-width: 720px; margin: 26px auto 0;
  animation: rise 0.7s 0.18s var(--ease) both;
}
.searchbox .ic-search { position: absolute; left: 20px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; color: var(--muted); pointer-events: none; transition: color 0.2s; }
.searchbox input {
  width: 100%; height: 62px; padding: 0 104px 0 54px; border-radius: 20px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 1.05rem; font-weight: 500; box-shadow: var(--shadow-md);
  transition: border-color 0.2s, box-shadow 0.3s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.searchbox input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.searchbox input:focus { outline: none; border-color: color-mix(in srgb, var(--brand) 70%, transparent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 16%, transparent), var(--shadow-md); }
.searchbox:focus-within .ic-search { color: var(--brand); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox .sb-end { position: absolute; right: 10px; top: 50%; translate: 0 -50%; display: flex; align-items: center; gap: 6px; }
.kbd { font: 600 0.75rem var(--font-text); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); }
.clear-btn { opacity: 0; scale: 0.6; pointer-events: none; transition: opacity 0.2s, scale 0.25s var(--spring); }
.searchbox.has-value .clear-btn { opacity: 1; scale: 1; pointer-events: auto; }
.searchbox.has-value .kbd { display: none; }
@media (max-width: 760px) { .kbd { display: none; } }

/* chips */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 18px -16px 0; padding-inline: 16px;
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  animation: rise 0.7s 0.24s var(--ease) both;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .chips { justify-content: center; flex-wrap: wrap; margin-inline: 0; padding-inline: 2px; } }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 0.88rem;
  transition: background 0.25s, color 0.2s, border-color 0.2s, transform 0.18s var(--ease), box-shadow 0.25s;
}
.chip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chip .count { font-size: 0.74rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; box-shadow: var(--shadow-md); }
.chip[aria-pressed="true"] .count { background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; }

/* toolbar above results */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 14px; }
.toolbar .result-count { font-weight: 650; color: var(--text-2); }
.toolbar .result-count b { font-family: var(--font-display); font-size: 1.15rem; color: var(--text); }
.toolbar .spacer { flex: 1; }
.select-wrap { position: relative; }
.select-wrap .ic { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.select-wrap select { height: 38px; padding: 0 30px 0 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 0.86rem; -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: 0.88rem; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; transition: background 0.25s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.3s var(--spring); }
.switch input:checked + .track { background: var(--grad); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* -------------------------------------------------------------- product cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; padding-bottom: 40px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; gap: 12px; } }

.pcard {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); cursor: pointer; text-align: left; width: 100%;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
  animation: card-in 0.5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 32ms);
}
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.pcard::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pcard:hover::before, .pcard:focus-visible::before { opacity: 1; }
.pcard:active { transform: scale(0.985); }
.pcard:focus-visible { outline: none; }

.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill {
  --h: 30; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.01em;
  color: hsl(var(--h) 70% 34%); background: hsl(var(--h) 85% 50% / 0.11);
  max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:root[data-theme="dark"] .pill { color: hsl(var(--h) 85% 72%); background: hsl(var(--h) 80% 60% / 0.14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill { color: hsl(var(--h) 85% 72%); background: hsl(var(--h) 80% 60% / 0.14); } }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.stock { font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.stock.ok { color: var(--ok); background: var(--ok-soft); }
.stock.low { color: var(--warn); background: var(--warn-soft); }
.stock.out { color: var(--bad); background: var(--bad-soft); }

.pcard h3 { font-family: var(--font-text); font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .sub { color: var(--muted); font-size: 0.85rem; margin-top: -6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
mark { background: color-mix(in srgb, var(--sun-1) 38%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; margin: 0 -2px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 3px 8px; }
.tag .ic { width: 13px; height: 13px; color: var(--muted); }

.price-row { display: flex; align-items: baseline; gap: 6px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.price { font-family: var(--font-display); font-weight: 750; font-size: 1.7rem; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.price small { font-size: 0.55em; font-weight: 700; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
.price-row .unit { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.per-watt { font-size: 0.8rem; color: var(--brand-ink); font-weight: 650; }

/* cost reveal — smooth height with the 0fr → 1fr grid trick */
.cost { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease), opacity 0.3s, margin 0.4s var(--ease); opacity: 0; margin-top: -10px; }
.cost > div { overflow: hidden; }
[data-cost="on"] .cost { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.cost-box { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 0.82rem; }
.cost-box span { color: var(--muted); font-weight: 600; }
.cost-box b { text-align: right; font-variant-numeric: tabular-nums; }
.profit-pos { color: var(--ok); }
.profit-neg { color: var(--bad); }

/* -------------------------------------------------------------- empty state */
.empty { text-align: center; padding: 50px 16px 70px; animation: rise 0.5s var(--ease) both; }
.empty .art { width: 132px; height: 132px; margin: 0 auto 18px; border-radius: 36px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); position: relative; }
.empty .art::after { content: ""; position: absolute; inset: -14px; border-radius: 44px; border: 1.5px dashed var(--line-strong); animation: spin 30s linear infinite; }
.empty .art .ic { width: 52px; height: 52px; color: var(--brand); stroke-width: 1.6; }
.empty h2 { font-size: 1.45rem; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- detail sheet (dialog) */
dialog.sheet {
  border: 0; padding: 0; width: min(560px, calc(100% - 24px)); max-height: min(88dvh, 760px);
  border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.sheet[open] { animation: sheet-in 0.42s var(--spring) both; }
dialog.sheet.closing { animation: sheet-out 0.22s var(--ease) both; }
dialog.sheet::backdrop { background: rgba(10, 14, 22, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in 0.3s var(--ease) both; }
dialog.sheet.closing::backdrop { animation: fade-out 0.22s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (max-width: 640px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 26px 26px 0 0; max-height: 90dvh; }
  dialog.sheet[open] { animation: sheet-up 0.45s var(--ease) both; }
  dialog.sheet.closing { animation: sheet-down 0.25s var(--ease) both; }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheet-down { to { transform: translateY(100%); } }
}
.sheet-body { overflow-y: auto; max-height: inherit; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-body:focus { outline: none; }
.sheet-grab { width: 42px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 10px auto 4px; }
@media (min-width: 641px) { .sheet-grab { display: none; } .sheet-body { padding-top: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet h2 { font-size: 1.4rem; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 0.9rem; }
.price-hero {
  margin: 16px 0; padding: 18px; border-radius: 20px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sun-1) 18%, var(--surface)), color-mix(in srgb, var(--sun-2) 12%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
}
.price-hero::after { content: ""; position: absolute; width: 180px; height: 180px; right: -60px; top: -80px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--sun-1) 45%, transparent), transparent 70%); }
.price-hero .label { font-size: 0.78rem; font-weight: 700; color: var(--brand-ink); text-transform: uppercase; letter-spacing: 0.06em; }
.price-hero .price { font-size: 2.4rem; margin: 6px 0 2px; }
.price-hero .meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
.dl dt, .dl dd { margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.dl dt { color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; background: var(--surface-2); }
.dl dd { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.dl dt:nth-last-of-type(1), .dl dd:last-of-type { border-bottom: 0; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* -------------------------------------------------------------- toast */
.toasts { position: fixed; left: 50%; translate: -50% 0; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow-lg);
  animation: toast-in 0.45s var(--spring) both; pointer-events: auto;
}
.toast .ic { color: var(--sun-1); }
.toast.out { animation: toast-out 0.3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* offline ribbon */
.offline-bar { display: none; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; font-size: 0.84rem; font-weight: 650; color: var(--warn); background: var(--warn-soft); border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
html.is-offline .offline-bar { display: flex; animation: rise 0.4s var(--ease) both; }

/* -------------------------------------------------------------- mobile tab bar */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: 70px; }
  .tabbar {
    display: grid; grid-template-columns: 1fr 76px 1fr; align-items: center;
    position: fixed; z-index: 50; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    height: 62px; border-radius: 22px; padding: 0 8px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(170%) blur(18px); -webkit-backdrop-filter: saturate(170%) blur(18px);
    border: 1px solid color-mix(in srgb, var(--line) 85%, transparent); box-shadow: var(--shadow-lg);
  }
  .tabbar a.tab { display: grid; justify-items: center; gap: 2px; font-size: 0.7rem; font-weight: 700; color: var(--muted); padding: 6px 0; border-radius: 14px; transition: color 0.2s; }
  .tabbar a.tab .ic { width: 22px; height: 22px; transition: transform 0.3s var(--spring); }
  .tabbar a.tab[aria-current="page"] { color: var(--brand); }
  .tabbar a.tab[aria-current="page"] .ic { transform: translateY(-1px) scale(1.08); }
  .tabbar a.fab {
    justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 20px; display: grid; place-items: center;
    background: var(--grad); color: #fff; box-shadow: var(--shadow-brand), 0 0 0 5px var(--bg);
    transition: transform 0.25s var(--spring);
  }
  .tabbar a.fab:active { transform: scale(0.92) rotate(90deg); }
  .tabbar a.fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
  .hide-sm { display: none !important; }
}
@media (min-width: 761px) { .only-sm { display: none !important; } }

/* -------------------------------------------------------------- page header (inner pages) */
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 28px 0 18px; animation: rise 0.5s var(--ease) both; }
.page-head h1 { font-size: clamp(1.7rem, 2.4vw + 1rem, 2.4rem); font-weight: 750; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 0.88rem; margin-bottom: 8px; transition: color 0.2s, gap 0.2s; }
.back-link:hover { color: var(--text); gap: 3px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; gap: 10px; } }
.stat {
  padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: grid; gap: 10px; animation: card-in 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.stat .bubble { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); }
.stat .label { font-size: 0.8rem; font-weight: 650; color: var(--muted); }
.stat .value { font-family: var(--font-display); font-size: clamp(1.1rem, 4.6vw, 1.55rem); font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* filter bar */
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 10px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); margin-bottom: 14px; position: sticky; top: calc(var(--header-h) + 8px); z-index: 20; }
.filterbar .search-mini { position: relative; flex: 1 1 240px; }
.filterbar .search-mini .ic { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.filterbar .search-mini input { width: 100%; height: 42px; padding: 0 12px 0 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.filterbar .search-mini input:focus { outline: none; border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.filterbar select { flex: 1 1 140px; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; font-weight: 600; font-size: 0.88rem; }
@media (min-width: 720px) { .filterbar select { flex: 0 0 auto; min-width: 170px; } }
/* Pages without the bottom tab bar (the product form): sticky Save bar sits at the very bottom. */
body.no-tabbar { --tabbar-h: 0px; }

/* products table → cards on phones */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 40px; }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.92rem; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tbody tr { transition: background 0.2s; animation: card-in 0.4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 16) * 22ms); }
.ptable tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.ptable tr.is-hidden-item td:not(.td-actions) { opacity: 0.55; }
.ptable .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable .name { font-weight: 700; min-width: 220px; }
.ptable time { white-space: nowrap; }
.ptable .pill { max-width: 190px; }
.ptable .name small { display: block; font-weight: 500; color: var(--muted); font-size: 0.8rem; }
.td-actions { white-space: nowrap; text-align: right; }
.td-actions form { display: inline; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge.pos { color: var(--ok); background: var(--ok-soft); }
.badge.neg { color: var(--bad); background: var(--bad-soft); }
.badge.mute { color: var(--muted); background: var(--surface-2); }
@media (max-width: 760px) {
  .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .ptable thead { display: none; }
  .ptable, .ptable tbody { display: block; }
  .ptable tbody { display: grid; gap: 10px; }
  .ptable tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  }
  .ptable td { border: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
  .ptable td::before { content: attr(data-label); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
  .ptable td.td-name, .ptable td.td-actions { grid-column: 1 / -1; }
  .ptable td.td-name::before, .ptable td.td-actions::before { display: none; }
  .ptable .r { text-align: left; }
  .td-actions { display: flex !important; flex-direction: row !important; justify-content: flex-end; gap: 4px; border-top: 1px solid var(--line) !important; padding-top: 8px !important; margin-top: 2px; }
}
.no-rows { display: none; padding: 40px 16px; text-align: center; color: var(--muted); font-weight: 600; }
.no-rows.show { display: block; }

/* -------------------------------------------------------------- forms */
.form-layout { display: grid; gap: 18px; padding-bottom: 110px; }
@media (min-width: 980px) { .form-layout { grid-template-columns: 1fr 360px; align-items: start; padding-bottom: 40px; } }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 18px; animation: card-in 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@media (min-width: 720px) { .section { padding: 22px; } }
.section + .section { margin-top: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-title .bubble { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.section-title h2 { font-size: 1.08rem; font-family: var(--font-text); font-weight: 750; letter-spacing: -0.01em; }
.section-title p { font-size: 0.82rem; color: var(--muted); }
.fields { display: grid; gap: 14px; }
.fields.two { grid-template-columns: 1fr; }
@media (min-width: 620px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-size: 0.84rem; font-weight: 700; color: var(--text-2); }
.field label .req { color: var(--brand); }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.input, .field input:not([type="checkbox"]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 0.98rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.25s var(--ease);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; background: var(--surface); border-color: color-mix(in srgb, var(--brand) 65%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; left: 14px; top: 50%; translate: 0 -50%; font-weight: 700; color: var(--muted); font-size: 0.9rem; pointer-events: none; }
.input-affix input { padding-left: 42px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.field-error, .validation-summary-errors { color: var(--bad); font-size: 0.8rem; font-weight: 600; }
.validation-summary-errors ul { margin: 0 0 12px; padding: 12px 14px 12px 30px; background: var(--bad-soft); border-radius: 12px; }
.validation-summary-valid { display: none; }
.input-validation-error { border-color: var(--bad) !important; }

.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.quick button { height: 30px; padding: 0 10px; border-radius: 9px; border: 1px dashed var(--line-strong); background: transparent; font-size: 0.78rem; font-weight: 700; color: var(--text-2); transition: all 0.2s var(--ease); }
.quick button:hover { border-style: solid; border-color: var(--brand); color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }

.preview { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 14px; animation: card-in 0.6s 0.15s var(--ease) both; }
.preview .pcard { cursor: default; animation: none; }
.preview .pcard:hover { transform: none; }
.preview-label { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.preview-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.profit-card { padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); display: grid; gap: 10px; }
.profit-card .big { font-family: var(--font-display); font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; transition: color 0.3s; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 0.6s var(--ease), background 0.3s; }
.meter.neg i { background: var(--bad); }
.warn-note { display: none; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 650; color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 10px; }
.warn-note.show { display: flex; animation: rise 0.3s var(--ease) both; }

.actionbar {
  position: sticky; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; gap: 10px; padding: 10px; margin-top: 16px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: var(--shadow-md);
}
.actionbar .btn-primary { flex: 1; }
@media (min-width: 761px) { .actionbar { position: static; background: transparent; border: 0; box-shadow: none; padding: 0; backdrop-filter: none; } .actionbar .btn-primary { flex: 0 0 auto; } }
.is-busy .actionbar { pointer-events: none; opacity: 0.7; }
.is-busy .actionbar .btn-primary .ic { animation: spin 0.9s linear infinite; }

/* profit line inside the Pricing card (phones/tablets — the big preview sits beside the form on desktop) */
.profit-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 0.88rem; font-weight: 650; color: var(--muted); }
.profit-inline b { font-family: var(--font-display); font-size: 1.1rem; color: var(--text); font-variant-numeric: tabular-nums; transition: color 0.3s; }
@media (min-width: 980px) { .lt-lg { display: none !important; } }
@media (max-width: 979px) { .gte-lg { display: none !important; } }

.field-error:empty { display: none; }
input.flash { animation: flash 0.9s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--sun-2) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

.chip.zero { opacity: 0.45; }
.top-actions form { display: inline-flex; }

/* sign-in */
.login-wrap { min-height: calc(100dvh - var(--header-h) - 40px); display: grid; place-items: center; padding-block: 24px; }
.login-card {
  width: min(420px, 100%); display: grid; gap: 16px; padding: 28px 22px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  animation: sheet-in 0.5s var(--spring) both;
}
.login-card .field { text-align: left; }
.login-card h1 { font-size: 1.7rem; }
.login-card .switch { justify-content: center; }
.login-logo { display: block; width: 72px; height: 72px; margin: 0 auto 4px; border-radius: 22px; box-shadow: var(--shadow-brand); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px !important; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 50%; translate: 0 -50%; }
.ptable tr[hidden] { display: none !important; }

/* confirm dialog */
dialog.confirm { border: 0; padding: 22px; width: min(400px, calc(100% - 32px)); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.confirm[open] { animation: sheet-in 0.35s var(--spring) both; }
dialog.confirm::backdrop { background: rgba(10, 14, 22, 0.45); backdrop-filter: blur(4px); animation: fade-in 0.25s both; }
dialog.confirm .bubble { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); margin-bottom: 14px; }
dialog.confirm h2 { font-size: 1.2rem; margin-bottom: 6px; }
dialog.confirm p { color: var(--muted); margin-bottom: 18px; }
dialog.confirm .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* install hint (iOS) */
.ios-hint p { margin-bottom: 10px; color: var(--text-2); }
.ios-hint ol { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; font-weight: 600; }

/* footer */
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 10px 0 30px; }

.mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 0.92em; letter-spacing: 0; }
.hint { font-size: 0.8rem; color: var(--muted); }
.login-alt { font-size: 0.86rem; font-weight: 650; color: var(--muted); justify-self: center; transition: color 0.2s; }
.login-alt:hover { color: var(--brand); }
.code-block { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; font: 600 0.82rem ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-narrow { max-width: 720px; padding-bottom: 110px; }
@media (min-width: 761px) { .form-narrow { padding-bottom: 40px; } }

/* -------------------------------------------------------------- segmented control (view switch, mode) */
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 34px; padding: 0 9px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 650; font-size: 0.85rem;
  transition: background 0.2s, color 0.2s, box-shadow 0.25s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button[aria-pressed="true"] .ic { color: var(--brand); }
.seg-wide { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.seg-wide button { height: 42px; }

/* -------------------------------------------------------------- appearance panel + colour swatches */
dialog.theme-panel { width: min(460px, calc(100% - 24px)); }
@media (max-width: 640px) { dialog.theme-panel { width: 100%; } }
.panel-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.panel-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.panel-foot .btn-primary { min-width: 110px; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swatch {
  position: relative; display: grid; justify-items: center; gap: 8px; padding: 12px 6px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 650; font-size: 0.84rem; color: var(--text-2);
  transition: border-color 0.2s, transform 0.25s var(--spring), box-shadow 0.25s;
}
.swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch .sw {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: linear-gradient(135deg, var(--s1), var(--s2) 55%, var(--s3));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 8px 16px -8px var(--s2);
}
.swatch .sw .ic { color: #fff; width: 18px; height: 18px; stroke-width: 3; opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.3s var(--spring); }
.swatch[aria-pressed="true"], .swatch:has(input:checked) { border-color: var(--s2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2) 22%, transparent); }
.swatch[aria-pressed="true"] .sw .ic, .swatch:has(input:checked) .sw .ic { opacity: 1; transform: none; }
.swatch:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--s2) 55%, transparent); outline-offset: 2px; }

/* -------------------------------------------------------------- search: list view */
.grid.is-list {
  display: flex; flex-direction: column; gap: 0; padding: 0; margin-bottom: 40px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.prow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left;
  transition: background 0.2s;
  animation: row-in 0.35s var(--ease) both; animation-delay: calc(min(var(--i, 0), 24) * 16ms);
}
.prow:last-child { border-bottom: 0; }
.prow:hover { background: color-mix(in srgb, var(--surface-2) 75%, transparent); }
.prow:focus-visible { outline: none; background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.prow:active { background: var(--surface-2); }
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } }
.prow-dot { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--h) 75% 50%); box-shadow: 0 0 0 4px hsl(var(--h) 80% 50% / 0.15); }
.prow-main { min-width: 0; }
.prow-name { font-weight: 700; font-size: 0.97rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-sub { margin-top: 2px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.prow-price { font-family: var(--font-display); font-weight: 750; font-size: 1.14rem; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.1; }
.prow-price small { font-size: 0.62em; font-weight: 700; color: var(--muted); margin-right: 2px; }
.prow-price .per { font-family: var(--font-text); font-size: 0.7rem; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.prow .stock { font-size: 0.68rem; padding: 2px 7px; }
.prow .cost { grid-column: 2 / -1; margin-top: 0; }
.cost-line { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cost-line b { color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .prow { padding: 12px 14px; gap: 2px 12px; } .prow-price { font-size: 1.06rem; } }

/* -------------------------------------------------------------- admin */
.admin-bar { background: color-mix(in srgb, var(--brand) 10%, var(--bg)); border-bottom: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); animation: rise 0.4s var(--ease) both; }
.admin-bar .wrap { display: flex; align-items: center; gap: 10px; min-height: 46px; font-size: 0.88rem; font-weight: 600; color: var(--brand-ink); }
.admin-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-bar form { display: inline-flex; }

.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding-bottom: 50px; }
@media (max-width: 560px) { .co-grid { grid-template-columns: 1fr; } }
.co-card {
  display: grid; gap: 14px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  animation: card-in 0.5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 50ms);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.co-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--s1), var(--s2), var(--s3)); }
.co-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.co-card.is-off { opacity: 0.72; }
.co-top { display: flex; align-items: center; gap: 12px; }
.co-mark {
  width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
  background: linear-gradient(135deg, var(--s1), var(--s2) 55%, var(--s3)); box-shadow: 0 8px 18px -8px var(--s2);
}
.co-title { flex: 1; min-width: 0; }
.co-title h3 { font-family: var(--font-text); font-size: 1.05rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-title .mono { font-size: 0.82rem; }
.co-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.co-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.co-meta b { color: var(--text); }
.co-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.co-actions form { display: inline-flex; }
.co-actions .spacer { flex: 1; }

.cred-card {
  display: grid; gap: 14px; padding: 18px; margin-bottom: 18px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); box-shadow: var(--shadow-md);
  animation: sheet-in 0.5s var(--spring) both;
}
.cred-head { display: flex; gap: 12px; align-items: flex-start; }
.cred-head .bubble { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--ok); background: var(--ok-soft); }
.cred-head h2 { font-family: var(--font-text); font-size: 1.05rem; font-weight: 750; margin-bottom: 2px; }
.cred-head p { font-size: 0.85rem; color: var(--muted); }
.cred-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--line-strong); }
.cred-list dt { color: var(--muted); font-weight: 650; font-size: 0.86rem; }
.cred-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cred-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pw-tools input { padding-right: 50px !important; letter-spacing: 0.04em; }

/* -------------------------------------------------------------- motion safety */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}
