:root {
  --ink: #12211b;
  --ink-soft: #3c4f47;
  --muted: #6d7b74;
  --paper: #f5f2ea;
  --surface: #ffffff;
  --surface-2: #fbf9f4;
  --line: #e3ddcf;
  --line-strong: #cfc6b2;
  --brand: #0b3b2e;
  --brand-2: #11553f;
  --brand-soft: #e6efe9;
  --gold: #b98a2f;
  --gold-soft: #f6eedb;
  --danger: #a83227;
  --danger-soft: #fbeae7;
  --warn: #925700;
  --warn-soft: #fdf1dc;
  --ok: #1e6b47;
  --ok-soft: #e6f2ea;
  --info: #245c7a;
  --info-soft: #e8f0f5;
  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", "Noto Serif", serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --sidebar: 268px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 33, 27, 0.05);
  --shadow-md: 0 14px 40px -18px rgba(18, 33, 27, 0.35);
  --focus: 0 0 0 3px rgba(185, 138, 47, 0.28);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--gold-soft); }

/* ---------- App shell ---------- */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.07), transparent 42%),
    radial-gradient(circle at 92% 92%, rgba(185, 138, 47, 0.14), transparent 46%),
    var(--brand);
  color: #eef3ef;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(145deg, #e9d9a6, #c9a24a);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.1px; }
.brand-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.6px; color: rgba(238, 243, 239, 0.62); margin-top: 4px; }

.institution-chip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  margin-bottom: 22px;
}

