:root {
  --bg: #0b0f19;
  --surface: #121826;
  --surface-2: #182033;
  --line: #263248;
  --ink: #e6edf7;
  --ink-soft: #9fb0c8;
  --accent: #22d3ee;
  --accent-ink: #04141a;
  --danger: #ff6b81;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); color: var(--ink); padding: .5rem 1rem; z-index: 10; }

.site-header { background: rgba(11, 15, 25, .92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; min-height: 64px; }
.site-header a { color: var(--ink); text-decoration: none; }
.brand { font-weight: 700; font-size: 1.15rem; display: inline-flex; align-items: center; gap: .6rem; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--accent); color: var(--accent); font-size: .95rem; }
.site-header nav a { margin-left: 1.1rem; color: var(--ink-soft); }
.site-header nav a:hover, .site-header nav a:focus-visible { color: var(--ink); }
.cart-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .55rem; font-size: .8rem; font-weight: 700; margin-left: .2rem; }

main { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 70vh; }
h1 { font-size: 2rem; line-height: 1.2; }
h2 { margin-top: 2.2rem; }
.lead { color: var(--ink-soft); font-size: 1.1rem; }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin-bottom: 1rem; }
.brand-label { margin: 0; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }

.hero { background: radial-gradient(900px 300px at 85% -20%, rgba(34, 211, 238, .28), transparent), linear-gradient(135deg, #111a2e, #0b0f19); border: 1px solid var(--line); border-radius: 16px; padding: 3.2rem 2rem; margin-bottom: 1.5rem; }
.hero h1 { margin: .2rem 0 .6rem; font-size: 2.6rem; max-width: 18ch; }
.hero p { color: var(--ink-soft); max-width: 52ch; }
.hero .eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }

.perks { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; padding: 0; margin: 0 0 1rem; }
.perks li { display: flex; gap: .75rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; font-size: .92rem; color: var(--ink-soft); }
.perks li > span { font-size: 1.5rem; }
.perks strong { color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; margin: 1rem 0 2rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card-media img { display: block; width: 100%; height: auto; aspect-ratio: 4/3; }
.card-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.02rem; line-height: 1.35; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { color: var(--accent); }
.card-body .btn { margin-top: auto; }
.price { font-weight: 700; margin: 0; font-size: 1.1rem; }
.price-lg { font-size: 1.8rem; margin: .2rem 0; }
.cat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; text-decoration: none; color: var(--ink); }
.cat-tile:hover { border-color: var(--accent); }
.cat-icon { font-size: 1.8rem; }
.cat-tile h3 { margin: .3rem 0 .25rem; }
.cat-tile p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1rem 0; }
.chip { display: inline-block; padding: .3rem .9rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-size: .92rem; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip-active:hover { color: var(--accent-ink); }

.badge { display: inline-block; font-size: .78rem; border-radius: 4px; padding: .05rem .5rem; width: fit-content; font-weight: 600; }
.badge-in { background: #0f3d36; color: #7ef0d5; }
.badge-low { background: #4a3508; color: #fbbf4a; }
.badge-out { background: #4a1520; color: #ff9aa8; }

.btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 9px; padding: .5rem 1rem; text-decoration: none; display: inline-block; text-align: center; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: #67e8f9; border-color: #67e8f9; }
.btn-ghost { background: transparent; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1.05rem; }
.btn-link { border: none; background: none; text-decoration: underline; padding: 0; color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 2px; }

.product { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; margin: 1rem 0 2rem; }
.product-img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.details { padding-left: 1.2rem; color: var(--ink-soft); }
.trust { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; color: var(--ink-soft); font-size: .9rem; }
.trust li::before { content: "✓ "; color: var(--accent); }

.spec-table { width: 100%; max-width: 720px; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.spec-table th, .spec-table td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.spec-table th { width: 38%; color: var(--ink-soft); font-weight: 500; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }

.cart-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { text-align: left; padding: .75rem; border-bottom: 1px solid var(--line); }
.cart-table th { color: var(--ink-soft); font-weight: 500; font-size: .9rem; }
.qty { width: 4.5rem; padding: .3rem; font: inherit; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.totals { display: grid; grid-template-columns: 1fr auto; max-width: 320px; margin: 1.5rem 0 1rem auto; gap: .3rem 1rem; }
.totals dt { color: var(--ink-soft); }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 700; font-size: 1.25rem; }
.error { color: #ffb3bf; background: #4a1520; border: 1px solid #7a2233; padding: .75rem 1rem; border-radius: 8px; }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--ink-soft); font-size: .9rem; }
.site-footer p { margin: .2rem 0; }

@media (max-width: 720px) {
  .product { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  .hero { padding: 2rem 1.2rem; }
  .hero h1 { font-size: 1.9rem; }
  .site-header nav a { margin: 0 .8rem 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform .15s, border-color .15s, box-shadow .15s; }
  .card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(34, 211, 238, .12); }
}

/* ---- store assistant (src/static/js/chat.js) ---- */
.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; }
.chat { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.chat-toggle { border-radius: 999px; padding: .65rem 1.2rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.chat-panel { width: min(380px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 6rem)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat-sub { display: block; font-size: .75rem; color: var(--ink-soft); }
.chat-head-actions { display: flex; align-items: center; gap: .6rem; }
.chat-close { font: inherit; font-size: 1.4rem; line-height: 1; background: none; border: none; color: var(--ink-soft); cursor: pointer; padding: .1rem .3rem; }
.chat-close:hover, .chat-close:focus-visible { color: var(--ink); }
.chat-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; }
.chat-msg { max-width: 88%; padding: .5rem .75rem; border-radius: 12px; font-size: .94rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }
.chat-user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat-pending { color: var(--ink-soft); font-style: italic; }
.chat-error { align-self: flex-start; border: 1px solid var(--danger); color: var(--danger); background: transparent; }
.chat-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: 0 .8rem .6rem; }
.chat-suggest[hidden] { display: none; }
.chat-chip { font-size: .85rem; padding: .3rem .7rem; border-radius: 999px; text-align: left; }
.chat-form { display: flex; gap: .5rem; padding: .6rem .8rem; border-top: 1px solid var(--line); }
.chat-input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: .5rem .7rem; }
.chat-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-note { margin: 0; padding: 0 .8rem .6rem; font-size: .72rem; color: var(--ink-soft); }
@media (max-width: 720px) {
  .chat { right: .5rem; bottom: .5rem; }
  .chat-panel { width: calc(100vw - 1rem); height: min(520px, calc(100vh - 5rem)); }
}

/* ---- accounts: header button + sign-in dialog (src/static/js/auth.js) ---- */
[hidden] { display: none !important; }
.site-header nav .auth-greeting { margin-left: 1.1rem; color: var(--ink-soft); font-size: .92rem; }
.site-header nav .auth-button { margin-left: 1.1rem; padding: .3rem .85rem; font-size: .92rem; }
.auth-dialog { width: min(400px, calc(100vw - 2rem)); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); }
.auth-dialog::backdrop { background: rgba(5, 8, 15, .7); }
.auth-form { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem; }
.auth-form h2 { margin: 0; font-size: 1.25rem; }
.auth-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--ink-soft); }
.auth-input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; }
.auth-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-note { margin: 0; font-size: .78rem; color: var(--ink-soft); }
.auth-error { margin: 0; padding: .5rem .7rem; border: 1px solid var(--danger); border-radius: 9px; color: var(--danger); font-size: .9rem; }
.auth-actions { display: flex; gap: .5rem; }
.auth-switch { margin: 0; font-size: .88rem; color: var(--ink-soft); }
@media (max-width: 720px) {
  .site-header nav .auth-greeting { display: none; }
}

/* ---- live viewers badge on product pages (src/static/js/viewers.js) ---- */
.viewers { display: inline-flex; align-items: center; gap: .5rem; margin: .25rem 0 .75rem; padding: .25rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: .88rem; }
.viewers-dot { width: .6rem; height: .6rem; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: viewers-pulse 2s infinite; }
@keyframes viewers-pulse { 70% { box-shadow: 0 0 0 .5rem rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@media (prefers-reduced-motion: reduce) { .viewers-dot { animation: none; } }

/* ---- promo code box on the cart page (src/static/js/cart.js) ---- */
.promo { margin: 1rem 0; }
.promo-form { display: flex; gap: .5rem; max-width: 360px; }
.promo-input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: .5rem .7rem; text-transform: uppercase; }
.promo-input::placeholder { text-transform: none; }
.promo-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.promo-msg { min-height: 1.4em; margin: .4rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.promo-msg.promo-error { color: var(--danger); }
.promo-applied { display: inline; margin: 0 .75rem 0 0; color: #34d399; font-weight: 600; }
.totals .discount { color: #34d399; }


/* ---- add-to-cart toast, anchored under the cart link (src/static/js/cart.js) ---- */
.cart-wrap { position: relative; display: inline-block; }
.toast {
  position: absolute;
  top: calc(100% + .65rem);
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: .9rem;
  width: max-content;
  max-width: min(340px, calc(100vw - 2rem));
  padding: .8rem 1rem;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
/* A little caret pointing up at the cart, so the notification reads as the cart speaking. */
.toast::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 1.1rem;
  width: 10px;
  height: 10px;
  background: var(--surface-2);
  border-left: 1px solid var(--accent);
  border-top: 1px solid var(--accent);
  transform: rotate(45deg);
}
.toast-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-hide { opacity: 0; transform: translateY(8px); pointer-events: none; }
.toast-text { margin: 0; font-size: .92rem; line-height: 1.35; }
/* The header's generic nav-link rules must not repaint or indent the button. */
.site-header nav .toast-action { margin-left: 0; color: var(--accent-ink); }
.toast-action { flex: none; padding: .35rem .85rem; font-size: .9rem; white-space: nowrap; }
.toast-fixed { position: fixed; top: 4.5rem; right: 1rem; }
@media (max-width: 720px) {
  .toast { max-width: min(300px, calc(100vw - 1rem)); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .3s ease; transform: none; }
  .toast-show, .toast-hide { transform: none; }
}
