/* Shared CSS for all 6 calculator blocks.
 *
 * Each calculator is a <div class="lyra-bt-calc lyra-bt-calc--{type}"> with:
 *   .lyra-bt-calc__form    — inputs grid
 *   .lyra-bt-calc__outputs — output card row
 *   .lyra-bt-calc__detail  — optional amortization / breakdown panel
 */

.lyra-bt-calc {
    --lyra-bt-calc-accent: #0f172a;
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
    box-sizing: border-box;
}
.lyra-bt-calc *, .lyra-bt-calc *::before, .lyra-bt-calc *::after { box-sizing: border-box; }

.lyra-bt-calc__heading {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}
.lyra-bt-calc__subheading {
    margin: 0 0 18px;
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

/* Input grid */
.lyra-bt-calc__form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px 22px 18px;
    margin-bottom: 18px;
}
.lyra-bt-calc__form--single { grid-template-columns: 1fr; }
.lyra-bt-calc__form--three  { grid-template-columns: repeat(3, 1fr); }

.lyra-bt-calc__field { display: block; }
.lyra-bt-calc__field--full { grid-column: 1 / -1; }
.lyra-bt-calc__label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.lyra-bt-calc__input-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lyra-bt-calc__input-wrap:focus-within {
    border-color: var(--lyra-bt-calc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--lyra-bt-calc-accent) 16%, transparent);
}
.lyra-bt-calc__input-wrap input {
    flex: 1;
    padding: 9px 11px;
    font-size: 15px;
    font-family: inherit;
    border: 0;
    background: transparent;
    color: #0f172a;
    width: 100%;
}
.lyra-bt-calc__input-wrap input:focus { outline: none; }
.lyra-bt-calc__input-prefix,
.lyra-bt-calc__input-suffix {
    background: #f8fafc;
    color: #64748b;
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}
.lyra-bt-calc__input-prefix { border-right: 1px solid #e2e8f0; }
.lyra-bt-calc__input-suffix { border-left:  1px solid #e2e8f0; }
.lyra-bt-calc__help { margin-top: 4px; font-size: 11px; color: #94a3b8; }

/* Slider row */
.lyra-bt-calc__field--slider .lyra-bt-calc__slider-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.lyra-bt-calc__slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    outline: none;
}
.lyra-bt-calc__slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--lyra-bt-calc-accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
}
.lyra-bt-calc__slider-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--lyra-bt-calc-accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
}
.lyra-bt-calc__slider-value {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #64748b;
    min-width: 0;
}
.lyra-bt-calc__slider-value input[type="number"] {
    width: 78px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}
.lyra-bt-calc__slider-value input[type="number"]:focus { outline: none; border-color: var(--lyra-bt-calc-accent); }

/* Select */
.lyra-bt-calc__select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
}
.lyra-bt-calc__select:focus {
    outline: none;
    border-color: var(--lyra-bt-calc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--lyra-bt-calc-accent) 16%, transparent);
}

