.estimate-request-page {
    --estimate-font: system-ui, sans-serif;
    --estimate-max: 1380px;
    font-family: var(--estimate-font);
}

.estimate-request-page .container {
    width: min(calc(100% - clamp(24px, 4vw, 48px)), var(--estimate-max));
}

.estimate-request-page input,
.estimate-request-page select,
.estimate-request-page textarea,
.estimate-request-page button,
.estimate-request-page .btn,
.estimate-request-page .estimate-story,
.estimate-request-page .estimate-intro,
.estimate-request-page .estimate-note,
.estimate-request-page .estimate-panel,
.estimate-request-page .cart-card,
.estimate-request-page .receipt-card,
.estimate-request-page .sticky-cart-bar {
    font-family: inherit;
}

.estimate-note {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 1040px;
    margin: 0 auto 28px;
    padding: 18px;
    border: 1px solid rgba(147, 197, 253, 0.52);
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.05);
    color: #334155;
}

.estimate-note p {
    margin: 0;
    padding: 18px 20px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    line-height: 1.7;
}

.estimate-note strong {
    display: block;
    margin-bottom: 8px;
    color: #1d4ed8;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.estimate-story {
    position: relative;
    max-width: 1040px;
    margin: 0 auto 34px;
    padding: 30px 34px 32px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(96, 165, 250, 0.16), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.05);
}

.estimate-story .quote {
    margin: 0 auto 12px;
    max-width: 940px;
    color: #0f172a;
    font-size: clamp(24px, 2.4vw, 34px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.28;
    text-wrap: balance;
}

.estimate-story .sub {
    margin: 0 auto;
    max-width: 760px;
    color: #475569;
    font-size: clamp(16px, 1.45vw, 20px);
    line-height: 1.75;
    text-wrap: balance;
}

.estimate-intro {
    max-width: 960px;
    margin: 0 auto 24px;
    padding: 0 8px;
}

.estimate-intro h2 {
    margin: 0 0 14px;
    color: #0f172a;
    font-size: clamp(32px, 3.8vw, 44px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.estimate-intro p {
    margin: 0 auto;
    max-width: 840px;
    color: #334155;
    font-size: clamp(18px, 1.55vw, 22px);
    line-height: 1.7;
    text-wrap: balance;
}

.estimate-request-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
    margin: 0 auto 32px;
    max-width: 860px;
}

.estimate-request-main {
    overflow: hidden;
}

.estimate-panel {
    padding: 28px;
    border-top: 1px solid var(--line);
}

.estimate-panel:first-child {
    border-top: 0;
}

.step-nav {
    justify-content: center;
}

.estimate-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.address-grid,
.detail-grid,
.service-grid,
.window-count-grid,
.receipt-grid,
.estimate-type-toggle {
    display: grid;
    gap: 16px;
}

.address-grid,
.detail-grid,
.window-count-grid,
.receipt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.estimate-services-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "property"
        "main"
        "details";
    gap: 24px;
    margin-top: 22px;
    align-items: start;
}

.estimate-services-property,
.estimate-services-main,
.estimate-services-detail {
    min-width: 0;
}

.estimate-services-property {
    grid-area: property;
}

.estimate-services-main {
    grid-area: main;
}

.estimate-services-detail {
    grid-area: details;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.estimate-services-main .service-grid {
    margin-top: 0;
}

.estimate-services-main .group-error {
    display: block;
    margin-top: 12px;
}

.estimate-type-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.estimate-property-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.05);
}

.estimate-property-card .estimate-type-toggle {
    grid-template-columns: 1fr;
}

.estimate-property-card .check-item {
    min-height: 0;
}

.check-help {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.service-card {
    align-items: stretch;
    min-height: 100%;
}

.service-card-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
}

.service-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.service-card-title {
    display: block;
    color: #0f172a;
    font-size: 18px;
    font-weight: 700;
}

.service-card-meta {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.service-card-price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.service-card-detail {
    display: block;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
}

.detail-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
}

.detail-card h3 {
    margin: 0 0 6px;
    color: #1e293b;
    font-size: 20px;
}

.detail-card p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
}

