.viz-root {
    color-scheme: light;
    --surface-0: #f4f4f2; --surface-1: #fcfcfb; --surface-2: #ffffff;
    --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #8a8984;
    --border: #e4e3df;
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
    --good: #008300; --warning: #eda100; --critical: #e34948; --violet:#4a3aa7;
    --good-bg: rgba(0,131,0,.08); --warning-bg: rgba(237,161,0,.10);
    --critical-bg: rgba(227,73,72,.08); --blue-bg: rgba(42,120,214,.10); --violet-bg: rgba(74,58,167,.10);
  }
  @media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .viz-root {
      color-scheme: dark;
      --surface-0: #111110; --surface-1: #1a1a19; --surface-2: #222220;
      --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8a8984;
      --border: #33332f;
      --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
      --good: #2aa52a; --warning: #c98500; --critical: #e66767; --violet:#9085e9;
      --good-bg: rgba(42,165,42,.12); --warning-bg: rgba(201,133,0,.14);
      --critical-bg: rgba(230,103,103,.12); --blue-bg: rgba(57,135,229,.14); --violet-bg: rgba(144,133,233,.14);
    }
  }
  * { margin:0; padding:0; box-sizing:border-box; }
  body { background: var(--surface-0); font-family: -apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; color: var(--text-primary); }
  .wrap { max-width: 1120px; margin: 0 auto; padding: 20px 24px 60px; }
  .topbar { display:flex; align-items:center; gap:16px; padding: 14px 0 6px; flex-wrap:wrap; }
  .logo { font-weight: 800; font-size: 18px; letter-spacing:-.02em; }
  .logo span { color: var(--series-1); }
  .cabs { display:flex; gap:6px; margin-left:auto; }
  .cab { border:1px solid var(--border); background:var(--surface-1); color:var(--text-secondary); border-radius:999px; padding:6px 14px; font-size:13px; cursor:pointer; font-weight:600;}
  .cab.active { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
  .datestamp { font-size: 13px; color: var(--text-muted); width:100%; padding-bottom:12px;}
  .crumb { font-size:13px; color:var(--text-muted); margin: 4px 0 14px; }
  .crumb a { color: var(--series-1); text-decoration:none; cursor:pointer; }

  .heroes { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
  @media (max-width: 760px){ .heroes { grid-template-columns: 1fr; } }
  .hero { background: var(--surface-1); border:1px solid var(--border); border-radius:14px; padding: 20px 24px; cursor:pointer; transition: border-color .15s; }
  .hero:hover { border-color: var(--series-1); }
  .hero .k { font-size: 13px; color: var(--text-secondary); font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
  .hero .v { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
  .hero .sub { font-size: 13px; color: var(--text-muted); }
  .pos { color: var(--good); } .neg { color: var(--critical); }
  .delta { font-size:13px; font-weight:600; }
  .planbar { height:8px; background:var(--surface-0); border:1px solid var(--border); border-radius:99px; margin-top:10px; overflow:hidden; }
  .planbar > div { height:100%; background: var(--series-1); border-radius:99px 0 0 99px; }
  .hint { font-size:12px; color:var(--text-muted); margin-top:8px; }
  .cruise { display:flex; justify-content:space-between; margin-top:10px; padding-top:10px; border-top:1px dashed var(--border); font-size:13px; }
  .cruise b { font-variant-numeric:tabular-nums; color:var(--good); }

  /* рейтинг-бейджи (товары как акции) */
  .rk { font-size:10.5px; font-weight:800; padding:2px 7px; border-radius:6px; letter-spacing:.02em; white-space:nowrap;}
  .rk-aa { color:var(--series-1); background:var(--blue-bg); }      /* голубая фишка */
  .rk-a  { color:var(--good); background:var(--good-bg); }
  .rk-b  { color:var(--text-secondary); background:var(--surface-0); }
  .rk-c  { color:var(--warning); background:var(--warning-bg); }
  .rk-d  { color:var(--critical); background:var(--critical-bg); }
  .rk-h  { color:var(--violet); background:var(--violet-bg); }      /* хайп/потенциал */

  /* кабинеты-карточки */
  .cabgrid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-top:16px; }
  @media (max-width:900px){ .cabgrid{grid-template-columns:1fr;} }
  .cabcard { background:var(--surface-1); border:1px solid var(--border); border-radius:14px; padding:16px 18px; cursor:pointer; min-width:0;}
  .cabcard:hover { border-color: var(--series-1); }
  .cabcard .nm { font-weight:800; font-size:15px; display:flex; align-items:center; gap:8px;}
  .cabcard .nm .dot{ width:9px;height:9px;border-radius:50%;}
  .cc-lines { margin-top:10px; }
  .cc-line { display:flex; justify-content:space-between; font-size:13px; padding:5px 0; border-top:1px solid var(--border);}
  .cc-line b { font-variant-numeric:tabular-nums; }
  .roi-big { font-size:22px; font-weight:800; margin-top:8px; font-variant-numeric:tabular-nums;}
  .roi-cap { font-size:11.5px; color:var(--text-muted); }

  .grid3 { display:grid; grid-template-columns: repeat(3, 1fr); gap:16px; margin-top:16px; }
  @media (max-width: 900px){ .grid3 { grid-template-columns: 1fr; } }
  .card { background: var(--surface-1); border:1px solid var(--border); border-radius:14px; padding: 18px 18px 10px; min-width:0; }
  .card h3 { font-size: 14px; font-weight: 700; display:flex; align-items:center; gap:8px; margin-bottom: 4px;}
  .card .cap { font-size:12px; color:var(--text-muted); margin-bottom:10px; }
  .dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
  .rows { list-style:none; }
  .row { display:flex; align-items:center; gap:8px; padding:9px 6px; border-top:1px solid var(--border); cursor:pointer; border-radius:8px; }
  .row:hover { background: var(--surface-0); }
  .row .name { font-size:13.5px; font-weight:600; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .row .cabtag { font-size:11px; color:var(--text-muted); }
  .row .val { font-size:13.5px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
  .row .sub2 { font-size:11px; color:var(--text-muted); white-space:nowrap; }
  .barwrap { height:6px; flex: 0 0 52px; border-radius:4px; overflow:hidden; background:var(--surface-0);}
  .barwrap > i { display:block; height:100%; border-radius:0 4px 4px 0; }

  .screen { display:none; } .screen.on { display:block; }
  .panel { background: var(--surface-1); border:1px solid var(--border); border-radius:14px; padding: 20px 22px; margin-top:14px; }
  .panel h3 { font-size:15px; margin-bottom:2px; }
  .panel .cap { font-size:12.5px; color:var(--text-muted); margin-bottom:14px; }
  .contribution .crow { display:grid; grid-template-columns: 170px 1fr 90px; align-items:center; gap:12px; padding:7px 0; cursor:pointer; border-radius:8px;}
  .contribution .crow:hover { background: var(--surface-0); }
  .contribution .cname { font-size:13px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:flex; gap:6px; align-items:center;}
  .contribution .cbar { height:16px; position:relative; }
  .contribution .cbar i { position:absolute; top:0; height:16px; border-radius:0 4px 4px 0; }
  .contribution .cval { font-size:13px; font-weight:700; text-align:right; font-variant-numeric:tabular-nums;}
  .legend { display:flex; gap:16px; font-size:12.5px; color:var(--text-secondary); margin: 4px 0 12px; flex-wrap:wrap;}
  .legend b { font-weight:600; }

  .prodhead { display:flex; gap:16px; align-items:center; margin-top:6px; flex-wrap:wrap;}
  .thumb { width:56px; height:56px; border-radius:12px; background:var(--surface-1); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:24px;}
  .prodhead h2 { font-size:20px; letter-spacing:-.01em; display:flex; gap:10px; align-items:center;}
  .prodhead .meta { font-size:13px; color:var(--text-muted);}
  .kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-top:14px;}
  @media (max-width:800px){ .kpis{grid-template-columns:repeat(2,1fr);} }
  .kpi { background:var(--surface-1); border:1px solid var(--border); border-radius:12px; padding:12px 14px;}
  .kpi .k{ font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em;}
  .kpi .v{ font-size:20px; font-weight:800; font-variant-numeric:tabular-nums; margin-top:3px;}
  .badge { font-size:11px; font-weight:700; padding:3px 9px; border-radius:99px; }
  .b-warn { color:var(--warning); background:var(--warning-bg); }
  .b-muted { color:var(--text-muted); background:var(--surface-0); }
  .sigrow { display:flex; gap:12px; padding:11px 4px; border-top:1px solid var(--border); align-items:flex-start;}
  .sigrow .ico{ font-size:15px; line-height:1.4;}
  .sigrow .t{ font-size:13.5px; }
  .sigrow .eff{ margin-left:auto; font-size:13px; font-weight:700; white-space:nowrap; font-variant-numeric:tabular-nums;}
  table.comp { width:100%; border-collapse:collapse; font-size:13px; }
  table.comp th { text-align:left; font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em; padding:6px 8px; border-bottom:1px solid var(--border); font-weight:600;}
  table.comp td { padding:8px; border-bottom:1px solid var(--border); font-variant-numeric:tabular-nums;}
  table.comp tr.me { background: var(--surface-0); font-weight:700; }
  .split { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
  @media (max-width:900px){ .split{grid-template-columns:1fr;} }
  .sline { display:flex; justify-content:space-between; padding:8px 2px; border-top:1px solid var(--border); font-size:13.5px;}
  .sline b { font-variant-numeric:tabular-nums; }
  .note { font-size:12px; color:var(--text-muted); background:var(--surface-0); border:1px dashed var(--border); border-radius:10px; padding:10px 12px; margin-top:12px;}
  .rk-legend { display:flex; gap:10px; flex-wrap:wrap; margin-top:14px; font-size:12px; color:var(--text-secondary); align-items:center;}

  /* итог по капиталу */
  .capitalbar { display:flex; align-items:center; gap:24px; background:var(--surface-1); border:1px solid var(--border); border-radius:14px; padding:16px 22px; margin-top:16px; flex-wrap:wrap;}
  .capitalbar .blk .k { font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; font-weight:600;}
  .capitalbar .blk .v { font-size:26px; font-weight:800; font-variant-numeric:tabular-nums; letter-spacing:-.02em;}
  .capitalbar .sep { width:1px; align-self:stretch; background:var(--border); }
  .info { display:inline-block; width:15px; height:15px; border-radius:50%; background:var(--surface-0); border:1px solid var(--border); color:var(--text-muted); font-size:10px; line-height:14px; text-align:center; cursor:help; vertical-align:middle; margin-left:4px; font-weight:700;}

  /* глоссарий */
  .gloss { margin-top:22px; background:var(--surface-1); border:1px solid var(--border); border-radius:14px; }
  .gloss summary { padding:14px 20px; font-weight:700; font-size:14px; cursor:pointer; list-style:none; display:flex; align-items:center; gap:8px;}
  .gloss summary::-webkit-details-marker{ display:none; }
  .gloss summary::after { content:'▾'; margin-left:auto; color:var(--text-muted); }
  .gloss[open] summary::after { content:'▴'; }
  .gloss .g-body { padding: 0 20px 16px; }
  .g-item { padding:10px 0; border-top:1px solid var(--border); font-size:13.5px; }
  .g-item b { font-weight:700; }
  .g-item p { color:var(--text-secondary); margin-top:2px; }
