/* Treasurer: the app's own pieces on top of Ink (admin variation).
   Written outside Ink's layers, so these win without !important. */

.boot { padding: var(--sp-6); }
.muted { color: var(--ink-3); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--pen); }
.nowrap { white-space: nowrap; }
.small { font-size: var(--fs-sm); }
.grow { flex: 1; }

.shell-top .save-state { font-size: var(--fs-sm); color: var(--ink-3); display: inline-flex; align-items: center; gap: .35rem; }
.shell-top .save-state.error { color: var(--pen); }
.shell-top .who { font-size: var(--fs-sm); color: var(--ink-2); display: inline-flex; gap: .5rem; align-items: center; }
.brand-name { white-space: normal; line-height: 1.15; font-size: .95em; }

.page-head { flex-wrap: wrap; gap: var(--sp-3); }
.page-actions { flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.page-actions .form-select { width: auto; }

/* ---- stat tiles ---- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat-strip > .stat { min-width: 0; }
.stat .stat-value small { font-size: var(--fs-sm); color: var(--ink-3); font-weight: 500; margin-left: .2rem; }
.gauge { display: block; height: 6px; border-radius: 3px; background: var(--paper-3); margin-top: .5rem; overflow: hidden; position: relative; }
.gauge > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ink); }
.gauge.good > i { background: var(--hl-green-deep, #2A7322); }
.gauge.warn > i { background: var(--hl-orange-deep, #A04E00); }
.gauge.bad > i { background: var(--pen); }
.gauge .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-4); }

/* ---- insights ---- */
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.insights li { display: grid; grid-template-columns: 1.25rem 1fr; gap: .5rem; line-height: 1.45; }
.insights li i { margin-top: .1rem; }
.insights .good i { color: var(--hl-green-deep, #2A7322); }
.insights .warn i { color: var(--hl-orange-deep, #A04E00); }
.insights .bad i { color: var(--pen); }

/* ---- P&L table ---- */
.pl-wrap { overflow-x: auto; }
.pl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.pl th, .pl td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule-soft); }
.pl thead th { position: sticky; top: 0; background: var(--paper-2); color: var(--ink-3); font-weight: 600; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.pl thead th:first-child { text-align: left; }
.pl td:first-child, .pl th:first-child { position: sticky; left: 0; background: var(--paper-2); min-width: 13rem; text-align: left; }
.pl td { text-align: right; white-space: nowrap; }
.pl .section td { font-weight: 700; padding-top: 1rem; border-bottom: 0; color: var(--ink); }
.pl .total td { font-weight: 700; border-top: 1px solid var(--ink-4); border-bottom: 1px solid var(--rule); }
.pl .net td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.pl .col-total { background: var(--paper-3); font-weight: 600; }
.pl tr.uncat td:first-child { color: var(--pen); }
.pl td.cell { cursor: pointer; }
.pl td.cell:hover { background: var(--wash); text-decoration: underline; text-decoration-color: var(--ink-4); }
.pl td.empty-col { color: var(--ink-4); }
.pl td.zero { color: var(--ink-4); }
.pl .sub { color: var(--ink-3); font-weight: 400; }

.statement { width: 100%; max-width: 560px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.statement td { padding: .4rem .5rem; border-bottom: 1px solid var(--rule-soft); }
.statement td:last-child { text-align: right; }
.statement .total td { font-weight: 700; border-top: 1px solid var(--ink-4); }

/* ---- upload ---- */
.drop { display: grid; place-items: center; gap: .5rem; padding: var(--sp-6) var(--sp-4); border: 1.5px dashed var(--ink-4); border-radius: var(--r-lg); text-align: center; cursor: pointer; background: var(--paper-2); transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: var(--wash); border-color: var(--ink); }
.drop i { font-size: 1.8rem; }
.layout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); }
.preview-table { font-size: var(--fs-sm); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); align-items: end; }
label.lbl { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: .25rem; color: var(--ink-2); }
.hint { font-size: var(--fs-sm); color: var(--ink-3); margin-top: .25rem; }

/* ---- mapping ---- */
.map-table td { vertical-align: middle; }
.map-table .form-control, .map-table .form-select { font-size: var(--fs-sm); padding-top: .25rem; padding-bottom: .25rem; }
.map-table input.pattern { min-width: 16rem; }
#rules select[data-f="match"] { min-width: 9.5rem; }
#rules select[data-f="direction"] { min-width: 7.5rem; }
#rules select[data-f="categoryId"], .map-table td > select[aria-label="Category"] { min-width: 13rem; }
#cats input[data-f="name"] { min-width: 11rem; }
#cats select[data-f="type"] { min-width: 8rem; }
.order-btns { display: inline-flex; gap: 2px; }
.order-btns button, .icon-btn { border: 0; background: transparent; color: var(--ink-3); padding: .15rem .3rem; border-radius: var(--r-sm); }
.order-btns button:hover, .icon-btn:hover { background: var(--wash-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--pen); }
.group-desc { font-weight: 600; }
.group-sample { font-size: var(--fs-xs, .75rem); color: var(--ink-3); word-break: break-all; }
.src { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.src.manual { color: var(--hl-lilac-deep, #6438C0); }
.tx-cat { min-width: 12rem; }
tr.unmapped td:first-child { box-shadow: inset 3px 0 0 var(--pen); }

/* ---- drill-down dialog ---- */
dialog.drill { width: min(760px, calc(100vw - 2rem)); max-height: min(80vh, 760px); padding: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-3, 0 12px 40px rgba(0,0,0,.2)); }
dialog.drill::backdrop { background: rgba(10,10,10,.35); }
.drill-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper-2); }
.drill-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); overflow: auto; }

