/* Cash dashboard, terminal style. One dark theme, system fonts only, no images.
   Numbers, labels and tables are monospaced; sentences stay in a sans face so
   they read as sentences. */
:root {
  color-scheme: dark;
  --page: #000; --surface: #0c0c0c; --raise: #151515; --line: #2b2b2b; --line-2: #3a3a3a;
  --ink: #ececec; --ink-2: #b9b9b4; --muted: #8b8b86;
  --amber: #ffa028;                                   /* interface accent: titles, tabs, keys */
  --up: #37c871; --down: #ff5f57; --warn: #fab219;    /* state only, always with a sign or a word */
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --cg: #6e6e69; --ce: #a3a39c;                       /* everyone else / other; equipment */
  --o1: #184f95; --o2: #256abf; --o3: #3987e5; --o4: #6da7ec; --o5: #9ec5f4;      /* age of a debt, dark to light */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) var(--page); }
body { margin: 0; background: var(--page); color: var(--ink); font: 13px/1.45 var(--mono); }
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 12px; }
h2, h3, p { margin: 0; }
a { color: var(--c1); }
a:hover { color: #6da7ec; }
[hidden] { display: none !important; }

/* ---- top bar and tabs */
.bar { position: sticky; top: 0; z-index: 10; background: var(--page); border-bottom: 1px solid var(--line-2); }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 6px; }
.brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
.brand b { color: var(--amber); font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
.brand span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.bar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.langs { display: inline-flex; border: 1px solid var(--line-2); }
.langs:empty { display: none; }
.langs button { background: none; border: 0; color: var(--ink-2); font: inherit; font-size: 11px; letter-spacing: .05em; padding: 2px 8px; cursor: pointer; }
.langs button:hover { color: var(--ink); background: var(--raise); }
.langs button[aria-pressed="true"] { background: var(--amber); color: #000; font-weight: 700; }
.account { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 11.5px; color: var(--muted); }
.account span { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account button { background: none; border: 1px solid var(--line-2); color: var(--ink-2); font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; cursor: pointer; }
.account button:hover { color: #000; background: var(--amber); border-color: var(--amber); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ink-2); font: inherit; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 7px 12px 6px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); background: var(--raise); }
.tabs button[aria-selected="true"] { color: #000; background: var(--amber); border-bottom-color: var(--amber); font-weight: 700; }
.tabs kbd { font: inherit; color: var(--amber); margin-right: 7px; }
.tabs button[aria-selected="true"] kbd { color: #000; }

.period-row { display: flex; align-items: center; gap: 10px; padding-top: 5px; padding-bottom: 5px; border-top: 1px solid var(--line); min-height: 30px; }
.period-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.periods { display: inline-flex; border: 1px solid var(--line-2); flex: none; }
.periods button { background: none; border: 0; border-left: 1px solid var(--line); color: var(--ink-2); font: inherit; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 2px 9px; cursor: pointer; min-width: 38px; }
.periods button:first-child { border-left: 0; }
.periods button:hover { color: var(--ink); background: var(--raise); }
.periods button[aria-pressed="true"] { background: var(--amber); color: #000; font-weight: 700; }
.period-range { color: var(--ink-2); font-size: 11.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.period-row[data-off] .periods { opacity: .35; pointer-events: none; }

main { padding-top: 10px; padding-bottom: 40px; }
.tab { display: grid; gap: 10px; }
.row { display: grid; gap: 10px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c21 { grid-template-columns: 2fr 1fr; }
.state { padding: 80px 12px; color: var(--muted); text-align: center; letter-spacing: .05em; }

/* ---- panels */
.panel { background: var(--surface); border: 1px solid var(--line); padding: 0 12px 12px; min-width: 0; }
.panel > header { display: flex; align-items: baseline; gap: 12px; margin: 0 -12px 10px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--raise); }
.panel h2 { font-size: 12px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: .05em; flex: none; }
.panel .sub { color: var(--muted); font-size: 11.5px; flex: 1; min-width: 0; }
.panel h3 { font-size: 11.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.panel h3 span { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 8px; }
.note { font: 12.5px/1.5 var(--sans); color: var(--ink-2); margin-top: 8px; max-width: 110ch; }

/* ---- the answer */
.verdict { padding: 12px 14px 14px; border-left: 4px solid var(--line-2); }
.verdict[data-status="ok"] { border-left-color: var(--up); }
.verdict[data-status="watch"] { border-left-color: var(--warn); }
.verdict[data-status="action"] { border-left-color: var(--down); }
.verdict-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.verdict h2 { font: 600 20px/1.25 var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0; flex: 1 1 240px; min-width: 0; }
.verdict > p { font: 14px/1.5 var(--sans); color: var(--ink-2); margin-top: 6px; max-width: 105ch; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border: 1px solid currentColor; white-space: nowrap; }
.badge[data-status="ok"] { color: var(--up); } .badge[data-status="ok"]::before { content: "● "; }
.badge[data-status="watch"] { color: var(--warn); } .badge[data-status="watch"]::before { content: "▲ "; }
.badge[data-status="action"] { color: var(--down); } .badge[data-status="action"]::before { content: "■ "; }
.actions { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px; }
.actions li { border: 1px solid var(--line); background: var(--raise); }
.actions a { display: block; padding: 8px 10px; text-decoration: none; color: inherit; height: 100%; }
.actions a:hover { background: #1c1c1c; }
.actions strong { display: block; color: var(--ink); font-weight: 700; }
.actions span { display: block; font: 12.5px/1.45 var(--sans); color: var(--ink-2); margin-top: 2px; }

/* ---- figure strip */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.cell { background: var(--surface); padding: 9px 12px 10px; position: relative; min-width: 0; }
.cell .label { font-size: 11px; color: var(--amber); text-transform: uppercase; letter-spacing: .05em; padding-right: 20px; }
.cell .value { font-size: 23px; font-weight: 700; line-height: 1.25; margin-top: 2px; white-space: nowrap; }
.cell .line { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.cell .line b { font-weight: 700; }
.cell .hint { font: 11.5px/1.4 var(--sans); color: var(--muted); margin-top: 4px; }
.cell .info { position: absolute; top: 7px; right: 8px; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }

/* ---- "?" explanations: a plain <details> */
.info { position: relative; flex: none; }
.info > summary { list-style: none; width: 17px; height: 17px; border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; line-height: 15px;
  text-align: center; cursor: pointer; user-select: none; }
.info > summary::-webkit-details-marker { display: none; }
.info > summary:hover, .info[open] > summary { color: #000; background: var(--amber); border-color: var(--amber); }
.info-body { position: absolute; right: 0; top: 22px; z-index: 12; width: min(380px, 84vw); background: #101010; border: 1px solid var(--amber);
  padding: 10px 12px; font: 12.5px/1.5 var(--sans); color: var(--ink-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .7); text-transform: none; letter-spacing: 0; }
.info-body p + p { margin-top: 8px; }
.info-body b { color: var(--amber); font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 2px; }
.info-body ul { margin: 2px 0 0; padding-left: 16px; }

/* ---- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 10.5px var(--mono); }
.chart .lbl { fill: var(--ink); font-size: 11px; }
.grid-line { stroke: #1f1f1f; stroke-width: 1; }
.zero-line { stroke: #6a6a66; stroke-width: 1; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.thin { stroke-width: 1.25; }
.line.dash { stroke-dasharray: 5 4; }
.dot { stroke: var(--surface); stroke-width: 2; }
.seg-rect, .arc { stroke: var(--surface); stroke-width: 1.5; }
.est { fill: #171717; }
.cross { stroke: #5a5a56; stroke-width: 1; }
.hit { fill: transparent; }
.hit:focus-visible { outline: 1px solid var(--amber); }
.sc1 { stroke: var(--c1); } .sc2 { stroke: var(--c2); } .sc3 { stroke: var(--c3); } .scg { stroke: var(--cg); }
.fc1 { fill: var(--c1); } .fc2 { fill: var(--c2); } .fc3 { fill: var(--c3); } .fc4 { fill: var(--c4); } .fc5 { fill: var(--c5); }
.fc6 { fill: var(--c6); } .fc7 { fill: var(--c7); } .fc8 { fill: var(--c8); } .fcg { fill: var(--cg); } .fce { fill: var(--ce); }
.area.fc1, .area.fc2 { opacity: .22; stroke: none; }
.band { fill: var(--c1); stroke: none; }
.band.wide { opacity: .15; } .band.mid { opacity: .2; }                /* the two overlap: the middle reads as the darker one */
.hline { stroke: #8b8b86; stroke-width: 1; stroke-dasharray: 2 4; }
.dimmed { opacity: .4; }
.bw { background: rgba(57, 135, 229, .15); } .bm { background: rgba(57, 135, 229, .38); }
.bc1 { background: var(--c1); } .bc2 { background: var(--c2); } .bc3 { background: var(--c3); } .bc4 { background: var(--c4); } .bc5 { background: var(--c5); }
.bc6 { background: var(--c6); } .bc7 { background: var(--c7); } .bc8 { background: var(--c8); } .bcg { background: var(--cg); } .bce { background: var(--ce); }
.best { background: #2a2a2a; }
.legend { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px; }
.legend span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.legend i { display: inline-block; width: 10px; height: 10px; vertical-align: -1px; margin-right: 6px; }
.legend i.ln { height: 2px; width: 14px; vertical-align: 3px; }
.legend i.ln.dash { background: none !important; border-top: 2px dashed var(--c2); height: 0; }
.legend i.ln.dash.bc1 { border-top-color: var(--c1); } .legend i.ln.dash.bcg { border-top: 1px dashed #8b8b86; }
.tip { position: fixed; z-index: 30; pointer-events: none; background: #101010; border: 1px solid var(--amber); padding: 7px 9px; font-size: 12px;
  min-width: 170px; max-width: 320px; box-shadow: 0 8px 26px rgba(0, 0, 0, .75); }
.tip h4 { margin: 0 0 4px; font-size: 11px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: .04em; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.tip .r span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip .r b { font-weight: 700; white-space: nowrap; }
.tip .r i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }
.tip .r.total { border-top: 1px solid var(--line-2); margin-top: 3px; padding-top: 3px; }
.tip .extra { margin-top: 4px; color: var(--muted); font: 11.5px/1.4 var(--sans); }

/* ---- donut */
.seg-toggle { display: inline-flex; border: 1px solid var(--line-2); margin-bottom: 8px; }
.seg-toggle button { background: none; border: 0; color: var(--ink-2); font: inherit; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; cursor: pointer; }
.seg-toggle button[aria-pressed="true"] { background: var(--amber); color: #000; font-weight: 700; }
.donut svg { display: block; width: min(200px, 60%); height: auto; margin: 0 auto 10px; }
.donut .mid-a { fill: var(--ink); font: 700 15px var(--mono); } .donut .mid-b { fill: var(--muted); font: 10px var(--mono); }
.dl { display: grid; grid-template-columns: 1fr auto auto; gap: 3px 12px; font-size: 12px; align-items: baseline; }
.dl .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.dl .n i { display: inline-block; width: 9px; height: 9px; margin-right: 7px; }
.dl .v { text-align: right; } .dl .p { text-align: right; color: var(--muted); min-width: 4ch; }

/* ---- age of invoices and bills: one bar split into parts */
.seg { display: flex; gap: 2px; height: 22px; margin: 2px 0 6px; }
.seg span { min-width: 3px; color: #fff; font-size: 11px; font-weight: 700; line-height: 22px; padding-left: 5px; overflow: hidden; white-space: nowrap; }
.a1 { background: var(--o1); } .a2 { background: var(--o2); } .a3 { background: var(--o3); } .a4 { background: var(--o4); } .a5 { background: var(--o5); }
.seg span.a4, .seg span.a5 { color: #000; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 11.5px; color: var(--ink-2); }
.seg-legend span { white-space: nowrap; }
.seg-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; }
.seg-legend b { color: var(--ink); }

/* ---- rows with a bar */
.hbars { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; gap: 6px 10px; align-items: center; font-size: 12px; }
.hbars .nm { color: var(--ink-2); }
.hbars .track { height: 10px; background: #161616; position: relative; }
.hbars .bar { height: 10px; min-width: 2px; }
.hbars .val { text-align: right; white-space: nowrap; }
.hbars .val span { color: var(--muted); margin-left: 8px; }
.hbars .total { border-top: 1px solid var(--line); padding-top: 6px; color: var(--ink); font-weight: 700; }
.div .track { background: none; display: grid; grid-template-columns: 1fr 1fr; }
.div .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid #6a6a66; }
.div .neg { justify-self: end; background: var(--down); height: 10px; } .div .pos { background: var(--up); height: 10px; grid-column: 2; }

/* ---- tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th { text-align: left; font-weight: 700; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 12px 4px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 4px 12px 4px 0; border-bottom: 1px solid #1c1c1c; vertical-align: top; }
tbody tr:hover td { background: #141414; }
tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; white-space: nowrap; padding-left: 8px; }
th:last-child, td:last-child { padding-right: 0; }
td.name { max-width: 240px; overflow-wrap: break-word; color: var(--ink); }
td.dim { color: var(--muted); }
tr.strong td { font-weight: 700; } tr.indent td:first-child { padding-left: 14px; color: var(--ink-2); }
tr.head td { color: var(--amber); font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; padding-top: 10px; border-bottom-color: var(--line-2); }
.pill { font-size: 11px; white-space: nowrap; color: var(--ink-2); }
.pill.late { color: var(--down); }
.pill.good { color: var(--up); }
.more { margin-top: 8px; background: none; border: 1px solid var(--line-2); padding: 3px 10px; font: inherit; font-size: 11.5px; color: var(--ink-2); cursor: pointer; text-transform: uppercase; letter-spacing: .04em; }
.more:hover { color: #000; background: var(--amber); border-color: var(--amber); }
.tbl { margin-top: 8px; }
.tbl > summary { cursor: pointer; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 3px 0; }
.tbl > summary:hover { color: var(--amber); }
.tbl[open] > summary { margin-bottom: 4px; }
.notes { margin: 0; padding-left: 18px; font: 13px/1.5 var(--sans); color: var(--ink-2); }
.notes li + li { margin-top: 5px; }
.notes li.warning { color: var(--warn); }
:focus-visible { outline: 1px solid var(--amber); outline-offset: 1px; }

/* ---- sign-in and set-up pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 12px; }
.auth-box { width: min(420px, 100%); display: grid; gap: 12px; }
.auth-brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.auth-brand b { color: var(--amber); font-size: 16px; letter-spacing: .04em; text-transform: uppercase; }
.auth-brand span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.auth-form { display: grid; gap: 12px; padding-bottom: 14px; }
.auth-form > header { margin-bottom: 0; }
.auth-form label { display: grid; gap: 4px; }
.auth-form label span { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.auth-form label span i { color: var(--muted); font-style: normal; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.auth-form input { background: #000; border: 1px solid var(--line-2); color: var(--ink); font: 14px var(--mono); padding: 8px 10px; width: 100%; border-radius: 0; }
.auth-form input:focus { outline: 1px solid var(--amber); border-color: var(--amber); }
.auth-form small { font: 11.5px/1.4 var(--sans); color: var(--muted); }
.auth-form button { background: var(--amber); border: 0; color: #000; font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; cursor: pointer; margin-top: 2px; }
.auth-form button:hover { background: #ffb654; }
.auth-lead, .auth-note { font: 13px/1.5 var(--sans); color: var(--ink-2); }
.auth-note { font-size: 11.5px; color: var(--muted); }
.auth-error { font: 13px/1.45 var(--sans); color: var(--down); border-left: 3px solid var(--down); padding: 6px 10px; background: #1a0f0e; }

@media (max-width: 900px) {
  .row.c2, .row.c21 { grid-template-columns: 1fr; }
  .panel > header { flex-wrap: wrap; }
  .panel .sub { flex-basis: 100%; order: 3; }
  .verdict h2 { font-size: 17px; }
  .bar { position: static; }
  .period-row { flex-wrap: wrap; } .period-range { flex-basis: 100%; white-space: normal; }
}
@media print {
  :root { --page: #fff; --surface: #fff; --raise: #fff; --ink: #000; --ink-2: #222; --muted: #555; --line: #bbb; --line-2: #999; --amber: #000; }
  .bar { position: static; } .tabs, .info, .more, .seg-toggle, .periods, .period-label { display: none; } .tab[hidden] { display: grid !important; }
}
