/* ================================================================
 * Financial Roadmap — Multi-step Calculator Tool
 * Design tokens inherit from :root in main.css
 * Product/UX Spec: docs/Product-UX-Spec-v2.1.md
 * ================================================================ */

/* --- FR-specific tokens (override if needed) --- */
:root {
    --c-fr-success: #10b981;
    --c-fr-warning: #f59e0b;
    --c-fr-gap: #f97316;
    --c-fr-self-prepare: #10b981;
    --c-fr-solution: #3b82f6;
    --c-fr-card-border: #e2e8f0;
    --c-fr-card-bg: #ffffff;
    --c-fr-step-active: #2563eb;
    --c-fr-step-complete: #10b981;
    --c-fr-step-pending: #cbd5e1;
    --c-fr-selected-bg: #dbeafe;
    --c-fr-selected-border: #bfdbfe;
    --radius-fr-card: 12px;
    --radius-fr-progress: 8px;
}

/* --- Section container --- */
.fr-section {
    padding: 4rem 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.fr-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.fr-title {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 800;
    color: #1a2440;
    letter-spacing: -0.01em;
    margin-bottom: 0.65rem;
}

.fr-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    max-width: 480px;
    margin: 0 auto;
}

/* --- Step container --- */
.fr-step-container {
    max-width: 720px;
    margin: 0 auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fr-step-container[hidden] {
    display: none;
}

.fr-step-header {
    margin-bottom: 2rem;
}

.fr-step-headline {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a2440;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.fr-step-sub {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
}

.fr-step-progress {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

/* --- Step Indicator --- */
.fr-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    padding: 0.5rem;
}

.fr-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-fr-step-pending);
    transition: background 0.3s;
}

