/* =========================
   Monthly Payment Calculator
   (builds on the shared .calc-* styles in affordability.css)
========================= */
.mp-wrapper .mp-one-col {
    grid-template-columns: 1fr;
}

.mp-wrapper .fld[hidden] {
    display: none;
}

/* Tabs */
.mp-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--dc-bg-card, #fff);
    border: 1px solid var(--dc-border, rgba(19, 77, 50, .12));
    border-radius: 12px;
    box-shadow: var(--dc-sh-sm, 0 2px 8px rgba(0, 0, 0, .07));
}

.mp-tab {
    border: 0;
    border-radius: 9px;
    padding: 10px 8px;
    font: 700 13px var(--dc-font-b, sans-serif);
    letter-spacing: .02em;
    color: var(--dc-txt-2, #3D5446);
    background: transparent;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.mp-tab.active {
    background: linear-gradient(135deg, #134D32, #0B2818);
    color: var(--dc-gold-lt, #F7E27A);
    box-shadow: 0 4px 12px rgba(11, 40, 24, .3);
}

.mp-clear {
    align-self: flex-start;
    background: none;
    border: 0;
    padding: 2px 4px;
    font: 600 12px var(--dc-font-b, sans-serif);
    color: var(--dc-txt-3, #7A9488);
    text-decoration: underline;
    cursor: pointer;
}

.mp-clear:hover,
.mp-clear:focus,
.mp-clear:active {
    background: none;
    box-shadow: none;
    transform: none;
    color: var(--dc-green, #1E7A50);
    text-decoration-color: var(--dc-gold, #F2D535);
}

/* Display extras */
.mp-summary {
    margin: 6px 0 2px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--dc-sage, #A8D8BC);
}

.mp-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.mp-stats div {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
}

.mp-stats small {
    display: block;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--dc-sage, #A8D8BC);
}

.mp-stats b {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.mp-donut-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 14px;
}

.mp-donut {
    width: 116px;
    height: 116px;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .35));
}

.mp-donut circle {
    transition: stroke-dasharray .4s var(--dc-ease, ease);
}

.mp-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    font-size: 13px;
}

.mp-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mp-legend i {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.mp-legend b {
    margin-left: 4px;
    color: var(--dc-gold-lt, #F7E27A);
}

/* Schedule */
.mp-schedule {
    margin-top: 18px;
    padding: 16px 18px;
}

.mp-schedule-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.mp-schedule-head h3 {
    margin: 0;
    font-family: var(--dc-font-h, Georgia, serif);
    font-size: 24px;
    color: var(--dc-forest, #134D32);
}

.mp-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--dc-bg, #F5F2EC);
    border: 1px solid var(--dc-border-md, rgba(19, 77, 50, .2));
}

.mp-switch button {
    border: 0;
    border-radius: 999px;
    padding: 6px 16px;
    font: 600 12.5px var(--dc-font-b, sans-serif);
    color: var(--dc-txt-2, #3D5446);
    background: transparent;
    cursor: pointer;
}

.mp-switch button.active {
    background: var(--dc-forest, #134D32);
    color: #fff;
}

.mp-schedule-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 14px;
    align-items: start;
}

.mp-table-wrap {
    max-height: 440px;
    overflow: auto;
    border: 1px solid var(--dc-border, rgba(19, 77, 50, .12));
    border-radius: 12px;
}

.mp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.mp-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 12px;
    text-align: right;
    font-size: 11.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--dc-gold-lt, #F7E27A);
    background: #0F3A27;
}

.mp-table td {
    padding: 8px 12px;
    text-align: right;
    color: var(--dc-txt, #111A14);
    border-top: 1px solid var(--dc-border, rgba(19, 77, 50, .12));
}

.mp-table th:first-child,
.mp-table td:first-child {
    text-align: center;
    width: 64px;
    font-weight: 700;
}

.mp-table td:first-child {
    color: var(--dc-green, #1E7A50);
}

.mp-table tbody tr:nth-child(even) {
    background: rgba(19, 77, 50, .04);
}

.mp-table tbody tr:hover {
    background: rgba(242,213,53, .12);
}

.mp-table .mp-empty {
    text-align: center;
    padding: 24px;
    color: var(--dc-txt-3, #7A9488);
    font-weight: 400;
}

/* Chart */
.mp-chart-card {
    position: sticky;
    top: 90px;
}

.mp-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--dc-txt-2, #3D5446);
}

.mp-chart-legend i {
    display: inline-block;
    width: 18px;
    height: 4px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.mp-chart {
    position: relative;
}

.mp-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

.mp-chart text {
    font: 11px var(--dc-font-b, sans-serif);
    fill: var(--dc-txt-3, #7A9488);
}

.mp-chart .ax {
    font-weight: 600;
    fill: var(--dc-txt-2, #3D5446);
}

.mp-chart .g {
    stroke: var(--dc-border, rgba(19, 77, 50, .12));
    stroke-width: 1;
}

.mp-chart .ln {
    fill: none;
    stroke-width: 2.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.mp-chart .guide {
    stroke: var(--dc-gold, #F2D535);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.mp-chart #mpHit {
    cursor: crosshair;
}

.mp-tip {
    position: absolute;
    top: 6px;
    transform: translateX(-50%);
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    white-space: nowrap;
    pointer-events: none;
    color: #fff;
    background: rgba(11, 40, 24, .94);
    border: 1px solid rgba(247,226,122, .4);
}

.mp-tip[hidden] {
    display: none;
}

.mp-tip b {
    color: var(--dc-gold-lt, #F7E27A);
}

.mp-note {
    margin: 14px 4px 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--dc-txt-3, #7A9488);
    text-align: center;
}

@media (max-width: 900px) {
    .mp-schedule-body {
        grid-template-columns: 1fr;
    }

    .mp-chart-card {
        position: static;
        order: -1;
    }
}

@media print {

    .mp-tabs,
    .mp-clear {
        display: none;
    }

    .mp-table-wrap {
        max-height: none;
        overflow: visible;
    }
}

/* =========================
   Labels beside inputs, expand panel, results lines
========================= */
.mp-wrapper .mp-rows {
    grid-template-columns: 1fr;
    gap: 10px;
}

.mp-row {
    display: grid;
    grid-template-columns: minmax(120px, 42%) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin: 0;
}

.mp-row>span,
.mp-row>label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dc-txt-2, #3D5446);
    margin: 0;
}

.mp-down,
.mp-rate {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-down .inp,
.mp-rate .inp {
    flex: 1;
    min-width: 0;
}

.mp-down em {
    font-style: normal;
    font-weight: 700;
    font-size: 13px;
    color: var(--dc-green, #1E7A50);
    white-space: nowrap;
}

.mp-find {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--dc-green, #1E7A50);
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.mp-find:hover {
    color: var(--dc-gold, #C9973A);
}

.mp-expand,
.mp-expand:hover,
.mp-expand:focus {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1.5px dashed var(--dc-border-md, rgba(19, 77, 50, .2));
    background: transparent;
    box-shadow: none;
    font: 700 13px var(--dc-font-b, sans-serif);
    color: var(--dc-forest, #134D32);
    cursor: pointer;
    text-align: left;
}

.mp-expand:hover {
    border-color: var(--dc-gold, #C9973A);
    background: rgba(201, 151, 58, .08);
}

.mp-expand small {
    font-weight: 500;
    color: var(--dc-txt-3, #7A9488);
}

.mp-expand-plus {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--dc-forest, #134D32);
    color: var(--dc-gold-lt, #E8C06E);
    font-size: 16px;
    line-height: 1;
    transition: transform .2s;
}

.mp-expand.open .mp-expand-plus {
    transform: rotate(45deg);
}

.mp-extra[hidden] {
    display: none;
}

/* Results lines */
.mp-lines {
    list-style: none;
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px dashed rgba(255, 255, 255, .18);
    display: grid;
    gap: 4px;
}

.mp-lines li {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--dc-sage, #A8D8BC);
}

.mp-lines b {
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.mp-actions {
    grid-template-columns: 1fr 1fr;
}

.mp-actions .btn.btn-primary {
    grid-column: 1 / -1;
    padding: 11px 6px;
    font-size: 14px;
}

.mp-schedule+.mp-schedule {
    margin-top: 18px;
}

.mp-schedule .mp-chart-legend {
    margin: 0;
}

.mp-chart .g {
    stroke: var(--dc-border, rgba(19, 77, 50, .12));
}

/* Email dialog */
.mp-dialog {
    border: 0;
    padding: 0;
    border-radius: 16px;
    width: min(420px, calc(100vw - 32px));
    box-shadow: var(--dc-sh-lg, 0 16px 56px rgba(0, 0, 0, .3));
}

.mp-dialog::backdrop {
    background: rgba(11, 40, 24, .6);
    backdrop-filter: blur(3px);
}

.mp-dialog-box {
    padding: 22px;
    border-top: 5px solid var(--dc-gold, #C9973A);
    border-radius: 16px;
}

.mp-dialog-box h3 {
    margin: 0 0 6px;
    font-family: var(--dc-font-h, Georgia, serif);
    font-size: 24px;
    color: var(--dc-forest, #134D32);
}

.mp-dialog-box p {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--dc-txt-2, #3D5446);
}

.mp-dialog-msg {
    min-height: 18px;
    margin: 10px 0 0 !important;
    font-weight: 600;
}

.mp-dialog-msg.ok {
    color: var(--dc-green, #1E7A50);
}

.mp-dialog-msg.err {
    color: #B3261E;
}

.mp-dialog-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.mp-dialog-cancel,
.mp-dialog-cancel:hover {
    background: none;
    border: 0;
    box-shadow: none;
    font: 600 13px var(--dc-font-b, sans-serif);
    color: var(--dc-txt-3, #7A9488);
    cursor: pointer;
}

@media (max-width: 480px) {
    .mp-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media print {

    .mp-expand,
    .mp-actions {
        display: none;
    }
}
