/* Mortgage planner. Shared tokens and components come from site.css. */

/* Scenario tabs */
.tabs{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.tab{display:flex; align-items:center; gap:8px; border:1px solid var(--line); background:var(--surface);
  padding:8px 14px; border-radius:999px; cursor:pointer; font-weight:500; font-size:.92rem}
.tab[aria-selected="true"]{border-color:var(--fg); box-shadow:inset 0 0 0 1px var(--fg)}
.dot{width:10px; height:10px; border-radius:50%; flex:none; background:var(--c)}

.grid{display:grid; grid-template-columns:minmax(280px,360px) 1fr; gap:24px; align-items:start}
@media (max-width:860px){ .grid{grid-template-columns:1fr} }
.seg{display:grid; grid-template-columns:1fr 1fr; border:1px solid var(--line); border-radius:8px; overflow:hidden}
.seg button{border:0; background:var(--sunk); padding:8px; cursor:pointer; font-size:.88rem; font-weight:500}
.seg button[aria-pressed="true"]{background:var(--fg); color:var(--bg)}
.derived{display:flex; flex-direction:column; gap:2px; background:var(--accent-soft); border-radius:8px; padding:10px 12px}
.derived .dv{font-family:var(--f-display); font-weight:700; font-size:1.2rem; font-variant-numeric:tabular-nums}
.derived.bad{background:var(--sunk)} .derived.bad .dv{color:var(--bad)}

/* Results */
.results{display:flex; flex-direction:column; gap:20px; min-width:0}

.bulk{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:16px; display:flex; flex-direction:column; gap:12px}
.bulk-row{display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end}
.bulk-row .field{flex:1 1 130px}

/* Chart */
#chart{position:relative; width:100%}
#chart svg{display:block; width:100%}
.legend{display:flex; flex-wrap:wrap; gap:14px; font-size:.85rem; color:var(--muted)}
.legend span{display:flex; align-items:center; gap:6px}
.tip{position:absolute; pointer-events:none; background:var(--surface); border:1px solid var(--line); border-radius:8px;
  padding:8px 10px; font-size:.8rem; box-shadow:0 6px 20px rgba(0,0,0,.12); min-width:170px}
.tip div{display:flex; justify-content:space-between; gap:12px}

td.name{font-family:var(--f-body); font-weight:500}
td.name > span{display:inline-flex; align-items:center; gap:8px}
tr.ref td{background:var(--sunk)}

/* Ledger */
.ledger{max-height:70vh; overflow:auto; border:1px solid var(--line); border-radius:var(--r); background:var(--surface)}
.ledger table{font-size:.85rem}
.ledger thead th{position:sticky; top:0; background:var(--surface); z-index:1}
.ledger td{padding:4px 10px}
.ledger tr.jan td{border-top:2px solid var(--line)}
.ledger tr.jan td.date{font-weight:500; color:var(--fg)}
.ledger td.date,.ledger td.idx{color:var(--muted)}
.ledger td.extra{padding:2px 6px}
.ledger input{width:100px; text-align:right; border:1px solid transparent; border-radius:6px; background:var(--sunk); padding:4px 6px;
  font-family:var(--f-num); font-variant-numeric:tabular-nums}
.ledger input:hover{border-color:var(--line)}
.ledger input:focus{border-color:var(--accent); outline:none; background:var(--surface)}
.ledger input.edited{background:var(--edit); border-color:var(--edit-line)}
.ledger tr.final td{font-weight:600; color:var(--good)}
.io{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:18px 20px; display:flex; flex-direction:column; gap:12px}
.io-head{display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap}
.io textarea{width:100%; min-height:260px; resize:vertical; border:1px solid var(--line); border-radius:8px; background:var(--sunk); color:var(--fg);
  padding:10px 12px; font-family:var(--f-num); font-size:.8rem; line-height:1.5; tab-size:2}
.io textarea:focus{border-color:var(--accent); outline:none}
.io .msg{font-size:.85rem}
.io .msg.err{color:var(--bad)} .io .msg.ok{color:var(--good)}
.confirm{display:flex; gap:10px; align-items:center; flex-wrap:wrap; background:var(--edit); border:1px solid var(--edit-line); border-radius:8px; padding:10px 12px; font-size:.88rem}
.filebtn{position:relative; overflow:hidden}
.filebtn input{position:absolute; inset:0; opacity:0; cursor:pointer}
.copybox{width:100%; height:120px; font-family:var(--f-num); font-size:.75rem}

.card .panel.profile{background:var(--sunk);border:0}
.page-head .actions{align-items:center}
.ledger table td{white-space:nowrap}
