* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    line-height: 1.7;
    color: #111;
    background: #fff;
}

.pricelist-page {
    background:
        radial-gradient(circle at top right, rgba(240, 90, 40, 0.14), transparent 20%),
        linear-gradient(180deg, #eef5f7 0%, #f9fbfc 100%);
    color: #173541;
}

.pricelist-shell {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.designer-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
    gap: 1.5rem;
}

.designer-main,
.designer-side {
    min-width: 0;
}

.designer-main {
    align-self: start;
}

.summary-sticky {
    position: sticky;
    top: 1.5rem;
}

.designer-card,
.summary-card {
    margin: 0 0.75rem 1.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(47, 95, 115, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 30px rgba(15, 40, 50, 0.07);
}

.designer-side .summary-card {
    margin-top: 0;
}

.designer-card h2,
.summary-card h2 {
    margin: 0 0 1rem;
}

.summary-heading-row {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.summary-heading-row h2 {
    margin-bottom: 0;
}

.builder-subsection {
    margin: 0.25rem 0 0.5rem;
    padding: 1.1rem 0 0;
    border-top: 1px solid #e3ecef;
}

.builder-subsection-nested {
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.builder-subsection h3 {
    margin: 0 0 0.9rem;
    color: #1c4656;
    font-size: 1.05rem;
}

.designer-grid {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

.designer-grid-tight {
    margin-bottom: 0.35rem;
}

.designer-field {
    padding: 0 0.75rem 1rem;
}

.designer-field-tight {
    padding: 0 0 0.85rem;
}

.designer-field-platform {
    max-width: 12rem;
}

.designer-field-qty {
    max-width: 8rem;
}

.designer-field label {
    display: block;
    margin: 0 0 0.45rem;
    color: #1c4656;
    font-size: 0.92rem;
    font-weight: 700;
}

.designer-field select {
    width: 100%;
    height: 3rem;
    padding: 0 0.85rem;
    border: 1px solid #c9d9de;
    border-radius: 12px;
    background: #fbfdfe;
    color: #173541;
}

.designer-field input[type="number"] {
    width: 100%;
    height: 3rem;
    padding: 0 0.85rem;
    border: 1px solid #c9d9de;
    border-radius: 12px;
    background: #fbfdfe;
    color: #173541;
    box-shadow: none;
}

.designer-field input[type="number"]::placeholder {
    color: #8aa2ac;
}

.field-note {
    margin: 0.4rem 0 0;
    color: #648391;
    font-size: 0.88rem;
    line-height: 1.4;
}

.rail-capacity {
    margin-top: 0.55rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    background: #f4f8fa;
}

.rail-capacity-bar {
    height: 0.5rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dbe7eb;
}

.rail-capacity-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f05a28 0%, #ff8a3d 100%);
}

.rail-capacity-copy {
    margin: 0.5rem 0 0;
    color: #456674;
    font-size: 0.84rem;
    line-height: 1.35;
}

.section-heading-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading-row h2 {
    margin: 0;
}

.designer-reset-button {
    padding: 0.45rem 0.9rem;
    border: 1px solid #c9d9de;
    border-radius: 999px;
    background: #fbfdfe;
    color: #1c4656;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.section-caption {
    margin: 0;
    color: #648391;
    font-size: 0.95rem;
}

.extras-list {
    display: grid;
    gap: 0.85rem;
}

.extra-option {
    display: flex;
    align-items: start;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid #d8e4e8;
    border-radius: 16px;
    background: #f8fbfc;
}

.extra-option input {
    margin-top: 0.25rem;
}

.extra-copy {
    flex: 1;
}

.extra-copy strong,
.extra-copy span {
    display: block;
}

.extra-copy span {
    color: #648391;
    font-size: 0.92rem;
}

.table-wrap {
    overflow-x: auto;
}

.pricing-table-detail {
    width: 100%;
    border-collapse: collapse;
}

.pricing-table-detail th,
.pricing-table-detail td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid #e3ecef;
    text-align: left;
    vertical-align: top;
}

.pricing-table-detail th {
    color: #5f7b87;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pricing-table-detail td:last-child,
.pricing-table-detail td:nth-last-child(2),
.pricing-table-detail th:last-child,
.pricing-table-detail th:nth-last-child(2) {
    text-align: right;
}

.pricing-table-detail td:nth-child(3),
.pricing-table-detail th:nth-child(3) {
    text-align: left;
}

.pricing-table-total td {
    padding-top: 1rem;
    border-top: 2px solid #d8e4e8;
    border-bottom: none;
    font-weight: 700;
    color: #173541;
    background: #f8fbfc;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.summary-card > .summary-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-metric {
    padding: 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, #f5fafb 0%, #edf4f6 100%);
}

.internal-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
    align-items: stretch;
}

.summary-label {
    display: block;
    color: #648391;
    font-size: 0.9rem;
}

.summary-metric strong {
    display: block;
    margin-top: 0.25rem;
    color: #163440;
    font-size: 1.3rem;
    line-height: 1.1;
}

.metric-input {
    width: 4.5rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #163440;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.1;
    box-shadow: none;
    outline: none;
    appearance: auto;
    -moz-appearance: auto;
}

.metric-input-wide {
    width: 100%;
}

.summary-metric .metric-input {
    font: inherit;
    color: inherit;
    font-weight: 700;
    line-height: inherit;
    vertical-align: baseline;
}

.metric-input:focus,
.metric-input:focus-visible {
    outline: none;
    box-shadow: none;
}

.totals-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: #173541;
    color: #eff8fa;
}

.total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.total-row + .total-row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.total-row strong {
    font-size: 1.15rem;
}

.total-row-featured strong {
    color: #ffd7ca;
    font-size: 1.45rem;
}

.total-row.total-row-featured {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.payback-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
}

.payback-panel .summary-label {
    color: rgba(239, 248, 250, 0.8);
}

.payback-panel strong {
    color: #fff7f0;
    font-size: 1.15rem;
    line-height: 1.1;
}

.mobile-summary-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #d7e4e8;
    border-radius: 999px;
    background: #f8fbfc;
    color: #1c4656;
    cursor: pointer;
}

.mobile-summary-toggle-icon {
    width: 0.7rem;
    height: 0.7rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    transition: transform 160ms ease;
}

.summary-card.summary-card-collapsed .savings-card {
    display: none;
}

.summary-card:not(.summary-card-collapsed) .mobile-summary-toggle-icon {
    transform: rotate(-135deg) translateY(1px);
}

.summary-notes {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 16px;
    background: #f8fbfc;
}

.summary-notes-tight {
    display: grid;
    gap: 0.65rem;
}

.savings-card {
    margin-top: 1rem;
}

.tariff-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.savings-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.solar-flow-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0.25rem;
}

