:root {
    --bg: #071225;
    --surface: #0b192f;
    --surface-strong: #0e213d;
    --line: rgba(125, 211, 252, .2);
    --text: #e7eef8;
    --muted: #9fb0c4;
    --accent: #67e8f9;
    --accent-two: #818cf8;
}

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

body {
    min-height: 100vh;
    padding: 1.25rem;
    color: var(--text);
    background:
        radial-gradient(circle at 90% 0%, rgba(129, 140, 248, .2), transparent 30%),
        radial-gradient(circle at 0% 35%, rgba(103, 232, 249, .13), transparent 26%),
        var(--bg);
    font-family: "Barlow", sans-serif;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.calculator-topbar,
.calculator-page {
    width: min(1180px, 100%);
    margin-inline: auto;
}

.calculator-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 0 2.8rem;
}

.brand img {
    width: 180px;
    max-height: 54px;
    object-fit: contain;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
}

.back-link:hover {
    color: var(--accent);
}

.calculator-hero {
    max-width: 820px;
    margin-bottom: 2.7rem;
}

.eyebrow,
.section-label,
.required-label {
    color: var(--accent);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.eyebrow {
    display: inline-flex;
    padding: .42rem .7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(103, 232, 249, .08);
}

.calculator-hero h1 {
    margin: 1rem 0 .7rem;
    font-size: clamp(2.25rem, 5vw, 4rem);
    line-height: 1.02;
    letter-spacing: -.05em;
}

.calculator-hero h1 em {
    color: var(--accent);
    font-style: normal;
}

.calculator-hero p {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.preset-section {
    margin-bottom: 2.6rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .8rem;
    margin-top: .8rem;
}

.preset-card {
    display: grid;
    gap: .42rem;
    padding: 1.15rem;
    text-align: left;
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, .12);
    background: rgba(8, 20, 38, .72);
    cursor: pointer;
    transition: .2s ease;
}

.preset-card:hover,
.preset-card.is-active {
    border-color: rgba(103, 232, 249, .65);
    background: rgba(14, 33, 61, .95);
    box-shadow: inset 0 0 0 1px rgba(103, 232, 249, .12);
}

.preset-card strong {
    font-size: 1.05rem;
}

.preset-card span {
    color: var(--muted);
    line-height: 1.4;
}

.preset-card small {
    color: var(--accent);
    font-weight: 800;
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.5rem;
    align-items: start;
}

.calculator-options {
    display: grid;
    gap: 2.3rem;
}

.base-card,
.capacity-card,
.summary-card {
    border: 1px solid rgba(148, 163, 184, .13);
    background: rgba(8, 20, 38, .75);
}

.base-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem;
}

.base-card h2,
.capacity-card h2 {
    margin: .3rem 0;
    font-size: 1.2rem;
}

.base-card p,
.capacity-card p {
    color: var(--muted);
    line-height: 1.45;
}

.base-card > strong {
    flex: none;
    color: var(--text);
    font-size: 1.4rem;
}

.base-card > strong small {
    color: var(--muted);
    font-size: .75rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .8rem;
}

.module-card {
    position: relative;
    display: grid;
    min-height: 170px;
    align-content: start;
    gap: .55rem;
    padding: 1.15rem 4.5rem 1.15rem 1.15rem;
    border: 1px solid rgba(148, 163, 184, .12);
    background: rgba(8, 20, 38, .58);
    cursor: pointer;
    transition: .2s ease;
}

.module-card:has(input:checked) {
    border-color: rgba(103, 232, 249, .62);
    background: linear-gradient(145deg, rgba(15, 43, 70, .9), rgba(8, 20, 38, .76));
    box-shadow: inset 0 0 0 1px rgba(103, 232, 249, .1);
}

.module-card input {
    position: absolute;
    opacity: 0;
}

.module-card strong {
    font-size: 1rem;
}

.module-card small {
    color: var(--muted);
    line-height: 1.4;
}

.module-card b {
    margin-top: auto;
    color: var(--accent);
    font-size: .8rem;
}

.module-switch {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #17243a;
    border: 1px solid rgba(148, 163, 184, .16);
}

.module-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #65758d;
    transition: .2s ease;
}

.module-card input:checked + .module-switch {
    background: linear-gradient(120deg, var(--accent), var(--accent-two));
}

.module-card input:checked + .module-switch::after {
    left: 23px;
    background: #061225;
}

.capacity-card {
    padding: 1.35rem;
}

.capacity-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.capacity-title output {
    color: var(--accent);
    font-size: 1.7rem;
    font-weight: 900;
}

.capacity-card input[type="range"] {
    width: 100%;
    margin: 1.2rem 0 .7rem;
    accent-color: var(--accent);
}

.summary-card {
    position: sticky;
    top: 1.25rem;
    padding: 1.4rem;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}

