/* QL Budget + QL Business Finance — shared styles (was inline in budget.html). */
:root { color-scheme: dark; --bg:#000000; --panel:#0d1117; --panel2:#161b22; --line:#252b33; --fg:#f0f6fc; --text:#c9d1d9; --muted:#8b949e; --dim:#6e7681; --orange:#EA580C; --green:#3fb950; --red:#f85149; --yellow:#d29922; --blue:#58a6ff; --purple:#bc8cff; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 26px 20px 80px; }
h1 { font-size: 30px; margin: 0 0 6px; color: var(--fg); letter-spacing: -0.01em; }
h1 .accent { color: var(--orange); }
h2 { font-size: 17px; margin: 0 0 10px; color: var(--fg); }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--fg); }
.subtitle { color: var(--muted); margin: 0 0 18px; max-width: 900px; line-height: 1.5; font-size: 14px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--orange); color: #fff; }
.btn { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn { transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease, color .15s ease; }
.btn:hover { border-color: #3a424c; }
.bar > .btn:not(.ghost):hover { border-color: rgba(234,88,12,.6); background: #1b2129; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.bar > .btn:not(.ghost):active { transform: translateY(0); box-shadow: none; }
.seg button { transition: background .15s ease, color .15s ease; }
.seg button[aria-pressed="false"]:hover { color: var(--fg); background: #161b22; }
/* QL Intelligence inline + custom modules (qlBudgetIntelligence) */
.modoff { display: none !important; }
.qli { background: linear-gradient(180deg, rgba(234,88,12,.08), rgba(13,17,23,0) 70%), var(--panel); border: 1px solid rgba(234,88,12,.35); border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; }
.qli .qhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qli .qhead h2 { margin: 0; font-size: 16px; }
.qli .qhead .sp { flex: 1; }
.qli .qhint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; line-height: 1.45; }
.qli form { display: flex; gap: 8px; }
.qli input[type=text] { flex: 1; min-width: 0; }
.qli .chips { margin-top: 10px; }
.qli .qhidden { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qli .qhidden .chip { padding: 3px 9px; font-size: 11px; }
/* Follow-up prompt chips under the latest QL Intelligence answer */
.qli .qnext { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(234,88,12,.18); }
.qli .qnext .dim { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.qli .qnext .chip { font-size: 12.5px; padding: 5px 11px; border-color: rgba(234,88,12,.45); }
.qli .qnext .chip:hover { border-color: #EA580C; background: rgba(234,88,12,.12); }
.qthread { max-height: 520px; overflow-y: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.qt { border-radius: 10px; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; max-width: 100%; }
.qt.u { align-self: flex-end; background: var(--panel2); border: 1px solid var(--line); color: var(--fg); max-width: 85%; }
.qt.a { background: #0b1020; border-left: 3px solid var(--orange); color: var(--text); }
.qt.a.err { border-left-color: var(--red); }
.qt p { margin: 0 0 6px; } .qt p:last-child { margin: 0; }
.qt ul { margin: 4px 0 6px; padding-left: 18px; } .qt li { margin: 2px 0; }
.qt b { color: var(--fg); }
.qdid { margin-top: 8px; font-size: 12px; color: var(--green); } .qdid.bad { color: var(--red); }
.qchart { margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.qch { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; } .qch .sp { flex: 1; }
.qdots i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--orange); animation: qdot 1s infinite ease-in-out; }
.qdots i:nth-child(2) { animation-delay: .15s; } .qdots i:nth-child(3) { animation-delay: .3s; }
@keyframes qdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .qdots i { animation: none; } }
.customgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; margin: 0 0 14px; }
@media (max-width: 720px) { .customgrid { grid-template-columns: 1fr; } }
.cmod.full { grid-column: 1 / -1; }
.cmh { display: flex; align-items: center; gap: 4px; } .cmh h2 { margin: 0; } .cmh .sp { flex: 1; }
.bigv { font-size: 30px; font-weight: 800; color: var(--fg); font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpich { font-size: 12px; color: var(--muted); margin-top: 2px; } .kpich .up { color: var(--orange); } .kpich .down { color: var(--green); }
.donutwrap { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
@media (max-width: 480px) { .donutwrap { grid-template-columns: 1fr; justify-items: center; } .donutwrap > div { width: 100%; } }
.rsec { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.rhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.rhead h2 { margin: 0; font-size: 20px; }
.rhead .sp { flex: 1; }
.sechint { color: var(--muted); font-size: 13px; margin: 2px 0 12px; max-width: 900px; line-height: 1.5; }
.rp-inputs { margin: 0 0 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.lbar { margin: 0 0 9px; }
.lbar .top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; gap: 8px; }
.lbar .top b { color: var(--fg); font-weight: 600; }
.lbar .track { height: 9px; background: #0a0e14; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; display: flex; }
.lbar .track i { display: block; height: 100%; }
.hrow { display: grid; grid-template-columns: minmax(0, 1fr) 70px 46px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
.hrow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hrow .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); }
.hrow .p { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.goalgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.goal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 9px; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.goal:hover { border-color: rgba(234,88,12,.4); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.goal .gh { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; }
.goal .gi { font-size: 22px; line-height: 1; }
.goal .gh input { font-weight: 700; font-size: 14px; }
.goal .gprog { height: 10px; background: #0a0e14; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.goal .gprog i { display: block; height: 100%; background: linear-gradient(90deg, #EA580C, #f0883e); transition: width .4s ease; }
.goal.funded .gprog i { background: #3fb950; }
.goal .gnums { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.goal .gnums b { color: var(--fg); }
.goal .gfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.goal .gfields label { display: grid; gap: 3px; font-size: 11px; color: var(--dim); }
.goal .gstat { font-size: 12px; line-height: 1.45; color: var(--muted); }
.goal .gadd { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.gpill { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); }
.gpill.on_track, .gpill.funded { color: var(--green); border-color: rgba(63,185,80,.5); }
.gpill.behind, .gpill.overdue { color: var(--red); border-color: rgba(248,81,73,.5); }
.gpill.saving, .gpill.no_date { color: var(--yellow); border-color: rgba(210,153,34,.5); }
.simtop { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.simtop .sp { flex: 1; }
.schip { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.schip:hover { border-color: var(--orange); color: var(--fg); }
.schip[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); background: rgba(234,88,12,.1); }
.stiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.stile { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; transition: border-color .15s ease; }
.stile:hover { border-color: rgba(234,88,12,.45); }
.stile span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700; }
.stile b { display: block; font-size: 17px; color: var(--fg); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile i { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 1px; }
.stile.good b { color: var(--green); } .stile.warn b { color: var(--yellow); } .stile.bad b { color: var(--red); }
.sliders { display: grid; gap: 8px; margin: 0 0 10px; }
.sliders label { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr 70px; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.sliders input[type=range] { width: 100%; accent-color: var(--orange); cursor: pointer; }
.sliders output { text-align: right; color: var(--fg); font-weight: 700; font-variant-numeric: tabular-nums; }
.simnote { font-size: 11px; color: var(--dim); margin-top: 6px; line-height: 1.45; }
.xhair { stroke: #6e7681; stroke-dasharray: 3 3; pointer-events: none; }
@keyframes simDraw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.simline { stroke-dasharray: var(--len); animation: simDraw .9s ease-out both; }
@media (prefers-reduced-motion: reduce) { .kpi, .kpi::before, .card, .btn, .schip { transition: none; } .kpi:hover, .card.lift:hover, .bar > .btn:not(.ghost):hover { transform: none; } .simline { animation: none; stroke-dasharray: none; } }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease; }
.kpi::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--orange); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.kpi:hover { border-color: rgba(234,88,12,.45); background: #10161d; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.45); }
.kpi:hover::before { transform: scaleX(1); }
.kpi:hover .l { color: var(--text); }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; color: var(--fg); margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11px; color: var(--dim); margin-top: 2px; }
.kpi.good .v { color: var(--green); } .kpi.warn .v { color: var(--yellow); } .kpi.bad .v { color: var(--red); }
.cols { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
/* Institutional layout (2026-09-14): rows always fill — explicit column counts
   instead of auto-fit (which orphans the 4th card of a 3-up row), cards are
   flex columns so their body fills the row height, and a lone last card in a
   2-up grid spans the row. */
.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1040px) { .cols3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cols3, .cols2 { grid-template-columns: 1fr; } }
.grid > .card, .customgrid > .card { display: flex; flex-direction: column; }
.grid > .card > .tbl-wrap, .grid > .card > [id^="chart"], .grid > .card > .steps, .grid > .card > .ins, .customgrid > .card > .cmb { flex: 1 1 auto; min-height: 0; }
.grid > .card > .tbl-wrap { max-height: 440px; overflow: auto; }
.grid > .card > .tbl-wrap thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.card.span-all { grid-column: 1 / -1; }
.lines2 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
.lines2 > .card:nth-child(1) { grid-column: 1; grid-row: 1; }
.lines2 > .card:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
.lines2 > .card:nth-child(3) { grid-column: 1; grid-row: 2; }
@media (max-width: 720px) { .lines2 { grid-template-columns: 1fr; } .lines2 > .card:nth-child(n) { grid-column: auto; grid-row: auto; } }
.cols2 > .card:last-child:nth-child(odd), .customgrid > .cmod:last-child:nth-child(odd) { grid-column: 1 / -1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.card:hover { border-color: rgba(234,88,12,.35); box-shadow: 0 10px 28px rgba(0,0,0,.4); }
.card.lift:hover { transform: translateY(-2px); }
.card.lift:hover h2 { color: #fff; }
.card .hint { color: var(--dim); font-size: 12px; margin: 4px 0 10px; line-height: 1.45; }
svg { display: block; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 6px; border-bottom: 1px solid var(--line); }
td { padding: 5px 6px; border-bottom: 1px solid #1b2129; vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
input[type=text], input[type=number], input[type=date], select, textarea { background: #0a0e14; color: var(--fg); border: 1px solid var(--line); border-radius: 7px; padding: 5px 7px; font-size: 13px; font-family: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: var(--orange); }
input.money { text-align: right; }
.ro input, .ro select { pointer-events: none; opacity: .85; }
.x { background: transparent; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; padding: 2px 6px; }
.x:hover { color: var(--red); }
.ins { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ins li { border-left: 3px solid var(--line); padding: 6px 10px; background: var(--panel2); border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.45; }
.ins li.good { border-color: var(--green); } .ins li.warn { border-color: var(--yellow); } .ins li.bad { border-color: var(--red); } .ins li.info { border-color: var(--blue); }
.steps { display: grid; gap: 8px; }
.step { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.step .r { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.step .amt { font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; text-align: right; }
.step .amt small { display: block; color: var(--dim); font-weight: 500; font-size: 11px; }
.step.funded .n { background: var(--green); }
.banner { background: #1c1408; border: 1px solid #5a3a12; color: #f0c48a; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; display: none; }
.banner.show { display: block; }
.banner.err { background: #2a0f0f; border-color: #6b1f1f; color: #ffb3b3; }
.banner.ok { background: #0c2015; border-color: #1f5a30; color: #9be7b1; }
.drop { border: 1.5px dashed #3a424c; border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop.over { border-color: var(--orange); color: var(--fg); }
.drop input { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--orange); color: var(--fg); }
.muted { color: var(--muted); } .dim { color: var(--dim); } .fg { color: var(--fg); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.pill.src-plaid { color: var(--blue); } .pill.src-import { color: var(--purple); } .pill.src-chat { color: var(--green); } .pill.src-csv { color: var(--yellow); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.status { font-size: 12px; color: var(--dim); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.settings-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
details.card summary { cursor: pointer; font-weight: 700; color: var(--fg); font-size: 15px; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: '▸'; float: right; color: var(--muted); }
details.card[open] summary::after { content: '▾'; }
.tooltip { position: fixed; pointer-events: none; background: #1b2129; border: 1px solid #3a424c; border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--fg); display: none; z-index: 30; max-width: 260px; }
.review { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty b { color: var(--fg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media (max-width: 720px) { .stiles { grid-template-columns: 1fr 1fr; } .sliders label { grid-template-columns: 1fr 64px; } .sliders label input { grid-column: 1 / -1; grid-row: 2; } }
/* Business financial analysis */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 4px 0 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--orange); }
.bizbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.bizbar h2 { margin: 0; }
.bizbar label { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.bizbar select { width: auto; }
.bpanel { display: grid; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(96px, 200px) 1fr minmax(96px, auto); gap: 10px; align-items: center; font-size: 12px; padding: 4px 0; }
.hbar .lbl { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { background: #161b22; border-radius: 4px; height: 12px; position: relative; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 1px; }
.hbar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); border-radius: 1px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); white-space: nowrap; }
.hbar .val small { color: var(--dim); margin-left: 4px; }
table.pnl td, table.pnl th, #tblScenario td, #tblVendors td.num, #tblVariance td.num { white-space: nowrap; }
table.pnl td:first-child, table.pnl th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 190px; }
table.pnl tr.sub td { font-weight: 700; color: var(--fg); border-top: 1px solid var(--line); }
table.pnl tr.ratio td { color: var(--muted); font-size: 12px; font-style: italic; }
table.pnl tr.sec td { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding-top: 14px; border-bottom: 0; }
table.pnl td.bud { color: var(--muted); }
table.pnl th.sep, table.pnl td.sep { border-left: 1px solid var(--line); }
.fav { color: var(--green); } .unfav { color: var(--red); }
.st { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.st.good { color: var(--green); border-color: #1f5a30; } .st.bad { color: var(--red); border-color: #6b1f1f; } .st.warn { color: var(--yellow); border-color: #5a3a12; } .st.info { color: var(--blue); border-color: #1f3a5a; }
.bgoals { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.bgoal { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; display: grid; gap: 7px; }
.bgoal .gv { font-size: 20px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.bgoal .gv small { font-size: 12px; color: var(--muted); font-weight: 500; }
.bgoal .gbar { height: 8px; background: #0a0e14; border-radius: 4px; overflow: hidden; }
.bgoal .gbar i { display: block; height: 100%; border-radius: 4px; }
.bsliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; }
.bsliders label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.bsliders label b { color: var(--fg); font-variant-numeric: tabular-nums; float: right; }
.bsliders input[type=range] { width: 100%; accent-color: var(--orange); }
.splitbar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; margin: 6px 0; }
.splitbar i { display: block; height: 100%; }
.note { font-size: 12px; color: var(--dim); line-height: 1.45; }
#chartWaterfall { overflow-x: auto; } #chartWaterfall svg { min-width: 640px; }
@media (max-width: 720px) { .hbar { grid-template-columns: 90px 1fr auto; } table.pnl td:first-child, table.pnl th:first-child { min-width: 140px; } }
@media (max-width: 720px) { .wrap { padding: 18px 12px 70px; } h1 { font-size: 24px; } .kpi .v { font-size: 19px; } .step { grid-template-columns: 26px 1fr; } .step .amt { grid-column: 2; text-align: left; } }
/* How-to footnote (collapsed by default) */
.howto { margin-top: 22px; }
.howto summary { font-size: 14px; color: var(--muted); }
.howto[open] summary { color: var(--fg); }
.howto-body { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 900px; }
.howto-body p { margin: 0 0 10px; }
.howto-body ol { margin: 0; padding-left: 20px; }
.howto-body li { margin: 0 0 8px; }
.howto-body b { color: var(--fg); }

/* Institution scope bar + linked-institutions manager (2026-09-14) */
.scopebar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.scopebar .schip { padding: 4px 11px; }
.scopebar .schip b { color: inherit; font-weight: 700; }
.scopebar .schip i { font-style: normal; opacity: .7; margin-left: 4px; }
.scopebar .sp { flex: 1; }
.scopebar .manage { color: var(--blue); cursor: pointer; background: none; border: 0; font-size: 12px; padding: 4px 6px; }
.inst-kind { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); }
.inst-kind.brokerage { color: var(--purple); border-color: rgba(188,140,255,.45); }
.inst-kind.bank { color: var(--blue); border-color: rgba(88,166,255,.45); }
.inst-status.warn { color: var(--yellow); } .inst-status.ok { color: var(--green); }
#tblInstitutions td .btn.small { margin-right: 4px; }

/* Module grid, tools, drag + saved views (2026-09-14) */
.modgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.modgrid > [data-mod] { grid-column: span 6; min-width: 0; position: relative; }
.modgrid > [data-span="2"] { grid-column: span 2; }
.modgrid > [data-span="3"] { grid-column: span 3; }
.modgrid > [data-span="6"] { grid-column: span 6; }
.modgrid > .rsec { margin-top: 8px; }
.modgrid > .kpis { margin-bottom: 0; }
@media (max-width: 1040px) { .modgrid > [data-span="2"] { grid-column: span 3; } }
@media (max-width: 720px) { .modgrid > [data-mod] { grid-column: span 6 !important; } }
.modtools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px; opacity: 0; transition: opacity .15s ease; z-index: 3; }
.modgrid > [data-mod]:hover > .modtools, .modgrid > [data-mod]:focus-within > .modtools, .modgrid.customizing > [data-mod] > .modtools { opacity: 1; }
.modtools button { background: transparent; border: 0; color: var(--muted); font-size: 12px; line-height: 1; padding: 4px 6px; border-radius: 5px; cursor: pointer; font-weight: 700; }
.modtools button:hover { color: var(--fg); background: #21262d; }
.modtools button[aria-pressed="true"] { color: var(--orange); }
.modtools .handle { cursor: grab; font-size: 14px; letter-spacing: -2px; }
.modtools .handle:active { cursor: grabbing; }
.modgrid > .dragging { opacity: .45; }
.modgrid > .drop-before { box-shadow: -4px 0 0 0 var(--orange); }
.modgrid > .drop-after { box-shadow: 4px 0 0 0 var(--orange); }
.modgrid > .kpis > .modtools { top: -4px; right: -4px; }
.dashbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.dashbar select { width: auto; min-width: 160px; }
.dashbar .sp { flex: 1; }
.dashbar .lock { color: var(--yellow); }

/* QL Budget Labs (2026-09-15): simulations and models drawn by budget-labs.js */
.labs-empty { color: var(--dim); font-size: 12px; padding: 14px 0 6px; line-height: 1.5; }
.labs-grid-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 6px; }
.labs-grid { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
.labs-grid th { color: var(--muted); font-weight: 600; text-align: center; padding: 2px 4px; white-space: nowrap; }
.labs-grid tbody th { text-align: right; }
.labs-grid td { text-align: center; padding: 6px 4px; border-radius: 6px; color: var(--fg); }
.labs-grid td.dn { color: #ffb4ad; }
.card .lg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.card .lg b { font-weight: 700; }
.card svg { width: 100%; height: auto; display: block; }
.card svg text { font-family: inherit; }

/* Budget vs actual (2026-09-17): per-category plan vs linked-account spend, accuracy score + trend. Scoped to #varianceCard. */
#varianceCard .var-head { margin-bottom: 4px; }
#varianceCard .var-head select { width: auto; max-width: 100%; }
#varianceCard .var-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 4px; }
#varianceCard .var-kpis .stile b small { font-size: 11px; color: var(--muted); font-weight: 600; }
#varianceCard .var-trend { margin: 2px 0 10px; }
#varianceCard .var-trend-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }
#varianceCard .var-trend-title b { color: var(--fg); text-transform: none; letter-spacing: 0; }
#varianceCard .var-table { overflow-x: auto; }
#varianceCard .var-table table { width: 100%; min-width: 0; }
#varianceCard .var-table td, #varianceCard .var-table th { padding: 6px 6px; }
#varianceCard .var-table td.num { white-space: nowrap; }
#varianceCard .var-table td.num small { color: var(--muted); font-size: 11px; }
#varianceCard .var-table tfoot td { font-weight: 700; color: var(--fg); border-top: 1px solid var(--line); border-bottom: 0; }
#varianceCard .var-group th { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--fg); padding: 12px 6px 4px; border-bottom: 1px solid var(--line); }
#varianceCard .var-group th small { color: var(--dim); font-weight: 500; margin-left: 8px; font-variant-numeric: tabular-nums; }
#varianceCard .var-cat { min-width: 160px; }
#varianceCard .var-cat > span { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
#varianceCard .var-bar { position: relative; height: 6px; margin-top: 4px; background: #0a0e14; border: 1px solid var(--line); border-radius: 999px; overflow: visible; }
#varianceCard .var-bar i { display: block; height: 100%; border-radius: 999px; min-width: 0; opacity: .85; max-width: 100%; }
#varianceCard .var-bar b { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--fg); border-radius: 1px; margin-left: -1px; }
#varianceCard .var-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line); white-space: nowrap; }
#varianceCard .var-v { font-weight: 600; }
#varianceCard .var-empty { padding: 18px 0 8px; }
@media (max-width: 720px) { #varianceCard .var-kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) {
  /* Stacked rows: each row becomes a small card; cells label themselves from data-l. */
  #varianceCard .var-table { overflow-x: visible; }
  #varianceCard .var-table thead { display: none; }
  #varianceCard .var-table table, #varianceCard .var-table tbody, #varianceCard .var-table tfoot { display: block; width: 100%; }
  #varianceCard .var-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid #1b2129; }
  #varianceCard .var-table tr.var-group { display: block; padding: 0; border-bottom: 0; }
  #varianceCard .var-table tr.var-group th { display: block; }
  #varianceCard .var-table td { display: block; border: 0; padding: 0; min-width: 0; }
  #varianceCard .var-table td.var-cat { grid-column: 1 / -1; }
  #varianceCard .var-table td.num { text-align: left; }
  #varianceCard .var-table td[data-l]:not(.var-cat):not([data-l=""])::before { content: attr(data-l); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
  #varianceCard .var-table tfoot td { border-top: 0; }
  #varianceCard .var-cat > span { max-width: none; white-space: normal; }
}
/* Accounting tab + account books (2026-09-17) */
.viz-empty { color: var(--dim); font-size: 12px; padding: 22px 0; }
table.stmt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.stmt td, table.stmt th { padding: 5px 8px; border-bottom: 1px solid var(--line); }
table.stmt td.num, table.stmt th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stmt tr.sub td { font-weight: 700; color: var(--fg); border-top: 1px solid var(--line); }
table.stmt tr.total td { font-weight: 800; color: var(--fg); border-top: 2px solid var(--muted); border-bottom: 0; }
table.stmt tr.head td { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700; padding-top: 10px; border-bottom: 0; }
table.stmt td.pos { color: var(--green); } table.stmt td.neg { color: var(--red); }
tr.acct-row td { background: rgba(255,255,255,.02); font-size: 12px; padding-top: 4px; padding-bottom: 4px; }
tr.acct-row td.acct-name { padding-left: 22px; color: var(--muted); }
tr.acct-row select { width: auto; font-size: 12px; padding: 2px 6px; }
.tb-ok { color: var(--green); font-weight: 700; } .tb-bad { color: var(--red); font-weight: 700; }
#tblLedger td.lines { font-size: 11px; color: var(--muted); white-space: nowrap; }
#tblLedger td.lines b { color: var(--fg); font-weight: 600; }
.pill.ar { background: rgba(57,135,229,.18); color: #9cc4ff; } .pill.ap { background: rgba(217,89,38,.18); color: #ffb28f; }

/* QL Budget Charts (2026-12-01): the chart library and the analytics modules — budget-charts.js / budget-insights.js */
.simbadge { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--purple); border: 1px solid rgba(188,140,255,.45); border-radius: 999px; padding: 1px 7px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }
.qbc-svg { overflow: visible; }
.qbc-empty { color: var(--dim); font-size: 12px; padding: 14px 0 6px; line-height: 1.5; }
.qbc-col .qbc-guide { transition: opacity .08s ease; }
.qbc-col:hover .qbc-guide { opacity: 1; }
.qbc-tile rect, .qbc-day { transition: filter .12s ease; }
.qbc-tile:hover rect, .qbc-day:hover { filter: brightness(1.2); }
.tooltip.qbc-tip { max-width: 320px; padding: 8px 10px; }
.qbc-tip > b { display: block; margin-bottom: 4px; }
.qbc-tr { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 7px; align-items: center; font-size: 12px; color: var(--muted); line-height: 1.55; }
.qbc-tr i { width: 9px; height: 9px; border-radius: 2px; }
.qbc-tr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qbc-tr em { font-style: normal; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qbc-tf { margin-top: 4px; padding-top: 4px; border-top: 1px solid #3a424c; color: var(--muted); font-size: 11px; }
.qbc-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.qbc-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 3px 8px; font-family: inherit; }
button.qbc-leg { cursor: pointer; border-color: var(--line); }
button.qbc-leg:hover { border-color: var(--orange); }
button.qbc-leg[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.qbc-leg i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.qbc-leg em { font-style: normal; color: var(--dim); font-variant-numeric: tabular-nums; }
.qbc-head { margin: 12px 0 8px; }
.qbc-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.qbc-controls select, .qbc-head select { width: auto; font-size: 12px; padding: 5px 8px; }
.qbc-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel2); }
.qbc-seg button { background: transparent; border: 0; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; font-family: inherit; }
.qbc-seg button + button { border-left: 1px solid var(--line); }
.qbc-seg button:hover:not(:disabled) { color: var(--fg); }
.qbc-seg button[aria-pressed="true"] { background: rgba(234,88,12,.16); color: var(--orange); }
.qbc-seg button:disabled { opacity: .4; cursor: default; }
.qbc-sub { margin: 14px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.qbc-split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.qbc-split h3 { margin: 0 0 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stiles.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.modgrid > [data-span="2"] .qbc-split, .modgrid > [data-span="3"] .qbc-split { grid-template-columns: 1fr; }
.modgrid > [data-span="2"] .stiles.s4, .modgrid > [data-span="3"] .stiles.s4 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .qbc-split { grid-template-columns: 1fr; } .stiles.s4 { grid-template-columns: 1fr 1fr; } }
.stile b small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 1px; }
.qbc-buls { display: grid; gap: 10px; }
.qbc-bul .top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text); margin-bottom: 4px; }
.qbc-bul .top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qbc-bul .top span:last-child { color: var(--muted); white-space: nowrap; }
.qbc-bul .top b { color: var(--fg); font-variant-numeric: tabular-nums; }
.qbc-bul .track { position: relative; height: 8px; background: #161b22; border-radius: 4px; }
.qbc-bul .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; min-width: 2px; }
.qbc-bul .track em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--fg); border-radius: 1px; }
.qbc-bul .track u { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--panel); }
#paceEnvelopes .qbc-bul { cursor: pointer; }
#paceEnvelopes .qbc-bul:hover .top span:first-child { color: var(--orange); }
#paceEnvelopes > .schip, #billsTable > .schip { margin-top: 10px; }
.qbc-host { position: relative; }
.qbc-tools { position: absolute; top: 0; right: 0; display: flex; gap: 2px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; opacity: 0; transition: opacity .15s ease; z-index: 2; }
.qbc-host:hover > .qbc-tools, .qbc-host:focus-within > .qbc-tools { opacity: 1; }
/* Touch screens have no hover: the tools sit under the chart instead of over it. */
@media (hover: none) { .qbc-tools { position: static; width: fit-content; margin: 6px 0 0 auto; opacity: 1; } }
.qbc-tools button { background: transparent; border: 0; color: var(--muted); font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.qbc-tools button:hover, .qbc-tools button:focus-visible { color: var(--fg); background: #21262d; }
dialog.qbc-dialog { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; }
dialog.qbc-dialog::backdrop { background: rgba(0,0,0,.72); }
.qbc-dhead { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.qbc-dhead h2 { margin: 0; }
.qbc-dbody { padding: 14px 16px 18px; }
.qbc-dbody h3 { margin: 16px 0 8px; }
.qbc-dialog svg { width: 100%; height: auto; display: block; }
.qbc-dialog svg text { font-family: inherit; }
.qbc-table { max-height: 320px; overflow: auto; }
.qbc-hero { display: flex; align-items: center; gap: 16px; margin: 2px 0 14px; }
.qbc-score { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--line); flex: none; }
.qbc-score b { font-size: 30px; color: var(--fg); line-height: 1.05; font-variant-numeric: tabular-nums; }
.qbc-score span { font-size: 10px; color: var(--muted); }
.qbc-score.good { border-color: var(--green); } .qbc-score.warn { border-color: var(--yellow); } .qbc-score.bad { border-color: var(--red); }
.qbc-scoretext { font-size: 13px; color: var(--text); line-height: 1.5; }
.qbc-scoretext strong { display: block; font-size: 16px; color: var(--fg); }
.qbc-scoretext small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
.qbc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; margin: 12px 0 4px; }
.qbc-form label { display: grid; gap: 4px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.qbc-form label.chk { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; align-self: end; padding-bottom: 8px; }
.qbc-form select, .qbc-form input[type=text] { width: 100%; font-size: 13px; }
.qbc-scale { white-space: nowrap; margin-right: 6px; }
.qbc-scale i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #338ced; margin: 0 1px; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) { .qbc-col .qbc-guide, .qbc-tile rect, .qbc-day, .qbc-tools { transition: none; } }
