:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66737f;
  --line: #dce3e8;
  --surface: #ffffff;
  --surface-soft: #f4f7f8;
  --navy: #050505;
  --navy-2: #262626;
  --teal: #ef1b24;
  --teal-dark: #d81720;
  --lime: #ef1b24;
  --warning: #a55b00;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(15, 39, 53, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #f8fafb; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.section-wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.hero { color: #fff; background: radial-gradient(circle at 79% 18%, rgba(239, 27, 36, .18), transparent 25%), linear-gradient(135deg, #000, #171717 72%, #050505); overflow: hidden; }
.topbar { width: min(1180px, calc(100% - 40px)); min-height: 82px; margin: auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand { color: inherit; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: block; flex: 0 0 42px; width: 42px; height: 42px; object-fit: cover; border-radius: 10px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .95rem; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: #a7bdc8; font-size: .73rem; }
.topbar-actions { display: flex; gap: 10px; }
.hero-content { width: min(1180px, calc(100% - 40px)); min-height: 430px; margin: auto; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 60px; padding: 70px 0 84px; }
.eyebrow, .step-label { margin: 0 0 10px; color: var(--teal-dark); font-size: .73rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.hero .eyebrow { color: #ff777c; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 22px; font-size: clamp(2.6rem, 5.5vw, 5rem); line-height: .98; letter-spacing: -.055em; }
h1 span { color: var(--lime); }
.hero-copy { max-width: 650px; margin: 0; color: #c4d3da; font-size: 1.08rem; line-height: 1.7; }
.hero-visual { position: relative; min-height: 280px; perspective: 700px; }
.rack { position: absolute; width: 180px; height: 245px; padding: 20px; border: 2px solid rgba(255,255,255,.45); background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.025)); box-shadow: 0 30px 55px rgba(0,0,0,.25); transform: rotateY(-15deg) skewY(-2deg); }
.rack-front { right: 44px; top: 15px; display: grid; gap: 10px; }
.rack-front span { display: block; background: repeating-linear-gradient(90deg, #3a3a3a 0 8px, #242424 8px 12px); border: 1px solid #6c6c6c; border-radius: 2px; }
.rack-mid { right: 88px; top: 0; opacity: .5; }
.rack-back { right: 132px; top: -15px; opacity: .22; }
.signal { position: absolute; width: 12px; height: 12px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 0 8px rgba(185,212,50,.13), 0 0 30px var(--lime); }
.signal-a { right: 198px; top: 69px; }
.signal-b { right: 82px; top: 178px; background: #fff; box-shadow: 0 0 0 8px rgba(255,255,255,.13), 0 0 30px rgba(255,255,255,.8); }

.button { min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px; font-weight: 760; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(239,27,36,.24); outline-offset: 2px; }
.button-light { color: #fff; background: var(--teal); }
.button-ghost { color: #fff; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.25); }
.button-primary { color: #fff; background: var(--teal-dark); }
.button-secondary { color: #bd1119; background: #fff0f1; border-color: #f3bfc2; }
.button-tertiary { color: #45535e; background: #fff; border-color: #cbd5db; }
.button:disabled { cursor: not-allowed; color: #9b9b9b; background: #e3e3e3; border-color: #d4d4d4; transform: none; opacity: .8; }

.project-bar { display: grid; grid-template-columns: .7fr 1.5fr; align-items: end; gap: 28px 40px; margin-top: -34px; padding: 28px 30px; background: #fff; border: 1px solid rgba(220,227,232,.8); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; z-index: 2; }
.project-fields { display: grid; grid-template-columns: 1fr .8fr .65fr; gap: 14px; }
.project-options { grid-column: 1 / -1; display: grid; grid-template-columns: 1.5fr .7fr; align-items: end; gap: 14px; padding-top: 20px; border-top: 1px solid #edf0f2; }
.project-fields > *, .project-options > * { min-width: 0; }
.project-hardware .segmented { max-width: 720px; }
.key-locker-option { min-height: 46px; display: flex; align-items: center; gap: 11px; padding: 8px 13px; color: #485660; background: #fff; border: 1px solid #cbd5db; border-radius: 9px; cursor: pointer; }
.key-locker-option:hover { border-color: #95a7b1; }
.key-locker-option input { flex: 0 0 auto; width: 18px; height: 18px; padding: 0; accent-color: var(--teal); }
.key-locker-option span, .key-locker-option small { display: block; }
.key-locker-option strong { color: var(--ink); font-size: .82rem; }
.key-locker-option small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.rack-reconciliation { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 50px; padding: 12px 16px; border: 1px solid; border-radius: 10px; font-size: .82rem; }
.rack-reconciliation strong { font-size: .9rem; }
.rack-reconciliation span { color: inherit; opacity: .82; }
.rack-reconciliation.is-matched { color: #17623a; background: #eef8f2; border-color: #a8d6b9; }
.rack-reconciliation.is-neutral { color: #425967; background: #f2f6f8; border-color: #cbd8df; }
.rack-reconciliation.is-remaining { color: #815000; background: #fff7e6; border-color: #e8c477; }
.rack-reconciliation.is-excess { color: #a50f17; background: #fff0f1; border-color: #efaeb2; }
h2 { margin-bottom: 8px; font-size: clamp(1.55rem, 2.6vw, 2.2rem); line-height: 1.15; letter-spacing: -.035em; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > span, .field legend { color: #45535e; font-size: .78rem; font-weight: 760; }
.field > span small { color: var(--muted); font-size: .68rem; font-weight: 600; }
input, select { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); background: #fff; border: 1px solid #cbd5db; border-radius: 9px; }
input:hover, select:hover { border-color: #95a7b1; }

.workspace, .results, .boq, .rules { padding: 78px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading p:not(.step-label) { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.row-list, .row-results { display: grid; gap: 18px; }
.empty-state { padding: 28px; color: var(--muted); background: #fff; border: 1px dashed #cbd5db; border-radius: 14px; text-align: center; }
.row-card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 25px rgba(15,39,53,.045); }
.row-card-head { display: grid; grid-template-columns: 42px minmax(180px, 1fr) 42px; align-items: end; gap: 14px; margin-bottom: 22px; }
.row-number { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; background: var(--navy-2); border-radius: 12px; font-weight: 850; }
.row-name-field input { max-width: 360px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding-inline: 0; font-size: 1.08rem; font-weight: 750; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; color: #7b3030; background: #fff; font-size: 1.5rem; line-height: 1; }
.icon-button:disabled { cursor: not-allowed; opacity: .35; }
.row-fields { display: grid; grid-template-columns: .7fr 1.2fr 1fr; gap: 20px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.segmented span { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border: 1px solid #cbd5db; border-radius: 9px; color: #485660; font-size: .85rem; font-weight: 720; }
.segmented span, .key-locker-option span { min-width: 0; overflow-wrap: anywhere; }
.segmented small { color: #84919a; font-size: .7rem; font-weight: 650; }
.segmented input:checked + span { color: #b60e16; background: #fff0f1; border-color: #e85c63; box-shadow: inset 0 0 0 1px #e85c63; }
.segmented input:focus-visible + span { outline: 3px solid rgba(239,27,36,.24); outline-offset: 2px; }
.row-preview { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid #edf0f2; color: var(--muted); font-size: .82rem; }
.row-preview strong { color: var(--ink); }
.row-incomplete { color: #5d6b75; font-style: italic; }

.summary-band { padding: 64px 0 68px; color: #fff; background: var(--navy); }
.summary-heading p:not(.step-label) { color: #9fb4bf; }
.step-label-light { color: #ff777c; }
.calculation-status { display: inline-flex; align-items: center; gap: 8px; color: #bad0d9; font-size: .8rem; }
.calculation-status i { width: 8px; height: 8px; background: #4fc27a; border-radius: 50%; box-shadow: 0 0 0 5px rgba(79,194,122,.12); }
.calculation-status.has-warning i { background: #f2a533; box-shadow: 0 0 0 5px rgba(242,165,51,.13); }
.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.metric { padding: 20px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; }
.metric span { display: block; color: #9fb4bf; font-size: .75rem; font-weight: 700; }
.metric strong { display: block; margin: 9px 0 3px; font-size: 2rem; line-height: 1; }
.metric small { color: #7f9aa7; font-size: .68rem; }

.result-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px; background: linear-gradient(90deg, #f0f8f8, #fff); border-bottom: 1px solid var(--line); }
.result-title { display: flex; align-items: center; gap: 12px; }
.result-title .row-number { width: 36px; height: 36px; font-size: .85rem; }
.result-title h3 { margin: 0 0 3px; font-size: 1.12rem; }
.result-title p, .coverage p { margin: 0; color: var(--muted); font-size: .76rem; }
.coverage { text-align: right; }
.coverage strong { display: block; color: var(--teal-dark); font-size: 1.05rem; }
.result-body { padding: 24px; }
.row-equipment { display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); gap: 9px; margin-bottom: 24px; }
.equipment-pill { padding: 12px; background: var(--surface-soft); border-radius: 10px; }
.equipment-pill span { display: block; color: var(--muted); font-size: .68rem; }
.equipment-pill strong { display: block; margin-top: 4px; font-size: 1.1rem; }
.enclosure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); gap: 12px; }
.enclosure-card { position: relative; padding: 18px; border: 1px solid #dce5e8; border-radius: 12px; overflow: hidden; }
.enclosure-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--teal); }
.enclosure-card header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.enclosure-card h4 { margin: 0; font-size: .9rem; }
.enclosure-card header span { color: var(--muted); font-size: .68rem; }
.module-list { display: grid; gap: 7px; }
.module { display: flex; justify-content: space-between; gap: 12px; color: #4d5b65; font-size: .76rem; }
.module strong { color: var(--ink); }
.included { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); color: #687985; font-size: .7rem; }

.boq { padding-top: 10px; }
.boq-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.table-shell { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 28px rgba(15,39,53,.04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid #e9edef; }
th { color: #60707b; background: #f2f6f7; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: .86rem; }
td:first-child { color: #bd1119; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 750; }
td:last-child, th:last-child { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
.boq-empty td { color: var(--muted); font-family: inherit; font-weight: 500; text-align: center; }
.boq-note { max-width: 850px; margin: 18px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.software-note { padding: 13px 15px; color: #4f5962; background: #f4f7f8; border-left: 3px solid var(--teal); }
.software-note a { color: #bd1119; font-weight: 700; }
.export-note { margin-top: 7px; color: #3f5965; }
.rules { padding-top: 10px; }
details { padding: 20px 24px; background: #eef3f5; border-radius: 13px; }
summary { cursor: pointer; font-weight: 780; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 36px; margin-top: 20px; }
.rules-grid p { margin: 0; }
.rules-grid strong, .rules-grid span { display: block; }
.rules-grid strong { margin-bottom: 4px; font-size: .82rem; }
.rules-grid span { color: var(--muted); font-size: .78rem; line-height: 1.5; }
footer { margin-top: 40px; padding: 30px 0; color: #a7a7a7; background: #050505; border-top: 4px solid var(--teal); font-size: .72rem; }
footer .section-wrap { display: grid; gap: 9px; }
footer strong { color: #fff; font-size: .78rem; }
footer p { max-width: 1000px; margin: 0; line-height: 1.65; }

@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; min-height: auto; padding: 58px 0 80px; }
  .hero-visual { display: none; }
  .row-fields { grid-template-columns: 1fr 1fr; }
  .project-bar { grid-template-columns: 1fr; }
  .project-options { grid-column: auto; grid-template-columns: 1fr; align-items: stretch; }
  .rack-reconciliation { grid-column: auto; }
  .row-fields .field:last-child { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .row-equipment { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 620px) {
  .section-wrap, .topbar, .hero-content { width: min(1180px, calc(100% - 24px)); }
  .topbar { min-height: 70px; flex-wrap: wrap; gap: 10px; padding: 12px 0 14px; }
  .brand small { display: none; }
  .topbar-actions { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .topbar-actions .button { width: 100%; min-width: 0; padding: 12px 10px; white-space: nowrap; }
  .hero-content { padding-top: 48px; }
  h1 { font-size: 2.7rem; }
  .project-bar { width: 100%; grid-template-columns: 1fr; gap: 18px; padding: 22px; }
  .project-fields { grid-template-columns: 1fr; }
  .project-options { grid-template-columns: 1fr; }
  .rack-reconciliation { grid-column: auto; align-items: flex-start; flex-direction: column; gap: 4px; }
  .workspace, .results, .boq, .rules { padding-block: 58px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .boq-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .boq-actions .button { width: 100%; }
  .row-card-head { grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 10px; }
  .row-fields { grid-template-columns: 1fr; }
  .row-fields .field:last-child { grid-column: auto; }
  .segmented { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric:last-child { grid-column: 1 / -1; }
  .row-equipment { grid-template-columns: 1fr 1fr; }
  .result-head { align-items: flex-start; flex-direction: column; }
  .coverage { text-align: left; }
  .rules-grid { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .hero { color: var(--ink); background: #fff; }
  .hero-content { min-height: auto; padding: 28px 0; }
  .hero h1 { color: var(--ink); font-size: 2.4rem; }
  .hero-copy, .hero-visual, .topbar-actions, .workspace, .project-fields, .project-options, .rack-reconciliation, .rules, .button { display: none !important; }
  .topbar { min-height: 55px; color: var(--ink); border-color: var(--line); }
  .brand small { color: var(--muted); }
  .project-bar { margin-top: 0; padding: 18px 0; border: 0; box-shadow: none; }
  .summary-band { padding: 25px 0; color: var(--ink); background: #eef3f5; }
  .metric { border-color: #ccd6db; }
  .metric span, .metric small { color: var(--muted); }
  .results, .boq { padding-block: 30px; }
  .result-card, .enclosure-card, .table-shell { break-inside: avoid; box-shadow: none; }
  footer { margin-top: 20px; padding: 18px 0; color: #444; background: #fff; border-top: 2px solid #111; }
  footer strong { color: #111; }
}
