:root {
  --primary: #0E3A53;
  --accent: #F4A415;
  --primary-tint: color-mix(in srgb, var(--primary) 8%, white);
  --ink: #14202b;
  --muted: #5d6b78;
  --line: #e4e9ee;
  --bg: #f5f7f9;
  --card: #ffffff;
  --good: #2bb673;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,33,43,.06), 0 8px 24px rgba(16,33,43,.06);
  --shadow-lg: 0 12px 40px rgba(16,33,43,.18);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }

/* ---- header ---- */
.app-header { position: sticky; top: 0; z-index: 40; background: var(--primary); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-logo { display: inline-flex; width: 30px; height: 30px; color: var(--accent); }
.brand-logo svg { width: 100%; height: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; padding: 10px 18px; transition: filter .15s, transform .15s, background .15s;
}
.btn-phone { background: var(--accent); color: #231a02; }
.btn-phone:hover { filter: brightness(1.05); }
.phone-icon { font-size: 16px; }

/* ---- layout ---- */
.layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 32px;
  align-items: start; padding-top: 28px; padding-bottom: 80px;
}
.builder { min-width: 0; }

/* ---- hero ---- */
.hero { margin-bottom: 22px; }
.hero h1 { font-size: 32px; letter-spacing: -.02em; }
.hero-sub { color: var(--muted); font-size: 17px; margin: .5rem 0 0; max-width: 60ch; }
.steps { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; padding: 0; margin: 18px 0 0; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.steps span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-tint); color: var(--primary); font-weight: 700; font-size: 13px;
}