/* Output cards */
.lyra-bt-calc__outputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.lyra-bt-calc__output {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}
.lyra-bt-calc__output--primary {
    background: var(--lyra-bt-calc-accent);
    color: #fff;
    border-color: var(--lyra-bt-calc-accent);
}
.lyra-bt-calc__output-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 4px;
}
.lyra-bt-calc__output--primary .lyra-bt-calc__output-label { color: rgba(255,255,255,0.85); }
.lyra-bt-calc__output-value {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}
.lyra-bt-calc__output--primary .lyra-bt-calc__output-value { color: #fff; font-size: 28px; }
.lyra-bt-calc__output-help {
    margin-top: 4px;
    font-size: 11px;
    color: #94a3b8;
}
.lyra-bt-calc__output--primary .lyra-bt-calc__output-help { color: rgba(255,255,255,0.7); }

/* Toggles + buttons */
.lyra-bt-calc__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.lyra-bt-calc__toggle:hover { background: #f1f5f9; }
.lyra-bt-calc__toggle[aria-expanded="true"] {
    background: var(--lyra-bt-calc-accent);
    color: #fff;
    border-color: var(--lyra-bt-calc-accent);
}

/* Detail panel (amortization, breakdown, etc.) */
.lyra-bt-calc__detail {
    margin-top: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
}
.lyra-bt-calc__detail[hidden] { display: none; }

/* Amortization table */
.lyra-bt-calc__amort-table-wrap {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}
.lyra-bt-calc__amort-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.lyra-bt-calc__amort-table th,
.lyra-bt-calc__amort-table td {
    padding: 7px 10px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.lyra-bt-calc__amort-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lyra-bt-calc__amort-table td:first-child,
.lyra-bt-calc__amort-table th:first-child { text-align: left; }
.lyra-bt-calc__amort-table tr:nth-child(even) td { background: #fafbfc; }

/* Mortgage chart container — piggybacks on .lyra-bt-dv__chart so
   lyra-bt-data-viz.js detects it. Hidden until enabled. */
.lyra-bt-calc__chart-toggle-row {
    margin-top: 10px;
    text-align: center;
}
.lyra-bt-calc__chart-host {
    margin-top: 12px;
    height: 280px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.lyra-bt-calc__chart-host[hidden] { display: none; }

/* Tip/split — per-person highlight */
.lyra-bt-calc--tip_split .lyra-bt-calc__output--primary { grid-column: 1 / -1; }

/* Pricing slider — addon checkbox group */
.lyra-bt-calc__addon-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    grid-column: 1 / -1;
}
.lyra-bt-calc__addon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.lyra-bt-calc__addon input { margin: 0; }
.lyra-bt-calc__addon:has(input:checked) {
    border-color: var(--lyra-bt-calc-accent);
    background: color-mix(in srgb, var(--lyra-bt-calc-accent) 8%, #fff);
}

/* Billing toggle for pricing slider */
.lyra-bt-calc__billing-toggle {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    padding: 3px;
    grid-column: 1 / -1;
    justify-self: center;
}
.lyra-bt-calc__billing-toggle label {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
}
.lyra-bt-calc__billing-toggle input { display: none; }
.lyra-bt-calc__billing-toggle label:has(input:checked) {
    background: var(--lyra-bt-calc-accent);
    color: #fff;
}

/* Tip preset row */
.lyra-bt-calc__tip-presets {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.lyra-bt-calc__tip-preset {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.lyra-bt-calc__tip-preset:hover { background: #f1f5f9; }
.lyra-bt-calc__tip-preset[aria-pressed="true"] {
    background: var(--lyra-bt-calc-accent);
    color: #fff;
    border-color: var(--lyra-bt-calc-accent);
}

/* Tax bracket breakdown rows */
.lyra-bt-calc__brackets {
    margin-top: 10px;
}
.lyra-bt-calc__brackets-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.lyra-bt-calc__brackets-row strong { font-weight: 600; }
.lyra-bt-calc__brackets-row.is-active { background: color-mix(in srgb, var(--lyra-bt-calc-accent) 8%, transparent); }

@media (max-width: 640px) {
    .lyra-bt-calc__form { grid-template-columns: 1fr; padding: 16px; }
    .lyra-bt-calc__form--three { grid-template-columns: 1fr; }
    .lyra-bt-calc__output-value { font-size: 21px; }
    .lyra-bt-calc__output--primary .lyra-bt-calc__output-value { font-size: 25px; }
}

/* ─── v1.55.00 — Currency converter ───────────────────────────────── */
.lyra-bt-calc__fx-meta {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
}
.lyra-bt-calc__fx-history { margin-top: 10px; }
.lyra-bt-calc__fx-spark { width: 100%; }
.lyra-bt-calc__fx-spark-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ─── v1.55.00 — Unit converter (tabs + multi-panel) ──────────────── */
.lyra-bt-calc__tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.lyra-bt-calc__tab {
    background: transparent;
    border: 0;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    font-family: inherit;
}
.lyra-bt-calc__tab:hover { color: #0f172a; }
.lyra-bt-calc__tab[aria-selected="true"] {
    color: var(--lyra-bt-calc-accent);
    border-bottom-color: var(--lyra-bt-calc-accent);
}
.lyra-bt-calc__unit-panel + .lyra-bt-calc__unit-panel { margin-top: 12px; }
.lyra-bt-calc--variant-all_inline .lyra-bt-calc__unit-panel {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}
.lyra-bt-calc--variant-all_inline .lyra-bt-calc__unit-panel::before {
    content: attr(data-unit-cat);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ─── v1.55.00 — Carbon footprint (breakdown bars + CTA) ──────────── */
.lyra-bt-calc__carbon-row {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.lyra-bt-calc__carbon-row:last-child { border-bottom: 0; }
.lyra-bt-calc__carbon-row-label { color: #475569; font-weight: 600; }
.lyra-bt-calc__carbon-row-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.lyra-bt-calc__carbon-row-fill {
    height: 100%;
    background: var(--lyra-bt-calc-accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}
.lyra-bt-calc__carbon-row-val {
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
    .lyra-bt-calc__carbon-row { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; }
    .lyra-bt-calc__carbon-row-bar { height: 6px; }
}
