*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden],
.is-hidden {
    display: none !important;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.calc-page {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(252, 100, 50, 0.045) 0, rgba(255, 255, 255, 0) 230px),
        linear-gradient(90deg, rgba(247, 183, 15, 0.055) 0, rgba(255, 255, 255, 0) 42%),
        #ffffff;
    color: #111216;
    -webkit-font-smoothing: antialiased;
}

.calc-shell {
    width: 100%;
    max-width: 1080px;
    min-height: 100vh;
    padding-top: 78px;
}

.calc-main {
    min-width: 0;
    padding-bottom: 28px;
}

.calc-intro {
    position: relative;
    padding: 34px 0 22px;
    border-bottom: 1px solid #e8eaee;
}

.calc-intro::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #fc6432, #f7b70f 34%, #00827b 70%, transparent);
    opacity: 0.76;
}

.calc-intro-inner {
    display: grid;
    gap: 10px;
    max-width: 760px;
}

.calc-intro-overline,
.calc-feature-row {
    display: flex;
    align-items: center;
}

.calc-intro-overline {
    gap: 9px;
    color: #535860;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.calc-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #fc6432;
    box-shadow: 0 0 0 5px rgba(252, 100, 50, 0.12);
}

.calc-intro-title {
    max-width: 780px;
    color: #111216;
    font-family: var(--font-family-display, "DM Sans", sans-serif);
    font-size: clamp(42px, 7vw, 78px);
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: 0;
}

.calc-intro-desc {
    max-width: 560px;
    color: #555961;
    font-size: 15px;
    line-height: 1.55;
}

.calc-feature-row {
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 4px;
    color: #555961;
    font-size: 12px;
    font-weight: 800;
}

.calc-feature-row span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.calc-feature-row i {
    color: #fc6432;
}

.calc-workspace {
    padding-top: 28px;
}

.calc-layout {
    display: grid;
    grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.calc-sidebar {
    position: sticky;
    top: 88px;
    min-width: 0;
}

.calc-form-card,
.calc-preview-card,
.calc-summary-card,
.calc-ratio-card,
.calc-advice-card,
.calc-table-card {
    border: 1px solid #e8eaee;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 36px rgba(17, 18, 22, 0.045);
}

.calc-form-card {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.calc-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8eaee;
}

.calc-panel-kicker {
    margin-bottom: 4px;
    color: #8b9098;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.calc-panel-title {
    color: #111216;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.15;
}

.calc-panel-icon,
.calc-tip-icon {
    display: inline-grid;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(252, 100, 50, 0.14);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(252, 100, 50, 0.16), rgba(252, 100, 50, 0.045));
    color: #fc6432;
    font-size: 15px;
    line-height: 1;
    text-align: center;
}

.form-group {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 0.78fr;
    gap: 12px;
}

.form-label,
.form-hint {
    font-size: 12px;
    line-height: 1.35;
}

.form-label {
    color: #111216;
    font-weight: 900;
}

.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.form-hint {
    color: #8b9098;
    font-weight: 700;
}

.input-wrap {
    display: flex;
    min-width: 0;
    height: 44px;
    align-items: center;
    overflow: hidden;
    border: 1px solid #e8eaee;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-wrap:focus-within {
    border-color: #fc6432;
    box-shadow: 0 0 0 4px rgba(252, 100, 50, 0.1);
}

.input-prefix,
.input-suffix {
    display: inline-flex;
    height: 100%;
    align-items: center;
    padding: 0 12px;
    flex: 0 0 auto;
    background: #f8fafb;
    color: #555961;
    font-size: 12px;
    font-weight: 900;
}

.input-prefix {
    border-right: 1px solid #e8eaee;
}

.input-suffix {
    border-left: 1px solid #e8eaee;
}

.input-wrap .input,
.input-field-currency,
.input-field-rate {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: #111216;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
}

.input-wrap .input:focus {
    border: 0;
    box-shadow: none;
}

.input-field-rate,
.input-field-currency {
    -moz-appearance: textfield;
}

