:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #18243a;
  --muted: #64748b;
  --border: #e3e8f0;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #eff4ff;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --accent-soft: #fff7e6;
  --ok: #16a34a;
  --ok-soft: #e9f9ef;
  --err: #dc2626;
  --err-soft: #fdeeee;
  --hero-top: #0b1b34;
  --hero-bottom: #12335f;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(20, 40, 80, 0.10);
  --shadow-lg: 0 20px 50px rgba(10, 25, 55, 0.18);
  --mono: "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Светлая «панель документа» для интерактивных схем — остаётся светлой в обеих темах */
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-track: #e2e8f0;
  --panel-ink: #18243a;
  --panel-muted: #64748b;
  --panel-border: #e3e8f0;
  --stepper-track: #d7deea;
}

/* --- Тёмная тема --- */
[data-theme="dark"] {
  --bg: #0d1424;
  --surface: #141d31;
  --surface-2: #1b2740;
  --ink: #e6edf8;
  --muted: #93a6c2;
  --border: #283752;
  --primary: #5b8cff;
  --primary-2: #7aa8ff;
  --accent: #fbbf24;
  --accent-2: #fcd34d;
  --ok: #34d399;
  --err: #f87171;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --accent-soft: rgba(245, 158, 11, 0.14);
  --ok-soft: rgba(34, 197, 94, 0.14);
  --err-soft: rgba(248, 113, 113, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --stepper-track: #2a3a58;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Ссылка «к содержимому»: скрыта до получения фокуса. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

/* Видимый фокус для всех интерактивных элементов. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible, .navtab:focus-visible, .lang-btn:focus-visible,
.app-card:focus-visible, .load-card:focus-visible,
.sstep:focus-visible, .cart-close:focus-visible, .modal-close:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(11, 27, 52, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; user-select: none; }
.brand-mark { color: var(--accent); }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: 1.5px; }
.brand-accent { color: #7fa6e8; font-weight: 600; margin-left: 8px; letter-spacing: 3px; font-size: 12px; }

.topnav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lang-switch { display: inline-flex; gap: 2px; margin-left: 6px; padding: 3px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); }
.lang-btn { background: transparent; color: #9fb0c9; border: none; padding: 5px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: all 0.15s ease; }
.lang-btn:hover { color: #fff; }
.lang-btn.active { color: #0b1b34; background: #f5a623; }
@media (max-width: 640px) { .lang-switch { margin-left: auto; } }
.navtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #c3d2ea;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.15s ease;
}
.navtab:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.navtab.is-active { color: #fff; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.4); font-weight: 700; }
.navbadge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  font-size: 12px;
  text-align: center;
  background: var(--accent);
  color: #4a3200;
  border-radius: 20px;
  font-weight: 800;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c3d2ea;
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; color: var(--accent-2); }

.hero {
  background:
    radial-gradient(900px 380px at 85% -60%, rgba(245, 158, 11, 0.22), transparent 60%),
    radial-gradient(700px 400px at 5% -40%, rgba(59, 130, 246, 0.28), transparent 55%),
    linear-gradient(180deg, var(--hero-top), var(--hero-bottom));
  color: #fff;
  padding: 46px 28px 56px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 38px 38px;
  pointer-events: none;
}
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: center;
  position: relative;
}
.hero-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.hero h1 { font-size: 34px; font-weight: 800; line-height: 1.2; letter-spacing: -0.4px; }
.hero-text p { color: #b7c8e4; max-width: 640px; margin-top: 12px; font-size: 15.5px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 26px;
  margin-top: 26px;
}
.hstat-v { font-family: var(--mono); font-size: 18px; font-weight: 700; color: #fff; min-height: 24px; }
.hstat-k { font-size: 12px; color: #8ba3c8; margin-top: 2px; }

.hero-cta {
  display: inline-block;
  margin-top: 26px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #4a3200;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45); }

.hero-inv { display: flex; justify-content: center; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45)); }
.hero-inv svg { width: 100%; max-width: 300px; height: auto; }
.hero-inv .btn { transition: filter 0.12s ease; }
.hero-inv .btn:hover { filter: brightness(1.15); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 28px 50px;
  align-items: start;
}

.wizard { display: flex; flex-direction: column; gap: 16px; }

.stepper { display: flex; align-items: center; padding: 6px 0 14px; }
.sstep {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  background: transparent;
  border: none;
  color: #8ba0bc;
  transition: color 0.15s ease;
}
.sstep::before {
  content: "";
  position: absolute;
  left: calc(-50% + 16px);
  right: calc(50% + 16px);
  top: 50%;
  height: 3px;
  background: var(--stepper-track);
  z-index: 0;
}
.sstep:first-child::before { display: none; }
.sstep .snum {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--stepper-track);
  color: var(--muted);
  border: 2px solid transparent;
  transition: all 0.18s ease;
}
.sstep.done { color: #fff; }
.sstep.done .snum { background: linear-gradient(90deg, var(--primary), #4f8bff); color: #fff; border-color: #bcd3ff; }
.sstep.cur { color: #4a3200; }
.sstep.cur .snum { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #4a3200; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2); }
.sstep.locked { opacity: 0.4; }
.sstep.locked .snum { cursor: default; }
.sstep:not(.locked):hover .snum { transform: translateY(-2px); filter: brightness(1.05); }
@media (max-width: 640px) {
  .sstep::before { left: calc(-50% + 12px); right: calc(50% + 12px); }
  .sstep .snum { width: 26px; height: 26px; font-size: 12px; }
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  animation: stepin 0.25s ease both;
  scroll-margin-top: 80px;
}
@keyframes stepin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  border: 1px solid #d3e2fd;
  flex: none;
}
.step h2 { font-size: 17px; font-weight: 750; letter-spacing: -0.2px; }
.step-tip { margin-left: auto; font-size: 13px; color: var(--muted); }
.step-tip .chk { color: var(--ok); font-weight: 700; margin-right: 5px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: stretch; }
.choice-grid.power-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.choice-grid.volt-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.choice {
  position: relative;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 15px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: left;
  color: var(--ink);
}
.choice:hover { transform: translateY(-2px); border-color: #b9cdf5; box-shadow: var(--shadow); }
.choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.choice .c-title { font-weight: 700; font-size: 15px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.choice .c-sub { font-size: 12.8px; color: var(--muted); margin-top: 5px; }
#series-body .choice .c-sub { min-height: 60px; }
.choice .c-price { font-family: var(--mono); color: var(--primary-2); font-weight: 700; font-size: 13.5px; margin-top: 9px; }
.choice .c-price.unknown { color: var(--muted); font-weight: 600; }
.choice .c-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 9px;
  border-radius: 20px;
  background: #e4edfd;
  color: var(--primary-2);
  border: 1px solid #cfe0fb;
}
.choice .c-tag.gp { background: var(--accent-soft); color: #b45309; border-color: #fbe2b8; }
.choice .c-power { font-family: var(--mono); font-size: 21px; font-weight: 800; letter-spacing: 0.3px; color: var(--ink); white-space: nowrap; line-height: 1.1; }
.choice .c-power small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin: 3px 0 0; }

.c-feats { list-style: none; margin-top: 11px; display: flex; flex-direction: column; gap: 3px; }
.c-feats li { font-size: 12.5px; color: var(--muted); padding-left: 15px; position: relative; }
.c-feats li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.app-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.app-card:hover { transform: translateY(-2px); border-color: #b9cdf5; box-shadow: var(--shadow); }
.app-card:active { transform: scale(0.97); }
.app-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14); }
.app-card svg { width: 52px; height: 52px; margin: 0 auto 8px; display: block; color: var(--primary); }
.app-card.selected svg { color: #b45309; }
.app-card .a-name { font-weight: 700; font-size: 14.5px; }
.app-card .a-curve { font-size: 12px; color: var(--muted); margin-top: 3px; }

.app-info {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}
.app-info .ai-body { flex: 1; }
.app-info .ai-title { font-weight: 700; font-size: 15px; }
.app-info .ai-desc { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.app-info .ai-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.app-info .ai-tags span {
  font-size: 11.5px;
  padding: 2px 10px;
  border-radius: 20px;
  background: #e8eef8;
  color: #46566e;
  border: 1px solid #d9e2f0;
}
.app-badge {
  flex: none;
  text-align: center;
  font-size: 11.5px;
  color: #1e40af;
  background: var(--primary-soft);
  border: 1px solid #cfe0fb;
  border-radius: 10px;
  padding: 10px 12px;
}
.app-badge b { display: block; font-size: 16px; font-family: var(--mono); color: var(--primary-2); }
.app-badge.sub { color: #b45309; background: var(--accent-soft); border-color: #fbe2b8; }
.app-badge.sub b { color: #92400e; }

.ai-reco {
  margin-top: 8px;
  color: #1e3a8a;
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 8px 10px;
}
.ai-reco.sub { color: #92400e; background: var(--accent-soft); }

.scheme {
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  border-radius: 0;
  padding: 8px 6px 0;
  overflow: hidden;
}
.scheme svg { width: 100%; height: auto; display: block; }

.scheme-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel-2);
  border-radius: 12px 12px 0 0;
}
.tb-slider { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.tb-slider .tb-label { font-size: 13px; color: var(--panel-muted); white-space: nowrap; }
.tb-slider .tb-val { font-family: var(--mono); font-weight: 700; color: var(--panel-ink); min-width: 52px; text-align: right; }
input[type="range"] { flex: 1; accent-color: var(--primary); height: 28px; }

.run-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
}
.run-btn.run { background: var(--ok); color: #fff; box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3); }
.run-btn.run .dot { background: #c8ffe0; }
.run-btn.stop { background: var(--panel); color: #dc2626; border-color: #f5c2bf; }
.run-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: #d6ffe8; }
.run-btn.stop .dot { background: var(--err); }

.scheme-readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
  background: var(--panel-2);
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--panel-border);
}
.readout { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 8px 12px; }
.energy-panel { margin-top: 12px; background: linear-gradient(135deg, #ecfdf5, #eff6ff); border: 1px solid #bbf7d0; border-radius: 12px; padding: 14px 16px; }
.ep-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.ep-title { font-weight: 800; font-size: 14px; color: #065f46; }
.ep-sub { font-size: 12px; color: #64748b; }
.ep-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.ep-lbl { flex: 0 0 66px; font-size: 12.5px; font-weight: 700; color: #475569; }
.ep-bar { flex: 1; height: 14px; background: var(--panel-track); border-radius: 8px; overflow: hidden; }
.ep-bar i { display: block; height: 100%; border-radius: 8px; transition: width 0.25s ease; }
.ep-bar.thr i { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.ep-bar.vfd i { background: linear-gradient(90deg, #22c55e, #16a34a); }
.ep-val { flex: 0 0 auto; min-width: 66px; text-align: right; font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: #334155; }
.ep-save { margin-top: 8px; font-size: 15px; color: #334155; }
.ep-save b { font-size: 22px; color: #16a34a; font-family: var(--mono); }
.ep-star { color: #94a3b8; }
.ep-note { margin-top: 6px; font-size: 11px; color: #8a9ab5; }
.energy-panel.info { background: linear-gradient(135deg, #eff6ff, #eef2ff); border-color: #bfdbfe; }
.energy-panel.info .ep-title { color: #1e40af; }
.ep-note2 { font-size: 13px; line-height: 1.5; color: #475569; }
.readout .r-k { font-size: 11.5px; color: var(--panel-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.readout .r-v { font-family: var(--mono); font-size: 19px; font-weight: 800; color: var(--panel-ink); margin-top: 2px; }
.readout .r-v small { font-size: 12px; color: var(--panel-muted); font-weight: 600; margin-left: 3px; }
.readout.hot .r-v { color: #f59e0b; }

.load-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.load-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.load-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #b9cdf5; }
.load-card:active { transform: scale(0.97); }
.load-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14); }
.load-card .l-name { font-size: 17px; font-weight: 800; font-family: var(--mono); color: #b45309; }
.load-card .l-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.load-card .l-rate { font-family: var(--mono); font-size: 13px; margin-top: 9px; }
.load-card .l-price { font-family: var(--mono); font-size: 13.5px; color: var(--primary-2); font-weight: 700; margin-top: 8px; }
.load-reco {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--primary-soft);
  border: 1px solid #d3e2fd;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: #1e3a8a;
  margin-top: 14px;
}
.load-reco b { color: var(--primary-2); }

.opt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.opt:hover { border-color: #b9cdf5; box-shadow: var(--shadow); }
.opt.on { border-color: var(--primary); background: var(--primary-soft); }
.opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.opt .o-name { font-weight: 650; font-size: 14px; }
.opt .o-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.opt .o-price { font-family: var(--mono); font-size: 13px; color: var(--primary-2); font-weight: 700; margin-top: 6px; }
.opt .o-price.unknown { color: var(--muted); font-weight: 600; }

.summary { position: sticky; top: 86px; }
.summary-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.sum-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sum-head h3 { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.summary-empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

.sum-media { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.sum-media .inv-mini { margin-bottom: 0; flex: 1 1 52%; }
.sum-photo { flex: 0 0 40%; display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--panel-2); border: 1px solid var(--panel-border); border-radius: 12px; padding: 8px; }
.sum-photo img { width: 100%; max-height: 150px; object-fit: contain; display: block; }
.sum-photo-cap { font-size: 11px; font-weight: 700; color: #64748b; }
.inv-mini { margin-bottom: 14px; }
.inv-mini svg { width: 100%; max-width: 210px; margin: 0 auto; display: block; }
@media (max-width: 480px) { .sum-media { flex-direction: column; } .sum-photo { flex-basis: auto; width: 100%; } }

.sum-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding: 6px 0;
  border-bottom: 1px dashed #e6ebf3;
}
.sum-line .k { color: var(--muted); }
.sum-line .v { font-weight: 600; text-align: right; }
.sum-line .v.mono { font-family: var(--mono); }

.sum-total { margin-top: 12px; padding: 12px 0 4px; border-top: 1px solid var(--border); }
.sum-total .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sum-total .label { color: var(--muted); font-size: 13px; }
.sum-total .price { font-family: var(--mono); font-size: 21px; font-weight: 800; color: var(--primary-2); }
.sum-total .price.unknown { font-size: 14px; color: var(--muted); font-weight: 700; }

.qty { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; }
.qty button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qty button:hover { border-color: var(--primary); color: var(--primary); }
.qty .q-val { font-family: var(--mono); font-size: 17px; font-weight: 700; min-width: 40px; text-align: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
  font-size: 14.5px;
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
/* Спиннер в кнопке при отправке формы (state .loading) */
.btn-spinner {
  width: 15px;
  height: 15px;
  flex: none;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: btnspin 0.7s linear infinite;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading { pointer-events: none; }
@keyframes btnspin { to { transform: rotate(360deg); } }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(0.6) brightness(0.9); cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #4a3200; box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3); }
.btn-primary { background: linear-gradient(180deg, #4f8bff, var(--primary)); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
.btn-ok { background: linear-gradient(180deg, #2fd07c, var(--ok)); color: #fff; box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--primary); filter: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.field input, .field select, .field textarea {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.field.invalid input, .field.invalid select { border-color: var(--err); }
.field .ferr { font-size: 12px; color: var(--err); display: none; }
.field.invalid .ferr { display: block; }

.agree { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); }
.agree input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); flex: none; }

.order-items { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 14px; margin-bottom: 16px; }
.order-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e2e8f2; font-size: 13.5px; }
.order-item:last-child { border-bottom: none; }
.order-item .oi-model { font-family: var(--mono); font-weight: 700; color: var(--primary-2); }
.order-item .oi-qty { color: var(--muted); }
.order-item .oi-price { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.order-item .oi-price.unknown { color: var(--muted); font-weight: 600; }

.hint {
  font-size: 13px;
  color: #1e3a8a;
  background: var(--primary-soft);
  border: 1px solid #d3e2fd;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 14px;
}

.orders { max-width: 1240px; margin: 0 auto; padding: 26px 28px 50px; }

/* Закреплённая мобильная панель «В корзину» (только < 640px, где сводка перестаёт быть sticky) */
.mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(10, 25, 55, 0.12);
}
.mobile-cta[hidden] { display: none; }
.mobile-cta-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mobile-cta-label { font-size: 12px; color: var(--muted); }
.mobile-cta-total { font-family: var(--mono); font-size: 20px; font-weight: 800; color: var(--primary-2); white-space: nowrap; }
.mobile-cta .btn { flex: none; }
@media (min-width: 641px) {
  .mobile-cta { display: none; }
}

.orders-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.orders-head h2 { font-size: 21px; letter-spacing: -0.3px; }
.muted { color: var(--muted); }

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.order-card .oc-main { display: flex; flex-direction: column; gap: 3px; min-width: 220px; }
.order-card .oc-model { font-family: var(--mono); font-weight: 700; font-size: 15.5px; color: var(--primary-2); }
.order-card .oc-meta { font-size: 12.5px; color: var(--muted); }
.order-card .oc-total { font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--primary-2); }
.order-card .oc-total.unknown { font-size: 13px; color: var(--muted); font-weight: 600; }
.status {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: #b45309;
  border: 1px solid #fbe2b8;
}

.spec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.spec-table td { padding: 7px 10px; border-bottom: 1px solid #eef2f8; }
.spec-table td:first-child { color: var(--muted); }
.spec-table td:last-child { text-align: right; font-weight: 600; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 52, 0.5);
  backdrop-filter: blur(2px);
  z-index: 70;
}.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 71;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.cart-drawer.open { transform: none; }
.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-head h3 { font-size: 17px; }
.cart-count {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.cart-close { background: none; border: none; font-size: 26px; color: var(--muted); line-height: 1; }
.cart-close:hover { color: var(--ink); }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; display: flex; flex-direction: column; gap: 10px; }
.cart-empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

.cart-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--surface-2);
}
.ci-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ci-model { font-family: var(--mono); font-weight: 700; font-size: 13.5px; color: var(--primary-2); word-break: break-all; }
.ci-remove { background: none; border: none; color: var(--muted); font-size: 16px; line-height: 1; flex: none; }
.ci-remove:hover { color: var(--err); }
.ci-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ci-opts { font-size: 12px; color: var(--muted); margin-top: 5px; }
.ci-opts i { color: #8a9ab5; }
.ci-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.ci-price { font-family: var(--mono); font-weight: 800; font-size: 15.5px; color: var(--primary-2); }
.ci-price.unknown { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.cart-foot { border-top: 1px solid var(--border); padding: 16px 20px 20px; background: var(--surface-2); }
.cart-total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cart-total-row .k { color: var(--muted); }
.cart-total { font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--primary-2); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 52, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 80;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  padding: 26px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: pop 0.2s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal-body h3 { font-size: 19px; margin-bottom: 6px; letter-spacing: -0.3px; }
.modal-body .ok-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ok-soft);
  border: 1px solid #bfe9cf;
  color: #157347;
  border-radius: 12px;
  padding: 13px 15px;
  margin: 14px 0;
  font-weight: 700;
}
.modal-body .ok-banner .tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-weight: 900;
  flex: none;
}
.modal-body .ok-banner.warn {
  background: #fdf0e0;
  border-color: #f5c889;
  color: #92400e;
}
.modal-body .ok-banner.warn .tick {
  background: #f59e0b;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.code-block {
  background: #0f1c33;
  border-radius: 10px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c6d7f5;
  max-height: 280px;
  overflow-y: auto;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--hero-top);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .t-accent { color: var(--accent-2); }

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero-inv { max-width: 280px; margin: 0 auto; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head, .layout, .orders { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px; }
  .topnav { width: 100%; }
  .navtab { flex: 1; justify-content: center; }
  .hero { padding: 34px 16px 40px; }
  .hero h1 { font-size: 25px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .choice-grid.power-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .opt-list { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 6px; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

.inv-btn { cursor: pointer; }
.inv-btn:hover { filter: brightness(1.2); }

.scheme .anim-rot { animation: spin var(--dur, 3s) linear infinite; transform-box: fill-box; transform-origin: center; }
.scheme .anim-flow { animation: dash var(--dur, 3s) linear infinite; }
.scheme .anim-flowx { animation: flowx var(--dur, 3s) linear infinite; }
.scheme .anim-flowx2 { animation: flowx2 var(--dur, 3s) linear infinite; }
.scheme .anim-piston { animation: piston var(--dur, 3s) ease-in-out infinite alternate; }
.scheme .anim-hoist { animation: hoist 2.6s ease-in-out infinite; }
.scheme .anim-slide { animation: slide var(--dur, 3.4s) linear infinite; }
.scheme .d2 { animation-delay: -1.7s; }
.scheme .d3 { animation-delay: -0.9s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dash { to { stroke-dashoffset: 30; } }
@keyframes flowx { to { transform: translateX(60px); } }
@keyframes flowx2 { to { transform: translateX(90px); } }
@keyframes piston { to { transform: translateY(-40px); } }
@keyframes hoist { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(44px); } }
@keyframes slide { to { transform: translateX(-300px); } }

.scheme.stopped .anim-rot,
.scheme.stopped .anim-flow,
.scheme.stopped .anim-flowx,
.scheme.stopped .anim-flowx2,
.scheme.stopped .anim-piston,
.scheme.stopped .anim-hoist,
.scheme.stopped .anim-slide { animation-play-state: paused; }

/* Пользователи, чувствительные к движению: без анимаций и плавных переходов */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Навигация по шагам мастера */
.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.wizard-nav-progress {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.wizard-nav .btn { min-width: 120px; }

/* Примечание под сводкой */
.sum-note {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
}

/* Подсказка о ступенях объёмной скидки */
.sum-discount {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.sum-discount.active {
  color: var(--ok);
  font-weight: 700;
}
.ci-disc {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
  background: rgba(34, 197, 94, 0.12);
}

/* Полоса «Скидки за объём» в шапке */
.hero-discount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.hero-discount b { color: var(--ok); }
.hero-disc-tag {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(135deg, #16a34a, #15803d);
}

/* --- Печатная спецификация (PDF через печать браузера) --- */
#print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 24px;
    font-family: Arial, sans-serif;
    color: #111;
  }
  #print-area .print-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #111;
    padding-bottom: 8px;
    margin-bottom: 16px;
  }
  #print-area .print-head strong { font-size: 18px; letter-spacing: 1px; }
  #print-area .print-head div { font-size: 14px; font-weight: 700; }
  #print-area .print-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  #print-area .print-table td {
    border: 1px solid #ccc;
    padding: 6px 10px;
  }
  #print-area .print-table td:first-child { width: 45%; color: #444; }
  #print-area .print-table .print-total td { font-weight: 800; font-size: 14px; }
  #print-area .print-foot { margin-top: 18px; font-size: 11px; color: #666; }
}

/* --- Доводка тёмной темы: элементы с жёстко заданными светлыми цветами --- */
[data-theme="dark"] .step-num { border-color: #33466b; }
[data-theme="dark"] .choice .c-tag {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}
[data-theme="dark"] .app-badge { border-color: #33466b; color: #bfdbfe; }
[data-theme="dark"] .app-badge b { color: #7aa8ff; }
[data-theme="dark"] .app-badge.sub { border-color: #6b4a12; color: #fcd34d; }
[data-theme="dark"] .app-badge.sub b { color: #fbbf24; }
[data-theme="dark"] .ai-reco { color: #bfdbfe; }
[data-theme="dark"] .ai-reco.sub { color: #fcd34d; }
[data-theme="dark"] .app-info .ai-tags span { background: #22314e; color: #b9c8e0; }
[data-theme="dark"] .load-reco, [data-theme="dark"] .hint {
  color: #bfdbfe;
  border-color: #33466b;
}
[data-theme="dark"] .sum-line { border-bottom-color: var(--border); }
[data-theme="dark"] .order-item { border-bottom-color: var(--border); }
[data-theme="dark"] .spec-table td { border-bottom-color: var(--border); }
[data-theme="dark"] .field input, [data-theme="dark"] .field select, [data-theme="dark"] .field textarea { background: var(--surface); }
[data-theme="dark"] .cart-drawer { background: var(--surface); }
[data-theme="dark"] .modal { background: var(--surface); }
[data-theme="dark"] .order-card { background: var(--surface); }
[data-theme="dark"] .wizard-nav { background: var(--surface); }
[data-theme="dark"] .summary-inner { background: var(--surface); }
[data-theme="dark"] .mobile-cta { background: var(--surface); border-top-color: var(--border); }
[data-theme="dark"] .step { background: var(--surface); }
[data-theme="dark"] .qty button { background: var(--surface); }
[data-theme="dark"] .btn-ghost { background: var(--surface); }
[data-theme="dark"] .code-block { background: #0a1428; }
[data-theme="dark"] .scheme, [data-theme="dark"] .scheme-toolbar,
[data-theme="dark"] .scheme-readouts, [data-theme="dark"] .readout,
[data-theme="dark"] .sum-photo { background-color: var(--panel); }
[data-theme="dark"] .scheme-toolbar, [data-theme="dark"] .scheme-readouts { background-color: var(--panel-2); }
[data-theme="dark"] .app-info, [data-theme="dark"] .load-card, [data-theme="dark"] .opt,
[data-theme="dark"] .choice, [data-theme="dark"] .app-card, [data-theme="dark"] .cart-item,
[data-theme="dark"] .order-items { background-color: var(--surface-2); }
[data-theme="dark"] .order-items { border-color: var(--border); }
[data-theme="dark"] .sum-note { background: var(--surface-2); }
[data-theme="dark"] .cart-foot { background: var(--surface-2); }
[data-theme="dark"] .hero-discount { background: var(--surface-2); }
[data-theme="dark"] .energy-panel { background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(59, 130, 246, 0.12)); border-color: #1f4d3d; }
[data-theme="dark"] .energy-panel.info { background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.12)); border-color: #2b4366; }
[data-theme="dark"] .energy-panel .ep-title { color: #6ee7b7; }
[data-theme="dark"] .energy-panel.info .ep-title { color: #93c5fd; }
[data-theme="dark"] .ep-lbl, [data-theme="dark"] .ep-note2 { color: #b9c8e0; }
[data-theme="dark"] .ep-val, [data-theme="dark"] .ep-save { color: #e6edf8; }
[data-theme="dark"] .ep-note, [data-theme="dark"] .ep-sub { color: #93a6c2; }
[data-theme="dark"] .ep-save b { color: #34d399; }
[data-theme="dark"] .modal-body .ok-banner { background: rgba(34, 197, 94, 0.14); border-color: #1f4d3d; color: #6ee7b7; }
[data-theme="dark"] .modal-body .ok-banner.warn { background: rgba(245, 158, 11, 0.14); border-color: #6b4a12; color: #fbbf24; }

