/* ============================================================================
   VICTORY ORM — оформление «Бенто».
   Каждый показатель живёт в своей плитке: крупное — главное, мелкое — детали.
   Фон — светло-серый (в тёмной теме — почти чёрный), плитки — без рамок,
   скругление 22. Один акцент — зелёный ORM Service: заливка активного
   и главная плитка-показатель. Шрифт Onest, цифры — по ширине.
   Тема: светлая/тёмная, выбор хранится в браузере (html[data-theme]).
   ========================================================================== */
:root{
  --bg:#EEF0F3; --panel:#FFFFFF; --panel2:#F5F6F8; --panel3:#EBEDF0;
  --line:#E3E6EB; --line2:#D3D7DE;
  --text:#0E1116; --text2:#4A5160; --muted:#646B78;
  --ink:#0E1116; --on-ink:#FFFFFF;
  /* зелёный: заливка (на ней тёмный текст) и тёмный вариант для текста на белом */
  --lime-fill:#62C50A; --on-lime:#0E1116; --lime:#2F7A0A; --lime-d:#276708; --lime-bg:rgba(98,197,10,.14);
  --red:#C2410C; --red-bg:rgba(194,65,12,.10);
  --amber:#9A6400; --amber-bg:rgba(255,176,32,.18);
  --blue:#2563EB; --blue-bg:rgba(37,99,235,.10);
  --violet:#7C3AED;
  --r:22px; --r-m:16px; --r-s:12px; --r-pill:999px;
  --sh:0 12px 40px rgba(14,17,22,.12);
  --topbg:rgba(238,240,243,.86);
  --f:Onest,-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  --f-d:var(--f);
  color-scheme:light;
}
:root[data-theme="dark"]{
  --bg:#0B0D10; --panel:#15181D; --panel2:#1B1F25; --panel3:#232830;
  --line:#262B33; --line2:#363C46;
  --text:#EEF1F4; --text2:#B9C0CA; --muted:#8C95A2;
  --ink:#EEF1F4; --on-ink:#0E1116;
  --lime-fill:#7AD43A; --on-lime:#0E1116; --lime:#8FE04A; --lime-d:#A6EA6A; --lime-bg:rgba(122,212,58,.14);
  --red:#FF8A5B; --red-bg:rgba(255,138,91,.14);
  --amber:#E0A73E; --amber-bg:rgba(224,167,62,.16);
  --blue:#6EA8FF; --blue-bg:rgba(110,168,255,.14);
  --violet:#B794F6;
  --sh:0 12px 40px rgba(0,0,0,.5);
  --topbg:rgba(11,13,16,.84);
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{background:var(--bg);color:var(--text);font:15px/1.5 var(--f);-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums}
a{color:var(--lime-d);text-decoration:none}
a:hover{text-decoration:underline}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--lime-fill);outline-offset:2px}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--line2);border-radius:8px}
::-webkit-scrollbar-track{background:transparent}

