.fpm-dashboard-calculator {
    --fpm-bg: #f1f3f5;
    --fpm-card: #ffffff;
    --fpm-navy: #0a2540;
    --fpm-green: #007a4d;
    --fpm-text: #172033;
    --fpm-muted: #667085;
    --fpm-border: #d9dee5;
    --fpm-soft: #f6f8fa;

    width: 100%;
    background: var(--fpm-bg);
    color: var(--fpm-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 20px;
    box-sizing: border-box;
}

.fpm-dashboard-calculator *,
.fpm-dashboard-calculator *::before,
.fpm-dashboard-calculator *::after {
    box-sizing: border-box;
}

.fpm-dashboard-layout {
    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.fpm-card,
.fpm-panel {
    background: var(--fpm-card);
    border: 1px solid var(--fpm-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.fpm-input-panel {
    padding: 24px;
}

.fpm-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--fpm-border);
}

.fpm-panel-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #eef1f4;
    display: grid;
    place-items: center;
    color: var(--fpm-muted);
    font-size: 16px;
    line-height: 1;
}

.fpm-panel-header h2 {
    margin: 0;
    color: var(--fpm-navy);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
}

.fpm-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.fpm-form label {
    display: block;
    margin: 0;
}

.fpm-form label > span {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
}

.fpm-form select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--fpm-border);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--fpm-text);
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    margin: 0;
    cursor: pointer;
}

.fpm-form select:focus {
    border-color: var(--fpm-navy);
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.08);
}

.fpm-input-money,
.fpm-input-percent {
    position: relative;
}

.fpm-input-money span,
.fpm-input-percent span {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #667085;
    font-size: 13px;
    pointer-events: none;
}

.fpm-input-money span {
    left: 12px;
}

.fpm-input-percent span {
    right: 12px;
}

.fpm-form input[type="number"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--fpm-border);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--fpm-text);
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    margin: 0;
}

.fpm-form input[type="number"]::-webkit-inner-spin-button,
.fpm-form input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

.fpm-input-money input {
    padding-left: 28px !important;
}

.fpm-input-percent input {
    padding-right: 28px !important;
}

.fpm-form input:focus {
    border-color: var(--fpm-navy);
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.08);
}

.fpm-years-row {
    display: grid;
    grid-template-columns: 1fr 58px;
    gap: 14px;
    align-items: center;
}

.fpm-years-row input[type="range"] {
    width: 100%;
    accent-color: var(--fpm-green);
    margin: 0;
    cursor: pointer;
}

.fpm-years-row input[type="number"] {
    text-align: center;
}

#fpm-calculate {
    margin-top: 8px;
    height: 44px;
    width: 100%;
    border: none;
    border-radius: 6px;
    background: var(--fpm-green);
    color: white;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: 0.2s ease;
}

#fpm-calculate:hover {
    background: #006c45;
}

#fpm-calculate span {
    display: inline-block;
    margin-left: 6px;
}

.fpm-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.fpm-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.fpm-stat-card {
    min-height: 122px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.fpm-stat-card span {
    color: #667085;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fpm-stat-card strong {
    color: var(--fpm-navy);
    font-size: 21px;
    line-height: 1.2;
    font-weight: 800;
    word-break: break-word;
}

.fpm-main-stat strong {
    font-size: 26px;
}

.fpm-stat-card .fpm-green,
.fpm-green {
    color: var(--fpm-green) !important;
}

.fpm-stat-card small {
    margin-top: auto;
    color: #667085;
    font-size: 11px;
    line-height: 1.2;
}

.fpm-progress {
    margin-top: auto;
    height: 4px;
    background: #edf0f3;
    border-radius: 999px;
    overflow: hidden;
}

.fpm-progress div {
    height: 100%;
    width: 0%;
    background: var(--fpm-navy);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.fpm-progress .fpm-progress-green {
    background: var(--fpm-green);
}

.fpm-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 190px;
    gap: 18px;
}

.fpm-chart-card {
    height: 260px;
    padding: 18px;
    min-width: 0;
}

.fpm-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.fpm-chart-header h3,
.fpm-donut-card h3 {
    margin: 0;
    color: var(--fpm-navy);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 800;
}

.fpm-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #344054;
    font-size: 10px;
    white-space: nowrap;
}

.fpm-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fpm-dot-blue,
.fpm-dot-green {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.fpm-dot-blue {
    background: var(--fpm-navy);
}

.fpm-dot-green {
    background: var(--fpm-green);
}

.fpm-chart-area {
    height: 205px;
    border-left: 1px solid var(--fpm-border);
    border-bottom: 1px solid var(--fpm-border);
    position: relative;
    margin-left: 40px;
}

.fpm-y-label {
    position: absolute;
    left: -42px;
    color: #98a2b3;
    font-size: 10px;
    line-height: 1;
}

.fpm-y-top {
    top: 2px;
}

.fpm-y-bottom {
    bottom: -4px;
}

#fpm-growth-chart {
    width: 100%;
    height: 100%;
    display: block;
}

