/* Libro panel. Tokens from MUVERAN Design System 2 (colors_and_type.css): slate neutrals, blue primary, Geist. */
:root {
  --bg: #ffffff; --surface: #f8fafc; --fg: #020617; --muted: #64748b; --subtle: #94a3b8;
  --border: #e2e8f0; --primary: #2563eb; --primary-hover: #1d4ed8; --primary-fg: #f8fafc; --ring: #2563eb;
  --ok: #059669; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb; --bad: #dc2626; --bad-bg: #fef2f2;
  --c-in: #3b82f6; --c-commission: #8b5cf6; --c-transfer: #94a3b8; --c-out: #475569; --c-kept: #10b981;
  --c-before: #f59e0b; --c-unknown: #ef4444; --node: #0f172a;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --r: 6px; --shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617; --surface: #0f172a; --fg: #f8fafc; --muted: #94a3b8; --subtle: #64748b;
    --border: #1e293b; --primary: #60a5fa; --primary-hover: #93c5fd; --primary-fg: #0f172a; --ring: #3b82f6;
    --ok: #34d399; --ok-bg: #022c22; --warn: #fbbf24; --warn-bg: #2a1d03; --bad: #f87171; --bad-bg: #2a0a0a;
    --c-out: #64748b; --c-transfer: #475569; --node: #e2e8f0;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
h1 { font-size: 20px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; margin: 0; }
h2 { font-size: 16px; line-height: 1.25; letter-spacing: -.01em; font-weight: 600; margin: 32px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }

/* layout */
.top { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 2; }
.top nav, main { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.top nav { display: flex; align-items: center; gap: 4px; height: 52px; }
.brand { font-weight: 600; letter-spacing: -.02em; margin-right: 16px; color: var(--fg); }
.top nav a.tab { color: var(--muted); padding: 6px 12px; border-radius: var(--r); font-weight: 500; }
.top nav a.tab:hover { color: var(--fg); background: var(--surface); text-decoration: none; }
.top nav a.tab[aria-current="page"] { color: var(--fg); background: var(--surface); }
.top nav .end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
main { padding-top: 24px; padding-bottom: 64px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* chips, badges, status */
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: var(--r); font-size: 12px; line-height: 20px;
  text-align: center; background: var(--bad-bg); color: var(--bad); font-weight: 600; margin-left: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: var(--r); font-size: 12px;
  line-height: 22px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.status { padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px; border: 1px solid var(--border); }
.status.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.status.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.status.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.status a { color: inherit; text-decoration: underline; font-weight: 500; }

/* controls */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg a { padding: 4px 12px; border-radius: 4px; color: var(--muted); font-weight: 500; }
.seg a:hover { color: var(--fg); text-decoration: none; }
.seg a[aria-current="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--surface); }
.btn.icon { padding: 0; width: 32px; }
input, select, textarea { height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font: 14px var(--font); min-width: 0; }
textarea { height: 96px; padding: 8px 10px; font: 12px/1.4 var(--mono); width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(37 99 235 / .15); }
input:disabled { opacity: .5; }
input[type=file] { height: auto; padding: 6px; }
label.field { display: grid; gap: 4px; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.errorlist { list-style: none; padding: 0; margin: 4px 0; color: var(--bad); font-size: 12px; }

/* cards, tables */
.card { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface); }
td .sub { display: block; color: var(--muted); font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll { overflow-x: auto; }
.kpis { display: flex; gap: 32px; flex-wrap: wrap; margin: 4px 0 16px; }
.kpi .v { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
details > summary { cursor: pointer; color: var(--muted); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 16px; margin-bottom: 4px; }

/* sankey */
.sankey { width: 100%; height: auto; display: block; font: 12px var(--font); }
.sankey .node { fill: var(--node); }
.sankey text { fill: var(--fg); }
.sankey .name { font-weight: 500; }
.sankey .amt { fill: var(--muted); font-variant-numeric: tabular-nums; }
.sankey .band { fill-opacity: .35; transition: fill-opacity .15s; }
.sankey a:hover .band, .sankey a:focus .band { fill-opacity: .7; }
.sankey .t-in { fill: var(--c-in); } .sankey .t-commission { fill: var(--c-commission); }
.sankey .t-transfer { fill: var(--c-transfer); } .sankey .t-out { fill: var(--c-out); }
.sankey .t-kept { fill: var(--c-kept); } .sankey .t-before { fill: var(--c-before); }
.sankey .t-unknown { fill: var(--c-unknown); }
.sankey.dashed .band { fill-opacity: .15; stroke: currentColor; stroke-dasharray: 4 3; stroke-width: 1; }
.sankey.dashed .t-in { color: var(--c-in); } .sankey.dashed .t-commission { color: var(--c-commission); }
.sankey.dashed .t-out { color: var(--c-out); } .sankey.dashed .t-transfer { color: var(--c-transfer); }
.sankey.dashed .t-kept { color: var(--c-kept); } .sankey.dashed .t-before { color: var(--c-before); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* login */
.auth { max-width: 360px; margin: 12vh auto 0; }
.auth h1 { margin-bottom: 16px; }

@media (max-width: 640px) {
  .top nav, main { padding: 0 16px; }
  main { padding-top: 16px; }
  .brand { display: none; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
