/* Office ledger.
 *
 * Its own look, not the dashboard's: this is a small money tool used mostly on
 * a phone in an office, so it is built like a paper ledger - warm ground, ink
 * text, one green for money in and one red for money out, and numbers set in a
 * face where digits line up.
 */

:root {
  --paper:      #FAF8F3;
  --card:       #FFFFFF;
  --ink:        #1F2420;
  --ink-soft:   #5E665F;
  --line:       #E4E0D6;
  --in:         #1F6F43;   /* money arriving */
  --in-soft:    #EAF3ED;
  --out:        #9E3A2A;   /* money leaving */
  --gold:       #8A6A22;
  --bad:        #A32C1C;
  --shadow:     0 1px 2px rgba(31,36,32,.05), 0 4px 14px rgba(31,36,32,.05);
  --radius:     12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #141715;
    --card:     #1C201D;
    --ink:      #ECEFEA;
    --ink-soft: #9AA69D;
    --line:     #2C322D;
    --in:       #6BC08C;
    --in-soft:  #1B2A21;
    --out:      #E38B78;
    --gold:     #D8B462;
    --bad:      #E37D6B;
    --shadow:   0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 18px 16px 64px; }

/* ── top bar ─────────────────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar-inner {
  max-width: 880px; margin: 0 auto; padding: 11px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-right form { margin: 0; }
.who { font-size: 13px; color: var(--ink-soft); }
.role {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 7px; margin-left: 3px;
}
.eyebrow {
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin: 0;
}

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px;
}
.linkish:hover { color: var(--ink); }
.linkish.danger { color: var(--bad); }

/* ── balance ─────────────────────────────────────────────────────────── */
.balance {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center;
  justify-content: space-between; margin: 18px 0 22px;
}
.metric-label {
  display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 4px;
}
.figure {
  font-size: clamp(34px, 9vw, 46px); font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.05; display: block;
}
.figure .rs { font-size: .62em; font-weight: 500; margin-right: 2px; color: var(--ink-soft); }
.figure.over { color: var(--bad); }
.overspent { font-size: 12.5px; color: var(--bad); }
.balance-side { display: flex; gap: 26px; margin: 0; }
.balance-side dt {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.balance-side dd {
  margin: 2px 0 0; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ── panels and forms ────────────────────────────────────────────────── */
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cols { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.panel-credit { border-color: color-mix(in srgb, var(--in) 35%, var(--line)); }
.panel-title { font-size: 15px; margin: 0 0 14px; font-weight: 650; }
.panel-title.spaced { margin-top: 30px; }

.stack { display: flex; flex-direction: column; gap: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.opt { font-size: 11px; opacity: .7; }

input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%;
}
input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
input[type="file"] { padding: 8px; font-size: 13px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; margin-top: 16px;
  padding: 11px 16px; border-radius: 9px; border: 1px solid transparent;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-credit  { background: var(--in); color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── alerts ──────────────────────────────────────────────────────────── */
.alert { padding: 10px 13px; border-radius: 9px; font-size: 14px; margin: 0 0 16px; }
.alert-good { background: var(--in-soft); color: var(--in);
              border: 1px solid color-mix(in srgb, var(--in) 30%, transparent); }
.alert-bad  { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad);
              border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }

/* ── the ledger ──────────────────────────────────────────────────────── */
.ledger-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ledger-note { font-size: 12px; color: var(--ink-soft); }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* The five columns do not fit a phone. Scrolling the table inside its own box
   keeps the page itself from scrolling sideways, which is the thing that makes
   a layout feel broken. */
.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
}

table.ledger { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13.5px; }

table.ledger th {
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 1;
}
table.ledger td { padding: 11px 12px; vertical-align: top; border-top: 1px solid var(--line); }
table.ledger tbody tr:first-child td { border-top: 0; }

/* Money right-aligned with lining figures, so the columns read as columns. */
.c-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-date { white-space: nowrap; color: var(--ink-soft); width: 1%; }
.c-credit { color: var(--in); }
.c-debit  { color: var(--out); }
.c-bal    { font-weight: 600; }
.c-act    { width: 1%; text-align: right; }
.c-act form { margin: 0; }

.part { font-weight: 500; }
.by { color: var(--ink-soft); font-size: 12px; margin-left: 8px; white-space: nowrap; }

table.ledger tfoot td {
  border-top: 2px solid var(--line); padding-top: 12px; padding-bottom: 12px;
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}

.chip {
  font-size: 11px; border: 1px solid var(--line); border-radius: 20px;
  padding: 1px 8px; margin-left: 6px; color: var(--ink-soft); white-space: nowrap;
}
.chip-link { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent);
             text-decoration: none; }

/* A voided line stays legible - it is part of the account of what happened, it
   just stops counting. The balance column is NOT struck through, because that
   number is still the live balance at that point. */
tr.voided .part, tr.voided .c-credit, tr.voided .c-debit {
  text-decoration: line-through; opacity: .55;
}
tr.voided .c-bal { opacity: .55; }
.void-note { display: block; color: var(--bad); font-size: 11.5px; margin-top: 2px; }

.empty { color: var(--ink-soft); font-size: 14.5px; }

/* ── login ───────────────────────────────────────────────────────────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 30px; width: min(380px, 100%);
}
.auth-card h1 { font-size: 24px; margin: 6px 0 18px; letter-spacing: -.01em; }
.auth-card .btn { width: 100%; }
.fineprint { font-size: 12px; color: var(--ink-soft); margin: 18px 0 0; text-align: center; }