/* ---- control card ---- */
.control-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 28px; box-shadow: var(--shadow);
}
.control-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.control-title { font-size: 18px; }
.control-hint { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.size-readout { text-align: right; white-space: nowrap; }
.size-count { display: block; font-size: 14px; color: var(--muted); }
.size-count strong { font-size: 22px; color: var(--ink); }
.size-kw {
  display: inline-block; margin-top: 4px; font-weight: 700; color: var(--primary);
  background: var(--primary-tint); padding: 2px 10px; border-radius: 999px; font-size: 14px;
}
input[type=range] { width: 100%; accent-color: var(--accent); height: 6px; cursor: pointer; }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---- sections ---- */
.section-title { font-size: 22px; margin-top: 6px; display: flex; align-items: center; gap: 10px; }
.optional {
  font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line);
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.section-sub { color: var(--muted); margin: 4px 0 16px; }

/* ---- card grid ---- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 34px;
}
.product-card {
  position: relative; background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; flex-direction: column;
  box-shadow: var(--shadow); outline: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.product-card:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.product-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), var(--shadow); }

.thumb { height: 84px; display: grid; place-items: center; color: var(--primary); margin-bottom: 10px; }
.thumb svg { width: 64px; height: 64px; }
.thumb-battery { color: var(--good); }
.card-head { display: flex; flex-direction: column; }
.product-card .brand { font-size: 13px; color: var(--muted); font-weight: 600; }
.product-card .model { font-size: 16px; font-weight: 700; }
.product-card .spec { font-size: 13px; color: var(--muted); margin: 6px 0 0; min-height: 18px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.price { font-size: 18px; font-weight: 800; color: var(--ink); }
.price .per { font-size: 12px; font-weight: 600; color: var(--muted); }
.btn-info {
  background: transparent; border: 1px solid var(--line); color: var(--primary);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-info:hover { background: var(--primary-tint); }
.subtotal {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 14px; color: var(--muted);
}
.subtotal strong { color: var(--primary); font-size: 16px; }

.card-badge {
  position: absolute; top: 12px; right: 12px; background: var(--accent); color: #231a02;
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em;
}
.select-flag {
  display: none; position: absolute; top: 12px; left: 12px; background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.is-selected .select-flag { display: block; }
.is-selected .card-badge { display: none; }

/* ---- qty stepper ---- */
.qty {
  display: inline-flex; align-items: center; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: fit-content;
}
.qty-btn {
  width: 34px; height: 34px; border: 0; background: var(--primary-tint); color: var(--primary);
  font-size: 18px; font-weight: 700; cursor: pointer; line-height: 1;
}
.qty-btn:hover { background: var(--primary); color: #fff; }
.qty-value { min-width: 44px; text-align: center; font-weight: 700; }

/* ---- quote summary ---- */
.quote-col { position: sticky; top: 88px; }
.quote-summary {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.quote-title { font-size: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.quote-lines { margin: 12px 0; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 0; }
.qline { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.qline-main { display: flex; flex-direction: column; }
.qline-name { font-weight: 600; font-size: 14px; }
.qline-detail { font-size: 12px; color: var(--muted); }
.qline-amt { font-weight: 700; white-space: nowrap; }
.quote-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--ink);
}
.quote-total { font-size: 26px; font-weight: 800; color: var(--primary); }
.quote-meta { display: grid; gap: 10px; margin: 16px 0; padding: 14px; background: var(--bg); border-radius: 10px; }
.meta-item { display: flex; justify-content: space-between; gap: 12px; margin: 0; }
.meta-item dt { color: var(--muted); font-size: 13px; }
.meta-item dd { margin: 0; font-weight: 600; font-size: 13px; text-align: right; }
.btn-cta { width: 100%; background: var(--accent); color: #231a02; font-size: 16px; padding: 14px; margin-top: 6px; }
.btn-cta:hover { filter: brightness(1.05); }
.btn-cta.is-disabled { opacity: .5; pointer-events: none; }
.btn-ghost { width: 100%; background: transparent; border: 1px solid var(--line); color: var(--ink); margin-top: 10px; }
.btn-ghost:hover { background: var(--bg); }
.disclaimer { font-size: 11px; color: var(--muted); margin: 14px 0 0; text-align: center; }

/* ---- mobile sticky bar ---- */
.mobile-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(0,0,0,.08); padding: 10px 16px;
}
.mobile-bar-inner { display: flex; align-items: center; gap: 14px; max-width: var(--maxw); margin: 0 auto; }
.mobile-total { display: flex; flex-direction: column; flex: 1; }
.mobile-total span { font-size: 12px; color: var(--muted); }
.mobile-total strong { font-size: 20px; color: var(--primary); }
.mobile-bar .btn-cta { width: auto; margin: 0; white-space: nowrap; }

/* ---- footer ---- */
.app-footer { background: #fff; border-top: 1px solid var(--line); padding: 26px 0; margin-top: 20px; }
.app-footer p { margin: 0; }
#footer-name { font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16,33,43,.55); backdrop-filter: blur(2px); }
.modal-dialog {
  position: relative; background: #fff; border-radius: 18px; max-width: 520px; width: 100%;
  max-height: 88vh; overflow: auto; padding: 28px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: var(--bg); font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal-close:hover { background: var(--line); }
.modal-eyebrow { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.modal-title { font-size: 24px; margin: 4px 0 10px; }
.modal-summary { color: var(--ink); margin: 0 0 16px; }
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.spec-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); width: 44%; }
.spec-table td { text-align: right; font-weight: 600; padding: 8px 0; border-bottom: 1px solid var(--line); }
.modal-subh { font-size: 15px; margin: 18px 0 8px; }
.feature-list { margin: 0; padding-left: 18px; color: var(--ink); }
.feature-list li { margin: 4px 0; }
.modal-pdf { margin-top: 20px; }
body.modal-open { overflow: hidden; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-bottom: 96px; }
  .quote-col { position: static; }
  .mobile-bar { display: block; }
  .hero h1 { font-size: 26px; }
}

@media print {
  .app-header, .mobile-bar, .btn-info, .steps, .control-card, .hero-sub, .btn-ghost, .modal, .app-footer .muted { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .quote-col { position: static; }
  .quote-summary { box-shadow: none; border: none; }
  body { background: #fff; }
}
