@import url('fonts-local.css');
:root {
    --bg: #edf2f7;
    --card: #ffffff;
    --text: #13283a;
    --muted: #617487;
    --line: #d7e1ea;
    --primary: #0b5f7f;
    --primary-strong: #08465d;
    --accent: #15986c;
    --danger: #b23535;
    --soft: #f6fafc;
    --brand-display: "League Spartan", "Montserrat", "Segoe UI", Arial, sans-serif;
    --brand-body: "Montserrat", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--brand-body);
    color: var(--text);
    background: #ffffff;
}

.app-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 16px 52px;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(11, 33, 54, 0.07);
    padding: 20px;
}

.hero,
.result-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
}

.hero::before,
.result-hero::before {
    display: none;
}

.hero .tag {
    margin: 0;
    display: inline-flex;
    border: 1px solid #bad9ea;
    background: #f2f9fd;
    color: var(--primary);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.brand-lockup {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.brand-lockup.compact {
    margin-bottom: 10px;
    gap: 6px;
}

.brand-logo {
    width: 191px;
    height: auto;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: transparent;
}

/* Toggle PRESULINK fallback light/dark: solo aplica cuando NO hay logo de
   empresa subido (clases .brand-logo-light / .brand-logo-dark). Si el user
   tiene su logo propio, sale una sola <img> sin estas clases y este CSS no
   le afecta. */
.brand-logo-fallback.brand-logo-dark { display: none; }
html[data-theme="dark"] .brand-logo-fallback.brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-fallback.brand-logo-dark  { display: block; }

/* Nombre de empresa siempre debajo del logo en el wizard (V46).
   color usa var(--text) → cambia automaticamente con el tema. */
.brand-lockup-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.1;
    color: var(--text, #132d46);
    text-align: center;
}
.brand-lockup.compact .brand-lockup-name { font-size: 18px; }
.brand-lockup-name[data-name-font="bebas"] {
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
html[data-theme="dark"] .brand-lockup-name { color: var(--text, #e8eef4); }

.hero h1 {
    margin: 12px 0 8px;
    font-size: 34px;
    line-height: 1.15;
    font-family: var(--brand-display);
    font-weight: 700;
}

.hero p { margin: 0; color: var(--muted); }

.hero-slogan {
    margin-top: 10px !important;
    color: var(--primary) !important;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
}

.hero-meta {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.datetime-badge {
    font-size: 12px;
    color: #4f6779;
    border: 1px solid #d9e6ef;
    background: #ffffff;
    border-radius: 999px;
    padding: 4px 10px;
    letter-spacing: .2px;
}

.stepper {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    /* Flex (no grid fijo de 6): se reparte SOLO entre los pasos visibles. Antes
       era grid-template-columns: repeat(6, 1fr) → con tarifas de 3 pasos
       (Trabajos/Condiciones/Revisión) quedaban apretados a la izquierda y la
       mitad derecha vacía. Con flex + flex:1 por <li>, N pasos = N iguales. */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stepper li {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.stepper li .step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #e7eff5;
    color: var(--muted);
}

.stepper li.active {
    border-color: #9ec4d9;
    color: var(--primary);
    background: #eef8ff;
}

.stepper li.active .step-num {
    background: var(--primary);
    color: #fff;
}

.stepper li.done {
    border-color: #bfe4d4;
    color: #177f5a;
    background: #f2fbf7;
}

.stepper li.done .step-num {
    background: var(--accent);
    color: #fff;
}

.step { display: none; }
#budgetWizard:not(.wizard-ready) .step[data-step="1"] { display: block; }
#budgetWizard.wizard-ready .step.active { display: block; }

.step h2 { margin: 0; font-size: 24px; }
.step h2 { font-family: var(--brand-display); font-weight: 700; }
.subtitle { margin: 8px 0 14px; color: var(--muted); }

.mode-card-shell h2,
.m2-window h2 {
    margin: 0;
    font-size: 28px;
    font-family: var(--brand-display);
    font-weight: 700;
}

.mode-grid {
    grid-template-columns: repeat(2, 1fr);
}

.mode-choice {
    min-height: 132px;
    justify-content: center;
    position: relative;
    padding-top: 30px;
}

.mode-choice strong {
    font-size: 22px;
    font-family: var(--brand-display);
}

.mode-choice small {
    font-size: 13px;
}

.mode-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #c62828;
    color: #ffffff;
    border: 1px solid #9a1f1f;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .4px;
}

.mode-nav {
    justify-content: flex-end;
}

.mode-nav-primary {
    justify-content: center;
    margin-top: 16px;
}

.mode-nav-primary .btn {
    min-width: 230px;
}

.m2-window .flow-map {
    background: #f4faff;
}

.grid-cards {
    display: grid;
    gap: 10px;
}

.reform-grid { grid-template-columns: repeat(2, 1fr); }
.chapter-grid { grid-template-columns: repeat(2, 1fr); }

.option-card {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    position: relative;
}

.option-card:hover {
    border-color: #9fc2d8;
    box-shadow: 0 8px 16px rgba(12, 68, 95, 0.08);
    transform: translateY(-1px);
}

.option-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Tarjetas de items custom (definidos por el usuario en el editor de tarifas).
   Se diferencian sutilmente con un ribbon verde JUMA y un fondo levemente
   teñido para que se distingan visualmente de los del sistema. */
.option-card-custom {
    border-color: #cfe6dd;
    background: #f7fcfa;
}
.option-card-custom:hover {
    border-color: #19a677;
    box-shadow: 0 8px 16px rgba(25, 166, 119, 0.14);
}
.option-card-custom.selected {
    border-color: #19a677;
    background: #ecfdf5;
}
/* Badge de precio visible en las option-card del paso "Trabajos" cuando la
   acción custom es PER_UNIT/FIXED con price definido. Aparece abajo a la
   derecha de la card sin alterar el grid existente. */
.option-card .option-card-price {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: rgba(25, 166, 119, 0.12);
    color: #0f6d4d;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
    align-self: flex-start;
}
.option-card.selected .option-card-price {
    background: #19a677; color: #fff;
}
.mode-badge-custom {
    background: linear-gradient(140deg, #14678b 0%, #19a677 100%);
    color: #fff;
}

.option-card.selected {
    border-color: #9ec4d9;
    background: #edf7ff;
    box-shadow: 0 10px 18px rgba(12, 68, 95, 0.10);
}

.option-card.selected strong {
    color: var(--primary);
}

.option-card.selected small {
    color: #4d6e84;
}

.option-card strong { font-size: 15px; }
.option-card small { color: var(--muted); font-size: 12px; }

.chapter-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.info-chip {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #9fc2d8;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    background: #eef8ff;
    position: relative;
    flex-shrink: 0;
    cursor: help;
}

.info-chip::after {
    content: attr(data-info);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(260px, 68vw);
    border-radius: 8px;
    border: 1px solid #bed5e5;
    background: #ffffff;
    color: var(--text);
    padding: 8px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 10px 20px rgba(11, 33, 54, 0.14);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 5;
}

.info-chip:hover::after,
.info-chip:focus::after {
    opacity: 1;
}

.field-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, 1fr);
}

.field-group {
    grid-column: 1 / -1;
    border: 1px solid #d5e1ea;
    border-radius: 12px;
    background: #f9fcff;
    padding: 12px;
}

.field-group h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #18384f;
}

.nested-grid {
    grid-template-columns: repeat(2, 1fr);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: #2b455a;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 600 !important;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    padding: 10px;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.checkbox-inline.selected {
    border-color: #9ec4d9;
    background: #edf7ff;
    box-shadow: 0 8px 14px rgba(12, 68, 95, 0.08);
}

input[type="number"],
select {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 10px;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: 2px solid rgba(11, 95, 127, 0.2);
    outline-offset: 1px;
}

.hidden { display: none !important; }

.zone-autofill {
    border: 1px solid #c8dceb;
    border-radius: 10px;
    background: #f4faff;
    color: #2f566f;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.disabled-grid {
    opacity: 0.75;
}

.disabled-grid .option-card {
    cursor: default;
}

.conditions-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, 1fr);
}

.vat-field {
    max-width: 420px;
    margin-bottom: 12px;
}

.conditions-grid label {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    padding: 10px;
    display: flex;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.conditions-grid label.selected {
    border-color: #9ec4d9;
    background: #edf7ff;
    box-shadow: 0 8px 14px rgba(12, 68, 95, 0.08);
}

.flow-map {
    border: 1px dashed #b9cad8;
    border-radius: 12px;
    background: #f8fcff;
    padding: 12px;
}

.flow-map p { margin: 8px 0; color: var(--muted); }

.phase-banner {
    border: 1px solid #cde0ed;
    border-radius: 12px;
    background: #f3f9ff;
    padding: 10px 12px;
    margin: 0 0 12px;
}

.phase-counter {
    margin: 0 0 4px;
    color: #3b6078;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
}

.phase-banner h3 {
    margin: 0;
    font-size: 18px;
    font-family: var(--brand-display);
}

.phase-banner-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.phase-amount-box {
    border: 1px solid #bcd6e7;
    border-radius: 10px;
    background: #ffffff;
    padding: 8px 10px;
    min-width: 160px;
    text-align: right;
}

.phase-amount-box span {
    display: block;
    font-size: 11px;
    color: #4a697f;
    font-weight: 700;
    letter-spacing: .2px;
}

.phase-amount-box strong {
    display: block;
    margin-top: 2px;
    color: #0b5f7f;
    font-size: 20px;
    line-height: 1.1;
    font-family: var(--brand-display);
}

.phase-help {
    margin: 6px 0 0;
    color: #49667c;
    font-size: 13px;
}

.phase-input-grid {
    margin-top: 12px;
    border: 1px solid #d8e6f0;
    border-radius: 12px;
    background: #f8fcff;
    padding: 12px;
}

.wizard-nav {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.btn-ghost {
    background: #ecf2f7;
    color: #335066;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover { background: var(--primary-strong); }

#submitBtn { display: none; margin-left: auto; }
#nextBtn { margin-left: auto; }

.step-alert {
    display: none;
    margin: 0;
    color: #8f2f2f;
    font-size: 13px;
    font-weight: 700;
}

.step-alert.visible { display: block; }

.server-alert {
    border: 1px solid #f0c6c6;
    background: #fff3f3;
    color: #8f2f2f;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
}

.input-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(178, 53, 53, 0.12);
}

.error {
    margin: 0;
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 16px;
    align-self: start;
}

.sticky {}

.sticky h3 { margin: 0 0 12px; font-size: 20px; }
.sticky h3 { font-family: var(--brand-display); }

.kpi-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}

.kpi-grid article {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f9fcff;
    padding: 10px;
}

.kpi-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.kpi-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
}

.live-amount {
    margin-top: 10px;
    border-radius: 12px;
    background: linear-gradient(120deg, var(--primary), var(--accent));
    color: #fff;
    padding: 12px;
}

.live-amount p { margin: 0 0 6px; opacity: 0.92; }
.live-amount strong { font-size: 24px; line-height: 1; }

.mobile-phase-banner {
    display: none;
}

.legal {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.table th, .table td {
    padding: 8px;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.table th {
    background: #eef6fb;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.breakdown {
    margin: 10px 0 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.breakdown div {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.breakdown div:last-child { border-bottom: 0; }
.breakdown dd { margin: 0; font-weight: 800; }

.total-box {
    margin-top: 10px;
    border-radius: 12px;
    background: #0c607d;
    color: #fff;
    padding: 12px;
}

.total-box span {
    display: block;
    opacity: .85;
    font-size: 12px;
}

.total-box strong {
    display: block;
    font-size: 30px;
    line-height: 1.05;
    margin-top: 4px;
}

.whatsapp-btn {
    margin-top: 10px;
    display: inline-block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    background: #1dbe62;
    color: #fff;
    border-radius: 10px;
    padding: 11px;
    font-weight: 800;
}

.result-hero h1 {
    font-family: var(--brand-display);
    font-weight: 700;
}

.result-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 16px 52px;
    display: grid;
    gap: 16px;
}

.result-main-card {
    padding: 24px;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.table.large th, .table.large td {
    font-size: 14px;
    padding: 10px;
}

.scope-sheet {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    padding: 14px;
}

.scope-sheet h2 {
    margin: 0;
    font-size: 22px;
    font-family: var(--brand-display);
}

.scope-sheet > p {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.scope-card {
    border: 1px solid #d9e3ec;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fafdff 100%);
    padding: 12px;
    margin-top: 10px;
}

.scope-card:nth-of-type(even) {
    border-left-color: var(--accent);
}

.scope-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.scope-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.scope-card ul {
    margin: 10px 0 0;
    padding-left: 18px;
}

.scope-card li {
    margin: 5px 0;
    font-size: 13px;
}

.scope-metrics {
    margin-top: 10px;
    border-top: 1px dashed #c9d6e2;
    padding-top: 10px;
    display: grid;
    gap: 6px;
    background: #f4f9fc;
    border-radius: 8px;
    padding: 10px;
}

.scope-metrics span {
    font-size: 13px;
    color: #2f4a5f;
}

.scope-metrics strong {
    font-size: 15px;
    color: var(--primary-strong);
}

.scope-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed #d5e1eb;
    padding-bottom: 6px;
}

.scope-metric-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.scope-metric-label {
    font-size: 13px;
    color: #2f4a5f;
}

.scope-metric-value {
    margin-left: auto;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    color: #16384d;
}

.scope-metric-total .scope-metric-label,
.scope-metric-total .scope-metric-value {
    font-size: 16px;
    color: var(--primary-strong);
}

.breakdown.large div {
    font-size: 14px;
    padding: 10px 12px;
}

.total-box.huge strong {
    font-size: 52px;
}

.no-print {}

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 1fr; }
    .side-panel { position: static; }
}

@media (max-width: 860px) {
    .app-shell.mobile-flow-active .wizard-panel > .hero {
        display: none;
    }
    .app-shell.mobile-flow-active .side-panel {
        display: none;
    }
    .app-shell {
        padding: 14px 8px 28px;
        gap: 12px;
    }
    .card {
        padding: 14px;
        border-radius: 14px;
    }
    .hero {
        padding: 10px 12px 12px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "meta"
            "brand"
            "title"
            "subtitle"
            "slogan";
        text-align: center;
    }
    .hero h1,
    .hero p:not(.hero-slogan),
    .hero-slogan {
        text-align: center;
    }
    .hero-meta {
        justify-content: center;
    }
    .brand-lockup {
        justify-content: center;
    }
    .hero h1 {
        margin: 6px 0 4px;
        font-size: 20px;
        line-height: 1.1;
    }
    .hero p {
        font-size: 13px;
    }
    .hero-slogan {
        margin-top: 6px !important;
        font-size: 13px;
    }
    .hero-meta {
        margin-bottom: 4px;
    }
    .datetime-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    .brand-logo {
        width: 104px;
    }
    .stepper {
        display: none;
    }
    .reform-grid,
    .mode-grid,
    .chapter-grid,
    .field-grid,
    .conditions-grid {
        grid-template-columns: 1fr;
    }
    .wizard-nav {
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid var(--line);
        padding-top: 10px;
        margin-top: 14px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    .result-actions {
        justify-content: stretch;
    }
    .result-actions .btn,
    .result-actions a.btn {
        flex: 1 1 100%;
        text-align: center;
    }
    .result-main-card .breakdown.large div {
        gap: 8px;
        align-items: flex-start;
    }
    .result-main-card .breakdown.large dt {
        flex: 0 0 42%;
        max-width: 42%;
    }
    .result-main-card .breakdown.large dd {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }
    .result-main-card .breakdown.large div.summary-row-trabajos dd {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
    }
    .phase-banner-header {
        flex-direction: column;
        align-items: stretch;
    }
    .app-shell.mobile-flow-active #integralPhaseBanner {
        display: none !important;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner {
        display: block;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner.phase-banner {
        position: sticky;
        top: 6px;
        z-index: 44;
        border-color: #9ec4d9;
        background: #f4faff;
        box-shadow: 0 10px 18px rgba(12, 68, 95, 0.12);
        margin-bottom: 10px;
    }
    .app-shell.mobile-flow-active .mobile-phase-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-counter {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .35px;
        color: var(--primary);
    }
    .app-shell.mobile-flow-active .mobile-phase-banner h3 {
        font-size: 26px;
        color: var(--primary-strong);
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-help {
        margin-top: 8px;
        font-size: 12px;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-amount-box {
        min-width: 0;
        text-align: left;
        padding: 8px 9px;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-amount-box span {
        font-size: 10px;
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-amount-box strong {
        font-size: 22px;
    }
}

@media print {
    @page {
        margin: 12mm;
    }
    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .no-print {
        display: none !important;
    }
    .result-shell {
        display: block;
        max-width: 100%;
        padding: 0;
    }
    .card {
        box-shadow: none;
        border: 0;
        padding: 0;
        margin-bottom: 8mm;
    }
    .result-hero {
        page-break-after: avoid;
    }
    .scope-card {
        border: 1px solid #d9d9d9;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }
    .breakdown,
    .total-box {
        page-break-inside: avoid;
        break-inside: avoid-page;
    }
    .total-box.huge {
        border: 2px solid #111;
        background: #fff;
        color: #111;
        margin-top: 16px;
    }
}

/* Premium visual system override */
:root {
    --bg-0: #e9eef5;
    --bg-1: #f4f8ff;
    --bg-2: #dff8f0;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --surface-soft: rgba(251, 254, 255, 0.82);
    --text: #10273a;
    --muted: #5a6f83;
    --line: rgba(158, 184, 206, 0.44);
    --line-strong: rgba(124, 161, 188, 0.58);
    --primary: #105f87;
    --primary-strong: #0b4667;
    --accent: #19a677;
    --accent-soft: #c9f0e0;
    --danger: #ba3e3e;
    --elev-1: 0 8px 20px rgba(17, 45, 69, 0.08);
    --elev-2: 0 16px 38px rgba(16, 52, 80, 0.12);
    --elev-3: 0 24px 48px rgba(13, 45, 77, 0.18);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(1100px 680px at -8% -18%, rgba(161, 145, 255, 0.30) 0%, rgba(161, 145, 255, 0) 58%),
        radial-gradient(920px 560px at 108% -12%, rgba(74, 200, 164, 0.24) 0%, rgba(74, 200, 164, 0) 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

main {
    position: relative;
}

.app-shell::before,
.app-shell::after {
    content: "";
    position: fixed;
    z-index: 0;
    width: 150px;
    height: 150px;
    pointer-events: none;
    opacity: 0.28;
    background-image: radial-gradient(circle, rgba(103, 114, 247, 0.95) 1.4px, transparent 1.6px);
    background-size: 14px 14px;
    filter: blur(0.2px);
}

.app-shell::before {
    left: 28px;
    top: 170px;
}

.app-shell::after {
    right: 32px;
    bottom: 120px;
}

.app-shell,
.result-shell {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    padding: 32px 20px 64px;
    gap: 24px;
}

.card {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    backdrop-filter: blur(8px);
    box-shadow: var(--elev-1);
    transition: transform .32s ease, box-shadow .32s ease, border-color .32s ease, background-color .32s ease;
}

.card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--elev-2);
}

.hero,
.result-hero {
    padding: 22px 26px;
    border-radius: 24px;
    border: 1px solid rgba(166, 192, 212, 0.5);
    background:
        radial-gradient(460px 180px at 87% 104%, rgba(118, 105, 255, 0.32) 0%, rgba(118, 105, 255, 0) 72%),
        linear-gradient(132deg, rgba(255, 255, 255, 0.94) 0%, rgba(245, 250, 255, 0.9) 55%, rgba(244, 255, 251, 0.88) 100%);
}

.hero {
    display: grid;
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    grid-template-areas:
        "meta meta"
        "brand title"
        "brand subtitle"
        "brand slogan";
    align-items: center;
    column-gap: 24px;
}

.hero-meta {
    grid-area: meta;
    margin-bottom: 10px;
}

.datetime-badge {
    border: 1px solid rgba(166, 190, 208, 0.46);
    background: rgba(255, 255, 255, 0.74);
    color: #3f5971;
    padding: 6px 12px;
    font-size: 12px;
    box-shadow: 0 8px 14px rgba(15, 57, 88, 0.08);
}

.brand-lockup {
    grid-area: brand;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    align-self: center;
    gap: 8px;
}

.brand-logo {
    width: min(225px, 100%);
}

.hero h1 {
    grid-area: title;
    margin: 0;
    text-align: left;
    font-size: clamp(26px, 2.4vw, 38px);
    letter-spacing: -0.6px;
    color: #0f2740;
}

.hero p:not(.hero-slogan) {
    grid-area: subtitle;
    text-align: left;
    margin: 6px 0 0;
    color: #556f85;
    font-size: 16px;
}

.hero-slogan {
    grid-area: slogan;
    margin-top: 8px !important;
    text-align: left;
    color: #4c36cb !important;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.mode-card-shell {
    border: 1px solid rgba(166, 191, 214, 0.56);
    background: linear-gradient(180deg, rgba(252, 254, 255, 0.96) 0%, rgba(246, 250, 255, 0.92) 100%);
    box-shadow: var(--elev-1);
}

.mode-card-shell h2 {
    font-size: clamp(24px, 1.9vw, 32px);
    color: #152f46;
    letter-spacing: -0.4px;
}

.mode-card-shell .subtitle {
    font-size: 15px;
    margin-top: 8px;
    color: #60798f;
}

.mode-grid {
    gap: 12px;
    margin-top: 8px;
}

.mode-choice {
    min-height: 124px;
}

.mode-choice strong {
    margin-top: 6px;
    font-size: 22px;
    letter-spacing: -0.4px;
}

.mode-choice small {
    margin-top: 2px;
    font-size: 13px;
    color: #668098;
}

.mode-badge {
    background: linear-gradient(135deg, #d7284e 0%, #b3203f 100%);
    border: 0;
    box-shadow: 0 8px 14px rgba(164, 22, 51, 0.3);
    padding: 5px 10px;
}

.stepper {
    margin-bottom: 18px;
    gap: 12px;
}

.stepper li {
    position: relative;
    border-radius: 16px;
    border: 1px solid rgba(169, 188, 208, 0.56);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(242, 247, 255, 0.92) 100%);
    color: #60798f;
    font-size: 15px;
    font-weight: 700;
    min-height: 52px;
    gap: 10px;
    box-shadow: 0 8px 16px rgba(10, 44, 69, 0.08);
}

.stepper li .step-num {
    position: relative;
    width: 30px;
    height: 30px;
    font-size: 12px;
    font-weight: 800;
    background: #e7edf5;
    color: #60798f;
}

.stepper li .step-num::after {
    content: attr(data-icon);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: "Material Symbols Rounded", sans-serif;
    font-size: 18px;
    color: inherit;
}

.stepper li.active {
    color: #274760;
    border-color: rgba(93, 123, 242, 0.5);
    background: linear-gradient(90deg, rgba(93, 123, 242, 0.23) 0%, rgba(85, 209, 176, 0.2) 100%);
    box-shadow: 0 10px 20px rgba(52, 91, 214, 0.17);
}

.stepper li.active .step-num,
.stepper li.done .step-num {
    color: #ffffff;
}

.stepper li.active .step-num {
    background: linear-gradient(140deg, #5976f7 0%, #3ca4ff 100%);
}

.stepper li.done {
    color: #356e57;
    border-color: rgba(109, 210, 173, 0.56);
    background: linear-gradient(90deg, rgba(118, 224, 184, 0.2) 0%, rgba(145, 208, 255, 0.2) 100%);
}

.stepper li.done .step-num {
    background: linear-gradient(145deg, #1fa877 0%, #16c89f 100%);
}

.step h2 {
    font-size: clamp(26px, 2vw, 34px);
    letter-spacing: -0.5px;
    color: #132d46;
}

.subtitle {
    margin-top: 6px;
    font-size: 15px;
    color: #60798f;
}

.grid-cards {
    gap: 10px;
}

.option-card {
    position: relative;
    min-height: 104px;
    padding: 10px 12px 10px 70px;
    border: 1px solid rgba(169, 190, 210, 0.58);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 249, 255, 0.92) 100%);
    box-shadow: 0 6px 12px rgba(11, 42, 67, 0.07);
    transform-origin: center;
    will-change: transform, box-shadow;
    transition: border-color .28s ease, box-shadow .28s ease, transform .2s ease, background .28s ease;
}

.option-card::before {
    content: attr(data-icon);
    position: absolute;
    left: 12px;
    top: 14px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: "Material Symbols Rounded", sans-serif;
    font-size: 23px;
    color: #2f5d84;
    background-color: #e5f0fb;
    border: 1px solid rgba(124, 161, 188, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: background-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}

.option-card strong {
    font-size: 19px;
    line-height: 1.08;
    letter-spacing: -0.4px;
    color: #17334c;
    font-family: var(--brand-display);
}

.option-card small {
    font-size: 13px;
    line-height: 1.34;
    color: #5e768d;
}

.reform-grid .option-card strong {
    font-size: 26px;
}

.mode-grid .option-card strong {
    font-size: 22px;
}

.chapter-grid .option-card strong {
    font-size: 19px;
}

.option-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(11, 49, 77, 0.13), 0 4px 10px rgba(11, 49, 77, 0.07);
    border-color: rgba(98, 136, 164, 0.58);
}

.option-card:active,
.option-card.is-pressed {
    transform: scale(0.96) !important;
    box-shadow: 0 1px 4px rgba(11, 42, 67, 0.10) !important;
    transition: transform .22s cubic-bezier(.4, 0, .2, 1),
                box-shadow .22s cubic-bezier(.4, 0, .2, 1) !important;
}

.option-card.selected {
    border-color: rgba(25, 166, 119, 0.72);
    background: #d4f5e7;
    box-shadow: 0 16px 30px rgba(16, 117, 90, 0.18);
}

.option-card.kind-renovar-electricidad::before,
.option-card.kind-electrica::before,
.option-card.kind-renovar_electricidad::before {
    background-color: #fff0c2;
    color: #a66f00;
}

.option-card.kind-renovar-fontaneria::before,
.option-card.kind-renovar_fontaneria::before,
.option-card.kind-instalar-sanitarios::before {
    background-color: #d9efff;
    color: #1877ad;
}

.option-card.kind-alisar-paredes::before,
.option-card.kind-pintar-paredes::before,
.option-card.kind-pintar-techos::before {
    background-color: #ffdde2;
    color: #bd3558;
}

.option-card.kind-cambiar-suelo::before,
.option-card.kind-soleria-porcelanica::before,
.option-card.kind-soleria-tarima::before {
    background-color: #d9f3dd;
    color: #2d8d57;
}

/* Selected override must come AFTER kind-* rules to win the cascade */
.option-card.selected::before {
    color: #ffffff;
    background-color: #189f78;
    border-color: transparent;
}

.option-card .chapter-head {
    align-items: center;
}

.info-chip {
    width: 24px;
    height: 24px;
    border-color: rgba(111, 146, 171, 0.52);
    background: #f0f6ff;
    color: #3d6482;
    box-shadow: 0 5px 10px rgba(18, 61, 96, 0.1);
}

.field label {
    color: #274862;
}

input[type="number"],
select {
    border-radius: 14px;
    border: 1px solid rgba(165, 188, 206, 0.64);
    padding: 12px 12px;
    background: rgba(255, 255, 255, 0.94);
    font-size: 15px;
    transition: border-color .22s ease, box-shadow .22s ease, transform .16s ease;
}

input:hover,
select:hover {
    border-color: rgba(129, 164, 190, 0.78);
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(41, 141, 207, 0.8);
    box-shadow: 0 0 0 3px rgba(57, 148, 219, 0.16);
}

.checkbox-inline,
.conditions-grid label {
    border-radius: 14px;
    border: 1px solid rgba(165, 188, 206, 0.56);
    background: rgba(251, 254, 255, 0.92);
    box-shadow: 0 8px 15px rgba(12, 53, 82, 0.06);
}

.checkbox-inline:hover,
.conditions-grid label:hover {
    border-color: rgba(122, 157, 184, 0.72);
    transform: translateY(-1px);
}

.checkbox-inline.selected,
.conditions-grid label.selected {
    border-color: rgba(24, 159, 120, 0.66);
    background: linear-gradient(140deg, rgba(236, 253, 248, 0.9) 0%, rgba(237, 249, 255, 0.92) 100%);
    box-shadow: 0 12px 20px rgba(21, 130, 101, 0.14);
}

.phase-banner {
    border-radius: 18px;
    border-color: rgba(122, 159, 187, 0.56);
    background: linear-gradient(165deg, rgba(244, 251, 255, 0.94) 0%, rgba(237, 251, 246, 0.9) 100%);
}

.phase-counter {
    color: #1f6f89;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.phase-banner h3 {
    font-size: clamp(22px, 2vw, 28px);
    color: #153550;
}

.phase-amount-box {
    border-radius: 14px;
    border: 1px solid rgba(139, 169, 194, 0.54);
    box-shadow: 0 8px 16px rgba(13, 48, 74, 0.08);
}

.phase-amount-box strong {
    color: #0b5f7f;
    font-size: 22px;
}

.wizard-nav {
    margin-top: 20px;
    padding-top: 2px;
}

.btn {
    position: relative;
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 15px;
    letter-spacing: .2px;
    transition: transform .2s ease, box-shadow .22s ease, background-color .22s ease, border-color .22s ease;
    box-shadow: 0 8px 16px rgba(14, 52, 82, 0.12);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0) scale(0.985);
}

.btn-ghost {
    border-color: rgba(158, 183, 205, 0.56);
    background: linear-gradient(180deg, rgba(249, 252, 255, 0.95) 0%, rgba(236, 244, 252, 0.95) 100%);
    color: #33536b;
}

.btn-primary {
    border-color: rgba(11, 69, 100, 0.42);
    background: linear-gradient(140deg, #14678b 0%, #19a677 100%);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(140deg, #0f5777 0%, #14956a 100%);
    box-shadow: 0 15px 26px rgba(12, 81, 97, 0.28);
}

.side-panel .sticky {
    top: 20px;
    border: 1px solid rgba(164, 189, 211, 0.54);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 252, 255, 0.9) 62%, rgba(242, 255, 250, 0.88) 100%);
    box-shadow: var(--elev-2);
}

.sticky h3 {
    font-size: 39px;
    letter-spacing: -0.5px;
}

.kpi-grid {
    gap: 10px;
}

.kpi-grid article {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(167, 190, 211, 0.52);
    background: linear-gradient(160deg, rgba(244, 248, 255, 0.96) 0%, rgba(240, 253, 250, 0.92) 100%);
    box-shadow: 0 8px 14px rgba(15, 58, 88, 0.08);
    overflow: hidden;
}

.kpi-grid article::after {
    content: "";
    position: absolute;
    inset: auto -24px -24px auto;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(145, 176, 255, 0.16) 0%, rgba(145, 176, 255, 0) 70%);
}

.kpi-grid strong {
    font-size: 18px;
    letter-spacing: -0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-amount {
    margin-top: 12px;
    border-radius: 16px;
    border: 1px solid rgba(74, 113, 221, 0.38);
    box-shadow: 0 14px 26px rgba(35, 78, 171, 0.26);
    background: linear-gradient(132deg, #4933dd 0%, #3189ff 48%, #1fb299 100%);
}

.live-amount p {
    font-size: 16px;
}

.live-amount strong {
    font-size: 30px;
    letter-spacing: -0.4px;
}

.result-hero {
    text-align: center;
}

.result-hero h1 {
    margin-top: 8px;
    font-size: clamp(34px, 3vw, 48px);
    letter-spacing: -0.6px;
}

.result-main-card {
    border-radius: 24px;
    border: 1px solid rgba(162, 188, 209, 0.54);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 251, 255, 0.9) 100%);
}

.scope-sheet {
    border-radius: 16px;
    border-color: rgba(169, 192, 210, 0.56);
    background: linear-gradient(180deg, rgba(251, 254, 255, 0.97) 0%, rgba(246, 251, 255, 0.92) 100%);
}

.scope-sheet h2 {
    font-size: clamp(29px, 2.4vw, 36px);
    letter-spacing: -0.5px;
}

/* ─── Time card (sidebar, desktop only) ──────────────────────────── */
.time-card { display: none; }

@media (min-width: 1181px) {
    .time-card { display: block; }
}

.time-chart-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
}

.chart-3d-stage {
    width: 220px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-3d-stage canvas {
    display: block;
}

.time-total-label {
    font-family: var(--brand-display);
    font-size: .88rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    letter-spacing: .01em;
    text-align: center;
}

.time-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .42rem;
    margin-top: .45rem;
    justify-content: center;
}

.time-leg-item {
    display: inline-flex;
    align-items: center;
    gap: .22rem;
    font-size: .68rem;
    color: var(--muted);
    white-space: nowrap;
}

.time-leg-item i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scope-card {
    border-radius: 14px;
    border: 1px solid rgba(164, 189, 212, 0.54);
    border-left-width: 5px;
    box-shadow: 0 10px 18px rgba(16, 56, 86, 0.09);
}

.scope-card h3 {
    font-size: 30px;
    font-family: var(--brand-display);
    letter-spacing: -0.45px;
}

.scope-card li {
    font-size: 15px;
    line-height: 1.44;
}

.scope-metrics {
    border-radius: 12px;
    border: 1px dashed rgba(138, 170, 196, 0.52);
    background: linear-gradient(180deg, rgba(246, 251, 255, 0.95) 0%, rgba(241, 250, 255, 0.92) 100%);
}

.breakdown.large {
    border-radius: 14px;
    border-color: rgba(167, 192, 211, 0.58);
    box-shadow: 0 8px 15px rgba(15, 54, 83, 0.08);
}

.breakdown.large div {
    min-height: 54px;
    align-items: center;
}

.total-box {
    border-radius: 16px;
    border: 1px solid rgba(11, 70, 102, 0.48);
    box-shadow: 0 16px 28px rgba(17, 83, 108, 0.24);
    background: linear-gradient(132deg, #0c607d 0%, #15986c 100%);
}

.total-box.huge strong {
    font-size: clamp(52px, 4vw, 68px);
}

.reveal-ready {
    opacity: 0;
    transform: translateY(16px);
}

.reveal-ready.is-visible {
    animation: revealUp .5s ease forwards;
    animation-delay: var(--reveal-delay, 0ms);
}

@keyframes revealUp {
    0%   { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

.step-fade-in {
    animation: stepFadeIn .34s ease both;
}

@keyframes stepFadeIn {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.994);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1220px) {
    .hero {
        grid-template-columns: 168px minmax(0, 1fr);
    }
    .hero h1 {
        font-size: clamp(30px, 3vw, 42px);
    }
    .hero p:not(.hero-slogan) {
        font-size: 18px;
    }
    .sticky h3 {
        font-size: 32px;
    }
    .live-amount strong {
        font-size: 30px;
    }
}

@media (max-width: 860px) {
    .app-shell::before,
    .app-shell::after {
        opacity: 0.14;
        width: 92px;
        height: 92px;
        background-size: 12px 12px;
    }
    .app-shell::before {
        left: 8px;
        top: 88px;
    }
    .app-shell::after {
        right: 8px;
        bottom: 68px;
    }
    .app-shell,
    .result-shell {
        padding: 12px 8px 28px;
        gap: 12px;
    }
    .card {
        border-radius: 16px;
        backdrop-filter: blur(4px);
    }
    .hero,
    .result-hero {
        border-radius: 16px;
        padding: 12px;
    }
    .hero {
        grid-template-columns: 1fr;
        grid-template-areas:
            "meta"
            "brand"
            "title"
            "subtitle"
            "slogan";
        text-align: center;
        row-gap: 6px;
    }
    .hero h1,
    .hero p:not(.hero-slogan),
    .hero-slogan {
        text-align: center;
    }
    .hero h1 {
        font-size: clamp(22px, 6vw, 30px);
    }
    .hero p:not(.hero-slogan) {
        font-size: 14px;
    }
    .hero-slogan {
        font-size: 14px;
    }
    .mode-card-shell h2,
    .step h2,
    .scope-sheet h2 {
        font-size: clamp(20px, 5.5vw, 26px);
    }
    .subtitle {
        font-size: 14px;
    }
    .stepper li {
        min-height: 48px;
        font-size: 13px;
        border-radius: 12px;
    }
    .option-card {
        min-height: 72px;
        padding: 10px 14px 10px 66px;
        border-radius: 14px;
    }
    .option-card::before {
        top: 12px;
        left: 10px;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 21px;
    }
    .option-card strong {
        font-size: 16px;
    }
    .reform-grid .option-card strong {
        font-size: 17px;
    }
    .mode-grid .option-card strong {
        font-size: 17px;
    }
    .option-card small {
        font-size: 12px;
        line-height: 1.35;
    }
    /* space for badge (POPULAR / RECOMENDADO) */
    .reform-grid .option-card,
    .mode-grid .option-card {
        padding-right: 60px;
    }
    .mode-badge {
        font-size: 6.5px;
        padding: 2px 5px;
        letter-spacing: .2px;
        border-radius: 6px;
        top: 8px;
        right: 8px;
    }
    .app-shell.mobile-flow-active #quickFlowWrap.card {
        background: rgba(255, 255, 255, 0.92);
    }
    .app-shell.mobile-flow-active .mobile-phase-banner.phase-banner {
        top: 6px;
        z-index: 44;
        border-radius: 14px;
        border-color: rgba(92, 139, 170, 0.58);
        box-shadow: 0 12px 20px rgba(12, 65, 101, 0.18);
    }
    .app-shell.mobile-flow-active .mobile-phase-banner .phase-amount-box strong {
        font-size: 28px;
    }
    .wizard-nav {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(251, 254, 255, 0.96) 100%);
        border-top-color: rgba(163, 186, 205, 0.48);
    }
    /* Modo oscuro: el footer del wizard y el wrap no deben quedar blancos */
    html[data-theme="dark"] .wizard-nav {
        background: linear-gradient(180deg, rgba(17, 23, 39, 0.94) 0%, rgba(12, 16, 28, 0.97) 100%);
        border-top-color: rgba(255, 255, 255, 0.08);
    }
    html[data-theme="dark"] .app-shell.mobile-flow-active #quickFlowWrap.card {
        background: rgba(20, 26, 42, 0.92);
    }
    .btn {
        min-height: 44px;
        border-radius: 12px;
    }
    .side-panel .sticky {
        border-radius: 16px;
    }
    .kpi-grid strong {
        font-size: 16px;
    }
    .live-amount {
        border-radius: 14px;
    }
    .live-amount strong {
        font-size: 26px;
    }
    .scope-card h3 {
        font-size: 24px;
    }
    .total-box.huge strong {
        font-size: 42px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   PANEL DERECHO — Rediseño armonioso con el sidebar
   (estas reglas tienen prioridad sobre todo lo anterior)
   ═══════════════════════════════════════════════════════════════════════ */

/* Contenedor sticky: blanco limpio, sin glassmorphism */
.side-panel .card,
.side-panel .sticky {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04) !important;
    padding: 18px !important;
}

/* Encabezado de sección — pequeño y etiquetado como el sidebar */
.side-panel h3 {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .7px !important;
    color: #9ca3af !important;
    margin-bottom: 14px !important;
    font-family: var(--font-ui, 'Inter', 'Segoe UI', sans-serif) !important;
}

/* Grid KPI: limpio, sin gradientes ni sombras elaboradas */
.side-panel .kpi-grid {
    gap: 8px !important;
}

.side-panel .kpi-grid article {
    background: #f8fafc !important;
    border: 1px solid #e9ecf0 !important;
    border-radius: 11px !important;
    padding: 10px 12px !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.side-panel .kpi-grid article::after {
    display: none !important;
}

/* Etiqueta KPI */
.side-panel .kpi-grid span {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    color: #9ca3af !important;
    display: block !important;
}

/* Valor KPI */
.side-panel .kpi-grid strong {
    display: block !important;
    margin-top: 4px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Banner precio: mismo gradiente que el botón "Comenzar presupuesto" */
.side-panel .live-amount {
    margin-top: 12px !important;
    border-radius: 13px !important;
    border: 1px solid rgba(11, 69, 100, 0.42) !important;
    background: linear-gradient(140deg, #14678b 0%, #19a677 100%) !important;
    box-shadow: 0 8px 22px rgba(12, 81, 97, 0.22), inset 0 1px 0 rgba(255,255,255,.18) !important;
    padding: 14px 16px !important;
    color: #fff !important;
    position: relative !important;
    overflow: hidden !important;
}
.side-panel .live-amount::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 85% 0%, rgba(255,255,255,.18), transparent 60%);
    pointer-events: none;
}

.side-panel .live-amount p {
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    opacity: .8 !important;
    margin: 0 0 5px !important;
}

.side-panel .live-amount strong {
    font-size: 26px !important;
    font-weight: 800 !important;
    letter-spacing: -.5px !important;
    line-height: 1 !important;
}

/* Texto legal */
.side-panel .legal {
    font-size: 11px !important;
    color: #9ca3af !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
}

/* Tiempo estimado — mismo card limpio */
.side-panel .time-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.05) !important;
    padding: 18px !important;
}

.side-panel .time-total-label {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
}

.side-panel .time-leg-item {
    font-size: 11px !important;
    color: #6b7280 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   PANEL DERECHO — Tarjeta unificada (un solo bloque con borde superior
   e inferior redondeado, igual que las tarjetas del wizard)
   ═══════════════════════════════════════════════════════════════════════ */

/* Contenedor: UN solo card */
.side-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    background: #ffffff !important;
    border: 1px solid #e2e6eb !important;
    border-radius: 18px !important;
    box-shadow: 0 6px 24px rgba(11,33,54,.09) !important;
    overflow: hidden !important;
    padding: 0 !important;
}

/* Secciones internas: sin borde propio, fondo transparente */
.side-panel > .card,
.side-panel > section.card,
.side-panel > .sticky,
.side-panel > .time-card {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 18px 18px 16px !important;
}

/* Separador entre secciones */
.side-panel > .time-card {
    border-top: 1px solid #eef0f3 !important;
    padding-top: 16px !important;
}

/* ─── Stepper numérico estilizado ─────────────────────────────
   Reemplaza visualmente los <input type="number"> dentro del wizard
   con dos botones grandes [-] y [+] a los lados de un display central.
   El input real sigue presente para que Thymeleaf y la validación
   nativa sigan funcionando — solo lo enriquece visualmente. */
.num-stepper {
    display: inline-flex;
    align-items: stretch;
    background: linear-gradient(180deg, #fff 0%, #f5f9ff 100%);
    border: 1px solid rgba(169, 190, 210, 0.65);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(11, 42, 67, 0.06);
    height: 52px;
    width: fit-content;
    user-select: none;
}
.num-stepper-btn {
    width: 50px;
    border: 0;
    background: transparent;
    color: #14678b;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
    flex: 0 0 50px;
}
.num-stepper-btn:hover:not(:disabled) {
    background: rgba(20, 103, 139, 0.08);
}
.num-stepper-btn:active:not(:disabled) {
    background: rgba(20, 103, 139, 0.16);
    transform: scale(0.94);
}
.num-stepper-btn:disabled {
    color: #c5cfd9;
    cursor: not-allowed;
}
.num-stepper-btn.is-minus {
    border-right: 1px solid rgba(169, 190, 210, 0.45);
}
.num-stepper-btn.is-plus {
    border-left: 1px solid rgba(169, 190, 210, 0.45);
}
.num-stepper-input {
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #17334c !important;
    width: 80px !important;
    min-width: 80px !important;
    padding: 0 4px !important;
    box-shadow: none !important;
    /* Eliminar las flechas nativas (Chrome/Edge/Safari y Firefox) */
    -moz-appearance: textfield;
}
.num-stepper-input::-webkit-outer-spin-button,
.num-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.num-stepper-input:focus {
    background: rgba(20, 103, 139, 0.04) !important;
}

/* ─── Stepper de cantidad integrado en la action-card ─────────
   Cuando la card es multiplicable (su key está en WIZARD_PRICES.
   actionMultipliers), el JS le añade un stepper a la derecha. Solo
   se ve cuando la card está .selected — refuerza la idea de que
   primero se elige el trabajo, luego la cantidad. */
.action-card.has-multiplier,
.zone-card.has-multiplier {
    padding-right: 168px;
}
.action-multiplier-stepper {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid rgba(169, 190, 210, 0.65);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(11, 42, 67, 0.08);
    height: 44px;
    /* Siempre visible — antes solo aparecía con .selected y el cliente
       no veía nada hasta marcar la tarjeta. La cantidad acompaña al
       trabajo/zona de forma persistente. */
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}
.action-multiplier-btn {
    width: 38px;
    border: 0;
    background: transparent;
    color: #14678b;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}
.action-multiplier-btn:hover:not(:disabled) {
    background: rgba(20, 103, 139, 0.08);
}
.action-multiplier-btn:active:not(:disabled) {
    background: rgba(20, 103, 139, 0.16);
}
.action-multiplier-btn:disabled {
    color: #c5cfd9;
    cursor: not-allowed;
}
.action-multiplier-display {
    min-width: 44px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #17334c;
    border-left: 1px solid rgba(169, 190, 210, 0.45);
    border-right: 1px solid rgba(169, 190, 210, 0.45);
    background: #f5f9ff;
}
.action-multiplier-unit {
    position: absolute;
    bottom: -16px;
    right: 14px;
    font-size: 11px;
    color: #5e768d;
    font-weight: 500;
    pointer-events: none;
}
@media (max-width: 720px) {
    /* En móvil el stepper de cantidad va DEBAJO del texto (no a la derecha,
       que estrujaba el texto y se leía en vertical). El texto ocupa todo el
       ancho arriba y el stepper queda como una fila propia abajo.
       !important porque wizard-ui.js pone estos estilos inline (defensivos)
       y un !important de la hoja vence al inline sin !important. */
    .action-card.has-multiplier,
    .zone-card.has-multiplier {
        padding-right: 16px !important;
        padding-bottom: 58px !important;
    }
    .action-multiplier-stepper {
        top: auto !important;
        bottom: 12px !important;
        right: 14px !important;
        transform: none !important;
        height: 40px !important;
    }
    .action-multiplier-btn { width: 42px; font-size: 19px; }
    .action-multiplier-display { min-width: 46px; font-size: 15px; }
}

/* Modo oscuro del stepper de cantidad. wizard-ui.js pone los colores INLINE
   (claros, defensivos), asi que aqui hace falta !important para oscurecerlos. */
html[data-theme="dark"] .action-multiplier-stepper {
    background: #232638 !important;
    border-color: #3a4060 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4) !important;
}
html[data-theme="dark"] .action-multiplier-display {
    background: #1c1f2d !important;
    color: #e2e6f0 !important;
    border-left-color: #3a4060 !important;
    border-right-color: #3a4060 !important;
}
html[data-theme="dark"] .action-multiplier-btn { color: #6cb6e3 !important; }
html[data-theme="dark"] .action-multiplier-btn:disabled { color: #4a5168 !important; }
html[data-theme="dark"] .action-multiplier-unit { color: #8892a8 !important; }

/* Inputs antiguos del paso 3 modular ocultados cuando hay multiplier
   equivalente en la tarjeta. La clase la añade wizard-ui.js en
   enhanceCardsWithMultipliers → hideLegacyMeasurementInputs(). El
   !important es deliberado: el JS del flujo modular hace toggle de
   .hidden en estos campos por fase, y queremos que nuestra ocultación
   gane sin tener que parchear cada lugar. */
.field.legacy-hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   PASO 5 — "Condiciones e IVA" rediseñado
   Tarjetas seleccionables (radio para IVA + checkbox para condiciones)
   en vez de desplegable + checkboxes sueltos.
   Prefijo .cs- para "conditions step" y no chocar con clases del editor.
   ═══════════════════════════════════════════════════════════════ */

section.step[data-step="5"] { --cs-green: #15986c; --cs-green-soft: #ecfdf5; --cs-border: #e5e7eb; --cs-text: #111827; --cs-muted: #6b7280; }
section.step[data-step="5"] > h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: var(--cs-text); }
section.step[data-step="5"] > .subtitle { font-size: 14px; color: var(--cs-muted); margin: 0 0 22px; }

.cs-section { margin-bottom: 24px; }
.cs-section-title { font-size: 14px; font-weight: 700; color: var(--cs-text); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.cs-section-tag { font-size: 10.5px; font-weight: 600; color: var(--cs-muted); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; text-transform: lowercase; }
.cs-section-help { font-size: 12.5px; color: var(--cs-muted); margin: 0 0 12px; }

/* Grids de tarjetas */
.cs-vat-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.cs-cond-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.cs-info-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ── Tarjeta base (.cs-card) — IVA y Condiciones ── */
.cs-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--cs-border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .25s;
  user-select: none;
}
.cs-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(11,49,77,.07); }
.cs-card:active { transform: scale(.985); }
.cs-card input[type="radio"], .cs-card input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}

/* Check circular: oculto por defecto, aparece al estado :checked */
.cs-card-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--cs-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: all .2s;
}
.cs-card-check svg { opacity: 0; transition: opacity .15s; }

/* Estado seleccionado */
.cs-card:has(input:checked) {
  border-color: var(--cs-green);
  background: var(--cs-green-soft);
  box-shadow: 0 4px 14px rgba(21,152,108,.12);
}
.cs-card:has(input:checked) .cs-card-check {
  background: var(--cs-green);
  border-color: var(--cs-green);
}
.cs-card:has(input:checked) .cs-card-check svg { opacity: 1; }

/* IVA: la tarjeta es más simple (sólo el label) */
.cs-card-vat { padding: 16px 18px; }
.cs-vat-label { font-size: 14.5px; font-weight: 600; color: var(--cs-text); flex: 1; }
.cs-card-vat:has(input:checked) .cs-vat-label { color: #047857; }

/* Condiciones: la tarjeta tiene icono de la condición */
.cs-card-cond { padding: 14px 16px; align-items: center; }
.cs-card-cond .cs-card-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; color: var(--cs-muted);
  flex-shrink: 0;
  transition: all .2s;
}
.cs-card-cond .cond-label { font-size: 13.5px; font-weight: 500; color: var(--cs-text); line-height: 1.3; flex: 1; }
.cs-card-cond:has(input:checked) .cs-card-icon { background: var(--cs-green); color: #fff; }
.cs-card-cond:has(input:checked) .cond-label { color: var(--cs-text); font-weight: 600; }

/* ── Información extra (pills más sutiles) ── */
.cs-section-info { padding: 14px 16px; background: #f8fafc; border-radius: 14px; border: 1px dashed #e5e7eb; }
.cs-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: #fff;
  border: 1.5px solid var(--cs-border);
  border-radius: 999px;
  font-size: 13px; color: var(--cs-text);
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.cs-pill:hover { border-color: #cbd5e1; }
.cs-pill input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.cs-pill-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--cs-border);
  background: #fff;
  flex-shrink: 0;
  transition: all .2s;
}
.cs-pill:has(input:checked) {
  background: var(--cs-green-soft);
  border-color: var(--cs-green);
}
.cs-pill:has(input:checked) .cs-pill-dot {
  background: var(--cs-green);
  border-color: var(--cs-green);
  box-shadow: inset 0 0 0 3px #fff;
}
.cs-pill:has(input:checked) .cond-label { color: #047857; font-weight: 600; }

/* ── Campo "Planta" (aparece cuando "Sin ascensor") ── */
.cs-floor-wrap { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #e5e7eb; }
.cs-floor-wrap.hidden { display: none; }
.cs-floor-label { font-size: 12.5px; font-weight: 600; color: var(--cs-text); display: block; margin-bottom: 6px; }
.cs-floor-stepper { max-width: 200px; }
.cs-floor-stepper input { padding: 10px 12px; font-size: 15px; font-weight: 600; }

/* Estado de error: grid sin selección al pulsar Siguiente */
.cs-vat-grid-error .cs-card {
  border-color: #ef4444;
  animation: cs-shake .35s ease-in-out;
}
@keyframes cs-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════════════════════════
   Modal "¿Volver atrás?" — estilo JUMA, coherente con det-save-modal
   ═══════════════════════════════════════════════════════════════ */
.wz-back-modal-backdrop[hidden] { display: none; }
.wz-back-modal-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(11, 33, 54, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: wz-back-fade-in .2s ease both;
}
@keyframes wz-back-fade-in { from { opacity: 0; } to { opacity: 1; } }
.wz-back-modal {
  position: relative;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(11, 33, 54, .25), 0 8px 16px rgba(11, 33, 54, .12);
  max-width: 460px; width: 100%;
  padding: 28px 28px 22px;
  animation: wz-back-slide-up .28s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes wz-back-slide-up {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.wz-back-modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: 0; background: transparent;
  font-size: 22px; line-height: 1;
  color: #6b7280; cursor: pointer;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.wz-back-modal-close:hover { background: #f3f4f6; color: #111827; }
.wz-back-modal h2 {
  margin: 0 0 8px;
  font-size: 19px; font-weight: 700; color: #17334c;
}
.wz-back-modal p {
  margin: 0 0 22px;
  font-size: 14px; color: #6b7280; line-height: 1.45;
}
.wz-back-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
.wz-back-modal-actions .btn { padding: 10px 18px; font-size: 14px; font-weight: 600; border-radius: 10px; }
.wz-back-confirm-btn {
  color: #b91c1c !important;
  border: 1px solid rgba(185, 28, 28, .35) !important;
  background: transparent;
}
.wz-back-confirm-btn:hover { background: #fef2f2; border-color: #b91c1c !important; }

/* ═══════════════════════════════════════════════════════════════
   MODO OSCURO — overrides del wizard cliente
   (paso 5 con tarjetas + modal "Volver atrás")
   ═══════════════════════════════════════════════════════════════ */

/* Variables de la sección paso 5 */
html[data-theme="dark"] section.step[data-step="5"] {
  --cs-green: #34d399;
  --cs-green-soft: #0d2218;
  --cs-border: #2c3044;
  --cs-text: #e2e6f0;
  --cs-muted: #8892a8;
}
html[data-theme="dark"] section.step[data-step="5"] > h2 { color: #e2e6f0; }
html[data-theme="dark"] section.step[data-step="5"] > .subtitle { color: #8892a8; }
html[data-theme="dark"] .cs-section-title { color: #e2e6f0; }
html[data-theme="dark"] .cs-section-tag { background: #232638; color: #8892a8; }
html[data-theme="dark"] .cs-section-help { color: #8892a8; }

/* Tarjetas IVA y condiciones */
html[data-theme="dark"] .cs-card {
  background: #1c1f2d;
  border-color: #2c3044;
}
html[data-theme="dark"] .cs-card:hover { border-color: #3a4060; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .cs-card-check { background: #1c1f2d; border-color: #2c3044; }
html[data-theme="dark"] .cs-card:has(input:checked) {
  border-color: #34d399;
  background: #0d2218;
  box-shadow: 0 4px 14px rgba(52, 211, 153, .18);
}
html[data-theme="dark"] .cs-card:has(input:checked) .cs-card-check {
  background: #34d399; border-color: #34d399;
}
html[data-theme="dark"] .cs-vat-label { color: #e2e6f0; }
html[data-theme="dark"] .cs-card-vat:has(input:checked) .cs-vat-label { color: #6ee7b7; }
html[data-theme="dark"] .cs-vat-label small { color: #8892a8 !important; }

html[data-theme="dark"] .cs-card-cond .cs-card-icon { background: #232638; color: #8892a8; }
html[data-theme="dark"] .cs-card-cond .cond-label { color: #e2e6f0; }
html[data-theme="dark"] .cs-card-cond:has(input:checked) .cs-card-icon { background: #34d399; color: #0d1a22; }
html[data-theme="dark"] .cs-card-cond:has(input:checked) .cond-label { color: #e2e6f0; }

/* Información extra (pills informativos) */
html[data-theme="dark"] .cs-section-info {
  background: #191c2a;
  border-color: #2c3044;
}
html[data-theme="dark"] .cs-pill {
  background: #1c1f2d;
  border-color: #2c3044;
  color: #e2e6f0;
}
html[data-theme="dark"] .cs-pill:hover { border-color: #3a4060; }
html[data-theme="dark"] .cs-pill-dot { background: #1c1f2d; border-color: #2c3044; }
html[data-theme="dark"] .cs-pill:has(input:checked) {
  background: #0d2218; border-color: #34d399;
}
html[data-theme="dark"] .cs-pill:has(input:checked) .cs-pill-dot {
  background: #34d399; border-color: #34d399; box-shadow: inset 0 0 0 3px #0d2218;
}
html[data-theme="dark"] .cs-pill:has(input:checked) .cond-label { color: #6ee7b7; }

/* Campo "Planta" */
html[data-theme="dark"] .cs-floor-wrap { border-top-color: #2c3044; }
html[data-theme="dark"] .cs-floor-label { color: #e2e6f0; }

/* Modal "Volver atrás" */
html[data-theme="dark"] .wz-back-modal-backdrop { background: rgba(0, 0, 0, .72); }
html[data-theme="dark"] .wz-back-modal {
  background: #1c1f2d;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55), 0 8px 16px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] .wz-back-modal-close { color: #8892a8; }
html[data-theme="dark"] .wz-back-modal-close:hover { background: #232638; color: #e2e6f0; }
html[data-theme="dark"] .wz-back-modal h2 { color: #e2e6f0; }
html[data-theme="dark"] .wz-back-modal p { color: #8892a8; }
html[data-theme="dark"] .wz-back-confirm-btn {
  color: #fca5a5 !important;
  border-color: #5a1f1f !important;
}
html[data-theme="dark"] .wz-back-confirm-btn:hover { background: #2a1010; border-color: #ef4444 !important; }

/* ═══════════════════════════════════════════════════════════════
   MODO OSCURO — contraste de textos del wizard
   Hay muchas reglas con colores hardcoded (#2f4a5f, #16384d, …) que
   fueron pensadas para fondo claro. En oscuro las forzamos a tonos
   claros (var(--text), var(--muted)) sin tocar el modo claro.
   ═══════════════════════════════════════════════════════════════ */

/* Hero del wizard: título, descripción, slogan */
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .hero p { color: #e2e6f0; }
html[data-theme="dark"] .hero-slogan { color: #6ee7b7 !important; }

/* Subtítulos y small de los pasos */
html[data-theme="dark"] .wizard-panel h2,
html[data-theme="dark"] .wizard-panel h3 { color: #e2e6f0; }
html[data-theme="dark"] .wizard-panel .subtitle,
html[data-theme="dark"] .wizard-panel .field small,
html[data-theme="dark"] .wizard-panel small,
html[data-theme="dark"] .wizard-panel .hint,
html[data-theme="dark"] .wizard-panel .field-hint { color: #8892a8; }

/* Texto principal en cards: strong, small, p */
html[data-theme="dark"] .wizard-panel .option-card strong,
html[data-theme="dark"] .wizard-panel .option-card .strong,
html[data-theme="dark"] .wizard-panel .option-card h3,
html[data-theme="dark"] .wizard-panel .reform-card strong,
html[data-theme="dark"] .wizard-panel .zone-card strong,
html[data-theme="dark"] .wizard-panel .action-card strong { color: #e2e6f0; }
html[data-theme="dark"] .wizard-panel .option-card small,
html[data-theme="dark"] .wizard-panel .option-card p,
html[data-theme="dark"] .wizard-panel .reform-card small,
html[data-theme="dark"] .wizard-panel .zone-card small,
html[data-theme="dark"] .wizard-panel .action-card small { color: #8892a8; }
html[data-theme="dark"] .wizard-panel .option-card.selected strong,
html[data-theme="dark"] .wizard-panel .option-card.selected small { color: #e2e6f0; }

/* SELECCIÓN PREMIUM — glow verde neón con efecto "respiración" (pulso suave).
   Vale en CLARO y OSCURO. Antes el estado .selected se diluía (sobre todo en
   oscuro) y parecía no seleccionado tras el flash de pulsado. Lo hacemos con una
   ANIMACIÓN: el box-shadow/borde animado gana al box-shadow base de la card, así
   que el brillo se queda y "respira" mientras está seleccionada. */
@keyframes wz-breathe {
    /* opacity:1 Y transform:translateY(0) en todos los frames son OBLIGATORIOS:
       esta animación reemplaza a la 'revealUp' de .reveal-ready (que llevaba la
       card a opacity:1 y translateY(0)). Sin fijarlos aquí, la card volvía al
       opacity:0 base (invisible) y al translateY(16px) base (se desplazaba). */
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
        border-color: #34d399;
        box-shadow:
            0 0 0 1.5px rgba(52, 211, 153, 0.55),
            0 0 7px 1px rgba(52, 211, 153, 0.20),
            0 0 15px 2px rgba(45, 212, 191, 0.08);
    }
    50% {
        opacity: 1;
        transform: translateY(0);
        border-color: #4ade80;
        box-shadow:
            0 0 0 2px rgba(52, 211, 153, 0.80),
            0 0 13px 2px rgba(52, 211, 153, 0.38),
            0 0 27px 4px rgba(45, 212, 191, 0.17);
    }
}
/* Glow en ::after (NO en la card): así NO tocamos la 'animation' de la card
   (revealUp). Antes, animar .selected re-disparaba revealUp al des/seleccionar →
   la card deseleccionada PARPADEABA. Con ::after no hay flash. */
/* overflow:visible SOLO al seleccionar: el glow neón vive en ::after como
   box-shadow HACIA FUERA; la card base tiene overflow:hidden, que lo recortaba y
   hacía "desaparecer" el neón. La capa .wz-ignite se auto-recorta (overflow propio),
   así que esto no la afecta. */
.option-card.selected { border-color: #34d399; position: relative; overflow: visible !important; }
.option-card.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
    animation: wz-breathe 3.2s ease-in-out infinite;   /* 38% más rápido que 4.4s */
}
/* "Luz que se enciende desde el clic": capa radial verde que crece desde
   --sel-x/--sel-y (punto pulsado) hasta llenar la card y se desvanece.
   La inyecta el JS (wzIgnite) y la dispara con .wz-fill-run. */
.option-card .wz-ignite {
    position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
    pointer-events: none; z-index: 1;
    background-image: radial-gradient(circle at var(--sel-x, 50%) var(--sel-y, 50%),
        rgba(52, 211, 153, 0.50) 0%, rgba(52, 211, 153, 0.20) 42%, rgba(52, 211, 153, 0) 70%);
    background-repeat: no-repeat;
    background-position: var(--sel-x, 50%) var(--sel-y, 50%);
    background-size: 0% 0%;
    opacity: 0;
}
.option-card.wz-fill-run .wz-ignite { animation: wz-ignite 0.52s ease-out both; }
@keyframes wz-ignite {
    0%   { background-size: 0% 0%;     opacity: 0; }
    18%  { opacity: 1; }
    60%  { background-size: 300% 300%; opacity: 1; }
    100% { background-size: 300% 300%; opacity: 0; }
}
/* En oscuro, además, fondo con leve tinte verde para reforzar la selección. */
html[data-theme="dark"] .option-card.selected {
    background:
        linear-gradient(180deg, rgba(52, 211, 153, 0.20) 0%, rgba(45, 212, 191, 0.09) 100%),
        #142019 !important;
}
/* Badge/icono de la card seleccionada: verde neón sólido (oscuro). */
html[data-theme="dark"] .option-card.selected::before {
    background-color: #34d399;
    color: #0d1a22;
    border-color: transparent;
}
html[data-theme="dark"] .option-card.selected .option-card-price { color: #6ee7b7; }
@media (prefers-reduced-motion: reduce) {
    .option-card.selected {
        animation: none !important;
        opacity: 1 !important;            /* sin animación tampoco perdemos visibilidad */
        transform: translateY(0) !important; /* ni la posición */
        border-color: #34d399 !important;
        box-shadow: 0 0 0 1.5px #34d399, 0 0 9px 1px rgba(52, 211, 153, 0.28) !important;
    }
}

/* Cualquier texto dentro de tarjetas con fondo oscuro */
html[data-theme="dark"] .wizard-panel .field label,
html[data-theme="dark"] .wizard-panel .field-grid label,
html[data-theme="dark"] .wizard-panel .field-group h3,
html[data-theme="dark"] .wizard-panel .field-group .field-label { color: #e2e6f0; }
html[data-theme="dark"] .wizard-panel .field input,
html[data-theme="dark"] .wizard-panel .field select,
html[data-theme="dark"] .wizard-panel .field textarea {
  background: #232638; border-color: #2c3044; color: #e2e6f0;
}
html[data-theme="dark"] .wizard-panel .field input::placeholder,
html[data-theme="dark"] .wizard-panel .field textarea::placeholder { color: #6a7388; }

/* Resumen / sidebar derecho del wizard */
html[data-theme="dark"] .summary-block,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .live-summary-card { background: #1c1f2d; border-color: #2c3044; color: #e2e6f0; }
html[data-theme="dark"] .summary-row dt,
html[data-theme="dark"] .summary-row .label,
html[data-theme="dark"] .summary-row .key { color: #8892a8; }
html[data-theme="dark"] .summary-row dd,
html[data-theme="dark"] .summary-row .value { color: #e2e6f0; }
html[data-theme="dark"] .summary-row strong,
html[data-theme="dark"] .summary-total,
html[data-theme="dark"] .summary-total-value { color: #e2e6f0; }
html[data-theme="dark"] .review-summary,
html[data-theme="dark"] .review-summary h3 { color: #e2e6f0; }
html[data-theme="dark"] .review-summary dl dt { color: #8892a8; }
html[data-theme="dark"] .review-summary dl dd { color: #e2e6f0; }

/* Time chart card y leyenda */
html[data-theme="dark"] #timeCard,
html[data-theme="dark"] .time-card,
html[data-theme="dark"] #timeTotalLabel { color: #e2e6f0; }
html[data-theme="dark"] .time-leg-item { color: #c8d4e0; }

/* Acordeón / agrupación de zonas+acciones (flujo modular) */
html[data-theme="dark"] .module-phase h3,
html[data-theme="dark"] .module-phase strong,
html[data-theme="dark"] .scope-metric-row .scope-metric-label { color: #e2e6f0; }

/* Errores y avisos */
html[data-theme="dark"] .wizard-panel .error,
html[data-theme="dark"] .wizard-panel .client-alert { color: #fca5a5; }

/* Hero badge / tags y otros */
html[data-theme="dark"] .wizard-panel .badge,
html[data-theme="dark"] .wizard-panel .pill { color: #e2e6f0; }

/* Result final del wizard (resultado del cálculo) */
html[data-theme="dark"] .result-section,
html[data-theme="dark"] .result-section h2,
html[data-theme="dark"] .result-section h3,
html[data-theme="dark"] .result-section p,
html[data-theme="dark"] .result-section td,
html[data-theme="dark"] .result-section th { color: #e2e6f0; }
html[data-theme="dark"] .result-section small,
html[data-theme="dark"] .result-section .muted { color: #8892a8; }
html[data-theme="dark"] .result-section table { color: #e2e6f0; }
html[data-theme="dark"] .result-section .summary-row-trabajos { background: #232638; }

/* Generic: cualquier h1/h2/h3/h4/p dentro del wizard-panel sin clase específica */
html[data-theme="dark"] .wizard-panel h1,
html[data-theme="dark"] .wizard-panel h4,
html[data-theme="dark"] .wizard-panel p,
html[data-theme="dark"] .wizard-panel li,
html[data-theme="dark"] .wizard-panel dt,
html[data-theme="dark"] .wizard-panel dd,
html[data-theme="dark"] .wizard-panel span:not(.cs-card-check):not(.cs-pill-dot):not(.cs-card-icon):not(.cs-section-tag):not(.tag) { color: inherit; }

/* Container general del wizard heredando el color claro */
html[data-theme="dark"] .wizard-panel,
html[data-theme="dark"] .wizard-scroll-area { color: #e2e6f0; }

/* ─── Tarjetas internas del resumen en vivo (sidebar derecho) ─── */
/* .scope-card es la "tarjeta zona" del live summary; .scope-metrics es la
   sub-tarjeta con las métricas (m², paso, total). Ambas tienen fondos
   hardcoded a blanco/azulado claro en modo claro. */
html[data-theme="dark"] .scope-card {
  background: linear-gradient(180deg, #1c1f2d 0%, #232638 100%);
  border-color: #2c3044;
}
html[data-theme="dark"] .scope-card h3,
html[data-theme="dark"] .scope-card li,
html[data-theme="dark"] .scope-card p { color: #e2e6f0; }
html[data-theme="dark"] .scope-card p { color: #8892a8; }

html[data-theme="dark"] .scope-metrics {
  background: #232638;
  border-top-color: #2c3044;
}
html[data-theme="dark"] .scope-metrics span,
html[data-theme="dark"] .scope-metric-label { color: #c8d4e0; }
html[data-theme="dark"] .scope-metrics strong,
html[data-theme="dark"] .scope-metric-value { color: #e2e6f0; }
html[data-theme="dark"] .scope-metric-row { border-bottom-color: #2c3044; }
html[data-theme="dark"] .scope-metric-total .scope-metric-label,
html[data-theme="dark"] .scope-metric-total .scope-metric-value { color: #34d399; }

/* Breakdown (cards inferiores con número grande) */
html[data-theme="dark"] .breakdown div {
  background: #1c1f2d;
  border-color: #2c3044;
  color: #e2e6f0;
}
html[data-theme="dark"] .breakdown small { color: #8892a8; }
html[data-theme="dark"] .breakdown strong { color: #e2e6f0; }

/* ─── KPIs del Resumen en vivo (Tipo / Zonas / Trabajos / m² / Paso) ─── */
/* Cada artículo del .kpi-grid es una de las sub-tarjetas pequeñas con label
   y valor. El gradiente blanco/azulado claro hardcoded del modo claro queda
   ilegible en oscuro. */
/* Selector con .side-panel y !important para ganar a las reglas
   `.side-panel .kpi-grid article { background: #f8fafc !important; }` */
html[data-theme="dark"] .side-panel .kpi-grid article,
html[data-theme="dark"] .kpi-grid article {
  background: linear-gradient(160deg, #232638 0%, #1c1f2d 100%) !important;
  border-color: #2c3044 !important;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3) !important;
}
html[data-theme="dark"] .kpi-grid article::after {
  background: radial-gradient(circle, rgba(110, 231, 183, 0.10) 0%, rgba(110, 231, 183, 0) 70%);
}
html[data-theme="dark"] .side-panel .kpi-grid span,
html[data-theme="dark"] .kpi-grid span { color: #8892a8 !important; }
html[data-theme="dark"] .side-panel .kpi-grid strong,
html[data-theme="dark"] .kpi-grid strong { color: #e2e6f0 !important; }

/* Cards contenedoras del side-panel: el modo claro las pinta blanco
   con !important. Aquí ganamos con misma especificidad + !important. */
html[data-theme="dark"] .side-panel .card,
html[data-theme="dark"] .side-panel .sticky,
html[data-theme="dark"] .side-panel .time-card {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.35) !important;
}
html[data-theme="dark"] .side-panel h3 { color: #c8d4e0 !important; }
html[data-theme="dark"] .side-panel .time-total-label { color: #34d399 !important; }
html[data-theme="dark"] .side-panel .time-leg-item { color: #8892a8 !important; }
html[data-theme="dark"] .side-panel .legal { color: #6a7388 !important; }
/* NO tocamos .side-panel .live-amount — el banner verde se ve bien tal cual */

/* ─── Botones del wizard-nav (Anterior / Siguiente / Calcular) en oscuro ───
 * El .btn-ghost en modo claro tiene un gradiente blanco azulado que se
 * vuelve invisible sobre el fondo oscuro (Captura 4: paso 6 "Revisión
 * antes del cálculo"). El primario se respeta porque ya tiene color sólido. */
html[data-theme="dark"] .wizard-nav .btn-ghost,
html[data-theme="dark"] .btn-ghost {
  background: linear-gradient(180deg, #232638 0%, #1c1f2d 100%);
  border-color: #2c3044;
  color: #c8d4e0;
}
html[data-theme="dark"] .wizard-nav .btn-ghost:hover,
html[data-theme="dark"] .btn-ghost:hover {
  background: linear-gradient(180deg, #2a2e44 0%, #232638 100%);
  border-color: #3a4060;
  color: #e2e6f0;
}

/* ─── Página de Resultado del wizard ────────────────────────────────────
 * Captura 5: la "card madre" .result-main-card y la sub-card .scope-sheet
 * tienen gradientes blancos hardcoded; el header y la tabla quedan ilegibles.
 * El .total-box (banner verde "Total estimado") se respeta tal cual. */
html[data-theme="dark"] .result-main-card {
  background: linear-gradient(180deg, #1c1f2d 0%, #161a26 100%) !important;
  border-color: #2c3044 !important;
}
html[data-theme="dark"] .scope-sheet {
  background: linear-gradient(180deg, #232638 0%, #1c1f2d 100%) !important;
  border-color: #2c3044 !important;
  color: #e2e6f0;
}
html[data-theme="dark"] .scope-sheet h2 { color: #e2e6f0; }
html[data-theme="dark"] .result-hero h1 { color: #e2e6f0; }

/* Tabla genérica (.table) usada en el resultado: cabecera con fondo claro */
html[data-theme="dark"] .table {
  border-color: #2c3044;
  color: #e2e6f0;
}
html[data-theme="dark"] .table th {
  background: #232638;
  color: #c8d4e0;
  border-bottom-color: #2c3044;
}
html[data-theme="dark"] .table td {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Breakdown (filas resumen del resultado: subtotal / IVA / total parcial) */
html[data-theme="dark"] .breakdown {
  border-color: #2c3044;
}
html[data-theme="dark"] .breakdown.large {
  border-color: #2c3044;
}
html[data-theme="dark"] .breakdown.large div {
  background: #1c1f2d;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  color: #e2e6f0;
}
html[data-theme="dark"] .breakdown.large dt { color: #8892a8; }
html[data-theme="dark"] .breakdown.large dd { color: #e2e6f0; }
html[data-theme="dark"] .breakdown.large div.summary-row-trabajos {
  background: #232638;
}
html[data-theme="dark"] .breakdown.large div.summary-row-trabajos dd { color: #6ee7b7; }

/* Scope metrics dentro del resultado (panel pequeño con datos de la zona) */
html[data-theme="dark"] .scope-sheet .scope-metrics,
html[data-theme="dark"] .result-main-card .scope-metrics {
  background: linear-gradient(180deg, #1c1f2d 0%, #161a26 100%);
  border-color: #2c3044;
}

/* Modo oscuro — paneles que se quedaban en BLANCO con texto oscuro (invisible):
   resumen (.flow-map), banner de fase integral (.phase-banner + caja de precio)
   y la barra inferior del wizard. Top-level (NO dentro de @media) → vale para
   todas las tarifas, presente y futuras. */
html[data-theme="dark"] .flow-map {
  background: #1c1f2d;
  border-color: #3a4060;
}
html[data-theme="dark"] .flow-map p { color: #c2cad8; }
html[data-theme="dark"] .flow-map p strong { color: #e8eef4; }

html[data-theme="dark"] .phase-banner {
  background: #1a2230;
  border-color: #2a4a63;
}
html[data-theme="dark"] .phase-counter { color: #6fb6d8; }
html[data-theme="dark"] .phase-banner h3 { color: #e8eef4; }
html[data-theme="dark"] .phase-help { color: #9fb2c4; }
html[data-theme="dark"] .phase-amount-box {
  background: #11161f;
  border-color: #2a4a63;
}
html[data-theme="dark"] .phase-amount-box span { color: #8aa6bc; }
html[data-theme="dark"] .phase-amount-box strong { color: #3fb3cf; }

/* La .wizard-nav es solo el contenedor flex de los botones (Anterior/Siguiente):
   sin fondo combina con la pagina. La regla dark anterior le metia un gradiente
   MAS OSCURO que el fondo → barra fea entre los botones. La dejamos transparente
   (tambien anula el gradiente claro de la media query, asi que no sale blanca). */
html[data-theme="dark"] .wizard-nav {
  background: transparent;
  border-top: 0;
}

/* Responsive */
@media (max-width: 720px) {
  .cs-vat-grid { grid-template-columns: 1fr 1fr; }
  .cs-cond-grid { grid-template-columns: 1fr; }
}