.institution-chip .icon { width: 16px; height: 16px; margin-top: 2px; color: #d9c48c; }
.institution-chip strong { display: block; font-size: 12px; font-weight: 600; line-height: 1.35; }
.institution-chip span { display: block; font-size: 10.5px; color: rgba(238, 243, 239, 0.6); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 8px;
  color: rgba(238, 243, 239, 0.72);
  font-size: 13px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
}

.nav-item .icon { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.nav-item.active .icon { color: #e2cb92; opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #231c09;
  display: grid;
  place-items: center;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding-top: 20px; }

.control-note {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.control-note .icon { width: 15px; height: 15px; color: #d9c48c; margin-top: 2px; }
.control-note p { font-size: 10.5px; line-height: 1.45; color: rgba(238, 243, 239, 0.65); }
.control-note strong { color: #f3ead2; font-weight: 600; }

.version { font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(238, 243, 239, 0.35); padding-left: 3px; }

.shell { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 34px;
  background: rgba(245, 242, 234, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); }
.topbar h1 { font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -0.2px; white-space: nowrap; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.operator-control {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 6px 4px 11px;
  height: 38px;
  box-shadow: var(--shadow-sm);
}
.operator-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); }
.operator-control select { border: 0; background: transparent; font-size: 12px; font-weight: 600; padding: 0 4px; outline: none; min-width: 116px; }

.session-chip {
  display: none;
  flex-direction: column;
  justify-content: center;
  min-width: 148px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.25;
}
.session-chip.visible { display: flex; }
.session-chip strong { font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-chip span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); margin-top: 2px; }

.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.attachment-row strong { display: block; font-size: 12px; color: var(--ink); }
.attachment-row span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.attachment-row code { display: block; margin-top: 3px; font-family: var(--font-mono); font-size: 9.5px; color: var(--brand-2); }

.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.line-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid #eee9de; font-size: 12px; }
.line-row span { color: var(--ink-soft); }
.line-row strong { font-family: var(--font-mono); font-size: 11.5px; }
.line-row.total { margin-top: 10px; border-top: 1px solid var(--line); border-bottom: 0; padding-top: 12px; font-weight: 700; }
@media (max-width: 900px) { .split-2 { grid-template-columns: 1fr; } }

.report-hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-hub-card { display: block; padding: 18px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.report-hub-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.report-hub-card .section-title { margin-bottom: 6px; }
.report-hub-card .hint { min-height: 34px; }
.report-hub-card .eyebrow { margin-top: 12px; }
@media (max-width: 900px) { .report-hub-grid { grid-template-columns: 1fr; } }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms, color 120ms, transform 120ms;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn:active { transform: translateY(1px); }

.mobile-only { display: none; }

/* ---------- View ---------- */

.view { padding: 30px 34px 64px; max-width: 1460px; width: 100%; margin: 0 auto; outline: none; }

.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .page-intro { max-width: 640px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-head .spacer { flex: 1; }

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-title .icon { color: var(--gold); width: 17px; height: 17px; }
.section-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.side-main { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.grid.journal-page { grid-template-columns: 1fr; }
.journal-page .journal-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 88% 12%, rgba(185, 138, 47, 0.23), transparent 42%),
    linear-gradient(120deg, #0b3b2e 0%, #0e4737 58%, #11553f 100%);
  color: #f4f0e3;
  padding: 26px 28px;
  display: flex;
  gap: 26px;
  align-items: center;
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -110px auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.025), 0 0 0 84px rgba(255, 255, 255, 0.015);
  pointer-events: none;
}
.hero-copy { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero .eyebrow { color: #d9c48c; }
.hero h2 { font-family: var(--font-display); font-size: 27px; line-height: 1.2; font-weight: 600; margin: 7px 0 8px; letter-spacing: -0.3px; }
.hero p { color: rgba(244, 240, 227, 0.7); font-size: 12.5px; max-width: 560px; line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hero-stat { position: relative; z-index: 1; min-width: 188px; padding-left: 26px; border-left: 1px solid rgba(255, 255, 255, 0.16); }
.hero-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: rgba(244, 240, 227, 0.55); }
.hero-stat strong { display: block; font-family: var(--font-display); font-size: 42px; line-height: 1.1; font-weight: 500; margin: 6px 0 2px; }
.hero-stat em { font-style: normal; font-size: 11.5px; color: #d9c48c; }

/* ---------- KPI ---------- */

.kpi {
  padding: 17px 18px 15px;
  position: relative;
  overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto auto 0; height: 3px; width: 100%; background: var(--line); }
.kpi.accent-green::before { background: var(--ok); }
.kpi.accent-gold::before { background: var(--gold); }
.kpi.accent-red::before { background: var(--danger); }
.kpi.accent-blue::before { background: var(--info); }
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi-label .icon { width: 14px; height: 14px; }
.kpi-value { font-family: var(--font-display); font-size: 30px; line-height: 1.15; margin: 8px 0 3px; letter-spacing: -0.5px; }
.kpi-value.money { font-family: var(--font-ui); font-size: 22px; font-weight: 650; letter-spacing: -0.3px; }
.kpi-foot { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi-foot strong { color: var(--ink-soft); font-weight: 600; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, color 120ms, transform 120ms;
}
.btn .icon { width: 15px; height: 15px; }
.btn:hover { border-color: #b9ae97; background: #fdfbf6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #f6f2e6; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #241c07; }
.btn-gold:hover { background: #c7973a; border-color: #c7973a; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f291f; border-color: #8f291f; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: rgba(18, 33, 27, 0.05); border-color: transparent; }
.btn-sm { height: 31px; padding: 0 10px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn-link { border: 0; background: none; padding: 0; color: var(--brand-2); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-link .icon { width: 13px; height: 13px; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.input, .select, .textarea {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.textarea { height: auto; min-height: 86px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: #a7b0aa; }

#manual-lines .manual-account { width: 190px; min-width: 190px; }
#manual-lines .manual-description { width: 190px; min-width: 190px; }
#manual-lines .manual-fund { width: 96px; min-width: 96px; }
#manual-lines .manual-centre { width: 110px; min-width: 110px; }
#manual-lines .manual-debit, #manual-lines .manual-credit { width: 112px; min-width: 112px; }
#manual-lines .select, #manual-lines .input { height: 34px; }

.search-box { position: relative; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-box .input { padding-left: 34px; min-width: 240px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; gap: 2px; }
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented button:hover:not(.active) { color: var(--ink-soft); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid #eee9de; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 100ms; }
table.data tbody tr:hover { background: #fcfaf5; }
table.data tbody tr.clickable { cursor: pointer; }
table.data .num { text-align: right; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { font-weight: 600; }
table.data .muted { color: var(--muted); }
table.data tr.total-row td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; background: var(--surface-2); }
table.data tr.current-period td { background: #fcf7ea; }
table.data tr.current-period td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
table.data tr.subtotal-row td { border-top: 1px solid var(--line-strong); font-weight: 650; background: #fcfaf5; }
table.data.compact td { padding: 9px 14px; }
table.data.compact th { padding: 9px 14px; }

table.data.lines-table { table-layout: fixed; }
table.data.lines-table th:nth-child(1) { width: 4%; }
table.data.lines-table th:nth-child(2) { width: 18%; }
table.data.lines-table th:nth-child(3) { width: 28%; }
table.data.lines-table th:nth-child(4) { width: 9%; }
table.data.lines-table th:nth-child(5) { width: 11%; }
table.data.lines-table th:nth-child(6) { width: 15%; }
table.data.lines-table th:nth-child(7) { width: 15%; }
table.data.lines-table td { overflow-wrap: anywhere; }
table.data.lines-table td.num { overflow-wrap: normal; font-size: 11px; }

.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-stack strong { font-weight: 600; }
.cell-stack span { font-size: 11px; color: var(--muted); }

.code { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft); }
.batch-id { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; white-space: nowrap; letter-spacing: -0.1px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.posted { background: var(--ok-soft); color: var(--ok); border-color: #cfe4d8; }
.pill.validated, .pill.received { background: var(--warn-soft); color: var(--warn); border-color: #f1dfbb; }
.pill.rejected { background: var(--danger-soft); color: var(--danger); border-color: #f2d2cd; }
.pill.reversed { background: var(--info-soft); color: var(--info); border-color: #cfe0ea; }
.pill.open { background: var(--ok-soft); color: var(--ok); border-color: #cfe4d8; }
.pill.closed { background: #ece9e1; color: #5c5a52; border-color: #ddd8cb; }
.pill.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font-size: 10.5px; color: var(--ink-soft); }
.tag.gold { background: var(--gold-soft); border-color: #e8d7b4; color: #6d5215; }
.tag.green { background: var(--brand-soft); border-color: #cfe4d8; color: var(--brand-2); }
.tag.red { background: var(--danger-soft); border-color: #f2d2cd; color: var(--danger); }
.tag.blue { background: var(--info-soft); border-color: #cfe0ea; color: var(--info); }

/* ---------- Journal detail ---------- */

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.detail-head .back { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.detail-head .back:hover { color: var(--ink); }
.detail-title { font-family: var(--font-display); font-size: 25px; letter-spacing: -0.3px; line-height: 1.2; }
.detail-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.meta-item { background: var(--surface); padding: 12px 14px; min-width: 0; }
.meta-item span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); margin-bottom: 4px; }
.meta-item strong { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-item .mono { font-size: 11px; }

.callout { display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--radius); border: 1px solid; font-size: 12px; line-height: 1.5; }
.callout .icon { width: 17px; height: 17px; margin-top: 1px; }
.callout strong { display: block; margin-bottom: 2px; }
.callout.ok { background: var(--ok-soft); border-color: #cfe4d8; color: #175437; }
.callout.warn { background: var(--warn-soft); border-color: #f1dfbb; color: #6d4300; }
.callout.bad { background: var(--danger-soft); border-color: #f2d2cd; color: #7d241b; }
.callout.info { background: var(--info-soft); border-color: #cfe0ea; color: #1d4b64; }
.callout ul { margin: 5px 0 0; padding-left: 17px; }
.callout li + li { margin-top: 3px; }

.validation-item { display: flex; gap: 8px; font-size: 11.5px; }
.validation-item .code-badge { font-family: var(--font-mono); font-size: 9.5px; background: rgba(0, 0, 0, 0.07); padding: 1px 5px; border-radius: 4px; height: fit-content; white-space: nowrap; }

.audit-list { display: flex; flex-direction: column; }
.audit-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eee9de; }
.audit-item:last-child { border-bottom: 0; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 5px; flex: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.audit-item strong { font-size: 11.5px; display: block; }
.audit-item span { font-size: 10.5px; color: var(--muted); }
.audit-item p { font-size: 11px; color: var(--ink-soft); margin-top: 3px; word-break: break-word; }

/* ---------- Accounts / periods ---------- */

.class-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.class-chip { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.class-chip span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.class-chip strong { display: block; font-size: 19px; margin-top: 3px; font-family: var(--font-display); font-weight: 600; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- Final accounts ---------- */

.statement { max-width: 920px; margin: 0 auto; }
.statement-head { text-align: center; padding: 8px 0 20px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.statement-head .inst { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.statement-head h2 { font-family: var(--font-display); font-size: 24px; margin: 6px 0 3px; font-weight: 600; }
.statement-head p { font-size: 11.5px; color: var(--muted); }
.statement-section { margin-bottom: 18px; }
.statement-section h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); padding: 8px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.line-item { display: flex; justify-content: space-between; gap: 16px; padding: 7px 4px; font-size: 12.5px; border-bottom: 1px dotted #e6e0d3; }
.line-item:last-child { border-bottom: 0; }
.line-item .label { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.line-item .label .code { font-size: 10px; color: var(--muted); }
.line-item .amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-item.total { border-top: 1px solid var(--ink); border-bottom: 2px solid var(--ink); font-weight: 700; margin-top: 4px; padding: 9px 4px; }
.line-item.grand { border-top: 2px solid var(--ink); border-bottom: 4px double var(--ink); font-weight: 700; padding: 11px 4px; font-size: 14px; }
.line-item .funds { display: flex; gap: 5px; flex-wrap: wrap; }
.surplus-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px 18px; border-radius: var(--radius); background: var(--brand); color: #f4f0e3; }
.surplus-banner span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; color: rgba(244, 240, 227, 0.65); }
.surplus-banner strong { display: block; font-family: var(--font-display); font-size: 25px; font-weight: 500; line-height: 1.2; margin-top: 2px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 11px 15px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--gold); }
.tabs button:hover:not(.active) { color: var(--ink-soft); }

/* ---------- Modal / toast ---------- */

.scrim { position: fixed; inset: 0; background: rgba(12, 24, 19, 0.46); backdrop-filter: blur(2px); z-index: 60; }
.modal {
  position: fixed;
  z-index: 70;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.modal-head .icon-btn { margin-left: auto; width: 32px; height: 32px; box-shadow: none; }
.modal-body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal p.hint { font-size: 12px; color: var(--muted); line-height: 1.55; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 260px; max-width: 420px;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: #f4f1e8;
  font-size: 12px;
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.45);
  animation: toast-in 180ms ease-out;
}
.toast .icon { width: 16px; height: 16px; margin-top: 1px; color: #d9c48c; }
.toast.error { background: #5e1d16; }
.toast.error .icon { color: #f0b4ad; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Empty / loading ---------- */

.loading-state { display: flex; align-items: center; gap: 10px; padding: 50px 0; color: var(--muted); font-size: 12.5px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin 700ms linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; color: var(--line-strong); margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink-soft); font-size: 13px; margin-bottom: 3px; }
.empty p { font-size: 11.5px; }

.footnote { font-size: 10.5px; color: var(--muted); line-height: 1.6; margin-top: 12px; }
.hr { height: 1px; background: var(--line); margin: 18px 0; }

.stat-inline { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-inline div { min-width: 120px; }
.stat-inline span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.stat-inline strong { display: block; font-size: 16px; margin-top: 3px; font-family: var(--font-mono); }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-main { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .journal-page .journal-side { grid-template-columns: 1fr; }
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform 220ms ease; width: 268px; }
  .sidebar.open { transform: none; }
  .shell { margin-left: 0; }
  .mobile-only { display: grid; }
  .topbar { padding: 0 18px; height: 68px; }
  .view { padding: 22px 18px 56px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-stat { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.16); padding: 14px 0 0; width: 100%; }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .class-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .grid.cols-4, .grid.cols-2 { grid-template-columns: 1fr; }
  .card-head { flex-wrap: wrap; }
  .meta-grid { grid-template-columns: 1fr; }
  .class-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operator-control { display: none; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; }
  .search-box .input { min-width: 0; width: 100%; }
  .search-box { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .spacer { display: none; }
  .statement-head h2 { font-size: 20px; }
}

/* ---------- Print ---------- */

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .detail-actions, .tabs, .page-head .btn, .toast-root { display: none !important; }
  .shell { margin-left: 0; }
  .view { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .statement { max-width: none; }
  .print-block { break-inside: avoid; page-break-inside: avoid; }
}