.detail-card .form-field:last-child {
    margin-bottom: 0;
}

.service-detail-empty {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    border: 1px dashed #bfdbfe;
    border-radius: 14px;
    background: #f8fbff;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.service-detail-empty strong {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.service-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.estimate-services-detail .detail-card {
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.estimate-services-detail .detail-grid {
    grid-template-columns: 1fr;
}


.count-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
}

.count-card .form-label {
    margin-bottom: 8px;
    font-size: 16px;
}

.inline-price {
    display: block;
    margin-top: 4px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

.count-card .form-input {
    margin: 0;
}

.checkbox-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-stack .check-item {
    padding: 16px 18px;
}

.estimate-request-cart {
    min-width: 0;
}

.cart-card {
    position: sticky;
    top: 96px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.cart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.cart-head .step-title {
    margin: 0;
    font-size: 24px;
}

.cart-total-wrap {
    min-width: 116px;
    text-align: right;
}

.cart-total-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cart-total {
    display: block;
    color: #0f172a;
    font-size: 32px;
    line-height: 1.1;
}

.cart-description {
    margin: 0 0 18px;
    color: var(--muted);
}

.cart-list {
    min-height: 220px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.cart-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
}

.cart-row + .cart-row {
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.cart-row-label {
    flex: 1;
    color: #334155;
    line-height: 1.45;
}

.cart-row-sub {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.cart-row-amount {
    flex-shrink: 0;
    color: #0f172a;
    font-weight: 700;
    text-align: right;
}

.cart-row-amount.discount {
    color: #166534;
}

.cart-row-amount.quote {
    color: #475569;
    font-weight: 600;
}

.cart-empty {
    padding: 18px 0;
    color: var(--muted);
}

.cart-footer {
    padding-top: 16px;
}

.cart-footer .cart-row {
    margin-bottom: 10px;
    padding: 0;
    border-top: 0;
}

.cart-minimum-note {
    min-height: 22px;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.cart-caption {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.estimate-actions {
    align-items: center;
    justify-content: space-between;
}

.estimate-inline-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.estimate-outline-btn {
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: none;
    color: #1e293b;
}

.estimate-outline-btn:hover {
    background: var(--panel);
}

.consent-card {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.estimate-receipt {
    overflow: hidden;
    margin-bottom: 32px;
}

.receipt-grid {
    padding: 0 28px 28px;
}

.receipt-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
}

.receipt-card-wide {
    grid-column: 1 / -1;
}

.receipt-card h4 {
    margin: 0 0 12px;
    color: #1e293b;
    font-size: 18px;
}

.receipt-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.receipt-list li {
    padding: 10px 0;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
    color: #334155;
    line-height: 1.45;
}

.receipt-list li:first-child {
    padding-top: 0;
    border-top: 0;
}

.receipt-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.receipt-actions {
    justify-content: flex-start;
    padding: 0 28px 28px;
}

.receipt-send-error {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 8px;
    border-left: 4px solid #ef4444;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 15px;
    line-height: 1.55;
}

.receipt-send-error a {
    color: #b91c1c;
    font-weight: 600;
}

.sticky-cart-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.97);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.18);
    color: #fff;
}

.sticky-cart-label {
    display: block;
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sticky-cart-total {
    display: block;
    font-size: 24px;
    line-height: 1.1;
}

.sticky-cart-btn {
    padding: 12px 18px;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1100px) {
    .estimate-story {
        padding: 26px 24px 28px;
    }
}

/* ── Desktop / tablet: cart as horizontal sticky bar at bottom ── */
@media (min-width: 769px) {
    .estimate-request-page main {
        padding-bottom: 88px;
    }

    .estimate-request-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 900;
        min-width: 0;
    }

    .cart-card {
        position: static;
        top: auto;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 0;
        padding: 0;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
        background: #0f172a;
        color: #fff;
        box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.35);
        min-height: 80px;
    }

    /* Left section: label + title */
    .cart-head {
        flex: 0 0 auto;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 3px;
        margin-bottom: 0;
        padding: 12px 20px;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }

    .cart-head .estimate-kicker {
        color: #93c5fd;
    }

    .cart-head .step-title {
        color: #fff;
        font-size: 15px;
        margin: 0;
    }

    .cart-head .cart-total-wrap {
        display: none;
    }

    /* Middle: description (empty state) */
    .cart-description {
        display: flex;
        align-items: center;
        flex: 1;
        margin: 0;
        padding: 0 20px;
        color: rgba(255, 255, 255, 0.45);
        font-size: 13px;
        min-width: 0;
    }

    /* Middle: items (filled state) */
    .cart-list {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 0;
        padding: 0;
        border: none;
        min-height: 0;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    }

    /* Hide description once items exist */
    .cart-card:has(#cart-list:not(:empty)) .cart-description {
        display: none;
    }

    #cart-list:empty {
        display: none;
    }

    .cart-empty {
        display: none;
    }

    .cart-row {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 10px 18px;
        gap: 2px;
        border-top: none;
        border-right: 1px solid rgba(255, 255, 255, 0.07);
        white-space: nowrap;
        flex-shrink: 0;
    }

    .cart-row + .cart-row {
        border-top: none;
    }

    .cart-row-label {
        color: rgba(255, 255, 255, 0.85);
        font-size: 12px;
        line-height: 1.35;
    }

    .cart-row-sub {
        color: rgba(255, 255, 255, 0.45);
        font-size: 11px;
    }

    .cart-row-amount {
        color: #93c5fd;
        font-size: 15px;
        font-weight: 700;
        text-align: left;
    }

    .cart-row-amount.discount {
        color: #86efac;
    }

    .cart-row-amount.quote {
        color: rgba(255, 255, 255, 0.5);
    }

    /* Right section: total */
    .cart-footer {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        padding: 12px 24px;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        border-top: none;
        min-width: 152px;
        gap: 3px;
    }

    .cart-footer .cart-total-wrap {
        text-align: right;
    }

    .cart-footer .cart-total-label {
        color: rgba(255, 255, 255, 0.55);
        font-size: 11px;
    }

    #cart-footer-total {
        color: #fff;
        font-size: 26px;
        line-height: 1.1;
    }

    .cart-minimum-note {
        color: #93c5fd;
        font-size: 11px;
        text-align: right;
        min-height: 0;
    }

    .cart-caption {
        display: none;
    }

    /* Keep mobile sticky bar off on non-mobile */
    .sticky-cart-bar {
        display: none !important;
    }
}