/* ------------------------------- каркас ------------------------------- */
#app{min-height:100%}
.layout{display:grid;grid-template-columns:240px 1fr;min-height:100vh}
.side{background:var(--bg);border-right:1px solid var(--line);display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.brand{padding:22px 18px 18px;display:flex;align-items:center;gap:10px}
.brand .logo{width:34px;height:34px;border-radius:11px;background:var(--lime-fill);display:grid;place-items:center;color:var(--on-lime);font-weight:800;font-size:16px}
.brand b{font-size:16px;letter-spacing:.02em;font-weight:800;font-family:var(--f-d)}
.brand small{display:block;color:var(--muted);font-size:11px;font-weight:500;letter-spacing:.06em;text-transform:uppercase}
.nav{padding:4px 10px 10px;display:flex;flex-direction:column;gap:2px;overflow-y:auto;flex:1}
.nav a{display:flex;align-items:center;gap:11px;padding:0 12px;height:42px;border-radius:var(--r-s);color:var(--text2);font-size:14px;font-weight:600}
.nav a:hover{background:var(--panel3);color:var(--text);text-decoration:none}
.nav a.on{background:var(--panel);color:var(--text);font-weight:700;box-shadow:0 1px 0 var(--line)}
.nav a .ic{width:20px;display:grid;place-items:center;font-size:15px;flex:none}
.nav a .ic svg{width:19px;height:19px}
.nav a .badge{margin-left:auto;background:var(--lime-fill);color:var(--on-lime);font-size:11px;font-weight:700;border-radius:20px;padding:1px 8px}
.nav .sep{margin:14px 12px 6px;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700}
.side-foot{padding:14px;font-size:12.5px;color:var(--muted)}
.side-foot .who{color:var(--text);font-weight:600;font-size:13.5px}
.main{min-width:0;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:20;background:var(--topbg);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);padding:18px 28px 14px;display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.top h1{margin:0;font-size:26px;letter-spacing:-.01em;font-weight:700;font-family:var(--f-d);line-height:1.15}
.top .sub{color:var(--muted);font-size:13px;margin-top:2px}
.wrap{padding:8px 28px 96px;max-width:1480px;width:100%}

/* переключатель темы */
.theme-t{width:40px;height:40px;border-radius:var(--r-s);border:0;background:var(--panel);color:var(--text);display:grid;place-items:center;cursor:pointer;flex:none}
.theme-t:hover{background:var(--panel3)}
.theme-t svg{width:19px;height:19px}

/* ------------------------------ элементы ------------------------------ */
.card{background:var(--panel);border:0;border-radius:var(--r);padding:22px}
.card.pad0{padding:0;overflow:hidden}
.grid{display:grid;gap: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))}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.spread{display:flex;justify-content:space-between;align-items:center;gap:12px}
.muted{color:var(--muted)}
.small{font-size:12.5px}
h2.sec{font-size:12px;margin:30px 0 12px;letter-spacing:.08em;font-weight:700;text-transform:uppercase;color:var(--muted);font-family:var(--f-d)}
h2.sec:first-child{margin-top:0}
hr.d{border:0;border-top:1px solid var(--line);margin:18px 0}
.card>b:first-child,.card .spread>b:first-child{font-size:16px;font-weight:700}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;background:var(--panel);border:0;border-radius:var(--r-s);padding:0 16px;height:40px;font-weight:600;font-size:14px;color:var(--text);cursor:pointer;transition:background .14s,color .14s;white-space:nowrap;text-decoration:none}
.btn:hover{background:var(--panel3);text-decoration:none;color:var(--text)}
.card .btn:not(.p):not(.dgr),.modal .btn:not(.p):not(.dgr){background:var(--panel3)}
.card .btn:not(.p):not(.dgr):hover,.modal .btn:not(.p):not(.dgr):hover{background:var(--line2)}
.btn.p{background:var(--ink);color:var(--on-ink)}
.btn.p:hover{background:var(--lime-fill);color:var(--on-lime)}
.btn.g{background:transparent;color:var(--text2)}
.btn.g:hover{background:var(--panel3);color:var(--text)}
.btn.dgr{background:var(--red-bg);color:var(--red)}
.btn.dgr:hover{background:var(--red);color:#fff}
.btn.sm{height:32px;padding:0 12px;font-size:12.5px;border-radius:10px}
.btn:disabled{opacity:.45;cursor:not-allowed}

.inp,select.inp,textarea.inp{width:100%;background:var(--panel);border:1.5px solid var(--line2);border-radius:var(--r-s);padding:0 14px;height:44px;outline:none;transition:.14s;color:var(--text)}
textarea.inp{min-height:90px;height:auto;padding:11px 14px;resize:vertical}
.inp:focus{border-color:var(--lime-fill);box-shadow:0 0 0 3px var(--lime-bg)}
.inp::placeholder{color:var(--muted)}
label.fl{display:block;font-size:12.5px;color:var(--muted);margin:0 0 6px;font-weight:600}
.field{margin-bottom:14px}

.chip{display:inline-flex;align-items:center;gap:6px;background:var(--panel3);border:0;border-radius:var(--r-pill);padding:0 14px;height:34px;font-size:13px;font-weight:600;cursor:pointer;transition:.14s;white-space:nowrap;color:var(--text2);text-decoration:none}
.chip:hover{background:var(--line2);color:var(--text);text-decoration:none}
.chip.on{background:var(--ink);color:var(--on-ink)}
.chip .dot{width:8px;height:8px;border-radius:50%}
.chip .muted{color:inherit;opacity:.65}
.chips{display:flex;gap:6px;flex-wrap:wrap}

.tag{display:inline-block;font-size:12px;font-weight:600;border-radius:var(--r-pill);padding:3px 10px}
.tag.pos{background:var(--lime-bg);color:var(--lime-d)}
.tag.neg{background:var(--red-bg);color:var(--red)}
.tag.neu{background:var(--panel3);color:var(--text2)}
.tag.warn{background:var(--amber-bg);color:var(--amber)}
.tag.info{background:var(--blue-bg);color:var(--blue)}
.tag.demo{background:rgba(124,58,237,.12);color:var(--violet)}

table{width:100%;border-collapse:collapse;font-size:13.5px}
th{text-align:left;color:var(--muted);font-size:11.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:700;padding:12px 16px;border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:12px 14px;border-bottom:1px solid var(--line)}
tbody tr:hover{background:var(--panel2)}
tbody tr:last-child td{border-bottom:0}
.t-scroll{overflow-x:auto}

/* ------------------------- плитки-показатели -------------------------- */
.kpi{background:var(--panel);border:0;border-radius:var(--r);padding:20px 22px;display:flex;flex-direction:column;gap:6px;min-height:150px}
.kpi .lbl{color:var(--muted);font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em}
.kpi .val{font-size:46px;font-weight:800;letter-spacing:-.03em;margin-top:auto;line-height:1;font-family:var(--f-d)}
.kpi .val small{font-size:17px;font-weight:600;color:var(--muted);letter-spacing:0;margin-left:3px}
.kpi .delta{font-size:13px;font-weight:500}
/* главная плитка ряда — зелёная */
.bento>.kpi:first-child{background:var(--lime-fill);color:var(--on-lime)}
.bento>.kpi:first-child .lbl,.bento>.kpi:first-child .delta,.bento>.kpi:first-child .val small,.bento>.kpi:first-child .muted{color:var(--on-lime);opacity:.72}
.bento>.kpi:first-child .val{color:var(--on-lime)}
.bento>.kpi:first-child .stars{color:var(--on-lime)}
@media (min-width:1101px){
  .bento.g4{grid-template-columns:1.35fr 1fr 1fr 1fr}
}
.up{color:var(--lime)}.down{color:var(--red)}

.bar{height:8px;border-radius:6px;background:var(--panel3);overflow:hidden;display:flex}
.bar i{display:block;height:100%}
.stars{color:var(--amber);letter-spacing:1px}

/* ----------------------------- карточки ------------------------------ */
.loc{background:var(--panel);border:0;border-radius:var(--r);padding:18px;cursor:pointer;transition:transform .12s, box-shadow .12s}
.loc:hover{transform:translateY(-2px);box-shadow:var(--sh)}
.loc .addr{font-weight:650;font-size:15px;margin-bottom:3px}
.loc .city{color:var(--muted);font-size:12.5px}
.pf{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;padding:3px 9px;border-radius:var(--r-pill);background:var(--panel3);border:0;color:var(--text2)}

.rev{border-bottom:1px solid var(--line);padding:16px 0}
.rev:first-child{padding-top:4px}
.rev:last-child{border-bottom:0;padding-bottom:4px}
.rev .head{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:6px}
.rev .txt{color:var(--text);font-size:15px;line-height:1.5}
.rev .who{font-weight:650}

.topic{display:flex;align-items:center;gap:12px;padding:11px 0;border-bottom:1px solid var(--line)}
.topic:last-child{border-bottom:0}
.topic .ic{width:36px;height:36px;border-radius:12px;background:var(--panel3);display:grid;place-items:center;font-size:16px;flex:none}
.topic .nm{font-weight:650;font-size:14px}
.topic .mt{flex:1;min-width:90px}
.srcd{border-bottom:1px solid var(--line)}
.srcd:last-child{border-bottom:0}
.srcd>summary{list-style:none;cursor:pointer;border-bottom:0;border-radius:var(--r-s)}
.srcd>summary::-webkit-details-marker{display:none}
.srcd>summary:hover{background:var(--panel2)}
.srcd[open]>summary .srcd-arr{transform:rotate(180deg)}
.srcd-arr{display:inline-block;color:var(--muted);transition:transform .15s}
.srcd-list{padding:0 0 12px 48px}
.srcd-a{display:flex;gap:12px;justify-content:space-between;align-items:baseline;padding:9px 0;border-top:1px solid var(--line);text-decoration:none;color:inherit}
.srcd-a:hover{text-decoration:none}
.srcd-a:hover .srcd-t{text-decoration:underline}
.srcd-t{line-height:1.4}

.mod{background:var(--panel);border:0;border-radius:var(--r);padding:22px;display:flex;flex-direction:column;gap:10px}
.mod .ic{font-size:26px}
.mod h3{margin:0;font-size:17px;font-weight:700}
.mod .tl{color:var(--lime-d);font-size:13px;font-weight:600}
.mod ul{margin:2px 0 0;padding-left:18px;color:var(--text2);font-size:13.5px}
.mod li{margin:4px 0}
.mod .foot{margin-top:auto;padding-top:12px;display:flex;justify-content:space-between;align-items:center;gap:10px}

/* -------------------------------- чат --------------------------------- */
.chat-l{display:grid;grid-template-columns:290px 1fr;gap:14px;height:calc(100vh - 150px);min-height:460px}
.chat-list{overflow-y:auto;background:var(--panel);border-radius:var(--r)}
.chat-i{padding:14px 16px;border-bottom:1px solid var(--line);cursor:pointer}
.chat-i:hover{background:var(--panel2)}
.chat-i.on{background:var(--lime-bg)}
.chat-b{display:flex;flex-direction:column;background:var(--panel);border-radius:var(--r);overflow:hidden}
.msgs{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:10px}
.msg{max-width:min(72%,620px);padding:10px 14px;border-radius:16px;background:var(--panel3);font-size:14px}
.msg.me{align-self:flex-end;background:var(--lime-bg)}
.msg .m{font-size:11px;color:var(--muted);margin-bottom:3px}
.chat-in{display:flex;gap:10px;padding:12px;border-top:1px solid var(--line)}

/* ------------------------------ модалка ------------------------------- */
.ov{position:fixed;inset:0;background:rgba(14,17,22,.42);backdrop-filter:blur(4px);display:grid;place-items:center;z-index:280;padding:20px}
.modal{background:var(--panel);border:0;border-radius:var(--r);max-width:640px;width:100%;max-height:88vh;overflow-y:auto;box-shadow:var(--sh)}
.modal .m-h{padding:18px 22px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:var(--panel);z-index:2}
.modal .m-b{padding:22px}
.modal .m-f{padding:16px 22px;border-top:1px solid var(--line);display:flex;gap:10px;justify-content:flex-end;position:sticky;bottom:0;background:var(--panel)}
.x{background:none;border:0;color:var(--text2);font-size:22px;cursor:pointer;line-height:1}
.x:hover{color:var(--text)}

/* -------------------------------- вход -------------------------------- */
.auth{min-height:100vh;display:grid;place-items:center;padding:24px;background:var(--bg)}
.auth-box{width:100%;max-width:920px;display:grid;grid-template-columns:1fr 1fr;gap:14px}
.auth-l{padding:40px 38px;background:var(--panel);border-radius:var(--r)}
.auth-r{padding:40px 38px;background:var(--lime-fill);color:var(--on-lime);border-radius:var(--r)}
.auth-r .feat,.auth-r .feat b{color:var(--on-lime)}
.auth h2{margin:0 0 6px;font-size:28px;letter-spacing:-.01em;font-weight:800;font-family:var(--f-d)}
.auth .lead{color:var(--muted);font-size:14px;margin-bottom:24px}
.auth-r .lead{color:var(--on-lime);opacity:.75}
.auth .feat{display:flex;gap:11px;margin:16px 0;font-size:14px;color:var(--text2)}
.auth .feat b{color:var(--text);display:block;font-size:15px}
.tabs{display:flex;gap:4px;background:var(--panel3);padding:4px;border-radius:14px;margin-bottom:20px}
.tabs button{flex:1;background:none;border:0;height:38px;border-radius:11px;font-weight:600;font-size:14px;color:var(--text2);cursor:pointer}
.tabs button.on{background:var(--panel);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.08)}

