:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-soft: #1b2430;
  --border: #2a3645;
  --text: #f5f7fb;
  --muted: #96a3b5;
  --accent: #80e1b6;
  --accent-strong: #46c98f;
  --danger: #ff8585;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #152238 0, var(--bg) 38%);
  color: var(--text);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(13, 17, 23, .82);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 48px);
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  color: #08271b; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #b7ffd9);
}
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }

main { width: min(1180px, calc(100% - 28px)); margin: 28px auto 56px; }
.card {
  background: linear-gradient(180deg, rgba(27,36,48,.95), rgba(21,27,36,.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero {
  padding: clamp(22px, 4vw, 42px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-bottom: 24px;
}
.hero h1 { font-size: clamp(30px, 5vw, 56px); line-height: 1.02; max-width: 760px; margin: 8px 0 14px; }
.hero p { color: var(--muted); max-width: 700px; line-height: 1.6; margin: 0; }
.hero-stat {
  min-width: 180px; padding: 24px; border-radius: 22px;
  background: rgba(128,225,182,.08); border: 1px solid rgba(128,225,182,.2);
  text-align: center;
}
.hero-stat strong { display: block; color: var(--accent); font-size: 46px; }
.hero-stat span { color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 800; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.catalog, .summary { padding: 24px; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 20px; }
h2 { margin: 6px 0 0; }
.search {
  min-width: 220px; display: flex; align-items: center; gap: 8px;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px;
}
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }

.supplement-list { display: grid; gap: 14px; }
.supplement {
  padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.018);
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center;
}
.supplement h3 { margin: 0 0 5px; font-size: 17px; }
.supplement p { margin: 0; color: var(--muted); font-size: 13px; }
.supplement-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px; font-size: 11px; }
.doses { display: flex; gap: 14px; }
.dose-control { min-width: 132px; }
.dose-control label { color: var(--muted); font-size: 12px; display: block; margin-bottom: 7px; }
.stepper { display: grid; grid-template-columns: 36px 44px 36px; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button { border: 0; background: var(--panel-soft); color: var(--text); height: 36px; font-size: 18px; }
.stepper span { text-align: center; font-weight: 800; }

.summary { position: sticky; top: 94px; }
.summary-row, .price-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-top: 16px; }
.summary-row span, .price-row span, .price-row small { color: var(--muted); }
.price-row strong { font-size: 30px; color: var(--accent); }
.price-row small { display: block; font-size: 11px; margin-top: 4px; }
.divider { height: 1px; background: var(--border); margin: 22px 0; }
.selected-items { display: grid; gap: 12px; }
.selected-items.empty { color: var(--muted); font-size: 14px; }
.selected-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.selected-item strong { font-size: 14px; }
.selected-item span { color: var(--muted); font-size: 12px; }

.primary-btn, .secondary-btn, .ghost-btn, .icon-btn {
  border-radius: 14px; border: 1px solid transparent; padding: 12px 16px; font-weight: 800;
}
.primary-btn { width: 100%; background: var(--accent); color: #08271b; margin-top: 22px; }
.primary-btn:hover { background: var(--accent-strong); }
.secondary-btn { width: 100%; background: transparent; color: var(--text); border-color: var(--border); margin-top: 10px; }
.ghost-btn { background: transparent; color: var(--muted); border-color: var(--border); }
.icon-btn { background: transparent; color: var(--muted); padding: 4px 10px; font-size: 24px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.fineprint { color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }

#checkoutDialog { border: 0; padding: 0; background: transparent; width: min(520px, calc(100% - 24px)); }
#checkoutDialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
.dialog-card { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; }
.dialog-card label { display: block; color: var(--muted); font-size: 13px; margin-top: 16px; }
.dialog-card input { width: 100%; margin-top: 7px; background: var(--panel-soft); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px; outline: 0; }
.checkout-summary { margin: 18px 0; padding: 16px; background: var(--panel-soft); border-radius: 14px; color: var(--muted); line-height: 1.7; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.dialog-actions .primary-btn { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); background: #f5f7fb; color: #111820; padding: 12px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 700px) {
  .hero { align-items: stretch; flex-direction: column; }
  .hero-stat { min-width: 0; }
  .section-head { align-items: stretch; flex-direction: column; }
  .search { min-width: 0; }
  .supplement { grid-template-columns: 1fr; }
  .doses { display: grid; grid-template-columns: 1fr 1fr; }
  .dose-control { min-width: 0; }
  .stepper { grid-template-columns: 1fr 1fr 1fr; }
}

.price-breakdown { display: grid; gap: 10px; margin-top: 8px; }
.price-breakdown > div { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.price-breakdown span { color: var(--muted); font-size: 13px; }
.price-breakdown strong { font-size: 14px; }
.selected-cost { text-align: right; display: grid; gap: 2px; }
.selected-cost span { font-size: 11px; }
