/* ═══════════════════════════════════════════════════════════
   BEZALT · terminal.css: credit line simulator. Loads after
   site.css and docs.css (header, footer, tokens come from there).
   ═══════════════════════════════════════════════════════════ */

.term-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 56px var(--gutter) 96px;
}

.term-intro {
    max-width: 780px;
    margin-bottom: 40px;
}

.term-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(42px, 5vw, 66px);
    line-height: 1.04;
    letter-spacing: -0.015em;
    margin-bottom: 18px;
    text-wrap: balance;
}

.term-lede {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-2);
}

.term-lede a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 180, 65, 0.35);
}

.term-lede a:hover {
    border-bottom-color: var(--gold);
}

/* ─────────────────────────────
   LAYOUT
───────────────────────────── */
.term-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
    gap: 20px;
    align-items: start;
}

.term-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    padding: 26px 24px;
}

.term-results {
    border-color: var(--line-gold);
    background: radial-gradient(ellipse at 0% 0%, rgba(242, 180, 65, 0.08), transparent 45%), linear-gradient(180deg, var(--bg-2), var(--bg-1));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 60px rgba(242, 180, 65, 0.05);
}

.term-panel-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 20px;
}

/* ─────────────────────────────
   FORM
───────────────────────────── */
.term-field {
    margin-bottom: 22px;
}

.term-field:last-of-type {
    margin-bottom: 0;
}

.term-field > label,
.term-label-row label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.term-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.term-unit {
    color: var(--text-3);
    font-weight: 500;
    font-size: 12px;
    margin-left: 4px;
}

.term-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 180, 65, 0.35);
}

.term-link-btn:hover {
    border-bottom-color: var(--gold);
}

.term-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.term-prefix,
.term-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
}

.term-prefix {
    left: 16px;
}

.term-suffix {
    right: 16px;
}

.term-input,
.term-select {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #0A0907;
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.2s, box-shadow 0.2s;
    -moz-appearance: textfield;
}

.term-input::-webkit-outer-spin-button,
.term-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.term-prefix + .term-input {
    padding-left: 32px;
}

.term-input:focus,
.term-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(242, 180, 65, 0.18);
}

.term-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image: linear-gradient(45deg, transparent 50%, #9a938a 50%), linear-gradient(135deg, #9a938a 50%, transparent 50%);
    background-position: calc(100% - 22px) 22px, calc(100% - 16px) 22px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.term-hint {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-3);
}

.term-range {
    width: 100%;
    margin: 14px 0 6px;
    accent-color: var(--gold);
    cursor: pointer;
}

.term-range:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 4px;
    border-radius: 4px;
}

.term-range-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}

.term-error {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 120, 90, 0.4);
    border-radius: 10px;
    background: rgba(255, 120, 90, 0.08);
    color: #FFB4A0;
    font-size: 13.5px;
    line-height: 1.5;
}

.is-invalid .term-results {
    opacity: 0.45;
    pointer-events: none;
}

/* ─────────────────────────────
   RESULTS
───────────────────────────── */
.term-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.term-results-head .term-panel-title {
    margin-bottom: 0;
}

.term-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    background: rgba(242, 180, 65, 0.08);
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.term-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.term-status[data-tone="warn"] {
    color: #FFC85E;
}

.term-status[data-tone="danger"] {
    color: #FF8F73;
    border-color: rgba(255, 143, 115, 0.4);
    background: rgba(255, 143, 115, 0.08);
}

.term-status[data-tone="idle"] {
    color: var(--text-3);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
}

.term-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.term-kpi {
    padding: 16px 16px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
}

.term-kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-3);
    letter-spacing: 0.02em;
}

.term-kpi-value {
    margin-top: 10px;
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.term-kpi:first-child .term-kpi-value {
    color: var(--gold);
}

.term-kpi-note {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--text-4);
}

/* health bar */
.term-health {
    padding: 18px 16px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    margin-bottom: 22px;
}

.term-health-head {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}

.term-health-bar {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: visible;
}

.term-health-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold));
    transition: width 0.25s var(--ease);
}

.term-health-fill[data-tone="danger"] {
    background: linear-gradient(90deg, #C9612E, #FF8F73);
}

.term-health-marker {
    position: absolute;
    top: -5px;
    width: 2px;
    height: 20px;
    background: var(--text-3);
    transform: translateX(-1px);
}

.term-health-marker--maint {
    background: #FF8F73;
}

.term-health-scale {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-4);
}

.term-health-desc {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-2);
}

/* liquidation breakdown */
.term-liq {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    margin-bottom: 22px;
}

.term-liq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    padding: 6px 16px 4px;
}

.term-liq-grid > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    min-width: 0;
}

.term-liq-grid > div:nth-last-child(-n+2) {
    border-bottom: 0;
}

.term-liq-label {
    font-size: 11.5px;
    color: var(--text-3);
}

.term-liq-value {
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.term-liq-note {
    padding: 0 16px 14px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-3);
}

/* comparison */
.term-compare {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    overflow-x: auto;
    overflow-y: hidden;
}

.term-compare-head {
    position: sticky;
    left: 0;
}

.term-compare-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.term-compare-head h3 {
    font-size: 13.5px;
    font-weight: 700;
}

.term-compare-meta {
    font-size: 11.5px;
    color: var(--text-4);
    text-align: right;
}

.term-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.term-table th,
.term-table td {
    padding: 11px 16px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.term-table th:first-child,
.term-table td:first-child {
    text-align: left;
    color: var(--text-2);
}

.term-table th {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.term-table tbody tr:last-child td {
    border-bottom: 0;
}

.term-table td.is-positive {
    color: var(--gold);
    font-weight: 650;
}

.term-table td.is-negative {
    color: #FF8F73;
    font-weight: 650;
}

.term-table td.is-neutral {
    color: var(--text-3);
}

.term-disclaimer {
    margin-top: 16px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-4);
}

/* ─────────────────────────────
   ACTIONS
───────────────────────────── */
.term-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.term-actions .btn {
    width: auto;
    padding: 0 22px;
    height: 54px;
    font-size: 15px;
}

.term-share {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ─────────────────────────────
   RESPONSIVE
───────────────────────────── */
@media (max-width: 900px) {
    .term-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .term-main {
        padding-top: 36px;
    }
}

@media (max-width: 640px) {
    .term-panel {
        padding: 20px 16px;
        border-radius: 16px;
    }
    .term-kpis {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .term-kpi {
        padding: 12px;
    }
    .term-compare-head {
        flex-direction: column;
        gap: 4px;
    }
    .term-liq-grid {
        grid-template-columns: 1fr;
    }
    .term-liq-grid > div:nth-last-child(-n+2) {
        border-bottom: 1px dashed var(--line);
    }
    .term-liq-grid > div:last-child {
        border-bottom: 0;
    }
    .term-compare-meta {
        text-align: left;
    }
    .term-table {
        font-size: 12.5px;
    }
    .term-table th,
    .term-table td {
        padding: 9px 8px;
    }
    .term-table th:first-child,
    .term-table td:first-child,
    .term-table th:last-child,
    .term-table td:last-child {
        white-space: normal;
    }
    .term-actions .btn {
        flex: 1;
    }
}