/* ---- report page ---- */
.report-layout { display: grid; grid-template-columns: 300px 1fr; gap: var(--sp-4); align-items: start; }
.report-options { position: sticky; top: calc(var(--shell-top-h, 3.5rem) + 1rem); }
.report-options .form-check { margin-bottom: .35rem; }
.report-stage { background: var(--paper-4); border-radius: var(--r-lg); padding: var(--sp-4); overflow: auto; }
@media (max-width: 991px) { .report-layout { grid-template-columns: 1fr; } .report-options { position: static; } }

.auth-card { max-width: 420px; margin: 10vh auto; }

#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  body { background: #fff !important; }
}

/* ---- trends ---- */
.pickers { display: grid; gap: .5rem; }
.pick-group { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pick-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; width: 5.5rem; flex: none; }
.pick { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink-2); border-radius: var(--r-pill); padding: .25rem .7rem; font-size: var(--fs-sm); line-height: 1.3; cursor: pointer; }
.pick:hover { background: var(--wash); color: var(--ink); }
.pick.on { border-color: var(--ink); color: var(--ink); font-weight: 600; background: var(--paper-2); }
.pick i { width: .7rem; height: .7rem; border-radius: 2px; background: var(--c); display: inline-block; }
@media (max-width: 575px) { .pick-label { width: 100%; } }
.change-marker line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.change-marker text { font-size: 11px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--paper-2); stroke-width: 4px; }
.events li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--rule-soft); }

.glance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.glance { display: grid; gap: .15rem; padding: .75rem .9rem; border: 1px solid var(--rule); border-radius: var(--r-md); color: inherit; text-decoration: none; background: var(--paper-2); }
.glance:hover { border-color: var(--ink); background: var(--wash); }
.glance-v { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.glance .spark { width: 100%; height: 34px; margin-top: .3rem; }

/* ---- P&L groups ---- */
.pl tr.group td { font-weight: 600; color: var(--ink-2); padding-top: .7rem; border-bottom: 0; }
.pl tr.indent td:first-child { padding-left: 1.4rem; }
.pl tr.subtotal td { font-weight: 600; border-top: 1px solid var(--rule); }
.pl td.pos { color: var(--hl-green-deep); }
.pl thead tr.sub th { font-weight: 400; font-size: var(--fs-xs); padding-top: 0; }

/* ---- transaction rows ---- */
.tx-cell { display: flex; align-items: center; gap: .25rem; }
.tx-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.tx-tag { font-size: var(--fs-xs); color: var(--ink-2); background: var(--paper-3); border-radius: var(--r-sm); padding: .05rem .4rem; }
.tx-tag.grant { background: color-mix(in srgb, var(--hl-yellow) 45%, transparent); color: var(--ink); }
.split-btn { text-align: left; white-space: normal; font-size: var(--fs-xs); }
dialog.txedit { width: min(720px, calc(100vw - 2rem)); }

/* ---- health ---- */
.health .panel-title { display: flex; align-items: center; gap: .5rem; }
.health-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--hl-green-deep); display: inline-block; }
.health.warn .health-dot { background: var(--hl-orange); }
.health.bad .health-dot { background: var(--pen); }
.hm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: .75rem; }
.hm { border: 1px solid var(--rule); border-radius: var(--r-md); padding: .7rem .85rem; background: var(--paper-2); border-top: 3px solid var(--ink-4); }
.hm.good { border-top-color: var(--hl-green-deep); }
.hm.warn { border-top-color: var(--hl-orange); }
.hm.bad { border-top-color: var(--pen); }
.hm-top { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.hm.good .hm-top i { color: var(--hl-green-deep); } .hm.warn .hm-top i { color: var(--hl-orange-deep); } .hm.bad .hm-top i { color: var(--pen); } .hm.info .hm-top i { color: var(--ink-3); }
.hm-value { font-size: var(--fs-lg); font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.hm-target { font-size: var(--fs-xs); color: var(--ink-3); }
.hm-explain { font-size: var(--fs-sm); color: var(--ink-2); margin: .5rem 0 0; line-height: 1.4; }
.hitlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.hitlist li { display: grid; grid-template-columns: 1.2rem 1fr; gap: .4rem; line-height: 1.4; }
.hitlist a { color: inherit; text-decoration: none; }
.hitlist a:hover { text-decoration: underline; }
.hitlist .good i { color: var(--hl-green-deep); } .hitlist .warn i { color: var(--hl-orange-deep); } .hitlist .bad i { color: var(--pen); } .hitlist .info i { color: var(--ink-3); }

/* ---- targets ---- */
.goals { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 1rem; }
.goal-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.goal.good .goal-head i { color: var(--hl-green-deep); } .goal.warn .goal-head i { color: var(--hl-orange-deep); } .goal.bad .goal-head i { color: var(--pen); }
.bar { position: relative; height: 10px; background: var(--paper-3); border-radius: 5px; margin: .4rem 0 .25rem; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 5px; }
.goal.good .bar > i { background: var(--hl-green-deep); }
.bar > b { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, var(--hl-blue) 0 4px, transparent 4px 8px); opacity: .8; }
.bar .now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink-2); }
.goal-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; align-items: end; border-top: 1px solid var(--rule-soft); padding-top: 1rem; }
.goal-form .g-label { grid-column: span 2; }
@media (max-width: 575px) { .goal-form .g-label { grid-column: auto; } }