.savings-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.25rem;
}

.savings-metrics-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bill-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.25rem;
}

.summary-metric-cost {
    background: linear-gradient(180deg, #fff2f2 0%, #ffe4e4 100%);
}

.summary-metric-benefit {
    background: linear-gradient(180deg, #edf9f0 0%, #dff3e5 100%);
}

.summary-metric-total {
    margin-top: 0.25rem;
    background: linear-gradient(180deg, #e6f5ea 0%, #d2edda 100%);
}

.annual-outcome-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.25rem;
}

.summary-metric-bill {
    margin-top: 0.25rem;
    background: linear-gradient(180deg, #fff2f2 0%, #ffe4e4 100%);
}

.summary-metric-bill.is-surplus {
    background: linear-gradient(180deg, #e6f5ea 0%, #d2edda 100%);
}

.summary-metric-longterm {
    margin-top: 0.25rem;
    background: linear-gradient(180deg, #edf4f6 0%, #e1ecef 100%);
}

.summary-notes h3 {
    margin: 0 0 0.65rem;
    color: #1c4656;
}

.summary-notes ul {
    margin: 0;
    padding-left: 1.2rem;
}

.total-row-compact {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.total-row-compact strong {
    color: #163440;
    font-size: 1rem;
}

@media (max-width: 63.99em) {
    .designer-layout {
        grid-template-columns: 1fr;
    }

    .designer-side {
        order: -1;
        position: sticky;
        top: 0;
        z-index: 25;
    }

    .designer-card,
    .summary-card {
        margin-left: 0;
        margin-right: 0;
    }

    .summary-sticky {
        position: static;
    }

    .summary-card {
        margin-bottom: 1rem;
        border-radius: 0 0 18px 18px;
    }

    .mobile-summary-hide {
        display: none;
    }
}

@media (max-width: 47.99em) {
    .pricelist-shell {
        width: 100%;
        padding-top: 0;
    }

    .designer-card,
    .summary-card {
        padding: 1rem;
    }

    .designer-side {
        top: 0;
        margin: 0;
    }

    .summary-card {
        margin: 0 0 0.75rem;
        border: none;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 10px 24px rgba(15, 40, 50, 0.08);
    }

    .section-heading-row,
    .total-row {
        align-items: start;
        flex-direction: column;
    }

    .summary-heading-row {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .summary-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .summary-metric {
        padding: 0.8rem;
    }

    .savings-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .savings-inputs {
        grid-template-columns: 1fr;
    }

    .solar-flow-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tariff-inputs,
    .bill-metrics,
    .savings-metrics-secondary,
    .annual-outcome-metrics {
        grid-template-columns: 1fr;
    }

    .summary-label {
        font-size: 0.8rem;
    }

    .summary-metric strong {
        font-size: 1rem;
    }

    .totals-panel {
        margin-top: 0.75rem;
        padding: 0.9rem;
    }

    .total-row-featured strong {
        font-size: 1.3rem;
    }

    .designer-field input[type="number"],
    .metric-input {
        appearance: textfield;
        -moz-appearance: textfield;
    }

    .designer-field input[type="number"]::-webkit-outer-spin-button,
    .designer-field input[type="number"]::-webkit-inner-spin-button,
    .metric-input::-webkit-outer-spin-button,
    .metric-input::-webkit-inner-spin-button {
        margin: 0;
        -webkit-appearance: none;
    }

    .metric-input {
        min-height: 1.4em;
    }
}
