:root {
    --ink: #5b4ce6;
    --muted: #64748b;
    --line: #e5e7eb;
    --soft: #f7f8fa;
    --accent: #5b4ce6;
    --accent-soft: #eaf0f7;
    --white: #ffffff;
    --success: #18794e;
}


.back-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 60px;
}



.calculator-grid {
    display: grid;
    margin-top: 10px;
    grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
    gap: 20px;
}

.card,
.info-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(16, 35, 63, .045);
}

.inputs-card,
.result-card {
    padding: 26px;
}

.card-title h2 {
    margin: 0;
    font-size: 18px;
}

.card-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.field {
    margin-top: 22px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
}

.input-wrap {
    position: relative;
}

.input-wrap input,
.tenure-row input,
.tenure-row select {
    width: 100%;
    height: 46px;
    border: 1px solid #d9dee7;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.input-wrap input {
    padding: 0 42px 0 40px;
}

.input-wrap input:focus,
.tenure-row input:focus,
.tenure-row select:focus {
    border-color: #8da5bf;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.prefix,
.suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
}

.prefix {
    left: 14px;
}

.suffix {
    right: 14px;
}

.tenure-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 8px;
}

.tenure-row input {
    padding: 0 13px;
}

.tenure-row select {
    padding: 0 10px;
}

.slider-field {
    margin-top: 24px;
}

.slider-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.slider-label strong {
    color: var(--accent);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 9px;
    height: 44px;
    padding: 0 18px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn {
    width: 100%;
    margin-top: 24px;
    background: var(--accent);
    color: white;
}

.primary-btn:hover {
    opacity: .93;
}

.secondary-btn {
    background: var(--accent-soft);
    color: var(--accent);
}

.emi-result {
    margin-top: 25px;
    padding: 20px;
    border-radius: 12px;
    background: var(--accent-soft);
}

.emi-result span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.emi-result strong {
    display: block;
    margin-top: 5px;
    color: var(--accent);
    font-size: clamp(30px, 5vw, 42px);
    letter-spacing: -.03em;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 18px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.summary-item {
    padding: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.summary-item span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.summary-item strong {
    display: block;
    margin-top: 5px;
    font-size: 14px;
}

.breakdown {
    margin-top: 22px;
}

.breakdown-head,
.legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}

.bar {
    display: flex;
    overflow: hidden;
    height: 12px;
    margin-top: 9px;
    border-radius: 999px;
    background: #e8ebef;
}

.principal-bar {
    width: 70%;
    background: #163f70;
}

.interest-bar {
    width: 30%;
    background: #9aa8b8;
}

.legend {
    justify-content: flex-start;
    margin-top: 9px;
    gap: 18px;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
}

.principal-dot {
    background: #163f70;
}

.interest-dot {
    background: #9aa8b8;
}

.schedule-card {
    margin-top: 20px;
    padding: 22px 26px;
}

.schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.schedule-header h2 {
    margin: 0;
    font-size: 17px;
}

.schedule-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.schedule-container {
    margin-top: 18px;
}

.hidden {
    display: none;
}

.table-wrap {
    max-height: 440px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th,
td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    background: #f8f9fb;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.info-card {
    margin-top: 20px;
    padding: 24px 26px;
}

.info-card h2 {
    margin: 0;
    font-size: 17px;
}

.info-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.formula {
    margin: 18px 0;
    padding: 15px;
    border-radius: 9px;
    background: var(--soft);
    color: var(--accent);
    text-align: center;
    font-weight: 700;
}

.muted {
    font-size: 11px !important;
}

.tool-db-content {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.tool-content-section {
    padding: 24px 26px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(16, 35, 63, .045);
}

.tool-content-section h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.tool-content-body,
.tool-faq-item div {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.tool-faq-list {
    display: grid;
    gap: 10px;
}

.tool-faq-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
}

.tool-faq-item summary {
    padding: 13px 15px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.tool-faq-item div {
    padding: 0 15px 15px;
}

footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 22px;
    color: var(--muted);
    font-size: 11px;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 650;
}

@media (max-width: 800px) {
    .topbar {
        padding: 0 18px;
    }

    .container {
        width: min(100% - 22px, 680px);
        padding-top: 30px;
    }

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

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

    .schedule-header .secondary-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .inputs-card,
    .result-card,
    .schedule-card,
    .info-card {
        padding: 18px;
    }

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

    .tenure-row {
        grid-template-columns: 1fr 105px;
    }

    .topbar {
        height: 58px;
    }
}