.fr-dot.is-active {
    background: var(--c-fr-step-active);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.fr-dot.is-complete {
    background: var(--c-fr-step-complete);
}

.fr-connector {
    width: 2rem;
    height: 2px;
    background: var(--c-fr-step-pending);
    transition: background 0.3s;
}

.fr-connector.is-complete {
    background: var(--c-fr-step-complete);
}

/* --- Concern Cards (Step 0) --- */
.fr-concern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.fr-concern-card {
    border: 2px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    padding: 1.25rem;
    background: var(--c-fr-card-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
}

.fr-concern-card:hover {
    border-color: var(--c-fr-selected-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.fr-concern-card.is-selected {
    border-color: #2563eb;
    background: var(--c-fr-selected-bg);
}

.fr-concern-card.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fr-concern-card .fr-card-icon {
    width: 32px;
    height: 32px;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.fr-concern-card .fr-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a2440;
    margin-bottom: 0.25rem;
}

.fr-concern-card .fr-card-sub {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
}

.fr-concern-card .fr-card-check {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.fr-concern-card.is-selected .fr-card-check {
    background: #2563eb;
    border-color: #2563eb;
}

.fr-counter {
    text-align: center;
    font-size: 0.95rem;
    color: #1a2440;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fr-hint-link {
    font-size: 0.82rem;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
}

.fr-hint-link:hover {
    color: #1d4ed8;
}

/* --- Form fields (Step 1, 2-N) --- */
.fr-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.fr-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fr-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a2440;
}

.fr-label .fr-optional {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.82rem;
}

.fr-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.95rem;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fr-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.fr-input.is-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.fr-helper {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
}

.fr-helper.is-error {
    color: #ef4444;
}

.fr-trust-note {
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 0.5rem;
}

/* --- Range/Slider styling --- */
.fr-slider-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fr-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

.fr-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.fr-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.fr-slider-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a2440;
    min-width: 3.5rem;
    text-align: center;
}

/* --- Radio buttons --- */
.fr-radio-group {
    display: flex;
    gap: 1rem;
}

.fr-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.fr-radio-label:hover {
    border-color: #2563eb;
}

.fr-radio-label.is-selected {
    border-color: #2563eb;
    background: #dbeafe;
}

/* --- Navigation --- */
.fr-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.fr-nav-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-left: auto;
}

.fr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border: none;
    line-height: 1.4;
}

.fr-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.fr-btn--primary {
    background: #2563eb;
    color: #fff;
}

.fr-btn--primary:hover {
    background: #1d4ed8;
}

.fr-btn--primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.fr-btn--back {
    background: transparent;
    color: #64748b;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.fr-btn--back:hover {
    color: #1a2440;
}

.fr-btn--skip {
    background: transparent;
    color: #94a3b8;
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
}

.fr-btn--skip:hover {
    color: #64748b;
}

.fr-btn--secondary {
    background: #fff;
    color: #2563eb;
    border: 1px solid #2563eb;
}

.fr-btn--secondary:hover {
    background: #eff6ff;
}

/* --- Result Dashboard --- */
.fr-dashboard-summary {
    background: linear-gradient(135deg, #1a2440 0%, #2563eb 100%);
    border-radius: var(--radius-fr-card);
    padding: 2rem;
    color: #fff;
    margin-bottom: 2rem;
    text-align: center;
}

.fr-dashboard-summary .fr-primary-metric {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.fr-dashboard-summary .fr-secondary-metric {
    font-size: 1rem;
    opacity: 0.85;
}

/* --- Result Cards --- */
.fr-result-card {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    background: var(--c-fr-card-bg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.fr-result-card-header {
    padding: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
}

.fr-result-card-header:hover {
    background: #f8fafc;
}

.fr-result-card-header .fr-result-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.fr-result-card-header .fr-result-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: #1a2440;
}

.fr-result-card-header .fr-result-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.fr-result-status--full {
    background: #d1fae5;
    color: #065f46;
}

.fr-result-status--partial {
    background: #fef3c7;
    color: #92400e;
}

.fr-result-status--skipped {
    background: #f1f5f9;
    color: #64748b;
}

.fr-result-card-body {
    padding: 0 1.25rem 1.25rem;
}

/* --- Progress Bar --- */
.fr-progress-bar {
    display: flex;
    height: 12px;
    border-radius: var(--radius-fr-progress);
    overflow: hidden;
    margin: 0.75rem 0;
    background: #e2e8f0;
}

.fr-progress-have {
    background: var(--c-fr-success);
    transition: width 0.5s ease-out;
}

.fr-progress-need {
    background: var(--c-fr-gap);
    transition: width 0.5s ease-out;
}

.fr-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.fr-gap-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.fr-gap-numbers .fr-existing {
    font-weight: 700;
    color: var(--c-fr-success);
}

.fr-gap-numbers .fr-gap {
    font-weight: 700;
    color: var(--c-fr-gap);
}

/* --- Split Cards (Self-prepare vs Solution) --- */
.fr-split-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.fr-split-card {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    padding: 1.25rem;
}

.fr-split-card .fr-split-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.fr-split-card--self .fr-split-title {
    color: var(--c-fr-self-prepare);
}

.fr-split-card--solution .fr-split-title {
    color: var(--c-fr-solution);
}

.fr-split-card .fr-split-amount {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.fr-split-card .fr-split-pct {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.fr-split-card .fr-split-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fr-split-card .fr-split-items li {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #475569;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.fr-split-card .fr-split-items li:last-child {
    border-bottom: none;
}

.fr-split-card--self {
    border-left: 3px solid var(--c-fr-self-prepare);
}

.fr-split-card--solution {
    border-left: 3px solid var(--c-fr-solution);
}

/* --- Solution coverage levels --- */
.fr-coverage-levels {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.fr-coverage-levels .fr-level-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.fr-level-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.fr-level-item {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
}

.fr-level-item .fr-level-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1a2440;
    margin-bottom: 0.25rem;
}

.fr-level-item .fr-level-premium {
    font-size: 0.78rem;
    color: #64748b;
}

/* --- Timeline --- */
.fr-timeline {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.fr-timeline .fr-timeline-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a2440;
    margin-bottom: 0.5rem;
}

.fr-timeline .fr-timeline-text {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
}

/* --- Compare section --- */
.fr-compare-card {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--c-fr-card-bg);
}

.fr-compare-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a2440;
    margin-bottom: 1rem;
}

.fr-compare-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fr-compare-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fr-compare-label {
    font-size: 0.82rem;
    color: #64748b;
    min-width: 3.5rem;
}

.fr-compare-bar-wrap {
    flex: 1;
    display: flex;
    gap: 2px;
}

.fr-compare-bar {
    height: 24px;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.fr-compare-bar--before {
    background: #e2e8f0;
}

.fr-compare-bar--after {
    background: #2563eb;
}

/* --- Disclaimer --- */
.fr-disclaimer {
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-top: 2rem;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Final CTAs --- */
.fr-cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.fr-cta-zalo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background: #2563eb;
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
}

.fr-cta-zalo:hover {
    background: #1d4ed8;
    color: #fff;
}

.fr-cta-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.2s, color 0.2s;
    text-decoration: none;
}

.fr-cta-secondary:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* --- Sticky Summary Bar --- */
.fr-summary-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.fr-summary-bar.is-visible {
    transform: translateY(0);
}

.fr-summary-bar .fr-summary-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a2440;
}

.fr-summary-bar .fr-summary-cta {
    padding: 0.65rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.2s;
}

.fr-summary-bar .fr-summary-cta:hover {
    background: #1d4ed8;
}

/* --- Loading skeleton --- */
.fr-loading {
    text-align: center;
    padding: 3rem 0;
}

.fr-loading p {
    font-size: 1.1rem;
    color: #1a2440;
    margin-bottom: 1.5rem;
}

.fr-skeleton {
    width: 100%;
    height: 120px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-fr-card);
    animation: fr-shimmer 1.5s infinite;
}

@keyframes fr-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================================
 * HINT POPOVER — "Không chắc? Xem gợi ý"
 * Replaces browser alert with a modal/popover overlay
 * ================================================================ */

.fr-hint-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.fr-hint-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.fr-hint-popover {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 90vw;
    padding: 1.75rem 1.75rem 1.25rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.25s ease;
}

.fr-hint-overlay.is-open .fr-hint-popover {
    transform: scale(1) translateY(0);
}

.fr-hint-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.fr-hint-close:hover,
.fr-hint-close:focus-visible {
    background: #e2e8f0;
    color: #1a2440;
    outline: none;
}

.fr-hint-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2440;
    margin: 0 0 0.35rem;
    padding-right: 2rem;
}

.fr-hint-sub {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 1.25rem;
    padding-right: 2rem;
}

.fr-hint-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.fr-hint-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    text-align: left;
    background: #fff;
    font: inherit;
    color: inherit;
    width: 100%;
}