#fpm-interest-area {
    fill: rgba(0, 122, 77, 0.16);
}

#fpm-interest-line {
    fill: none;
    stroke: var(--fpm-green);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#fpm-investment-area {
    fill: rgba(10, 37, 64, 0.12);
}

#fpm-investment-line {
    fill: none;
    stroke: var(--fpm-navy);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fpm-donut-card {
    height: 260px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fpm-donut-card h3 {
    align-self: flex-start;
    margin-bottom: 18px;
}

.fpm-donut {
    width: 122px;
    height: 122px;
    border-radius: 50%;
    background: conic-gradient(var(--fpm-green) 57%, var(--fpm-navy) 0);
    display: grid;
    place-items: center;
}

.fpm-donut > div {
    width: 76px;
    height: 76px;
    background: #ffffff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    align-content: center;
}

.fpm-donut strong {
    color: var(--fpm-navy);
    font-size: 20px;
    line-height: 1;
    font-weight: 800;
}

.fpm-donut span {
    color: #667085;
    font-size: 10px;
    line-height: 1.2;
}

.fpm-donut-legend {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    text-align: center;
}

.fpm-donut-legend div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fpm-donut-legend strong {
    color: var(--fpm-navy);
    font-size: 11px;
    line-height: 1.2;
}

.fpm-donut-legend span {
    color: #667085;
    font-size: 10px;
    line-height: 1.2;
}

.fpm-table-card {
    margin-top: 20px;
    overflow: hidden;
}

.fpm-table-header {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--fpm-border);
    gap: 16px;
}

.fpm-table-header h2 {
    margin: 0;
    color: var(--fpm-navy);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
}

.fpm-table-header p {
    margin: 3px 0 0;
    color: #667085;
    font-size: 11px;
    line-height: 1.4;
}

.fpm-export-button {
    height: 32px;
    border: 1px solid var(--fpm-border);
    background: white;
    color: var(--fpm-navy);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    padding: 0 12px;
    cursor: pointer;
    white-space: nowrap;
}

.fpm-export-button:hover {
    background: #f8fafc;
}

.fpm-table-wrapper {
    overflow-x: auto;
}

.fpm-table-card table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    margin: 0;
}

.fpm-table-card th,
.fpm-table-card td {
    padding: 13px 22px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 12px;
    line-height: 1.4;
}

.fpm-table-card th {
    background: #f8fafc;
    color: #344054;
    font-weight: 800;
}

.fpm-table-card td {
    color: #344054;
}

.fpm-table-card th:last-child,
.fpm-table-card td:last-child {
    text-align: right;
}

.fpm-table-interest {
    color: var(--fpm-green) !important;
    font-weight: 700;
}

.fpm-table-final {
    color: var(--fpm-navy) !important;
    font-weight: 800;
}

.fpm-table-card tbody tr:last-child td {
    background: rgba(0, 122, 77, 0.04);
    font-weight: 700;
}

.fpm-table-card tbody tr:last-child td:last-child {
    font-size: 20px;
}

@media (max-width: 1024px) {
    .fpm-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .fpm-stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .fpm-chart-grid {
        grid-template-columns: 1fr;
    }

    .fpm-donut-card {
        height: auto;
        min-height: 260px;
    }
}

@media (max-width: 768px) {
    .fpm-dashboard-calculator {
        padding: 14px;
    }

    .fpm-stat-grid {
        grid-template-columns: 1fr;
    }

    .fpm-chart-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .fpm-table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .fpm-export-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .fpm-input-panel {
        padding: 18px;
    }

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

    .fpm-years-row input[type="number"] {
        width: 100%;
    }

    .fpm-chart-area {
        margin-left: 36px;
    }

    .fpm-stat-card strong {
        font-size: 20px;
    }

    .fpm-main-stat strong {
        font-size: 24px;
    }
}

.fpm-danger {
    color: #c2410c !important;
}

.fpm-progress .fpm-progress-danger {
    background: #c2410c;
}

.fpm-credit-summary-card {
    min-height: 260px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fpm-credit-summary-card h3 {
    margin: 0 0 16px;
    color: var(--fpm-navy);
    font-size: 18px;
    font-weight: 800;
}

.fpm-credit-summary-card p {
    margin: 0;
    color: #344054;
    font-size: 16px;
    line-height: 1.6;
}

.fpm-credit-warning {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 13px;
    line-height: 1.5;
}

.fpm-credit-calculator .fpm-table-card table {
    min-width: 880px;
}