.input-field-rate::-webkit-outer-spin-button,
.input-field-rate::-webkit-inner-spin-button,
.input-field-currency::-webkit-outer-spin-button,
.input-field-currency::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.input-wrap input::placeholder {
    color: #a6abb3;
}

.tenor-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tenor-chip {
    display: inline-flex;
    min-width: 0;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid #e8eaee;
    border-radius: 8px;
    background: #ffffff;
    color: #111216;
    cursor: pointer;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tenor-chip:hover {
    border-color: rgba(252, 100, 50, 0.45);
    color: #fc6432;
    transform: translateY(-1px);
}

.tenor-chip.active {
    border-color: #fc6432;
    background: #fc6432;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(252, 100, 50, 0.2);
}

.tenor-chip-unit {
    color: inherit;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    opacity: 0.72;
}

.tenor-chip--custom {
    font-size: 12px;
}

.calc-custom-tenor {
    animation: calcFadeSlideIn 0.22s ease both;
}

.calc-custom-tenor-field {
    margin: 0;
}

.calc-cta {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    gap: 8px;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 900 !important;
}

.calc-results {
    display: grid;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
}

.calc-preview-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    background:
        linear-gradient(135deg, rgba(252, 100, 50, 0.12), rgba(247, 183, 15, 0.06) 42%, rgba(255, 255, 255, 0.9)),
        #ffffff;
}

.calc-preview-card::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #fc6432, #f7b70f, #00827b);
}

.calc-preview-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.calc-preview-label,
.calc-summary-label {
    color: #6d737d;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

.calc-preview-amount {
    margin-top: 6px;
    color: #111216;
    font-family: var(--font-family-display, "DM Sans", sans-serif);
    font-size: clamp(34px, 5.5vw, 56px);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.calc-preview-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: #555961;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.calc-preview-status i {
    color: #fc6432;
    font-size: 9px;
}

.calc-status-ready {
    color: #16823a !important;
}

.calc-preview-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.calc-preview-meta-item {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(17, 18, 22, 0.1);
}

.calc-preview-meta-label {
    color: #6d737d;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.calc-preview-meta-value {
    color: #111216;
    font-size: 13px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.calc-placeholder {
    display: flex;
    min-height: 78px;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-top: 1px solid #e8eaee;
    border-bottom: 1px solid #e8eaee;
    color: #555961;
}

.calc-placeholder i {
    display: inline-grid;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    place-items: center;
    border-radius: 10px;
    background: rgba(0, 130, 123, 0.12);
    color: #00827b;
    flex: 0 0 auto;
    line-height: 1;
    text-align: center;
}

.calc-placeholder p {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

#simulationReport {
    display: grid;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
    animation: calcFadeSlideIn 0.28s ease both;
}

#simulationReport > * {
    min-width: 0;
    max-width: 100%;
}

.calc-summary-row {
    display: grid;
    grid-template-columns: 1.05fr 1.2fr;
    gap: 14px;
}

.calc-summary-card {
    padding: 16px;
    min-width: 0;
}

.calc-summary-primary {
    display: grid;
    align-content: center;
    gap: 6px;
    border-color: rgba(252, 100, 50, 0.18);
}

.calc-summary-amount {
    color: #fc6432;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.05;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.calc-summary-secondary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.calc-summary-group {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.calc-summary-value {
    color: #111216;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.calc-summary-value--danger {
    color: #fc6432;
}

.calc-summary-divider {
    width: 1px;
    height: 44px;
    background: #e8eaee;
}

.calc-ratio-card,
.calc-advice-card,
.calc-table-card {
    padding: 16px;
    min-width: 0;
    max-width: 100%;
}

.calc-ratio-header,
.calc-table-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111216;
    font-size: 14px;
    font-weight: 900;
}

.calc-ratio-header i,
.calc-table-title i {
    color: #fc6432;
}

.calc-ratio-bar {
    display: flex;
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #f0f2f4;
}

.calc-ratio-fill {
    height: 100%;
    transition: width 0.45s ease;
}

.calc-ratio-principal {
    border-radius: 999px 0 0 999px;
    background: #111216;
}

.calc-ratio-interest {
    border-radius: 0 999px 999px 0;
    background: #fc6432;
}