/* ----------------------------- уведомления ---------------------------- */
.toast-w{position:fixed;right:20px;bottom:20px;z-index:300;display:flex;flex-direction:column;gap:10px}
.toast{background:var(--ink);color:var(--on-ink);border:0;border-radius:16px;padding:13px 16px;box-shadow:var(--sh);font-size:14px;max-width:380px;animation:slide .25s ease}
.toast.err{background:var(--red);color:#fff}
.toast.ok{background:var(--lime-fill);color:var(--on-lime)}
@keyframes slide{from{opacity:0;transform:translateY(10px)}}

.empty{text-align:center;padding:56px 20px;color:var(--muted)}
.empty .e{font-size:40px;margin-bottom:10px;opacity:.55}
.spin{width:18px;height:18px;border:2px solid var(--line2);border-top-color:var(--lime-fill);border-radius:50%;animation:sp .7s linear infinite;display:inline-block;vertical-align:-3px}
@keyframes sp{to{transform:rotate(360deg)}}
.skel{background:linear-gradient(90deg,var(--panel2) 25%,var(--panel3) 50%,var(--panel2) 75%);background-size:200% 100%;animation:sk 1.2s infinite;border-radius:8px;height:14px}
@keyframes sk{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.spin,.skel,.toast{animation:none}.loc:hover{transform:none}}

/* ======================= интерактивный график ========================== */
.chartbox{position:relative}
.chartbox svg{display:block;width:100%;height:220px;overflow:visible;touch-action:none;cursor:crosshair}
.chartbox .gridline{stroke:var(--line);stroke-width:1}
.chartbox .axis{fill:var(--muted);font-size:11px}
.chartbox .ser{fill:none;stroke-width:2.4;stroke-linejoin:round;stroke-linecap:round}
.chartbox .area{opacity:.14}
.chartbox .cursor{stroke:var(--line2);stroke-width:1;stroke-dasharray:3 3}
.chartbox .pt{stroke:var(--panel);stroke-width:2}
.chartbox .mark{fill:none;stroke-width:2;stroke-dasharray:2 3}
.tipbox{position:absolute;pointer-events:none;background:var(--ink);color:var(--on-ink);border:0;
  border-radius:12px;padding:8px 12px;font-size:12.5px;box-shadow:var(--sh);white-space:nowrap;z-index:5;transform:translate(-50%,-115%)}
.tipbox b{display:block;margin-bottom:3px}
.tipbox i{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:6px}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--text2);margin-top:8px}
.legend span{display:inline-flex;align-items:center;gap:6px;cursor:pointer;user-select:none}
.legend span.off{opacity:.38}
.legend i{width:10px;height:10px;border-radius:3px}
.endpoints{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.endpoints .ep{flex:1;min-width:150px;background:var(--panel2);border:0;border-radius:14px;padding:10px 13px}
.endpoints .ep .l{font-size:11.5px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.05em}
.endpoints .ep .v{font-size:20px;font-weight:800;letter-spacing:-.02em}

/* ============================ донастройка ============================== */
.tuner{border:1.5px dashed var(--line2);border-radius:var(--r);background:transparent;padding:0;margin-top:16px;overflow:hidden}
.tuner>summary{list-style:none;cursor:pointer;padding:14px 18px;font-weight:650;font-size:14px;display:flex;align-items:center;gap:8px}
.tuner>summary::-webkit-details-marker{display:none}
.tuner>summary::before{content:"⚙";opacity:.6}
.tuner>summary .hint{font-weight:500;color:var(--muted);font-size:12.5px}
.tuner .body{padding:0 18px 18px;border-top:1px solid var(--line)}
.tuner .body>.grid{margin-top:14px}

/* =============================== чат-виджет ============================ */
.cw-btn{position:fixed;left:20px;bottom:20px;z-index:260;width:56px;height:56px;border-radius:18px;
  background:var(--lime-fill);border:0;color:var(--on-lime);font-size:24px;cursor:pointer;
  box-shadow:var(--sh);display:grid;place-items:center;transition:.14s}
.cw-btn:hover{transform:translateY(-2px)}
.cw{position:fixed;left:20px;bottom:86px;z-index:260;width:min(390px,calc(100vw - 40px));height:min(560px,calc(100vh - 140px));
  background:var(--panel);border:0;border-radius:var(--r);box-shadow:var(--sh);display:flex;flex-direction:column;overflow:hidden}
.cw .h{padding:14px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px}
.cw .h b{font-size:15px}
.cw .h .x{margin-left:auto}
.cw .body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:9px;background:var(--panel2)}
.cw .b{max-width:86%;padding:10px 13px;border-radius:14px;font-size:14px;background:var(--panel);border:0;white-space:pre-wrap}
.cw .b.me{align-self:flex-end;background:var(--lime-bg)}
.cw .b.sys{align-self:center;background:var(--amber-bg);font-size:12.5px}
.cw .b .ap{display:block;margin-top:5px;font-size:11.5px;color:var(--lime-d);font-weight:600}
.cw .f{border-top:1px solid var(--line);padding:10px;display:flex;flex-direction:column;gap:8px;background:var(--panel)}
.cw .f .row{gap:8px}
.cw textarea{min-height:44px;max-height:120px;resize:none}