@media (max-width: 820px) {
    .estimate-note {
        grid-template-columns: 1fr;
    }

    .address-grid,
    .detail-grid,
    .service-grid,
    .window-count-grid,
    .receipt-grid,
    .estimate-type-toggle {
        grid-template-columns: 1fr;
    }

    .estimate-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    main {
        padding-bottom: 120px;
    }

    .cart-card {
        position: static;
    }

    .cart-list {
        min-height: 0;
    }

    .estimate-story {
        margin-bottom: 28px;
        padding: 24px 18px 26px;
    }

    .estimate-story .quote {
        font-size: clamp(22px, 7vw, 28px);
        text-align: center;
    }

    .estimate-story .sub {
        font-size: 16px;
        text-align: center;
    }

    .estimate-intro {
        margin-bottom: 20px;
        padding: 0;
    }

    .estimate-intro h2 {
        font-size: clamp(28px, 8vw, 36px);
    }

    .estimate-intro p {
        font-size: 17px;
    }

    .estimate-note {
        padding: 14px;
        margin-bottom: 22px;
    }

    .estimate-note p {
        padding: 16px 16px 17px;
    }

    .estimate-panel {
        padding: 22px 18px;
    }

    .estimate-panel > .estimate-kicker,
    .estimate-panel > .step-title,
    .estimate-panel > .step-subtitle {
        text-align: center;
    }

    .cart-card {
        padding: 20px;
    }

    .cart-total {
        font-size: 28px;
    }

    .receipt-grid,
    .receipt-actions {
        padding-right: 18px;
        padding-left: 18px;
    }

    .sticky-cart-bar[hidden] {
        display: none !important;
    }

    .sticky-cart-bar {
        display: flex;
    }
}