.calc-ratio-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.calc-ratio-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #555961;
    font-size: 12px;
    font-weight: 800;
}

.calc-ratio-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.calc-ratio-dot--principal {
    background: #111216;
}

.calc-ratio-dot--interest {
    background: #fc6432;
}

.calc-advice-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid #fc6432;
}

.calc-advice-icon {
    display: inline-grid;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    place-items: center;
    border-radius: 10px;
    background: #f8fafb;
    color: #fc6432;
    flex: 0 0 auto;
    line-height: 1;
    text-align: center;
}

.calc-advice-icon i,
.calc-feature-row i,
.calc-ratio-header i,
.calc-table-title i,
.calc-export-btn i,
.tenor-chip i {
    line-height: 1;
}

.calc-advice-text {
    margin: 0;
    color: #555961;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.55;
}

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

.calc-export-btn {
    min-height: 34px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    gap: 7px;
    font-size: 12px !important;
    font-weight: 900 !important;
}

.calc-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calc-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13px;
}

.calc-table th,
.calc-table td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

.calc-table th {
    border-bottom: 1px solid #e8eaee;
    color: #6d737d;
    font-size: 10px;
    font-weight: 900;
}

.calc-table td {
    border-bottom: 1px solid #eef0f3;
    color: #111216;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.calc-table tbody tr:last-child td {
    border-bottom: 0;
}

.interest-cell {
    color: #fc6432 !important;
}

.calc-tip-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8eaee;
}

.calc-tip-item {
    display: flex;
    min-width: 0;
    gap: 12px;
}

.calc-tip-icon {
    flex: 0 0 auto;
}

.calc-tip-title {
    margin: 0 0 4px;
    color: #111216;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
}

.calc-tip-desc {
    margin: 0;
    color: #555961;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

#papicToast {
    pointer-events: none;
}

@keyframes calcFadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .calc-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .calc-sidebar {
        position: static;
    }

    .calc-form-card {
        gap: 16px;
    }
}

@media (max-width: 720px) {
    .calc-shell {
        padding-top: 58px;
    }

    .calc-intro {
        padding: 20px 0 16px;
    }

    .calc-intro-title {
        font-size: 40px;
    }

    .calc-intro-desc {
        max-width: 340px;
        font-size: 13px;
    }

    .calc-feature-row {
        gap: 7px 12px;
        font-size: 11px;
    }

    .calc-workspace {
        padding-top: 16px;
    }

    .calc-layout,
    .calc-results,
    #simulationReport {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .calc-form-card,
    .calc-preview-card,
    .calc-summary-card,
    .calc-ratio-card,
    .calc-advice-card,
    .calc-table-card {
        box-shadow: none;
    }

    .calc-form-card,
    .calc-preview-card {
        padding: 14px;
    }

    .form-grid,
    .calc-summary-row,
    .calc-tip-container {
        grid-template-columns: 1fr;
    }

    .calc-preview-top {
        display: grid;
    }

    .calc-preview-status {
        width: fit-content;
        max-width: 100%;
        white-space: normal;
    }

    .calc-preview-meta {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 16px;
    }

    .calc-preview-meta-item {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        min-width: 0;
    }

    .calc-preview-meta-value {
        max-width: 58%;
        text-align: right;
    }

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

    .calc-summary-amount {
        font-size: 25px;
    }

    .calc-summary-value {
        font-size: 15px;
    }

    .calc-summary-divider {
        width: 100%;
        height: 1px;
    }

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

    .calc-table-card {
        overflow: hidden;
    }

    .calc-table {
        min-width: 500px;
        font-size: 12px;
    }

    .calc-table th,
    .calc-table td {
        padding: 9px 10px;
    }

}

@media (max-width: 430px) {
    .calc-intro-title {
        font-size: 36px;
    }

    .calc-feature-row {
        gap: 7px 10px;
        font-size: 10.5px;
    }

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

    .calc-preview-amount {
        font-size: 32px;
    }

    .calc-table {
        min-width: 460px;
    }

    .calc-table th,
    .calc-table td {
        padding: 8px;
    }
}