/* на широком экране кнопка чата стоит справа от меню, не поверх него */
@media (min-width:901px){ .cw-btn,.cw{left:calc(240px + 24px)} }

/* ------------------------------ адаптив ------------------------------- */
@media (max-width:1100px){ .g4{grid-template-columns:repeat(2,minmax(0,1fr))} .g3{grid-template-columns:repeat(2,minmax(0,1fr))} }
/* Нижняя панель вкладок для телефона и Mini App в Телеграме: на широком экране скрыта */
.tabbar{display:none}
@media (max-width:900px){
  .layout{grid-template-columns:1fr}
  .side{display:none}
  .tabbar{position:fixed;left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom,0px));z-index:40;display:grid;grid-auto-flow:column;grid-auto-columns:1fr;
    background:var(--panel);border-radius:20px;padding:5px;box-shadow:0 8px 30px rgba(14,17,22,.14)}
  .tabbar a{display:flex;flex-direction:column;align-items:center;gap:3px;padding:7px 2px;border-radius:14px;color:var(--muted);
    font-size:10.5px;font-weight:600;text-decoration:none;line-height:1.1;text-align:center;min-width:0;position:relative}
  .tabbar a .ic{font-size:18px;line-height:1;display:grid;place-items:center}
  .tabbar a .ic svg{width:22px;height:22px}
  .tabbar a.on{color:var(--on-ink);background:var(--ink)}
  .tabbar a .badge{position:absolute;top:2px;left:calc(50% + 8px);background:var(--lime-fill);color:var(--on-lime);font-size:10px;font-weight:700;border-radius:20px;padding:0 5px}
  .more-menu a{display:flex;align-items:center;gap:11px;padding:0 12px;height:46px;border-radius:12px;color:var(--text);font-weight:600;text-decoration:none}
  .more-menu a .ic svg{width:19px;height:19px}
  .more-menu a:hover,.more-menu a.on{background:var(--panel3);text-decoration:none}
  .more-menu a .badge{margin-left:auto;background:var(--lime-fill);color:var(--on-lime);font-size:11px;font-weight:700;border-radius:20px;padding:1px 8px}
  .more-menu .sep{margin:10px 12px 4px;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700}
  .auth-box{grid-template-columns:1fr}
  .auth-r{display:none}
  .chat-l{grid-template-columns:1fr;height:auto}
  .wrap{padding:6px 12px 110px}
  .top{padding:14px 14px 10px;position:static;backdrop-filter:none;-webkit-backdrop-filter:none;background:transparent}
  .top h1{font-size:22px}
  .g2,.g3,.g4{grid-template-columns:1fr}
  /* показатели на телефоне — бенто 2×2: главная плитка на всю ширину */
  .bento.g3,.bento.g4{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  /* при нечётном числе плиток главная — на всю ширину, при чётном — сетка 2×2 */
  .bento>.kpi:first-child:nth-last-child(odd){grid-column:span 2}
  .bento .kpi{min-height:118px;padding:16px;border-radius:20px}
  .bento .kpi .val{font-size:34px}
  .card,.loc,.mod{border-radius:20px;padding:18px}
}
@media (max-width:640px){
  .cw{left:10px;right:10px;width:auto;bottom:86px} .cw-btn{left:auto;right:14px;bottom:calc(88px + env(safe-area-inset-bottom,0px));width:46px;height:46px;border-radius:15px;font-size:20px}
  table{display:block;overflow-x:auto;white-space:nowrap}
}