/* ---- budget ---- */
.budget-table input.form-control { max-width: 9rem; margin-left: auto; }
.budget-table select { max-width: 10rem; }
.budget-table td.indent { padding-left: 1.4rem; }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .4rem; }
.month-grid label { display: grid; gap: .15rem; font-size: var(--fs-xs); color: var(--ink-3); }

/* ---- grants ---- */
.grant-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.grant-form .gf-wide { grid-column: 1 / -1; }

/* ---- forecast ---- */
.adj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.adj-grid label { display: grid; gap: .2rem; font-size: var(--fs-sm); color: var(--ink-2); }
.pl th.col-open, .pl td.col-open { background: var(--paper-3); }
#timing select { min-width: 9.5rem; }
#timing select[data-t="mode"] { min-width: 15rem; }

/* ---- treasurer's notes ---- */
.notes { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .6rem; }
.note { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: start; padding: .5rem; border: 1px solid var(--rule); border-left: 3px solid var(--ink-4); border-radius: var(--r-md); background: var(--paper-2); }
.note.good { border-left-color: var(--hl-green-deep); }
.note.bad { border-left-color: var(--pen); }
.note.done .note-text { text-decoration: line-through; color: var(--ink-3); }
.note-tone { display: grid; gap: 2px; }
.note-tone button { border: 0; background: transparent; color: var(--ink-4); padding: .1rem .3rem; border-radius: var(--r-sm); line-height: 1; }
.note-tone button:hover { background: var(--wash-2); color: var(--ink); }
.note-tone button.on[data-tone="good"] { color: var(--hl-green-deep); background: color-mix(in srgb, var(--hl-green) 35%, transparent); }
.note-tone button.on[data-tone="bad"] { color: var(--pen); background: color-mix(in srgb, var(--pen) 12%, transparent); }
.note-tone button.on[data-tone="neutral"] { color: var(--ink); background: var(--wash-2); }
.note-text { border: 0; background: transparent; padding: .15rem .25rem; resize: vertical; font-size: var(--fs-sm); }
.note-text:focus { background: var(--paper); }
.note-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .3rem; }
.note-meta input.form-control { width: auto; max-width: 9.5rem; }
.note-side { display: grid; gap: 2px; }
.note-side .icon-btn.on { color: var(--hl-orange-deep); }
.note-add { display: flex; gap: .4rem; }
.suggest { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .45rem; }
.suggest li { display: grid; grid-template-columns: 1.2rem 1fr auto; gap: .5rem; align-items: start; line-height: 1.4; font-size: var(--fs-sm); }
.suggest .good > i { color: var(--hl-green-deep); } .suggest .bad > i { color: var(--pen); } .suggest .neutral > i { color: var(--ink-3); }
.agenda { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.agenda label { display: flex; gap: .45rem; align-items: baseline; font-size: var(--fs-sm); }
.agenda .muted { margin-left: 1.6rem; }
.tone-good { color: var(--hl-green-deep); } .tone-bad { color: var(--pen); } .tone-neutral { color: var(--ink-3); }
