:root {
    --abtg-primary: #f57c00;
    --abtg-bg: #ffffff;
    --abtg-card: #f7f7f7;
    --abtg-border: #e5e7eb;
    --abtg-text: #1f2937;
    --abtg-positive: #1f8a4c;
    --abtg-negative: #b42318;
    --abtg-neutral: #374151;
    --abtg-radius: 12px;
}

.abtg-tool {
    background: var(--abtg-bg);
    color: var(--abtg-text);
    max-width: 980px;
    margin: 0 auto;
    font-family: inherit;
}

.abtg-tool-header h2 {
    margin: 0 0 6px;
    font-size: clamp(1.5rem, 2.8vw, 2rem);
}

.abtg-tool-header p {
    margin: 0 0 20px;
    color: #4b5563;
}

.abtg-steps-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.abtg-step-pill {
    border: 1px solid var(--abtg-border);
    border-radius: 999px;
    background: #fff;
    padding: 9px 10px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #374151;
}

.abtg-step-pill.is-active {
    border-color: var(--abtg-primary);
    color: #fff;
    background: var(--abtg-primary);
}

.abtg-tool-card {
    border: 1px solid var(--abtg-border);
    border-radius: var(--abtg-radius);
    background: var(--abtg-card);
    padding: 20px;
    margin-bottom: 16px;
}

.abtg-step {
    display: none;
}

.abtg-step.is-active {
    display: block;
}

.abtg-step h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.abtg-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.abtg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.abtg-field span {
    font-weight: 600;
    color: #374151;
    font-size: 0.92rem;
}

.abtg-field input {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    outline: none;
    font-size: 0.98rem;
}

.abtg-field input:focus {
    border-color: var(--abtg-primary);
}

.abtg-toggle-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.abtg-toggle {
    position: relative;
    width: 52px;
    height: 30px;
}

.abtg-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.abtg-toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #d1d5db;
    border-radius: 100px;
    transition: background 0.2s ease;
}

.abtg-toggle-slider::before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.abtg-toggle input:checked + .abtg-toggle-slider {
    background: var(--abtg-primary);
}

.abtg-toggle input:checked + .abtg-toggle-slider::before {
    transform: translateX(22px);
}

.abtg-mortgage-fields.is-hidden {
    display: none;
}

.abtg-advanced summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 14px;
}

.abtg-step-actions {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.abtg-btn {
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}

.abtg-btn-primary {
    background: var(--abtg-primary);
    border-color: var(--abtg-primary);
    color: #fff;
}

.abtg-btn-secondary {
    background: #fff;
    border-color: #d1d5db;
    color: #111827;
}

.abtg-kpi-panel h3 {
    margin-top: 0;
    margin-bottom: 14px;
}

.abtg-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.abtg-kpi {
    border: 1px solid var(--abtg-border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.abtg-kpi-label {
    margin: 0;
    color: #6b7280;
    font-size: 0.88rem;
}

.abtg-kpi-value {
    margin: 8px 0 0;
    font-size: clamp(1.1rem, 2.4vw, 1.45rem);
    font-weight: 700;
    color: var(--abtg-neutral);
}

.abtg-kpi-value.is-positive {
    color: var(--abtg-positive);
}

.abtg-kpi-value.is-negative {
    color: var(--abtg-negative);
}

.abtg-tool-placeholder,
.abtg-tool-error {
    border: 1px solid var(--abtg-border);
    border-radius: var(--abtg-radius);
    background: var(--abtg-card);
    padding: 24px;
}

.abtg-tool-placeholder h2,
.abtg-tool-error h2 {
    margin: 0 0 8px;
}

@media (max-width: 991px) {
    .abtg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .abtg-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .abtg-steps-nav,
    .abtg-grid,
    .abtg-kpi-grid {
        grid-template-columns: 1fr;
    }

    .abtg-step-actions {
        flex-direction: column-reverse;
    }

    .abtg-btn {
        width: 100%;
    }
}