/* ================= телефон и Mini App: без графиков, главная плитками ============== */
@media (max-width:900px){ .m-hide{display:none!important} }
html.tg .m-hide{display:none!important}
a.kpi{color:inherit;text-decoration:none}
a.kpi:hover{text-decoration:none;box-shadow:var(--sh)}
.home-b{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.home-b .kpi{min-height:118px;padding:16px;border-radius:20px}
.home-b .kpi .val{font-size:34px}
.home-b .kpi .delta{color:var(--muted);font-size:12.5px;line-height:1.35}
.home-b .kpi.hero{grid-column:span 2;min-height:150px;background:var(--lime-fill);color:var(--on-lime)}
.home-b .kpi.hero .val{font-size:52px;color:var(--on-lime)}
.home-b .kpi.hero .lbl,.home-b .kpi.hero .delta,.home-b .kpi.hero .val small{color:var(--on-lime);opacity:.72}
.home-b .kpi.warnv .val{color:var(--red)}
.home-b>.kpi:last-child:nth-child(even){grid-column:span 2}
.mgr{display:flex;align-items:center;justify-content:space-between;gap:12px}
.svc{display:flex;align-items:center;gap:12px;padding:13px 0;border-bottom:1px solid var(--line)}
.svc .mt{flex:1;min-width:0}
.svc .nm{font-weight:650;font-size:15px}
.svc .small{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.svc-all{border-bottom:0;justify-content:center;font-weight:600;font-size:14px}
@media (min-width:901px){ .home-b{grid-template-columns:repeat(4,minmax(0,1fr))} .home-b .kpi.hero{grid-row:span 2} }
/* На телефоне связь — через карточку менеджера на главной и «Чаты» в меню; плавающая кнопка не нужна */
@media (max-width:900px){ .cw-btn{display:none} }
html.tg .cw-btn{display:none}

/* ================================ чаты ==================================== */
.chat-l{grid-template-columns:320px 1fr;height:calc(100vh - 120px)}
.chat-list{display:flex;flex-direction:column;padding:6px}
.chat-search{padding:6px 6px 8px}
.chat-i{display:block;padding:12px 14px;border:0;border-radius:14px;color:inherit;text-decoration:none}
.chat-i:hover{background:var(--panel2);text-decoration:none}
.chat-i.on{background:var(--lime-bg)}
.chat-i .ct{font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-i .cl{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.cbadge{background:var(--lime-fill);color:var(--on-lime);font-size:11px;font-weight:700;border-radius:20px;padding:1px 8px;flex:none}
.chat-h{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line)}
.chat-h .mt{flex:1;min-width:0}
.msgs{gap:6px;background:var(--panel2)}
.msg{background:var(--panel);border-radius:18px 18px 18px 6px;padding:9px 13px 6px;max-width:min(78%,560px);box-shadow:0 1px 0 var(--line)}
.msg.me{background:var(--lime-bg);border-radius:18px 18px 6px 18px;box-shadow:none}
.msg .m{font-size:11.5px;color:var(--muted);font-weight:600;margin-bottom:2px}
.msg .mt{font-size:14.5px;line-height:1.45;white-space:normal;word-wrap:break-word}
.mtime{font-size:10.5px;color:var(--muted);text-align:right;margin-top:2px}
.msg-day{align-self:center;font-size:11.5px;color:var(--muted);background:var(--panel);border-radius:20px;padding:3px 10px;margin:8px 0 4px}
.msg-sys{align-self:center;font-size:12.5px;color:var(--text2);background:var(--panel3);border-radius:12px;padding:6px 12px;max-width:85%;text-align:center}
.att-img img{display:block;max-width:100%;max-height:320px;border-radius:12px;margin:2px 0 4px}
.att-voice{display:flex;align-items:center;gap:8px;margin:2px 0}
.att-voice audio{height:36px;max-width:260px}
.att-video{max-width:100%;max-height:320px;border-radius:12px}
.att-file{display:flex;gap:10px;align-items:center;padding:8px 10px;background:var(--panel3);border-radius:12px;color:inherit;text-decoration:none;margin:2px 0 4px}
.att-file:hover{text-decoration:none;background:var(--line2)}
.att-ic{width:34px;height:34px;border-radius:10px;background:var(--panel);display:grid;place-items:center;flex:none}
.att-ic svg{width:18px;height:18px}
.att-meta{display:flex;flex-direction:column;min-width:0}
.att-meta b{font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-in{flex-direction:column;gap:8px;padding:10px 12px}
.ci-row{display:flex;align-items:flex-end;gap:6px}
.ci-text,textarea.inp.ci-text{min-height:44px;height:44px;max-height:160px;resize:none;padding:11px 14px;line-height:1.4}
.ci-btn{width:44px;height:44px;border-radius:14px;border:0;background:var(--panel3);color:var(--text);display:grid;place-items:center;cursor:pointer;flex:none}
.ci-btn:hover{background:var(--line2)}
.ci-btn svg{width:20px;height:20px}
.ci-send{background:var(--ink);color:var(--on-ink)}
.ci-send:hover{background:var(--lime-fill);color:var(--on-lime)}
.ci-btn.rec{background:var(--red);color:#fff;animation:pulse 1.2s infinite}
@keyframes pulse{50%{opacity:.6}}
.ci-status:empty{display:none}
.as-sel .chip{height:30px;font-size:12.5px}

/* ============================ мои клиенты ================================= */
.invite{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.invite .mt{flex:1;min-width:220px}
.inv-link{font-size:12.5px;color:var(--text2);background:var(--panel3);border-radius:10px;padding:6px 10px;margin-top:8px;word-break:break-all}
.wc{display:flex;flex-direction:column;gap:12px}
.wc.risk{box-shadow:inset 0 0 0 2px var(--red-bg)}
.wc-h{display:flex;gap:12px;align-items:flex-start}
.wc-h .mt{flex:1;min-width:0}
.wc-n{font-size:16px}
.wc-r{text-align:right;flex:none}
.wc-rate{font-size:30px;font-weight:800;letter-spacing:-.02em;line-height:1}
.wc-rate small{font-size:14px;color:var(--muted);margin-left:2px}
.wc-tags{display:flex;flex-wrap:wrap;gap:6px}
.wc-offer{background:var(--lime-bg);border-radius:12px;padding:9px 12px}
.wc-f{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.assign{display:flex;flex-direction:column;gap:4px;margin-left:auto;min-width:180px}
.assign .inp{height:34px;font-size:13px;padding:0 10px}

/* ================================ команда ================================= */
.tm{display:flex;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}
.tm:last-child{border-bottom:0}
.tm .mt{flex:1;min-width:200px}
.tm-ctl{gap:8px}
.tm-ctl .inp{height:36px;font-size:13px;width:auto;min-width:150px;padding:0 10px}

@media (max-width:900px){
  .chat-l{display:block;height:auto}
  .chat-list{background:var(--panel);border-radius:20px}
  .chat-b{border-radius:20px;height:calc(100vh - 150px - env(safe-area-inset-bottom,0px));min-height:420px}
  html.tg .chat-b{height:calc(100vh - 120px)}
  .msg{max-width:88%}
  .assign{margin-left:0;width:100%}
}
@media (max-width:900px){
  body.in-chat .tabbar{display:none}
  body.in-chat .wrap{padding-bottom:10px}
  body.in-chat .top{display:none}
  body.in-chat .chat-b{height:calc(100vh - 20px - env(safe-area-inset-bottom,0px))}
}

/* рейтинг на площадках */
.pf-tiles{grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px}
.pf-t{min-height:112px;padding:16px;color:inherit;text-decoration:none}
.pf-t:hover{text-decoration:none;box-shadow:var(--sh)}
.pf-t .val{font-size:32px}
.pf-t .delta{color:var(--muted);font-size:12.5px}
@media (max-width:900px){ .pf-tiles{grid-template-columns:repeat(2,minmax(0,1fr))} }

/* полоса загрузки при переходах: видно, что приложение работает */
body.loading::before{content:"";position:fixed;left:0;top:0;height:3px;width:40%;z-index:500;background:var(--lime-fill);
  animation:ld 1.1s ease-in-out infinite}
@keyframes ld{0%{transform:translateX(-100%)}100%{transform:translateX(260%)}}
@media (prefers-reduced-motion:reduce){body.loading::before{animation:none;width:100%;opacity:.6}}
.kpi .val .spin{width:26px;height:26px;border-width:3px}

/* отрывки с упоминанием в карточке материала */
.frag{margin-top:8px;background:var(--panel2);border-radius:14px;padding:10px 12px}
.frag-t{font-size:14px;line-height:1.5;color:var(--text)}
.frag-t mark{background:var(--lime-bg);color:var(--text);font-weight:700;border-radius:4px;padding:0 3px}
.frag-nav{display:flex;align-items:center;gap:10px;margin-top:8px}
.ci-btn.sm{width:32px;height:32px;border-radius:10px;font-size:18px;line-height:1}
