:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec; --accent: #1f5eff;
  --accent-soft: #e8eeff; --ok: #12805c; --ok-soft: #e3f5ee; --warn: #a15c00; --warn-soft: #fff3df;
  --err: #c0262d; --err-soft: #fde8e8; --navy: #101828;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef0f4; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; }
.topbar { display: flex; align-items: center; gap: 16px; background: var(--navy); color: #e6e9f0; padding: 10px 20px; position: sticky; top: 0; z-index: 5; }
.brand { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--accent); margin-right: 6px; }
.group-name { color: #aab3c5; }
.spacer { flex: 1; }
.who { color: #aab3c5; font-size: 13px; }
button.link { background: none; border: 0; color: #cfd6e6; cursor: pointer; font: inherit; }
.inline { display: inline; }
.layout { display: flex; min-height: calc(100vh - 46px); }
.sidebar { width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; }
.sidebar a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.sidebar a.active, .sidebar a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav-title { text-transform: uppercase; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; margin: 14px 10px 4px; }
main { flex: 1; padding: 22px 28px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { font-size: 24px; }
.kpi.good strong { color: var(--ok); } .kpi.bad strong { color: var(--err); } .kpi.warn strong { color: var(--warn); }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; position: sticky; top: 0; }
.grid tfoot th { border-top: 2px solid var(--ink); }
.num td.r, .num th.r, .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.dim td { color: var(--muted); }
.scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
.worksheet td:first-child, .worksheet th:first-child { position: sticky; left: 0; background: #fff; min-width: 260px; }
.worksheet thead th:first-child { background: #fafbfc; z-index: 2; }
.worksheet tr.type-income td:first-child, .worksheet tr.type-expense td:first-child { border-left: 3px solid #b4c6ff; }
.worksheet tr.type-equity td:first-child { border-left: 3px solid #f2c98a; }
td.drill, td.drill-line { cursor: pointer; }
td.drill:hover, td.drill-line:hover { background: var(--accent-soft); color: var(--accent); }
.strong { font-weight: 650; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.subtotal td { font-weight: 650; }
tr.section td { text-transform: uppercase; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; padding-top: 14px; }
tr.check td { color: var(--muted); font-size: 12px; }
td.indent { padding-left: 24px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef0f4; color: var(--muted); text-transform: lowercase; }
.badge.ok, .badge.matched, .badge.approved, .badge.full, .badge.parent { background: var(--ok-soft); color: var(--ok); }
.badge.warning, .badge.fx, .badge.submitted, .badge.equity { background: var(--warn-soft); color: var(--warn); }
.badge.error, .badge.mismatch, .badge.rejected { background: var(--err-soft); color: var(--err); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tick { color: var(--ok); font-weight: 700; } .cross { color: var(--err); font-weight: 600; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.issues .cat { color: var(--muted); font-size: 12px; margin-right: 6px; }
tr.status-mismatch td { background: #fff7f7; } tr.status-fx td { background: #fffaf0; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px; border-radius: 7px; cursor: pointer; font: inherit; font-weight: 550; }
.btn:hover { border-color: #c5cad6; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.period-picker { display: flex; gap: 8px; align-items: center; }
select, input[type=text], input[type=number], input[type=password], input[type=file] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 100%; }
.stack p { margin: 0 0 10px; } .stack label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 3px; }
.row-fields { display: flex; gap: 16px; flex-wrap: wrap; }
.helptext { display: block; color: var(--muted); font-size: 12px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--accent-soft); }
.flash.success { background: var(--ok-soft); color: var(--ok); } .flash.error { background: var(--err-soft); color: var(--err); }
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
details { border-bottom: 1px solid var(--line); padding: 6px 0; }
summary { cursor: pointer; }
details table { margin: 8px 0 8px 16px; width: calc(100% - 16px); }
.tree .node { padding: 10px 12px; border-left: 3px solid var(--accent); margin-bottom: 8px; background: #fafbfd; border-radius: 0 8px 8px 0; }
.tree .node.depth-1 { border-left-color: #7d9bff; } .tree .node.depth-2 { border-left-color: #b4c6ff; }
.node-main { display: flex; gap: 8px; align-items: center; }
.ccy { font-size: 11px; font-weight: 700; background: var(--navy); color: #fff; padding: 2px 6px; border-radius: 4px; }
.own { display: flex; gap: 10px; align-items: center; margin: 6px 0 2px; font-size: 13px; }
.bar { width: 160px; height: 8px; background: #e6e9f0; border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; background: var(--accent); }
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45); display: grid; place-items: center; z-index: 20; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px; width: min(900px, 94vw); max-height: 85vh; overflow: auto; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.exports { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .sidebar { display: none; } .kpis { grid-template-columns: 1fr 1fr; } main { padding: 16px; } }
