/* The generate report wizard: a step bar, then one card per step with its sections laid out like the report's cost cards.
   The step components (purchase, finance, refurb, exit) also render inside the complete renovation popup, so every
   section style here works without the wizard shell around it. */

.rw-root {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
    padding: 8px 0 24px;
    color: var(--color-text-primary);
}

/* Page heading */
.rw-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rw-eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.rw-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Step bar. Each step is a button so any step can be revisited */
.rw-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rw-step {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: var(--tpt-border);
    border-radius: 8px;
    background: var(--color-bg-surface);
    color: var(--color-text-secondary);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .rw-step:hover {
        background: rgba(var(--color-accent-rgb), 0.1);
    }

    .rw-step:focus-visible {
        outline: 2px solid var(--color-accent-hover);
        outline-offset: 2px;
    }

.rw-step-num {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(var(--color-accent-rgb), 0.18);
    color: var(--color-accent-hover);
    font-size: 0.85rem;
    font-weight: 600;
}

    .rw-step-num .e-icons {
        font-size: 12px;
    }

.rw-step-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rw-step-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rw-step-name {
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rw-step.active {
    border-color: var(--color-accent);
    background: rgba(var(--color-accent-rgb), 0.12);
    box-shadow: var(--shadow-sm);
}

    .rw-step.active .rw-step-num {
        background: var(--color-accent);
        color: var(--color-text-on-accent);
    }

.rw-step.done .rw-step-num {
    background: var(--color-accent-hover);
    color: var(--color-text-on-accent);
}

/* Seen, but something the report needs is still empty */
.rw-step.warn .rw-step-num {
    background: color-mix(in srgb, var(--color-warning) 35%, transparent);
    color: var(--color-text-primary);
    font-weight: 700;
}

.rw-step.warn .rw-step-label {
    color: var(--color-text-primary);
}

/* The step card, the same accent header bar as the report's cost cards */
.rw-card {
    display: flex;
    flex-direction: column;
    border: var(--tpt-border);
    border-radius: 8px;
    background: var(--color-bg-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.rw-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: var(--color-accent);
    color: var(--color-text-on-accent);
}

.rw-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.rw-card-sub {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.rw-card-count {
    flex: 0 0 auto;
    padding: 1px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.rw-card-body {
    padding: 4px 20px 8px;
    animation: rw-fade 0.25s ease-in-out;
}

.rw-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px dashed rgba(var(--color-accent-rgb), 0.35);
}

.rw-foot-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Gaps on other steps, each a link to its step */
.rw-todo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 10px 20px;
    border-top: 1px dashed rgba(var(--color-accent-rgb), 0.35);
    background: color-mix(in srgb, var(--color-warning) 10%, transparent);
}

.rw-todo-label {
    margin-right: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.rw-todo-step {
    color: var(--color-text-secondary);
    font-weight: 500;
}

    .rw-todo-step::before {
        content: "\00b7 ";
    }

@keyframes rw-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Buttons, the same pills as the landing page */
.rw-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 0;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

    .rw-btn .e-icons {
        font-size: 12px;
    }

    .rw-btn:focus-visible {
        outline: 2px solid var(--color-accent-hover);
        outline-offset: 2px;
    }

    .rw-btn:disabled {
        opacity: 0.6;
        cursor: default;
    }

.rw-btn-primary {
    background: var(--color-accent);
    color: var(--color-text-on-accent);
}

    .rw-btn-primary:hover:not(:disabled) {
        background: var(--color-accent-hover);
        box-shadow: var(--shadow-sm);
    }

.rw-btn-ghost {
    border: var(--tpt-border);
    background: transparent;
    color: var(--color-accent-hover);
}

    .rw-btn-ghost:hover:not(:disabled) {
        background: rgba(var(--color-accent-rgb), 0.12);
    }

/* Small text buttons inside a section, e.g. remove a loan */
.rw-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-accent-hover);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

    .rw-link-btn:hover {
        background: rgba(var(--color-accent-rgb), 0.15);
    }

    .rw-link-btn .e-icons {
        font-size: 10px;
    }

.rw-link-btn-danger {
    color: var(--color-danger);
}

    .rw-link-btn-danger:hover {
        background: color-mix(in srgb, var(--color-danger) 15%, transparent);
    }

/* Sections inside a step, divided like the cost card sections */
.rw-section {
    padding: 14px 0;
}

    .rw-section + .rw-section {
        border-top: 1px dashed rgba(var(--color-accent-rgb), 0.35);
    }

.rw-section-title {
    margin: 0 0 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.rw-note {
    margin: -4px 0 10px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.rw-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    align-items: end;
}

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

.rw-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rw-span-all {
    grid-column: 1 / -1;
}

/* A labelled toggle, so it reads as a question rather than a stray switch */
.rw-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
}

.rw-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.rw-choice-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.rw-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

/* Inputs. Syncfusion's boxes restyled as the tool's own fields: a small label like the toggles' above a 36px pill
   with the accent border, the same as the projects page's search and sort. Scoped to the sections so it also
   applies in the complete renovation popup */
.rw-section .e-input-group.e-control-wrapper {
    display: flex;
    align-items: center;
    height: 36px;
    margin-top: 24px;
    padding: 0 4px 0 14px;
    border: var(--tpt-border) !important;
    border-radius: 999px !important;
    background: var(--color-bg-surface) !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease;
}

    .rw-section .e-input-group.e-control-wrapper:not(.e-disabled):hover {
        border: var(--tpt-border-hover) !important;
    }

    .rw-section .e-input-group.e-control-wrapper.e-input-focus {
        outline: 2px solid var(--color-accent-hover);
        outline-offset: 1px;
    }

    .rw-section .e-input-group.e-control-wrapper input.e-control {
        height: 100%;
        min-height: 0;
        padding: 0;
        border: 0;
        background: transparent !important;
        color: var(--color-text-primary) !important;
        font-size: 0.875rem;
        font-variant-numeric: tabular-nums;
    }

    .rw-section .e-input-group.e-control-wrapper .e-float-line {
        display: none;
    }

    /* The theme moves the label with !important rules aimed at disabled and readonly inputs. :not(#rw-label) only
       adds the weight to beat them, so the label stays put whatever state the field is in */
    .rw-section .e-float-input.e-control-wrapper label.e-float-text.e-label-top:not(#rw-label) {
        top: -24px !important;
        left: 0 !important;
        padding: 0 !important;
        transform: none !important;
        color: var(--color-text-secondary) !important;
        font-size: 0.8rem !important;
        font-weight: 600;
        line-height: 18px;
    }

    /* Spin arrows don't fit a pill, and nothing else in the tool has them. The arrow keys still step the value */
    .rw-section .e-input-group.e-control-wrapper .e-spin-up,
    .rw-section .e-input-group.e-control-wrapper .e-spin-down {
        display: none;
    }

    .rw-section .e-input-group.e-control-wrapper .e-input-group-icon,
    .rw-section .e-input-group.e-control-wrapper .e-clear-icon {
        min-height: 0;
        height: 26px;
        min-width: 26px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent !important;
        color: var(--color-text-secondary) !important;
    }

        .rw-section .e-input-group.e-control-wrapper .e-input-group-icon:hover,
        .rw-section .e-input-group.e-control-wrapper .e-clear-icon:hover {
            background: rgba(var(--color-accent-rgb), 0.15) !important;
            color: var(--color-accent-hover) !important;
        }

    /* Worked out or locked fields read like the figure tiles: tinted, with the value still legible */
    .rw-section .e-input-group.e-control-wrapper.e-disabled,
    .rw-section .e-input-group.e-control-wrapper:has(input[readonly]) {
        border-style: dashed !important;
        background: rgba(var(--color-accent-rgb), 0.08) !important;
        cursor: not-allowed;
    }

        .rw-section .e-input-group.e-control-wrapper.e-disabled input.e-control,
        .rw-section .e-input-group.e-control-wrapper input.e-control[readonly] {
            color: var(--color-text-secondary) !important;
            -webkit-text-fill-color: var(--color-text-secondary);
        }

/* Fields the report needs. The label gets a marker, and an empty one that has been left gets a danger border and a line under it */
.rw-section .rw-field-required .e-float-input.e-control-wrapper label.e-float-text.e-label-top:not(#rw-label)::after {
    content: " *";
    color: var(--color-accent-hover);
    font-weight: 700;
}

.rw-section .rw-field-invalid .e-input-group.e-control-wrapper,
.rw-section .rw-field-invalid .e-input-group.e-control-wrapper:not(.e-disabled):hover {
    border-color: var(--color-danger) !important;
}

.rw-field-error {
    display: block;
    margin-top: 4px;
    padding-left: 14px;
    color: var(--color-danger);
    font-size: 0.78rem;
    font-weight: 600;
}

/* The message makes its field taller, so line the row up by the top instead of the bottom while one shows */
.rw-grid:has(.rw-field-invalid) {
    align-items: start;
}

/* Checkboxes in the accent, with the label in the same grey as the field labels */
.rw-section .e-checkbox-wrapper .e-label {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.rw-section .e-checkbox-wrapper:hover .e-label {
    color: var(--color-accent-hover);
}

.rw-section .e-checkbox-wrapper .e-frame {
    border-color: rgba(var(--color-accent-rgb), 0.5);
    border-radius: 4px;
}

.rw-section .e-checkbox-wrapper .e-frame.e-check,
.rw-section .e-checkbox-wrapper:hover .e-frame.e-check {
    border-color: var(--color-accent);
    background-color: var(--color-accent);
    color: var(--color-text-on-accent);
}

.rw-section .e-checkbox-wrapper .e-checkbox:focus + .e-frame {
    box-shadow: none;
    outline: 2px solid var(--color-accent-hover);
    outline-offset: 1px;
}

/* The LTV slider, in the accent */
.rw-section .e-slider-container.e-horizontal .e-slider-track {
    background: rgba(var(--color-accent-rgb), 0.25);
}

.rw-section .e-slider-container .e-slider .e-range {
    background: var(--color-accent);
}

.rw-section .e-slider-container .e-slider .e-handle {
    border-color: var(--color-accent);
    background-color: var(--color-accent);
}

    .rw-section .e-slider-container .e-slider .e-handle:hover,
    .rw-section .e-slider-container .e-slider .e-handle:active {
        border-color: var(--color-accent-hover);
        background-color: var(--color-accent-hover);
    }

.rw-section .e-slider-container .e-scale .e-tick .e-tick-value {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
}

.e-slider-tooltip.e-tooltip-wrap.e-popup {
    border-color: var(--color-accent-hover);
    background-color: var(--color-accent-hover);
}

    .e-slider-tooltip.e-tooltip-wrap .e-tip-content {
        color: var(--color-text-on-accent);
    }

/* Worked out figures, shown as read-only tiles rather than greyed out inputs */
.rw-figures {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.rw-figure {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 8px 12px;
    border-left: 3px solid var(--color-accent);
    border-radius: 6px;
    background: rgba(var(--color-accent-rgb), 0.08);
}

.rw-figure-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.rw-figure-value {
    font-size: 1.05rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rw-empty {
    margin: 0;
    padding: 12px 14px;
    border: 1px dashed rgba(var(--color-accent-rgb), 0.5);
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Loans. Add buttons, then one card per loan */
.rw-add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.rw-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px dashed var(--color-accent);
    border-radius: 999px;
    background: transparent;
    color: var(--color-accent-hover);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

    .rw-add-btn:hover {
        background: rgba(var(--color-accent-rgb), 0.12);
    }

    .rw-add-btn .e-icons {
        font-size: 10px;
    }

.rw-loans {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.rw-loan {
    border: var(--tpt-border);
    border-left: 4px solid var(--color-accent);
    border-radius: 6px;
    background: var(--color-bg-page);
}

.rw-loan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px 8px 14px;
    border-bottom: 1px dashed rgba(var(--color-accent-rgb), 0.35);
}

.rw-loan-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* The heading opens and closes its card. Closed, the summary of the loan sits beside the title */
.rw-loan-toggle {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

    .rw-loan-toggle > .e-icons {
        font-size: 0.75rem;
        color: var(--color-text-secondary);
    }

    .rw-loan-toggle:hover > .e-icons,
    .rw-loan-toggle:hover .rw-loan-title {
        color: var(--color-accent-hover);
    }

    .rw-loan-toggle:focus-visible {
        outline: 2px solid var(--color-accent-hover);
        outline-offset: 2px;
        border-radius: 4px;
    }

.rw-loan-summary {
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rw-loan.collapsed .rw-loan-head {
    border-bottom: 0;
}

.rw-loan-badge {
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-warning) 22%, transparent);
    color: var(--color-text-primary);
    font-size: 0.7rem;
    font-weight: 600;
}

.rw-loan-actions {
    display: flex;
    gap: 4px;
}

.rw-loan-body {
    display: flex;
    flex-direction: column;
    padding: 0 14px;
}

/* Borrowing, rate and term, payments and fees, ruled off like the step's own sections */
.rw-loan-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 0 14px;
}

    .rw-loan-group + .rw-loan-group {
        border-top: 1px dashed rgba(var(--color-accent-rgb), 0.35);
    }

.rw-loan-group-title {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

/* The slider's end labels are centred on the track's ends, so the inset keeps 0% and 100% inside the card */
.rw-slider {
    padding: 2px 16px 0;
}

/* Narrow screens */
@media (max-width: 767.98px) {
    .rw-steps {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .rw-step {
        justify-content: center;
        padding: 8px;
    }

    .rw-step-text {
        display: none;
    }

    .rw-grid-3, .rw-grid-4, .rw-figures {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Steps like finance run long here, so Back and Next stay pinned to the bottom of the screen. Fixed rather than sticky
       since the layout's content area is an overflow box that never scrolls itself. The right padding keeps Next clear of
       the feedback button, and the page's bottom padding keeps the last fields clear of the bar */
    .rw-root {
        padding-bottom: 80px;
    }

    .rw-card-foot {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 800;
        padding-right: 64px;
        border-top: var(--tpt-border);
        background: var(--color-bg-surface);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    }
}

@media (max-width: 575.98px) {
    .rw-grid, .rw-grid-3, .rw-grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .rw-card-head, .rw-card-body, .rw-todo {
        padding-left: 14px;
        padding-right: 14px;
    }

    .rw-card-foot {
        padding-left: 14px;
    }

    /* Eleven labels run together at this width, so the slider keeps every other one: 0%, 20%, 40%... */
    .rw-slider .e-scale .e-tick:nth-child(even) .e-tick-value {
        visibility: hidden;
    }
}
