/* Guard · Liabilities. A deep teal accent, never the Assets side's amber, so the two are told
   apart at a glance. */
:root {
  --ink: #10242b;
  --muted: #5b6f75;
  --line: #d9e3e5;
  --paper: #f5f8f8;
  --card: #ffffff;
  --accent: #0f6b6b;
  --accent-soft: #e3f1f0;
  --danger: #a3292b;
  --danger-soft: #fbeaea;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
/* "hidden" must win over any display rule below. Without this the menu, Sign out and the
   administrator-only Accounts link all showed to people who should not see them. */
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); }
a { color: var(--accent); }

.bar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.brand .mark { font-size: 18px; }
.brand .side { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; background: var(--accent); padding: 3px 8px; border-radius: 4px; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: #cfe0e2; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
nav a.active, nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.who { display: flex; gap: 12px; align-items: center; font-size: 13px; color: #cfe0e2; margin-left: auto; }
button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 48px auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar select, .toolbar button { width: auto; flex: none; }
/* A wide table scrolls inside its card rather than pushing the page sideways on a phone. */
.scroll { overflow-x: auto; }
ul.changes { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ul.changes li { margin: 0 0 2px; }
ul.changes .field { color: var(--muted); }
ul.changes del { color: var(--muted); }

label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
label .hint { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
textarea { min-height: 70px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .bar { flex-wrap: wrap; height: auto; padding: 10px 16px; } }

button.primary, button.secondary, button.danger { border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
button.primary { background: var(--accent); color: #fff; }
button.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px; }
td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ACTIVE, .pill.VERIFIED { background: var(--accent-soft); color: var(--accent); }
.pill.INACTIVE, .pill.PENDING { background: var(--warn-soft); color: var(--warn); }
.pill.CLOSED, .pill.EXPIRED { background: #eceff0; color: var(--muted); }

.error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.secret { background: var(--accent-soft); border-radius: 6px; padding: 12px; margin-top: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; }
dl.facts { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
pre.json { white-space: pre-wrap; word-break: break-word; font-size: 12px; margin: 0; color: var(--muted); }

/* ── Phase 1: borrowings screens ─────────────────────────────────────────────────────────── */
:root { --data: #0e9594; --ok: #1d7a46; --ok-soft: #e4f3ea; }
.who .link { color: #cfe0e2; font-size: 13px; }
.badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #e0a100; color: #10242b; font-size: 11px; font-weight: 700; text-align: center; }
h2.section { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 20px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.crumb { margin-bottom: 8px; }
.field[hidden] { display: none !important; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid2.wide { gap: 16px; align-items: start; }
.grid2.wide > .card { margin-bottom: 0; }
@media (max-width: 760px) { .grid3, .grid2.wide { grid-template-columns: 1fr; } }
.upper { text-transform: uppercase; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check.inline { display: inline-flex; margin-right: 16px; }
label.check input { width: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.notice.soft { background: var(--accent-soft); color: var(--ink); }
.notice.inline { display: inline-block; margin: 0; }
.actions.tight { margin: 0; gap: 6px; }
button.small { padding: 5px 10px; font-size: 13px; }
button.link-button { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
details { margin-top: 12px; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.tile.alarm { border-color: var(--danger); background: var(--danger-soft); }
.tile.alarm .l { color: var(--danger); font-weight: 600; }
.card.pending { border-color: #e0a100; background: #fffaf0; }

/* The one headline number on the dashboard. */
.hero { margin: 4px 0 16px; }
.hero-n { font-size: 48px; font-weight: 700; line-height: 1.1; }
.hero-l { color: var(--muted); font-size: 14px; }

/* Single-series bars (hbar — "bar" is the page header, and sharing the name broke both): thin, rounded at the value end, square at the baseline; value in ink. */
.bars { display: grid; gap: 8px; margin: 8px 0; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 16px; border-left: 1px solid var(--line); }
.hbar { height: 16px; background: var(--data); border-radius: 0 4px 4px 0; }
.hbar-value { white-space: nowrap; color: var(--ink); font-variant-numeric: tabular-nums; }
.hbar-row:hover .hbar { filter: brightness(1.12); }

/* Tabs for the payments-and-changes card. */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* The reason dialog. */
.dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: 480px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(16, 36, 43, .45); }
.dialog h2 { font-size: 18px; margin: 0 0 6px; }

/* Instalment and approval states. Each always carries its word, never colour alone. */
.pill.PAID { background: var(--ok-soft); color: var(--ok); }
.pill.OVERDUE, .pill.RETURNED { background: var(--danger-soft); color: var(--danger); }
.pill.DUE, .pill.PART_PAID, .pill.PENDING_APPROVAL { background: var(--warn-soft); color: var(--warn); }
.pill.UPCOMING, .pill.WITHDRAWN { background: #eceff0; color: var(--muted); }
/* On a phone the menu wraps rather than pushing "Audit trail" off the edge. */
nav { flex-wrap: wrap; }
td:first-child { white-space: nowrap; }