.fr-hint-item:hover {
    border-color: #2563eb;
    background: #f8faff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.fr-hint-item:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.fr-hint-item-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.fr-hint-item-content {
    flex: 1;
    min-width: 0;
}

.fr-hint-item-text {
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.5;
    margin-bottom: 0.3rem;
}

.fr-hint-item-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    line-height: 1.5;
}

.fr-hint-item.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Shake animation for max-reached feedback */
.fr-hint-item--shake {
    animation: fr-shake 0.4s ease;
}

@keyframes fr-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.fr-hint-footer {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    margin: 1rem 0 0;
    line-height: 1.5;
}

/* Mobile bottom-sheet */
@media (max-width: 480px) {
    .fr-hint-overlay {
        align-items: flex-end;
    }

    .fr-hint-popover {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem 1.25rem 1.25rem;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        max-height: 80vh;
        overflow-y: auto;
    }

    .fr-hint-overlay.is-open .fr-hint-popover {
        transform: translateY(0);
    }

    .fr-hint-item {
        padding: 0.875rem;
    }
}

/* --- Responsive --- */
@media (max-width: 767px) {
    .fr-section {
        padding: 2.5rem 0;
    }

    .fr-concern-grid {
        grid-template-columns: 1fr;
    }

    .fr-split-row {
        grid-template-columns: 1fr;
    }

    .fr-navigation {
        flex-direction: column-reverse;
    }

    .fr-nav-right {
        width: 100%;
        margin-left: 0;
    }

    .fr-btn--primary {
        flex: 1;
    }

    .fr-summary-bar {
        padding: 0.65rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .fr-summary-bar .fr-summary-cta {
        width: 100%;
        text-align: center;
    }

    .fr-radio-group {
        flex-direction: column;
    }

    .fr-level-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .fr-step-headline {
        font-size: 1.15rem;
    }
    .fr-dashboard-summary {
        padding: 1.5rem;
    }
    .fr-dashboard-summary .fr-primary-metric {
        font-size: 1.75rem;
    }
}

/* ================================================================
 * STANDALONE PAGE MODE (.fr-page)
 * Full-page wizard layout — no header/footer clutter
 * ================================================================ */

body.fr-page .fr-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 600;
}

