/* FinSight design system – dark-first, Quatra-inspired (original styling, no third-party branding) */
:root {
  --bg: #050505; --bg-2: #0b0b0b; --surface: #141414; --card: #1c1c1c; --card-2: #232323; --line: #303030; --line-2: #262626;
  --text: #f6f6f9; --text-2: #a1a0a4; --text-3: #6f6e73;
  --gold: #dda51a; --gold-2: #b88b1d; --gold-soft: rgba(221, 165, 26, .12); --gold-line: rgba(221, 165, 26, .35);
  --pos: #6fa85a; --pos-soft: rgba(92, 139, 73, .18); --warn: #f0a531; --warn-soft: rgba(240, 165, 49, .14); --neg: #d9615c; --neg-soft: rgba(208, 72, 72, .16);
  --info: #5b9be6; --info-soft: rgba(57, 135, 229, .14);
  --r: 14px; --r-sm: 9px; --r-lg: 20px;
  --font: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --nav-w: 248px; --top-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.n, .kpi .v { font-variant-numeric: tabular-nums; }
::selection { background: var(--gold); color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 10px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); height: 100vh; }
.nav { background: var(--bg-2); border-right: 1px solid var(--line-2); display: flex; flex-direction: column; overflow-y: auto; padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand .mark { width: 32px; height: 32px; border-radius: 10px; background: radial-gradient(120% 120% at 20% 10%, #f3c650, var(--gold) 45%, #8a6510); box-shadow: 0 0 22px rgba(221,165,26,.25); position: relative; }
.brand .mark::after { content: ''; position: absolute; left: 8px; right: 8px; top: 8px; bottom: 8px;
  background: linear-gradient(#120d00, #120d00) left bottom / 26% 42% no-repeat, linear-gradient(#120d00, #120d00) center bottom / 26% 70% no-repeat, linear-gradient(#120d00, #120d00) right bottom / 26% 100% no-repeat; }
.brand b { font-weight: 700; letter-spacing: .02em; font-size: 15px; }
.brand small { display: block; color: var(--text-3); font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; }
.company-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--text); font-size: 12.5px; font-weight: 600; line-height: 1.35; margin-bottom: 14px; }
.company-chip svg { width: 15px; height: 15px; flex: none; color: var(--gold); }
.company-chip.nav-co { margin: -6px 2px 6px; }
.nav-group { margin-top: 10px; }
.nav-group > .gl { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); padding: 8px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 13.5px; position: relative; }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav a:hover { background: #151515; color: var(--text); }
.nav a.active { background: var(--gold-soft); color: var(--text); }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a.active svg { color: var(--gold); opacity: 1; }
.nav a.sub { padding-left: 39px; font-size: 13px; }
.nav .badge { margin-left: auto; }
.nav-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--text-3); }
.nav-foot .who { color: var(--text-2); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.top { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line-2); background: rgba(5,5,5,.85); backdrop-filter: blur(8px); position: relative; z-index: 20; }
.top .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px 0 38px; outline: none; }
.search input:focus { border-color: var(--gold-line); }
.search svg { position: absolute; left: 13px; top: 11px; width: 16px; height: 16px; color: var(--text-3); }
.search .results { position: absolute; top: 44px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 20px 50px rgba(0,0,0,.6); max-height: 420px; overflow: auto; display: none; }
.search .results.open { display: block; }
.search .results a { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.search .results a:hover, .search .results a.sel { background: var(--card-2); }
.search .results .k { font-family: var(--mono); font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; min-width: 72px; padding-top: 2px; }
.top .spacer { flex: 1; }
.asof { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.asof b { color: var(--gold); font-weight: 600; }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 0; }
.page-head .desc { color: var(--text-2); max-width: 760px; margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- atoms ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); background: #161616; border: 1px solid var(--line-2); padding: 4px 9px; border-radius: 6px; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 1.5px; background: var(--gold); }
.mono { font-family: var(--mono); }
.micro { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); } .dim { color: var(--text-3); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #444; background: #191919; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #120d00; }
.btn.primary:hover { background: #e8b42c; }
.btn.light { background: #f6f6f9; color: #0a0a0a; border-color: #f6f6f9; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(217,97,92,.5); color: #f0a09c; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #232323; color: var(--text-2); white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: var(--gold); } .badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.neg { background: var(--neg-soft); color: var(--neg); } .badge.info { background: var(--info-soft); color: var(--info); }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--pos); } .delta.down { color: var(--neg); } .delta.flat { color: var(--text-3); }
input.inp, select.inp, textarea.inp { height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 11px; outline: none; min-width: 0; }
textarea.inp { height: auto; padding: 9px 11px; }
.inp:focus { border-color: var(--gold-line); }
select.inp { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
label.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 0 10px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.seg button.on { background: #2a2a2a; color: var(--text); }
.chk { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; font-size: 13px; }
.chk input { accent-color: var(--gold); width: 15px; height: 15px; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 20px; min-width: 0; position: relative; }
.card.elev { background: var(--card); }
.card-h { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.card-h .sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.card-h .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.kpi { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; cursor: pointer; transition: border-color .15s, transform .15s; }
.kpi:hover { border-color: #3d3d3d; }
.kpi .l { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .l .ic { width: 26px; height: 26px; border-radius: 8px; background: #2a2a2a; display: grid; place-items: center; color: var(--gold); flex: none; }
.kpi .l .ic svg { width: 14px; height: 14px; }
.kpi .v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v.na { font-size: 15px; color: var(--text-3); font-weight: 500; padding: 6px 0; }
.kpi .f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); margin-top: auto; }
.kpi .f .p { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; }
.hero { border-radius: 24px; padding: 26px 28px; background: radial-gradient(90% 140% at 85% 0%, rgba(221,165,26,.16), transparent 55%), linear-gradient(180deg, #121212, #0c0c0c); border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(180deg, #000, transparent 85%); pointer-events: none; }
.hero .big { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.disclaimer { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); line-height: 1.8; }
.chart-box { position: relative; height: 280px; width: 100%; min-width: 0; overflow: hidden; }
.chart-box canvas { display: block; max-width: 100%; }
.grid > * { min-width: 0; }
.chart-box.tall { height: 340px; } .chart-box.short { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; border-radius: 2px; vertical-align: 3px; width: 14px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; border-radius: var(--r); border: 1px solid var(--line-2); }
.tbl-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tbl-tools .inp { height: 32px; }
.tbl-tools .count { color: var(--text-3); font-size: 12px; margin-left: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 2; background: #111; color: var(--text-3); font-family: var(--mono); font-size: 9.8px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
table.t th.n, table.t td.n { text-align: right; }
table.t th .s { color: var(--gold); margin-left: 4px; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #171717; }
table.t tr.click { cursor: pointer; }
table.t tfoot td { position: sticky; bottom: 0; background: #121212; font-weight: 700; border-top: 1px solid var(--line); }
table.t td.wrap { white-space: normal; min-width: 220px; }
table.t td.nowrap { white-space: nowrap; }
.neg { color: var(--neg); } .pos { color: var(--pos); } .goldtxt { color: var(--gold); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.src { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); cursor: help; border-bottom: 1px dotted #444; }

/* ---------- misc components ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-bottom: 18px; overflow-x: auto; }
.tabs { scrollbar-width: none; } .tabs::-webkit-scrollbar { height: 0; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.empty { padding: 42px 20px; text-align: center; color: var(--text-2); }
.empty .ic { width: 46px; height: 46px; border-radius: 14px; background: #1d1d1d; display: grid; place-items: center; margin: 0 auto 12px; color: var(--gold); }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.note { border: 1px solid var(--line-2); background: #101010; border-radius: var(--r); padding: 12px 14px; color: var(--text-2); font-size: 13px; }
.note.warn { border-color: rgba(240,165,49,.35); background: rgba(240,165,49,.06); }
.note.neg { border-color: rgba(217,97,92,.4); background: rgba(217,97,92,.06); }
.note.gold { border-color: var(--gold-line); background: var(--gold-soft); }
.note b { color: var(--text); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--text-3); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.steps .st { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.steps .st i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #1f1f1f; font-family: var(--mono); font-size: 10.5px; }
.steps .st.on { color: var(--text); border-color: var(--gold-line); } .steps .st.on i { background: var(--gold); color: #000; }
.steps .st.done { color: var(--text-2); } .steps .st.done i { background: var(--pos-soft); color: var(--pos); }
.drop { border: 1.5px dashed #3a3a3a; border-radius: var(--r-lg); padding: 38px 20px; text-align: center; background: #0e0e0e; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--gold); background: rgba(221,165,26,.04); }
.drop h3 { margin: 10px 0 4px; }
.progress { height: 6px; background: #222; border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.bar-inline { height: 6px; background: #242424; border-radius: 6px; min-width: 60px; }
.bar-inline > i { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.spin { width: 18px; height: 18px; border: 2px solid #333; border-top-color: var(--gold); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #151515, #1d1d1d, #151515); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }
.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 12px; padding: 11px 14px; min-width: 280px; max-width: 440px; box-shadow: 0 12px 40px rgba(0,0,0,.6); font-size: 13px; animation: tin .2s ease-out; }
.toast.err { border-left-color: var(--neg); } .toast.ok { border-left-color: var(--pos); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fin .15s; }
@keyframes fin { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.modal.wide { width: min(1100px, 100%); }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 60% at 70% 10%, rgba(221,165,26,.12), transparent 60%), var(--bg); overflow: auto; }
.login { width: min(420px, 100%); }
.login .card { padding: 28px; }
.login h1 { font-size: 26px; margin: 14px 0 4px; letter-spacing: -.02em; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.diff-from { color: var(--text-3); text-decoration: line-through; }
.diff-to { color: var(--gold); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters .micro { margin-right: 2px; }
.drill { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 14px; }
.drill a { color: var(--gold); } .drill span.sep { color: var(--text-3); }
details.raw summary { cursor: pointer; color: var(--text-2); font-size: 12px; }
.hide { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g-1-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; }
  .nav { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.6); }
  .main { height: auto; min-height: 100vh; }
  .content { overflow: visible; padding: 18px 16px 50px; }
  .top { padding: 0 16px; position: sticky; top: 0; }
  .top .menu-btn { display: inline-flex; }
  .asof { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 24px; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g4 { grid-template-columns: 1fr; } .top .btn .lbl { display: none; } }

/* ---------- print (PDF export through the browser print dialog) ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --card: #fff; --text: #111; --text-2: #333; --text-3: #666; --line: #ccc; --line-2: #ddd; }
  body { overflow: visible; background: #fff; color: #111; }
  .nav, .top, .no-print, .page-head .actions, .tbl-tools, .pager { display: none !important; }
  .app { display: block; height: auto; } .main { height: auto; } .content { overflow: visible; padding: 0; }
  .card, .kpi, .hero { background: #fff !important; border: 1px solid #ccc; break-inside: avoid; }
  table.t th { background: #f2f2f2; color: #333; position: static; } table.t td { border-bottom: 1px solid #e5e5e5; }
  table.t tfoot td { position: static; background: #f7f7f7; }
  .tbl-wrap { overflow: visible; border: 0; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