.cycle-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 1rem 0 1.4rem;
    padding: .28rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #061225;
}

.cycle-toggle button {
    border: 0;
    border-radius: 10px;
    padding: .75rem .5rem;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

.cycle-toggle button.is-active {
    color: #061225;
    background: linear-gradient(120deg, var(--accent), var(--accent-two));
}

.cycle-toggle span {
    color: #8affc1;
}

.summary-price {
    display: grid;
    gap: .35rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.summary-price small,
.summary-price span,
.summary-help {
    color: var(--muted);
}

.summary-price strong {
    font-size: 2.65rem;
    letter-spacing: -.05em;
}

.summary-lines {
    display: grid;
    gap: .7rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.summary-lines div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
}

.summary-lines b {
    color: var(--text);
}

.discount-line b {
    color: #8affc1;
}

.selected-modules {
    padding: 1.1rem 0;
}

.selected-modules span {
    color: var(--muted);
    font-size: .8rem;
}

.selected-modules p {
    margin-top: .35rem;
    color: var(--text);
    line-height: 1.45;
}

.proposal-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: .95rem 1rem;
    border: 0;
    border-radius: 12px;
    color: #061225;
    background: linear-gradient(120deg, var(--accent), var(--accent-two));
    cursor: pointer;
    font-weight: 900;
}

.summary-help {
    display: block;
    margin-top: .75rem;
    text-align: center;
    font-size: .72rem;
}

html[data-theme="light"] body {
    --bg: #eef4f9;
    --surface: #ffffff;
    --surface-strong: #f3f8fd;
    --line: rgba(37, 99, 235, .17);
    --text: #081426;
    --muted: #4b6078;
    --accent: #0891b2;
    --accent-two: #6366f1;
    background:
        radial-gradient(circle at 90% 0%, rgba(129, 140, 248, .14), transparent 30%),
        radial-gradient(circle at 0% 35%, rgba(56, 189, 248, .12), transparent 26%),
        linear-gradient(180deg, #f9fcff, #eaf2f9);
}

html[data-theme="light"] .eyebrow {
    color: #075985;
    border-color: rgba(14, 165, 233, .22);
    background: rgba(14, 165, 233, .08);
}

html[data-theme="light"] .calculator-hero h1 em,
html[data-theme="light"] .section-label,
html[data-theme="light"] .required-label {
    color: #0369a1;
}

html[data-theme="light"] .preset-card,
html[data-theme="light"] .base-card,
html[data-theme="light"] .capacity-card,
html[data-theme="light"] .summary-card,
html[data-theme="light"] .module-card {
    color: var(--text);
    border-color: rgba(37, 99, 235, .14);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 16px 38px rgba(73, 105, 144, .08);
}

html[data-theme="light"] .preset-card:hover,
html[data-theme="light"] .preset-card.is-active,
html[data-theme="light"] .module-card:has(input:checked) {
    border-color: rgba(8, 145, 178, .5);
    background: linear-gradient(145deg, #eefcff, #f5f7ff);
    box-shadow: inset 0 0 0 1px rgba(8, 145, 178, .08), 0 16px 38px rgba(73, 105, 144, .1);
}

html[data-theme="light"] .preset-card small,
html[data-theme="light"] .module-card b,
html[data-theme="light"] .capacity-title output {
    color: #0369a1;
}

html[data-theme="light"] .module-switch {
    background: #d9e3ee;
    border-color: rgba(37, 99, 235, .12);
}

html[data-theme="light"] .module-switch::after {
    background: #71839a;
}

html[data-theme="light"] .module-card input:checked + .module-switch {
    background: linear-gradient(120deg, #22d3ee, #818cf8);
}

html[data-theme="light"] .cycle-toggle {
    border-color: rgba(37, 99, 235, .15);
    background: #e7eff8;
}

html[data-theme="light"] .cycle-toggle button {
    color: #42556d;
}

html[data-theme="light"] .cycle-toggle button.is-active {
    color: #061225;
    background: linear-gradient(120deg, #67e8f9, #818cf8);
}

html[data-theme="light"] .summary-price,
html[data-theme="light"] .summary-lines {
    border-color: rgba(37, 99, 235, .12);
}

html[data-theme="light"] .proposal-button {
    color: #061225;
    background: linear-gradient(120deg, #67e8f9, #818cf8);
    box-shadow: 0 12px 28px rgba(37, 99, 235, .14);
}

@media (max-width: 900px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .summary-card {
        position: static;
        order: -1;
    }
}

@media (max-width: 680px) {
    body {
        padding: .85rem;
    }

    .calculator-topbar {
        align-items: flex-start;
        padding-bottom: 2rem;
    }

    .brand img {
        width: 135px;
    }

    .back-link {
        font-size: .82rem;
    }

    .preset-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .base-card {
        align-items: flex-start;
        flex-direction: column;
    }
}