body.fr-page .fr-sticky-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 1.5rem;
    background: #1a2440;
    color: #fff;
    font-size: 0.82rem;
    position: sticky;
    top: 53px;
    z-index: 599;
}

body.fr-page .fr-sticky-step .fr-sticky-name {
    font-weight: 700;
    letter-spacing: 0.01em;
}

body.fr-page .fr-sticky-step .fr-sticky-count {
    opacity: 0.7;
    font-size: 0.75rem;
}

body.fr-page .fr-topbar-home {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

body.fr-page .fr-topbar-home:hover {
    color: #2563eb;
}

body.fr-page .fr-topbar-brand {
    font-size: 0.82rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

body.fr-page .fr-page-main {
    min-height: calc(100vh - 53px);
    display: flex;
    flex-direction: column;
}

body.fr-page .fr-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0 4rem;
    background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
    border: none;
}

body.fr-page .fr-step-container {
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

body.fr-page .fr-navigation {
    max-width: 640px;
    margin: 2rem auto 0;
}

body.fr-page .fr-step-indicator {
    margin: 1rem auto 2rem;
}

body.fr-page .fr-summary-bar {
    max-width: 640px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    border-radius: 12px 12px 0 0;
    bottom: 0;
}

body.fr-page .fr-summary-bar.is-visible {
    transform: translateX(-50%) translateY(0);
}

/* ================================================================
 * V2 — MODULE CARDS (D | R | C | S)
 * ================================================================ */

.fr-module-card {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    background: var(--c-fr-card-bg);
    margin-bottom: 1.25rem;
    overflow: hidden;
    border-left: 4px solid #94a3b8;
}

.fr-module-card--D { border-left-color: #ef4444; }
.fr-module-card--R { border-left-color: #f59e0b; }
.fr-module-card--C { border-left-color: #10b981; }
.fr-module-card--S { border-left-color: #3b82f6; }

.fr-module-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.fr-module-code {
    font-size: 0.75rem;
    font-weight: 800;
    background: #1a2440;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.fr-module-icon {
    font-size: 1.2rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fr-module-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a2440;
}

.fr-module-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.fr-status--safe {
    background: #d1fae5;
    color: #065f46;
}

.fr-status--caution {
    background: #fef3c7;
    color: #92400e;
}

.fr-status--danger {
    background: #fee2e2;
    color: #991b1b;
}

.fr-status--skipped {
    background: #f1f5f9;
    color: #64748b;
}

/* --- Metrics A/B/C --- */

.fr-module-metrics {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fr-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    font-size: 0.9rem;
}

.fr-metric-row.metric-a .fr-metric-value { color: #475569; }
.fr-metric-row.metric-b .fr-metric-value { color: var(--c-fr-success); }
.fr-metric-row.metric-c .fr-metric-value { color: var(--c-fr-gap); font-weight: 800; }

.fr-metric-label {
    color: #64748b;
    font-weight: 500;
}

.fr-metric-value {
    font-weight: 700;
    color: #1a2440;
}

.fr-coverage-pct {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    padding: 0.5rem 1.25rem 0;
}

/* --- Solutions --- */

.fr-solutions {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.fr-solutions-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.fr-solution-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #f8fafc;
}

.fr-solution-row:last-child { border-bottom: none; }

.fr-solution-name {
    color: #1e293b;
    flex: 1;
}

.fr-solution-amount {
    font-weight: 700;
    color: #1a2440;
    margin-left: 1rem;
}

.fr-solution-monthly {
    font-size: 0.78rem;
    color: #94a3b8;
    min-width: 5rem;
    text-align: right;
}

/* --- Recommendations --- */

.fr-recommendations {
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.fr-rec-item {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
    padding: 0.2rem 0;
    margin: 0;
}

.fr-rec-item::before {
    content: '\2022';
    color: #2563eb;
    font-weight: 700;
    display: inline-block;
    width: 1rem;
}

/* ================================================================
 * V2 — TABLE GRID (Expense & Asset tables)
 * ================================================================ */

.fr-table-grid {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    background: var(--c-fr-card-bg);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.fr-table-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a2440;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.fr-table-row {
    display: flex;
    align-items: flex-start;
    padding: 0.625rem 1rem;
    gap: 1rem;
    border-bottom: 1px solid #f8fafc;
}

.fr-table-row:last-child { border-bottom: none; }

.fr-table-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #fafafa;
}
.fr-table-header-label {
    flex: 0 0 40%;
}
.fr-table-header-amount {
    flex: 1;
    text-align: right;
}

.fr-table-label {
    flex: 0 0 40%;
    font-size: 0.88rem;
    color: #1e293b;
    padding-top: 0.5rem;
}

.fr-table-input-wrap {
    flex: 1;
}

.fr-table-input {
    text-align: right;
    font-weight: 700;
}

.fr-table-hint {
    margin-top: 0.15rem;
    font-size: 0.75rem;
}

.fr-table-footer {
    display: flex;
    padding: 0.625rem 1rem;
    background: #f8fafc;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a2440;
    border-top: 1px solid #e2e8f0;
}

.fr-table-footer-label {
    font-size: 0.88rem;
    color: #64748b;
}

.fr-table-footer-value {
    font-size: 1rem;
    color: #2563eb;
}

.fr-derived-row {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.fr-derived-value {
    font-size: 1.1rem;
    font-weight: 800;
}

/* --- Children Editor (Education v2) --- */

.fr-children-editor {
    border: 1px solid var(--c-fr-card-border);
    border-radius: var(--radius-fr-card);
    background: var(--c-fr-card-bg);
    margin-bottom: 1.25rem;
    padding: 1rem;
}

.fr-children-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.fr-child-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.fr-child-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.fr-child-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a2440;
}

.fr-btn--remove {
    background: transparent;
    color: #ef4444;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.fr-child-card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.fr-child-label {
    font-size: 0.82rem;
}

/* ================================================================
 * PRINT STYLES (v2)
 * ================================================================ */

@media print {
    .fr-navigation,
    .fr-topbar,
    .fr-sticky-step,
    .fr-cta-group,
    .fr-summary-bar,
    .fr-btn,
    .fr-hint-link,
    .fr-counter,
    .fr-step-indicator,
    .fr-loading { display: none !important; }

    .fr-section { padding: 0; background: white; border: none; }
    .fr-step-container[hidden] { display: block !important; }
    .fr-step-container { max-width: 100%; }
    .fr-module-card { break-inside: avoid; page-break-inside: avoid; }
    .fr-dashboard-summary { background: #1a2440 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fr-progress-have, .fr-progress-need { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --- Explainability accordion --- */
.fr-explain {
    margin-top: 1rem;
    border-top: 1px solid var(--c-fr-card-border);
    padding-top: 0.75rem;
}
.fr-explain-toggle {
    background: none;
    border: none;
    color: var(--c-fr-step-active);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.fr-explain-toggle:hover {
    opacity: 0.75;
}
.fr-explain-body {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.8125rem;
    line-height: 1.6;
}
.fr-explain-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.2rem 0;
    gap: 1rem;
}
.fr-explain-label {
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
    max-width: 55%;
}
.fr-explain-value {
    color: #334155;
    text-align: right;
    flex-shrink: 0;
}
.fr-explain-note {
    color: #64748b;
    font-style: italic;
    font-size: 0.75rem;
    display: block;
    width: 100%;
}

@media (max-width: 767px) {
    body.fr-page .fr-section {
        padding: 1.5rem 0 3rem;
        justify-content: flex-start;
    }
    body.fr-page .fr-topbar {
        padding: 0.5rem 1rem;
    }
}

/* --- Chips (preset selectors) --- */
.fr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.fr-chip {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 2px solid var(--c-fr-card-border, #e2e8f0);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    color: #334155;
    transition: all 0.15s;
}
.fr-chip:hover {
    border-color: var(--c-fr-step-active, #2563eb);
}
.fr-chip.is-selected {
    border-color: var(--c-fr-step-active, #2563eb);
    background: var(--c-fr-selected-bg, #dbeafe);
    color: var(--c-fr-step-active, #2563eb);
    font-weight: 600;
}
.fr-chip-custom {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.fr-chip-custom-input {
    width: 4rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
    border: 2px solid var(--c-fr-card-border, #e2e8f0);
    border-radius: 6px;
    text-align: center;
}
.fr-chip-custom-suffix {
    font-size: 0.8rem;
    color: #64748b;
}

/* --- Section break --- */
.fr-section-break {
    position: relative;
    margin: 1.5rem 0;
    text-align: center;
}
.fr-section-break hr {
    border: none;
    border-top: 1px dashed #cbd5e1;
    margin: 0;
}
.fr-section-break-label {
    display: inline-block;
    background: #fff;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    position: relative;
    top: -0.7rem;
}

/* --- Accordion (Xem cách tính) --- */
.fr-accordion {
    margin: 1rem 0 0;
    border: 1px solid var(--c-fr-card-border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
}
.fr-accordion-toggle {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: #f8fafc;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-fr-step-active, #2563eb);
    cursor: pointer;
    text-align: left;
}
.fr-accordion-toggle:hover {
    background: #f1f5f9;
}
.fr-accordion-body {
    border-top: 1px solid var(--c-fr-card-border, #e2e8f0);
    padding: 0.75rem 1rem;
    background: #fff;
}
.fr-step-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.5rem;
}
.fr-step-row:last-child {
    border-bottom: none;
}
.fr-step-label {
    flex: 1 1 auto;
    font-size: 0.8rem;
    color: #475569;
}
.fr-step-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    text-align: right;
}
.fr-step-formula {
    width: 100%;
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
}
.fr-step-note {
    width: 100%;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* --- Reference table (education costs) --- */
.fr-ref-table {
    margin: 1rem 0;
    border: 1px solid var(--c-fr-card-border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.8rem;
}
.fr-ref-title {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    border-bottom: 1px solid var(--c-fr-card-border, #e2e8f0);
}
.fr-ref-row {
    display: flex;
    flex-wrap: wrap;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.75rem;
}
.fr-ref-row:last-child {
    border-bottom: none;
}
.fr-ref-location {
    flex: 1 1 100%;
    font-weight: 500;
    color: #1e293b;
}
.fr-ref-value {
    color: #475569;
    font-size: 0.75rem;
}
.fr-ref-value + .fr-ref-value {
    margin-left: auto;
}
