:root {
  --ink: #161a17; --ink2: #4d554f; --ink3: #7c847e; --line: #e3e6e2; --surf: #f5f6f4; --card: #ffffff; --side: #0f1511;
  --green: #1f8a3b; --green-d: #176a2e; --green-t: #e6f3e9; --green-b: #2fa84f; --amber: #c98500; --amber-t: #fbf1dc; --red: #c9403f; --red-t: #fbeaea;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Manrope, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; color: var(--ink); background: var(--surf); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum'; font-size: 14px; }
button { font: inherit; cursor: pointer; }
a { color: var(--green); text-decoration: none; }
.loading { padding: 40px; color: var(--ink3); font-weight: 600; }

.app { display: flex; min-height: 100vh; }
.side { width: 248px; flex-shrink: 0; background: var(--side); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #b8c0ba; background: none; border: 0; text-align: left; width: 100%; }
.nav:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav.active { background: rgba(47,168,79,0.16); color: #fff; }
.nav svg { color: #8a938d; } .nav.active svg { color: var(--green-b); }
.nav .badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; }
.switcher { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 10px 12px; margin: 22px 0 18px; width: 100%; color: #fff; text-align: left; }
.switcher .av { width: 30px; height: 30px; border-radius: 8px; background: var(--green-b); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.switcher .t { display: flex; flex-direction: column; min-width: 0; } .switcher .t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .switcher .t span { font-size: 11px; color: #8a938d; }
.side .bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.side .user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 6px; }
.side .user .av { width: 28px; height: 28px; border-radius: 50%; background: #2a3a2e; display: flex; align-items: center; justify-content: center; }
.side .user b { font-size: 12px; display: block; } .side .user span { font-size: 11px; color: #8a938d; }
.section-label { font-size: 11px; font-weight: 700; color: #6f7872; text-transform: uppercase; letter-spacing: 0.8px; padding: 14px 14px 6px; }

main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.hdr { display: flex; align-items: center; gap: 16px; padding: 22px 32px 0; flex-wrap: wrap; }
.hdr h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.hdr .sub { font-size: 13px; color: var(--ink3); }
.hdr .controls { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.presets { display: inline-flex; gap: 2px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; }
.presets button { padding: 0 10px; height: 30px; border-radius: 7px; font-size: 12px; font-weight: 700; color: var(--ink2); background: transparent; border: 0; white-space: nowrap; }
.presets button.on { background: var(--green); color: #fff; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 700; background: var(--card); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.content { display: flex; flex-direction: column; gap: 18px; padding: 22px 32px 40px; }
.row { display: flex; gap: 18px; align-items: stretch; } .row > * { min-width: 0; }
.grow { flex: 1 1 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi .l { font-size: 12px; font-weight: 700; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.6px; }
.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; line-height: 1; }
.kpi .n { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink3); flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; padding: 2px 8px 2px 4px; border-radius: 999px; }
.delta.up { color: var(--green); background: var(--green-t); } .delta.down { color: var(--red); background: var(--red-t); } .delta.flat { color: var(--ink2); background: var(--surf); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.card-h { display: flex; align-items: flex-start; gap: 12px; } .card-h .t { display: flex; flex-direction: column; gap: 2px; } .card-h .t b { font-size: 15px; font-weight: 800; letter-spacing: -0.2px; } .card-h .t span { font-size: 12px; color: var(--ink3); font-weight: 600; }
.card-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--green); background: var(--green-t); } .pill.warn { color: var(--amber); background: var(--amber-t); } .pill.bad { color: var(--red); background: var(--red-t); } .pill.mute { color: var(--ink2); background: var(--surf); }
.pill.c1 { color: var(--s1); background: #e8f0fb; } .pill.c2 { color: var(--s2); background: #fdeee7; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 700; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { font-size: 13px; font-weight: 600; padding: 11px 10px; border-bottom: 1px solid var(--line); color: var(--ink2); white-space: nowrap; }
td:first-child { font-weight: 700; color: var(--ink); white-space: normal; } th.num, td.num { text-align: right; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafbf9; }
.tablewrap { overflow-x: auto; }
.summary p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink2); } .summary strong { color: var(--ink); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.alert .ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert .ic.bad { background: var(--red-t); color: var(--red); } .alert .ic.warn { background: var(--amber-t); color: var(--amber); } .alert .ic.ok { background: var(--green-t); color: var(--green); }
.alert b { font-size: 13px; display: block; } .alert span { font-size: 12px; color: var(--ink3); line-height: 1.45; }
.legend { display: flex; flex-direction: column; gap: 8px; } .legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; } .legend span { font-weight: 600; color: var(--ink2); } .legend b { margin-left: auto; }
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.src { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.src .top { display: flex; align-items: center; gap: 10px; } .src .top b { font-size: 14px; } .src .top small { display: block; font-size: 11px; color: var(--ink3); font-weight: 600; }
.src .dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; }
.src .st { font-size: 12px; font-weight: 600; } .src .cl { font-size: 12px; color: var(--ink3); }
.avatar { width: 28px; height: 28px; border-radius: 7px; background: var(--side); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; margin-right: 10px; vertical-align: middle; }
.note { font-size: 12px; color: var(--ink3); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.banner.info { background: #e8f0fb; color: #1c5cab; } .banner.warn { background: var(--amber-t); color: #7a5200; }
.empty { padding: 30px; text-align: center; color: var(--ink3); font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 16px 32px 0; border-bottom: 1px solid var(--line); margin: 0 32px; }
.tabs button { padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--ink3); background: none; border: 0; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--green); }
svg text { font-family: Manrope, Arial, sans-serif; }
.tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; z-index: 10; transform: translate(-50%, -110%); white-space: nowrap; display: none; }
.tip small { display: block; color: #b8c0ba; font-weight: 700; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
@media (max-width: 900px) {
  .app { flex-direction: column; } .side { width: 100%; height: auto; position: static; }
  .row { flex-direction: column; } .hdr, .content { padding-left: 16px; padding-right: 16px; } .tabs { margin: 0 16px; padding-left: 0; }
}
