:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --line: #e6e9f0;
  --line2: #eef1f6;
  --ink: #141a2b;
  --ink2: #5b6478;
  --ink3: #8a93a6;
  --brand: #1d4ed8;
  --brand-d: #0f2f86;
  --brand-50: #eef3ff;
  --brand-100: #dce6ff;
  --good: #0a7d1c;
  --bad: #c62f30;
  --warn: #b26b00;
  --r: 14px;
  --sh: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- karkas ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: 76px 1fr; }
.side { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.logo { display: flex; align-items: center; gap: 11px; padding: 18px 16px 14px; border-bottom: 1px solid var(--line2); }
.logo .em { width: 40px; height: 40px; flex: none; border-radius: 12px; background: linear-gradient(140deg, #1e40af, #0b1f5c); display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); }
.logo b { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.logo small { display: block; color: var(--ink3); font-size: 11.5px; margin-top: 1px; }
.collapse-btn { margin-left: auto; border: 1px solid var(--line); background: #fff; width: 28px; height: 28px; border-radius: 8px; color: var(--ink2); display: grid; place-items: center; flex: none; }
.nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav .grp { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--ink3); text-transform: uppercase; padding: 14px 10px 6px; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: 10px; color: var(--ink2); font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.nav a svg { flex: none; width: 18px; height: 18px; }
.nav a:hover { background: #f5f7fb; color: var(--ink); }
.nav a.on { background: var(--brand-50); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav a .cnt { margin-left: auto; font-size: 11px; background: #fdecec; color: var(--bad); border-radius: 20px; padding: 1px 7px; font-weight: 600; }
.side-foot { border-top: 1px solid var(--line2); padding: 12px 14px; font-size: 12px; color: var(--ink2); }
.side-foot .op { background: #fbf6ea; border: 1px solid #f1e3bf; border-radius: 10px; padding: 9px 11px; }
.side-foot .op div { display: flex; justify-content: space-between; margin-top: 3px; }
.side-foot .op b { color: var(--ink); font-weight: 600; }
.app.collapsed .logo div, .app.collapsed .nav .grp, .app.collapsed .nav a span, .app.collapsed .nav a .cnt, .app.collapsed .side-foot { display: none; }
.app.collapsed .collapse-btn { transform: rotate(180deg); margin-left: 0; }
.app.collapsed .logo { flex-direction: column; }

.main { min-width: 0; padding: 0 24px 40px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 16px 0 14px; background: linear-gradient(var(--bg) 82%, rgba(242, 244, 248, 0)); }
.top h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 700; }
.top .crumb { font-size: 12px; color: var(--ink3); margin-bottom: 2px; }
.top .sp { flex: 1; }
.sel { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: #fff; border: 1px solid var(--line); border-radius: 11px; font-weight: 600; color: var(--ink); min-width: 0; }
.sel small { font-size: 10.5px; color: var(--ink3); font-weight: 500; display: block; line-height: 1; }
.sel select { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink); padding-right: 16px; outline: none; cursor: pointer; }
.sel::after { content: ""; position: absolute; right: 12px; top: 17px; width: 6px; height: 6px; border-right: 1.6px solid var(--ink2); border-bottom: 1.6px solid var(--ink2); transform: rotate(45deg); pointer-events: none; }
.ibtn { height: 40px; width: 40px; border-radius: 11px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--ink2); }
.ibtn:hover, .sel:hover { border-color: #cfd6e4; }
.user { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px 0 5px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.user .av { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.user b { font-size: 12.5px; display: block; line-height: 1.1; }
.user small { font-size: 11px; color: var(--ink3); }

.context { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; font-size: 12.5px; color: var(--ink2); }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; display: inline-flex; gap: 6px; align-items: center; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.chip.live i { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- panjara ---------- */
.g { display: grid; gap: 14px; margin-bottom: 14px; }
.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)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-hero { grid-template-columns: 300px minmax(0, 1fr) 300px; }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.span2 { grid-column: span 2; }

/* ---------- karta ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px; min-width: 0; position: relative; }
.card.flat { box-shadow: none; }
.ch { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.ch h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.ch .sub { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.ch .meta { margin-left: auto; font-size: 12px; color: var(--ink2); text-align: right; white-space: nowrap; }
.ch .meta b { color: var(--ink); }
.ov { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--brand); margin-bottom: 2px; }
.sec-t { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); margin: 16px 0 10px; display: flex; align-items: center; gap: 10px; }
.sec-t::after { content: ""; flex: 1; height: 1px; background: var(--line2); }
.src { font-size: 11px; color: var(--ink3); margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.src code { font: 10.5px ui-monospace, Consolas, monospace; background: #f3f5f9; border: 1px solid var(--line2); padding: 1px 5px; border-radius: 5px; color: var(--ink2); }

/* ---------- KPI (ssverp uslubi) ---------- */
.kpi { padding: 14px 16px 12px; cursor: default; transition: border-color .15s; }
.kpi:hover { border-color: #c7d3f0; }
.kpi.sel-on { border: 1.5px solid var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.kpi .kt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink); }
.kpi .kt svg { color: var(--brand); width: 19px; height: 19px; flex: none; }
.kpi .kv { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; white-space: nowrap; }
.kpi .kv small { font-size: 13px; font-weight: 500; color: var(--ink2); margin-left: 3px; letter-spacing: 0; }
.kpi .kv .per { font-size: 11px; font-weight: 600; color: var(--warn); background: #fff4dc; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 4px; }
.kpi .ks { font-size: 11.5px; color: var(--ink3); }
.kpi .kb { display: flex; gap: 10px; margin-top: 10px; border-top: 1px solid var(--line2); padding-top: 10px; }
.unit-tag { font-size: 10px; font-weight: 600; color: var(--ink2); background: #f1f3f7; padding: 1px 5px; border-radius: 4px; display: inline-block; margin-bottom: 4px; }
.yb { display: flex; gap: 9px; align-items: flex-end; flex: none; }
.yb-c { display: flex; flex-direction: column; align-items: center; width: 34px; }
.yb-c b { font-size: 11.5px; font-weight: 600; color: var(--ink2); margin-bottom: 3px; white-space: nowrap; }
.yb-c span { height: 58px; width: 30px; display: flex; align-items: flex-end; }
.yb-c span i { display: block; width: 100%; background: #b9cdf3; border-radius: 5px 5px 2px 2px; }
.yb-c.cur span i { background: var(--brand); }
.yb-c.cur b { color: var(--ink); }
.yb-c small { font-size: 10.5px; color: var(--ink3); margin-top: 4px; }
.sc3 { flex: 1; min-width: 0; font-size: 11px; }
.sc3-h { display: flex; align-items: center; gap: 5px; color: var(--ink3); white-space: nowrap; }
.sc3-h b { color: var(--ink); font-size: 13px; margin-left: auto; }
.badge { font-size: 9.5px; font-weight: 700; color: var(--brand); border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: 4px; padding: 0 4px; letter-spacing: .03em; }
.sc3-b { margin-top: 7px; border-left: 3px solid #e7ebf3; }
.sc3-b div { display: flex; align-items: center; gap: 6px; padding: 3px 0 3px 8px; color: var(--ink3); position: relative; }
.sc3-b div.on { color: var(--ink); font-weight: 700; }
.sc3-b div.on::before { content: ""; position: absolute; left: -3px; top: 2px; bottom: 2px; width: 3px; background: var(--brand-d); border-radius: 2px; }
.sc3-b div.on i { width: 12px; height: 1.6px; background: var(--brand-d); margin-left: -8px; }

/* oddiy stat plitka */
.stat { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.stat.sel-on { border-color: var(--brand); background: var(--brand-50); }
.stat .l { font-size: 12px; color: var(--ink2); }
.stat .v { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; white-space: nowrap; }
.stat .v small { font-size: 12px; color: var(--ink2); font-weight: 500; }
.stat .d { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }
.up { color: var(--good); font-weight: 600; }
.dn { color: var(--bad); font-weight: 600; }
.st-row { display: grid; gap: 10px; }

/* ---------- xarita ---------- */
.map-card { padding: 18px 20px; display: flex; flex-direction: column; }
.map-wrap { position: relative; flex: 1; min-height: 420px; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-wrap path.rg { stroke: #fff; stroke-width: 1.4; cursor: pointer; transition: opacity .15s, filter .15s; }
.map-wrap path.rg:hover { filter: brightness(1.08) drop-shadow(0 2px 6px rgba(14, 61, 126, .35)); }
.map-wrap path.rg.on { stroke: #0b1f5c; stroke-width: 2.4; }
.map-wrap .lb { pointer-events: none; }
.map-wrap .lb rect { fill: rgba(255, 255, 255, .92); stroke: rgba(14, 61, 126, .14); }
.map-wrap .lb .n { font-size: 11px; fill: var(--ink2); }
.map-wrap .lb .v { font-size: 12.5px; font-weight: 700; fill: var(--ink); }
.map-tabs { display: flex; gap: 4px; flex-wrap: wrap; background: #f3f5f9; border-radius: 10px; padding: 3px; }
.map-tabs button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink2); }
.map-tabs button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.float { position: absolute; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(16, 24, 40, .08); padding: 11px 13px; width: 250px; }
.float .ov { color: var(--ink3); }
.float h4 { margin: 2px 0 2px; font-size: 14.5px; }
.float .big { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.float .big small { font-size: 12px; color: var(--ink2); font-weight: 500; }
.float .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink2); margin-top: 6px; }
.float .row b { color: var(--ink); }
.scale-legend { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; font-size: 11.5px; color: var(--ink2); }
.scale-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.play { border: 1px solid var(--brand-100); color: var(--brand); background: #fff; border-radius: 9px; padding: 6px 12px; font-weight: 600; font-size: 12.5px; }
.play.on { background: var(--brand); color: #fff; }

/* ---------- grafik elementlari ---------- */
.chart { display: block; overflow: visible; }
.chart text { font-family: inherit; }
.chart .ax { font-size: 11px; fill: var(--ink3); font-variant-numeric: tabular-nums; }
.chart .ax.ink { fill: var(--ink2); }
.chart .vl { font-size: 11px; font-weight: 650; fill: var(--ink); }
.chart .hv { font-size: 10.5px; font-weight: 600; }
.chart .grid { stroke: #eef0f4; stroke-width: 1; }
.chart .base { stroke: #c9ced8; stroke-width: 1; }
.chart .ref { stroke: #191919; stroke-width: 1; opacity: .5; }
.chart .band { fill: #0aac23; opacity: .06; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(29, 78, 216, .05); }
.chart .xh line { stroke: #9aa3b5; stroke-width: 1; opacity: 0; }
.chart .xh circle { opacity: 0; }
.chart .xh:hover line, .chart .xh:hover circle { opacity: 1; }
.chart .dl { font-size: 12px; fill: var(--ink3); }
.chart .dv { font-size: 22px; font-weight: 700; fill: var(--ink); letter-spacing: -.02em; }
.chart .tm-n { font-size: 11.5px; font-weight: 600; }
.chart .tm-v { font-size: 11px; opacity: .9; }
.donut path:hover { opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink2); margin: 2px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.hb { display: flex; flex-direction: column; gap: 3px; }
.hb-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; padding: 4px 6px; border-radius: 7px; }
.hb-row:has(.rk) { grid-template-columns: 18px minmax(90px, 36%) 1fr auto; }
.hb-row:hover { background: #f5f7fb; }
.hb-row.hl { background: var(--brand-50); }
.hb-row .rk { font-size: 11px; color: var(--ink3); text-align: right; }
.hb-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.hb-t { position: relative; height: 10px; background: #f1f3f7; border-radius: 5px; }
.hb-t i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.hb-t u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.hb-row em { font-style: normal; font-weight: 650; min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.hb-row em small { font-weight: 500; color: var(--ink3); margin-left: 6px; font-size: 11px; }

.seg { display: flex; gap: 2px; border-radius: 7px; overflow: hidden; }
.seg i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 700; color: #fff; min-width: 2px; }
.seg-l { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; margin-top: 10px; font-size: 12.5px; }
.seg-l div { display: flex; align-items: center; gap: 7px; }
.seg-l i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.seg-l span { color: var(--ink2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-l em { font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
.seg-l small { color: var(--ink3); width: 46px; text-align: right; }

.prog { background: #eef1f6; border-radius: 6px; overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 6px; }

/* ---------- jadval ---------- */
.tbl-wrap { overflow: auto; max-height: 420px; border-radius: 10px; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { position: sticky; top: 0; background: #f7f8fb; color: var(--ink2); font-weight: 600; font-size: 11.5px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line2); font-variant-numeric: tabular-nums; }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; }
table.t tr:hover td { background: #fafbfd; }
table.t tr.sum td { font-weight: 700; background: #f7f8fb; border-top: 1px solid var(--line); }
table.t tr.clk { cursor: pointer; }
table.t tr.on td { background: var(--brand-50); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #0a7d1c; background: #e7f6ea; }
.pill.wr { color: #8a5a00; background: #fff4dc; }
.pill.er { color: #b32627; background: #fdecec; }
.pill.in { color: #1d4ed8; background: #eef3ff; }
.pill.mt { color: #5b6478; background: #f1f3f7; }

/* ---------- ogohlantirishlar ---------- */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.al { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: #fbfcfe; font-size: 12.5px; }
.al .ic { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.al.crit .ic { background: #fdecec; color: #c62f30; }
.al.warn .ic { background: #fff4dc; color: #a86500; }
.al.info .ic { background: #eef3ff; color: #1d4ed8; }
.al.good .ic { background: #e7f6ea; color: #0a7d1c; }
.al b { display: block; font-weight: 650; color: var(--ink); }
.al span { color: var(--ink2); }
.al em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--ink3); white-space: nowrap; }

.tabs { display: inline-flex; background: #f3f5f9; border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink2); }
.tabs button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.flow { display: flex; align-items: stretch; gap: 0; }
.flow .st { flex: 1; text-align: center; padding: 10px 6px; position: relative; }
.flow .st + .st::before { content: ""; position: absolute; left: -7px; top: 50%; width: 14px; height: 14px; border-top: 1.5px solid #c9ced8; border-right: 1.5px solid #c9ced8; transform: translateY(-50%) rotate(45deg); background: transparent; }
.flow .st b { display: block; font-size: 20px; letter-spacing: -.02em; }
.flow .st span { font-size: 11.5px; color: var(--ink2); }
.flow .st small { display: block; font-size: 11px; color: var(--ink3); margin-top: 2px; }

.svc { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.svc div { border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; font-size: 12px; background: #fbfcfe; }
.svc div b { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.svc div b i { width: 7px; height: 7px; border-radius: 50%; }
.svc div small { color: var(--ink3); font-size: 11px; display: flex; justify-content: space-between; margin-top: 3px; }

.note { font-size: 12px; color: var(--ink2); background: #f7f9fd; border: 1px dashed #d3dbeb; border-radius: 10px; padding: 10px 12px; }
.empty { display: grid; place-items: center; color: var(--ink3); min-height: 120px; font-size: 13px; }

#tip { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; opacity: 0; transition: opacity .1s; background: #141a2b; color: #fff; border-radius: 10px; padding: 9px 11px; font-size: 12px; min-width: 150px; max-width: 320px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
#tip b { display: block; font-weight: 650; margin-bottom: 4px; }
#tip .tr { display: flex; align-items: center; gap: 7px; margin-top: 2px; color: #c9d1e3; }
#tip .tr i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
#tip .tr span { flex: 1; }
#tip .tr em { font-style: normal; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 10px; }

.fade { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

@media (max-width: 1400px) {
  .g-hero { grid-template-columns: 270px minmax(0, 1fr) 270px; }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .g-hero, .g-21, .g-12, .g-32, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app { grid-template-columns: 76px 1fr; }
}
@media print {
  .side, .top .sel, .top .ibtn, .user { display: none !important; }
  .app { display: block; }
  .card { break-inside: avoid; box-shadow: none; }
}
