/* The Finance section. */

/* tabs, period and branch choosers */
.fin-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-tabs button, .seg button { cursor: pointer; border: 2px solid var(--ink); background: var(--cream-2); color: var(--ink); border-radius: 100px; padding: 8px 16px; font-weight: 700; font-size: 14px; }
.fin-tabs button:hover, .seg button:hover { background: rgba(240, 197, 72, .3); }
.fin-tabs button.on { background: var(--teal); color: var(--cream); border-color: var(--teal-deep); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 6px 14px; font-size: 13px; border-width: 1.5px; }
.seg button.on { background: var(--ink); color: var(--cream); }

.fin-bar { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.period { display: flex; align-items: center; gap: 8px; }
.period .input { width: auto; padding: 8px 12px; font-weight: 700; }
.period .step { cursor: pointer; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream-2); font-size: 20px; font-weight: 700; line-height: 1; padding: 0 0 3px; }
.period .step:hover { background: var(--mustard); }
.period .link { margin-left: 4px; }

.fin-body > * + * { margin-top: 16px; }
.fin-body.loading { opacity: .45; pointer-events: none; transition: opacity .15s; }

/* headline figures: proportional digits read better at this size */
.tiles.kpis { grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); }
.tile.kpi .value { font-variant-numeric: normal; font-size: 26px; white-space: nowrap; }
.tile.kpi .value.neg, td.neg { color: var(--cherry-deep); }

.card-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.stack-cards > .card + .card { margin-top: 16px; }

/* report tables */
table.figures th[scope="row"] { font-family: inherit; font-size: 15px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: normal; }
table.figures td { padding: 9px 10px; white-space: nowrap; }
table.figures tr.strong th[scope="row"], table.figures tr.strong td { font-weight: 700; background: rgba(46, 122, 111, .08); border-bottom-color: rgba(43, 35, 32, .3); }
table.figures tr.clickable:hover th[scope="row"], table.figures tr.clickable:hover td { background: rgba(240, 197, 72, .18); }
table.figures tbody tr:last-child th, table.figures tbody tr:last-child td { border-bottom: 0; }

/* the entry grids */
.grid-card { padding: 16px 0 0; overflow: hidden; }
.grid-card .card-head { padding: 0 18px; }
.grid-card .hint { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.gold-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: rgba(240, 197, 72, .55); border: 1px solid rgba(43, 35, 32, .35); margin-right: 8px; vertical-align: -2px; }
.save-state { font-size: 13px; font-weight: 700; color: var(--teal-deep); }
.save-state.busy { color: var(--muted); }
.save-state.bad { color: var(--cherry-deep); max-width: 420px; }

table.grid-entry { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid-entry th, table.grid-entry td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
table.grid-entry thead th { padding: 8px 10px; vertical-align: bottom; background: var(--cream-2); border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.grid-entry thead th.gold { background: rgba(240, 197, 72, .3); }
table.grid-entry thead th .what { display: block; font-family: 'Figtree', system-ui, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
table.grid-entry thead tr.groups th { text-align: left; border-bottom: 1px solid var(--line); color: var(--ink); background: var(--cream); }
table.grid-entry .pin { position: sticky; left: 0; z-index: 1; background: var(--cream-2); text-align: left; font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); padding: 0 14px 0 18px; white-space: nowrap; border-right: 2px solid var(--ink); }
table.grid-entry thead .pin { font-family: 'Bungee', system-ui, sans-serif; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--teal); }
table.grid-entry thead tr.groups .pin { background: var(--cream); }
table.grid-entry td { padding: 0 10px; height: 36px; white-space: nowrap; vertical-align: middle; }
table.grid-entry td.calc { background: rgba(43, 35, 32, .035); }
table.grid-entry td.strong, table.grid-entry tfoot td, table.grid-entry tfoot th { font-weight: 700; }
table.grid-entry td.in { padding: 0; background: rgba(240, 197, 72, .2); }
table.grid-entry tr.today .pin { box-shadow: inset 4px 0 0 var(--cherry); }
table.grid-entry tbody tr:hover td.calc, table.grid-entry tbody tr:hover .pin { background: #F3EBDD; }
table.grid-entry tfoot td, table.grid-entry tfoot th { border-top: 2px solid var(--ink); border-bottom: 0; background: var(--cream); height: 40px; }
input.cell { display: block; width: 104px; height: 36px; border: 0; background: transparent; padding: 0 10px; text-align: right; font-variant-numeric: tabular-nums; outline: none; }
input.cell:hover { background: rgba(240, 197, 72, .25); }
input.cell:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--teal); }
input.cell.bad { box-shadow: inset 0 0 0 2px var(--cherry); background: rgba(196, 54, 43, .08); }
.add-item { margin-top: 14px; }
.add-item select.input { width: auto; }

/* charts */
.chart { margin: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.chart-legend .item { display: inline-flex; align-items: center; gap: 7px; }
.chart .key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; flex: none; }
.chart-plot { position: relative; min-height: 250px; }
.chart-empty { display: grid; place-items: center; min-height: 250px; margin: 0; }
.chart-svg { display: block; outline: none; border-radius: 10px; }
.chart-svg:focus-visible { box-shadow: 0 0 0 2px var(--teal); }
.chart-svg .grid { stroke: rgba(43, 35, 32, .1); stroke-width: 1; }
.chart-svg .axis { stroke: rgba(43, 35, 32, .38); stroke-width: 1; }
.chart-svg .hair { stroke: rgba(43, 35, 32, .45); stroke-width: 1; }
.chart-svg .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-svg .end-label { font-size: 12px; font-weight: 700; fill: var(--ink); }
.chart-svg .end-dot { stroke: var(--cream-2); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 2; pointer-events: none; min-width: 170px; background: var(--ink); color: var(--cream); border-radius: 12px; padding: 9px 12px; font-size: 13px; box-shadow: 0 6px 18px rgba(43, 35, 32, .25); }
.chart-tip .when { font-weight: 600; opacity: .8; margin-bottom: 5px; }
.chart-tip .row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.chart-tip .row strong { font-variant-numeric: tabular-nums; }
.chart-tip .row span:last-child { opacity: .8; }

@media print {
  .side, .fin-tabs, .fin-bar, .btn, .save-state { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card, .tile { break-inside: avoid; }
}
