:root {
  color-scheme: light;
  --ink: #152842;
  --muted: #57677a;
  --line: #dce4ed;
  --surface: #f3f6fa;
  --brand: #173d65;
  --accent: #a82c39;
  --credit: #087353;
  --debit: #a83242;
  font: 100%/1.45 "Inter", "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #478ac5; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); letter-spacing: -.045em; line-height: 1.1; }
h2 { font-size: 1.3rem; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.logo { width: 126px; height: auto; display: block; }
.workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
main { min-width: 0; }
.sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 16px 16px; position: sticky; height: 100dvh; top: 0; }
.brand { padding: 5px 11px; width: fit-content; }
nav { display: grid; gap: 5px; margin-top: 44px; }
nav a { display: flex; gap: 13px; align-items: center; padding: 10px 12px; border-radius: 8px; font-size: .93rem; font-weight: 600; color: var(--muted); }
nav a span { font-size: 1.2rem; width: 22px; text-align: center; line-height: 1; }
nav a:hover, nav a[aria-current="page"] { color: var(--brand); background: #eaf0f7; }
.account { margin-top: auto; border-top: 1px solid var(--line); padding: 15px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; background: #e8eff7; border-radius: 50%; font-weight: 700; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.account small { color: var(--muted); font-size: .76rem; }
.topbar { min-height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px clamp(16px, 3vw, 40px); font-weight: 650; }
#top-quote { color: var(--muted); font-size: .88rem; text-align: right; }
.page { max-width: 1540px; margin: auto; padding: 34px clamp(16px, 3vw, 40px) 50px; }
.page-header, .panel-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.page-header { margin-bottom: 24px; }
.page-header p { margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.primary, .secondary { border-radius: 8px; min-height: 42px; padding: 8px 15px; font-size: .91rem; font-weight: 650; }
.primary { color: #fff; border: 1px solid var(--brand); background: var(--brand); }
.primary:hover { background: #102d4c; }
.secondary { color: var(--brand); border: 1px solid #c5d3e0; background: #fff; }
.secondary:hover { background: #edf3fa; }
.text-button, .row-link { color: var(--brand); background: none; padding: 2px; border: none; font-weight: 650; font-size: .88rem; text-align: left; }
.text-button:hover, .row-link:hover { text-decoration: underline; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.card { min-width: 0; padding: 17px 19px; }
.card-label { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--muted); font-size: .92rem; }
.badge { background: #edf2f7; color: var(--brand); font-size: .77rem; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.number { display: block; margin-top: 6px; font-size: clamp(1.2rem, 2vw, 1.85rem); letter-spacing: -.04em; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card small { color: var(--muted); font-size: .86rem; display: block; margin-top: 5px; }
.panel { overflow: hidden; }
.panel-header { padding: 15px 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select { min-height: 38px; padding-block: 6px; }
.filters input { max-width: 100%; }
input, select, .readout { width: 100%; border: 1px solid #c5d3e0; color: var(--ink); background: #fff; border-radius: 7px; padding: 9px 11px; min-width: 0; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #50627b 50%), linear-gradient(135deg, #50627b 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.filters label { min-width: 100px; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ledger { min-width: 875px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8edf3; text-align: left; }
.ledger th, .ledger td { padding-inline: 8px; }
.ledger th[rowspan] { white-space: normal; }
th { background: #eff4f9; color: #334d69; white-space: nowrap; }
thead tr + tr th { padding-top: 6px; padding-bottom: 6px; font-weight: 550; }
.currency-group { text-align: center; border-left: 1px solid var(--line); }
.divide { border-left: 1px solid var(--line); }
td:first-child, td:nth-child(2) { white-space: nowrap; }
.ledger td:nth-child(3) { min-width: 136px; }
.ledger td:nth-child(4) { min-width: 115px; }
td { overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafd; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.credit { color: var(--credit); }
.debit { color: var(--debit); }
.empty { text-align: center; color: var(--muted); padding: 40px 15px; }
.totals { background: #eff4f9; font-weight: 700; }
.count { border-top: 1px solid var(--line); padding: 10px 18px; color: var(--muted); font-size: .88rem; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, #dce8f5, #f3f6fa 68%); }
.login-panel { width: min(100%, 420px); padding: 34px; border-radius: 16px; border: 1px solid var(--line); background: #fff; box-shadow: 0 18px 60px #18324b12; display: grid; gap: 15px; }
.login-panel .logo { margin-bottom: 12px; }
.login-panel h1 { font-size: 2rem; }
label { display: grid; gap: 5px; font-size: .9rem; font-weight: 650; }
.error { color: var(--debit); background: #fff2f3; padding: 9px 12px; border-radius: 7px; font-size: .88rem; }
dialog { border: 1px solid var(--line); border-radius: 15px; padding: 23px; color: var(--ink); width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: #10233978; }
dialog form { display: grid; gap: 15px; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.close { border: none; background: #eef3f8; color: var(--brand); border-radius: 7px; font-size: 1.3rem; width: 34px; height: 34px; line-height: 1; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 15px; }
.wide { grid-column: 1 / -1; }
.rate, .readout { background: #edf3f9; color: var(--brand); }
.rate { padding: 10px 12px; border-radius: 7px; font-size: .9rem; }
.readout { min-height: 43px; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 0; }
.details div { padding: 10px; background: #f3f6fa; border-radius: 7px; overflow-wrap: anywhere; }
.details dt { font-size: .83rem; color: var(--muted); }
.details dd { margin: 3px 0 0; }
.notice { position: fixed; bottom: 20px; right: 20px; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; position: static; display: grid; grid-template-columns: 1fr auto; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
  .sidebar .logo { width: 92px; }
  .brand { padding: 0; }
  nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; margin-top: 12px; gap: 3px; }
  nav a { gap: 4px; padding: 7px; }
  .account { border: none; margin: 0; padding: 0; }
  .topbar { min-height: 48px; }
  .page { padding-top: 24px; }
}
@media (max-width: 540px) {
  .cards { grid-template-columns: 1fr; gap: 7px; }
  .card { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px; }
  .number, .card small { margin: 0; }
  .card small { width: 100%; }
  .filters { width: 100%; }
  .filters label { flex: 1 1 110px; }
  .filters label:first-child { flex-basis: 100%; }
  dialog { padding: 15px; }
}
