/* МВидео — витрина. Токены и компоненты по дизайн-системе Dataforce (PrimeOne/Aura, Inter 14/20).
   Геометрия навбара: 250/68 px, пункт 36 px, иконка 16 px, radius 6 — по UI-kit «Отступы». */
:root{
  --surface-0:#fff;--surface-50:#f8fafc;--surface-100:#f1f5f9;--surface-200:#e2e8f0;--surface-300:#cbd5e1;
  --surface-400:#94a3b8;--surface-500:#64748b;--surface-600:#475569;--surface-700:#334155;--surface-800:#1e293b;--surface-900:#0f172a;
  --primary-50:#eff6ff;--primary-100:#dbeafe;--primary-500:#3b82f6;--primary-600:#2563eb;--primary-700:#1d4ed8;
  --success-50:#ecfdf5;--success-700:#047857;--warn-50:#fffbeb;--warn-700:#b45309;--danger-50:#fef2f2;--danger-600:#dc2626;--danger-700:#b91c1c;
  --series-1:#2563eb;--series-2:#9268ea;--series-3:#0e9f6e;
  --radius-sm:4px;--radius:6px;--radius-md:8px;--radius-lg:12px;--radius-xxl:16px;
  --shadow-1:0 1px 2px 0 rgba(18,18,23,.05);--shadow-dialog:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);
  --nav-w:250px;--nav-w-c:68px;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--surface-100);color:var(--surface-700);font-size:14px;line-height:20px;-webkit-font-smoothing:antialiased}
a{color:var(--primary-600)}
button{font-family:inherit}
code,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.muted{color:var(--surface-500);font-size:13px;line-height:18px}
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt16{margin-top:16px}.w100{width:100%}
.h1{font:600 24px/28px Inter;color:var(--surface-900)}
.h2{font:600 16px/22px Inter;color:var(--surface-900)}
[hidden]{display:none!important}

/* ---------- shell ---------- */
.app{display:flex;min-height:100vh}
.navbar{width:var(--nav-w);flex:0 0 var(--nav-w);background:var(--surface-100);padding:8px 16px 20px;display:flex;flex-direction:column;gap:8px;position:sticky;top:0;height:100vh;transition:width .18s,flex-basis .18s,padding .18s}
.logo{display:flex;align-items:center;height:36px;padding:0 10px;text-decoration:none;gap:8px}
.logo-lockup{display:flex;align-items:center;gap:6px}
.logo-wm svg{height:14px;width:auto;display:block}
.logo-suffix{font:500 14px/15px Inter;color:var(--primary-600);letter-spacing:.2px;text-transform:uppercase}
.logo-badge{display:none;width:36px;height:36px;border-radius:8px;background:var(--primary-600);color:#fff;font:600 16px/36px Inter;text-align:center}
.nav-section{display:flex;flex-direction:column;gap:2px;margin-top:12px}
.nav-label{font:500 12px/16px Inter;color:var(--surface-400);padding:8px 10px;text-transform:uppercase;letter-spacing:.02em;white-space:nowrap}
.nav-items{display:flex;flex-direction:column;gap:2px}
.nav-item{display:flex;align-items:center;gap:12px;padding:10px;border-radius:var(--radius);min-height:36px;font:400 14px/16px Inter;color:var(--surface-700);cursor:pointer;text-decoration:none;white-space:nowrap}
.nav-item:hover{background:var(--surface-50)}
.nav-item.active{background:var(--primary-50);color:var(--primary-700)}
.nav-item .ic{width:16px;height:16px;font-size:15px;line-height:16px;color:var(--surface-500);flex:0 0 16px;text-align:center}
.nav-item.active .ic{color:var(--primary-600)}
.nav-spacer{flex:1}
.nav-footer{display:flex;flex-direction:column;gap:2px;padding-top:8px;border-top:1px solid var(--surface-200)}
.nav-text{transition:opacity .12s}
html.nav-collapsed .navbar{width:var(--nav-w-c);flex-basis:var(--nav-w-c);padding:8px 4px 20px;align-items:center}
html.nav-collapsed .nav-section,html.nav-collapsed .nav-footer{width:100%;align-items:center}
html.nav-collapsed .nav-text,html.nav-collapsed .nav-label,html.nav-collapsed .logo-lockup{display:none}
html.nav-collapsed .logo{width:36px;padding:0;justify-content:center}
html.nav-collapsed .logo-badge{display:block}
html.nav-collapsed .nav-item{width:36px;justify-content:center;padding:10px 0;gap:0}
html.nav-collapsed #collapseIcon{transform:rotate(180deg)}
.content{flex:1;display:flex;flex-direction:column;min-width:0}
.topbar{height:56px;flex:0 0 56px;display:flex;align-items:center;justify-content:space-between;padding:0 24px;gap:16px}
.tb-left,.tb-right{display:flex;align-items:center;gap:10px;min-width:0}
.tb-space-label{font:400 14px/16px Inter;color:var(--surface-500)}
.tb-proj{display:flex;align-items:center;gap:8px;height:32px;padding:6px 10px;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius);box-shadow:var(--shadow-1)}
.tb-proj .fav{width:14px;height:14px;border-radius:3px;background:var(--primary-600);color:#fff;font:700 9px/14px Inter;text-align:center}
.tb-proj .pname{font:500 14px/20px Inter;color:var(--surface-700)}
.tb-meta{color:var(--surface-500);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-burger{display:none;width:32px;height:32px;border:0;background:transparent;border-radius:6px;color:var(--surface-600);cursor:pointer;font-size:16px}
.tb-profile{position:relative;display:flex;align-items:center;gap:4px;cursor:pointer;outline:none;border-radius:6px;padding:2px}
.tb-profile:focus-visible{box-shadow:0 0 0 2px var(--primary-100)}
.tb-avatar{width:28px;height:28px;border-radius:14px;background:var(--surface-400);color:#fff;display:flex;align-items:center;justify-content:center;font:500 14px/1 Inter}
.tb-profile .pi-angle-down{font-size:12px;color:var(--surface-500)}
.popover{position:absolute;top:calc(100% + 6px);right:0;min-width:200px;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:6px;z-index:40;cursor:default}
.pop-name{font:600 14px/18px Inter;color:var(--surface-900);padding:8px 10px 0}
.pop-sub{font:400 12px/16px Inter;color:var(--surface-500);padding:0 10px 8px;border-bottom:1px solid var(--surface-100);margin-bottom:4px}
.pop-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:6px;color:var(--surface-700);text-decoration:none}
.pop-item:hover{background:var(--surface-50)}
.page{padding:4px 24px 24px;display:flex;flex-direction:column;gap:16px;max-width:1240px;width:100%}
.scrim{position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:55;display:none}
.scrim.open{display:block}

/* ---------- card & типографика ---------- */
.card{background:#fff;border-radius:var(--radius-md);padding:24px 28px}
.card.weld-top{border-radius:8px 8px 0 0;border-bottom:1px solid var(--surface-200);margin-bottom:-16px}
.card.weld-bottom{border-radius:0 0 8px 8px}
.card-success{border:1px solid #bbf7d0;background:var(--success-50)}
.card-danger{border:1px solid #fecaca;background:var(--danger-50);color:var(--danger-700);display:flex;gap:8px;align-items:center}
.tcard{padding:0;overflow:hidden}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px 16px;min-height:80px;padding:20px 28px;border-bottom:1px solid var(--surface-200);flex-wrap:wrap}
/* заголовок с описанием занимает строку целиком и переносится сам; кнопки справа, если не влезли — строкой ниже.
   Без этого «нерезиновая» правая группа (числа с nowrap и кнопки) выжимала описание в колонку в пару слов. */
.card-head>:first-child{flex:1 1 360px;min-width:0}
.rep-header{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rep-header>:first-child{flex:1 1 360px;min-width:0}
.rep-actions{display:flex;gap:8px;margin-left:auto;align-items:center;flex-wrap:wrap}
.filters-panel{display:flex;flex-direction:column;gap:16px}
.total-pill{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid var(--surface-300);border-radius:var(--radius);background:#fff;color:var(--surface-700);font:500 14px/20px Inter}
.total-pill .pi{font-size:14px;color:var(--surface-500)}
.total-pill .muted{margin-left:2px}
.filter-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.filter-note{margin-left:auto}
.empty-card{display:flex;flex-direction:column;align-items:flex-start;gap:10px;max-width:520px}
.empty-icon{width:40px;height:40px;border-radius:10px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:18px}
.steps-list{padding-left:20px;margin-top:8px;display:flex;flex-direction:column;gap:6px}
.steps-list .done{color:var(--surface-400);text-decoration:line-through}

/* ---------- buttons ---------- */
.btn{height:32px;padding:7px 11px;border-radius:var(--radius);border:none;font:500 14px/18px Inter;display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:disabled{opacity:.5;cursor:default}
.btn-lg{height:38px;font-size:15px}
.btn-primary{background:var(--primary-600);color:#fff}.btn-primary:hover:not(:disabled){background:var(--primary-700)}
.btn-secondary{background:var(--surface-100);color:var(--surface-600)}.btn-secondary:hover:not(:disabled){background:var(--surface-200)}
.btn-outlined{background:transparent;color:var(--surface-700);border:1px solid var(--surface-300)}.btn-outlined:hover:not(:disabled){background:var(--surface-50)}
.btn-icon{width:32px;height:32px;border:1px solid var(--surface-200);border-radius:var(--radius);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--surface-600);flex:0 0 32px}
.btn-icon:hover{background:var(--surface-50);color:var(--primary-600)}
.btn-icon .pi{font-size:14px}
.btn-send{width:32px;padding:0;flex:0 0 32px}
.linkbtn{border:0;background:none;color:var(--primary-600);font:500 13px Inter;cursor:pointer;padding:0}
.linkbtn.danger{color:var(--danger-600)}
.inline{display:inline}

/* ---------- inputs ---------- */
.input{height:32px;padding:6px 11px;border:1px solid var(--surface-300);border-radius:var(--radius);box-shadow:var(--shadow-1);font:400 14px Inter;color:var(--surface-700);background:#fff;min-width:0}
.input:focus{outline:none;border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.input.select{padding-right:28px;appearance:none;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center}
.input.sm{height:28px;font-size:13px;padding:3px 26px 3px 8px}
.inline-form{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.inline-form.compact{display:inline-flex}
.field{display:block;margin-top:14px}
.field-label{display:block;font:500 13px/16px Inter;color:var(--surface-700);margin-bottom:6px}
.input-wrap{position:relative;display:block}
.input-wrap .input{padding-right:36px}
.input-eye{position:absolute;right:4px;top:4px;width:24px;height:24px;border:0;background:transparent;color:var(--surface-500);cursor:pointer;border-radius:4px}
.input-eye:hover{color:var(--primary-600)}
.form-error{color:var(--danger-700);font-size:13px;min-height:18px;margin-top:10px}

/* filter select (UI-kit: 32px, radius 6, border #CBD5E1/#94A3B8/#2563EB, chevron zone 36) */
.filter-select{position:relative;display:flex;align-items:center;height:32px;background:#fff;border:1px solid var(--surface-300);border-radius:var(--radius);cursor:pointer;user-select:none}
.filter-select:hover{border-color:var(--surface-400)}
.filter-select.open{border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.filter-select .fs-content{display:flex;align-items:center;gap:4px;padding:0 0 0 10px;height:30px;white-space:nowrap}
.filter-select .fs-label{font:400 14px Inter;color:var(--surface-500)}
.filter-select .fs-value{font:400 14px Inter;color:var(--surface-700)}
.filter-select.has-value .fs-value{color:var(--primary-700);font-weight:500}
.filter-select .fs-drop{width:36px;display:flex;align-items:center;justify-content:center;align-self:stretch}
.filter-select .fs-drop .pi{font-size:12px;color:var(--surface-500)}
.fs-menu{display:none;position:absolute;top:calc(100% + 4px);left:0;min-width:100%;z-index:40;background:#fff;border:1px solid var(--surface-200);border-radius:var(--radius-md);box-shadow:var(--shadow-dialog);padding:4px;white-space:nowrap}
.filter-select.open .fs-menu{display:block}
.fs-opt{padding:7px 10px;border-radius:6px;font:400 14px/18px Inter;color:var(--surface-700);cursor:pointer}
.fs-opt:hover{background:var(--surface-50)}
.fs-opt.sel{color:var(--primary-700);background:var(--primary-50)}
.fs-opt.disabled{color:var(--surface-300);cursor:not-allowed}
.fs-opt.disabled:hover{background:transparent}

/* segmented */
.segmented{display:inline-flex;background:var(--surface-100);border-radius:8px;height:32px;padding:3px;gap:2px}
.segmented button{border:none;background:transparent;font:500 14px/18px Inter;color:var(--surface-500);padding:4px 10px;cursor:pointer;border-radius:6px;white-space:nowrap}
.segmented button.active{background:#fff;color:var(--surface-900);box-shadow:var(--shadow-1)}
.segmented button:disabled{opacity:.38;cursor:default}
.seg-metrics{flex-wrap:wrap;height:auto;min-height:32px}

/* tags */
.tag{display:inline-flex;align-items:center;gap:4px;min-height:22px;padding:2px 8px;border-radius:6px;font:500 12px/16px Inter;white-space:nowrap}
.tag .pi{font-size:11px}
.tag-success{background:var(--success-50);color:var(--success-700)}
.tag-info{background:var(--primary-50);color:var(--primary-700)}
.tag-warn{background:var(--warn-50);color:var(--warn-700)}
.tag-danger{background:var(--danger-50);color:var(--danger-700)}
.tag-neutral{background:var(--surface-100);color:var(--surface-500)}
.delta{font:500 13px/18px Inter;font-variant-numeric:tabular-nums}
.delta.up{color:var(--success-700)}.delta.down{color:var(--danger-600)}

/* ---------- tables ---------- */
.tscroll{overflow-x:auto}
table.dt{width:100%;border-collapse:separate;border-spacing:0}
table.dt th,table.dt td{border-bottom:1px solid var(--surface-200);border-right:1px solid var(--surface-200);height:40px;padding:8px 14px;text-align:left;vertical-align:middle}
table.dt th:last-child,table.dt td:last-child{border-right:0}
table.dt tr:last-child td{border-bottom:0}
table.dt th{font:600 13px/18px Inter;color:var(--surface-500);background:var(--surface-50);white-space:nowrap}
table.dt td{font:500 14px/18px Inter;color:var(--surface-700)}
table.dt th:first-child,table.dt td:first-child{padding-left:28px}
table.dt th:last-child,table.dt td:last-child{padding-right:28px}
table.dt td.num,table.dt th.num{text-align:right;font-variant-numeric:tabular-nums}
table.dt tbody tr:hover td{background:var(--surface-50)}
table.dt tr.row-dim td{color:var(--surface-400)}
table.dt tfoot td{font-weight:600;background:var(--surface-50);border-top:2px solid var(--surface-200);border-bottom:0}
.cell-main{font-weight:600;color:var(--surface-800)}
.issues{padding:12px 28px}
.issue{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-top:1px solid var(--surface-100)}
.issue:first-child{border-top:0}
.issue .tag{flex:none;margin-top:1px}
.issue-text{line-height:20px}

/* ---------- KPI ---------- */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
.kpi{background:#fff;border-radius:var(--radius-md);padding:16px 18px;display:flex;flex-direction:column;gap:6px;min-height:118px;min-width:0}
.kpi.na{background:var(--surface-50);border:1px dashed var(--surface-200)}
.kpi-name{color:var(--surface-500);font-size:13px;line-height:18px;display:flex;align-items:center;gap:6px}
.kpi-val{font:600 22px/28px Inter;color:var(--surface-900);font-variant-numeric:tabular-nums;letter-spacing:-.02em;white-space:nowrap}
.kpi.na .kpi-val{color:var(--surface-400);font-size:18px}
.kpi-delta{display:flex;align-items:center;gap:6px;min-height:22px;flex-wrap:wrap}
.kpi-note{font:400 12px/16px Inter;color:var(--surface-400);min-height:16px}

/* ---------- chart ---------- */
.graph-actions{display:flex;flex-direction:column;gap:16px;padding:20px 28px}
.graph-body{padding:20px 28px 20px}
.legend{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px;align-items:center;min-height:26px}
.legend .item{display:flex;align-items:center;gap:6px;border:1px solid transparent;border-radius:6px;padding:3px 7px;font:400 13px/18px Inter;color:var(--surface-700);cursor:pointer;user-select:none}
.legend .item:hover{background:var(--surface-50);border-color:var(--surface-200)}
.legend .item.off{color:var(--surface-400)}
.legend .item.off .dot{background:transparent!important;border-color:var(--surface-300)}
.legend .dot{width:10px;height:10px;border-radius:50%;border:2px solid transparent}
.legend .lg-note{color:var(--warn-700);font-size:13px}
.legend .lg-title{margin-left:auto;color:var(--surface-500);font-size:13px}
.chart-wrap{position:relative}
.chart{width:100%;height:260px;display:block}
.chart .grid{stroke:var(--surface-200);stroke-width:1}
.chart .guide{stroke:var(--surface-300);stroke-width:1;stroke-dasharray:3 3}
.chart .ylab{font:400 11px Inter;fill:var(--surface-400)}
.chart polyline{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chart .area{opacity:.08}
.chart .area-partial{opacity:.04}
.chart .partial-line{stroke-dasharray:5 4;opacity:.7}
.chart .pt{stroke:#fff;stroke-width:1.5}
.chart .pt.partial{fill:#fff;stroke-width:2}
.axis-svg{width:100%;height:20px;display:block;margin-top:2px}
.axis-svg .axis-label{font:400 12px/16px Inter;fill:var(--surface-500)}
.chart-tip{position:absolute;background:var(--surface-900);color:var(--surface-200);border-radius:8px;padding:10px 12px;font:12px/18px Inter;pointer-events:none;z-index:5;box-shadow:var(--shadow-dialog);min-width:170px}
.chart-tip .t-week{font-weight:600;color:#fff;margin-bottom:4px}
.chart-tip .t-row{display:flex;justify-content:space-between;gap:14px}
.chart-tip .t-row .dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px}
.chart-tip .t-val{font-variant-numeric:tabular-nums;font-weight:600;color:#fff}
.chart-tip .t-note{color:#fbbf24;margin-top:4px}
.chart-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--surface-400);font-size:14px;background:repeating-linear-gradient(-45deg,transparent 0 8px,var(--surface-50) 8px 16px);border-radius:8px}

/* ---------- ИИ-режим ---------- */
.page-ai{padding-bottom:16px;max-width:none;height:calc(100vh - 60px)}
.body-ai .content{height:100vh}
.ai-layout{display:grid;grid-template-columns:272px minmax(0,1fr);gap:16px;height:100%;min-height:0}
.chatlist{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chatlist-head{padding:16px 16px 8px}
.chatlist-search{display:flex;align-items:center;gap:8px;margin:0 16px 8px;height:32px;padding:0 10px;border:1px solid var(--surface-200);border-radius:6px;color:var(--surface-400)}
.chatlist-search input{border:0;outline:0;flex:1;font:14px Inter;color:var(--surface-700);min-width:0;background:transparent}
.chatlist-search .pi{font-size:13px}
.chatlist-items{overflow-y:auto;padding:0 8px 12px;flex:1}
.chatlist-group{font:500 11px/16px Inter;color:var(--surface-400);text-transform:uppercase;letter-spacing:.04em;padding:12px 8px 4px}
.chat-item{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:6px;text-decoration:none;color:var(--surface-700)}
.chat-item:hover{background:var(--surface-50)}
.chat-item.active{background:var(--primary-50)}
.chat-item.active .ci-title{color:var(--primary-700)}
.ci-title{font:500 13px/18px Inter;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ci-meta{font:400 11px/14px Inter;color:var(--surface-400);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ci-who{color:var(--surface-500);font-weight:500}
.chatlist-empty{padding:16px 10px}
.chat{padding:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chat-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:16px 24px 12px;border-bottom:1px solid var(--surface-200)}
.chat-head-main{min-width:0;flex:1}
.chat-title{font:600 18px/24px Inter;color:var(--surface-900);outline:none;border-radius:4px;padding:0 4px;margin-left:-4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-title[contenteditable]:hover{background:var(--surface-50)}
.chat-title[contenteditable]:focus{background:var(--surface-50);box-shadow:0 0 0 2px var(--primary-100);white-space:normal}
.chat-head-meta{margin-top:2px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.chat-actions{display:flex;gap:6px}
.btn-icon.on{color:var(--primary-600);border-color:var(--primary-100);background:var(--primary-50)}
.msgs{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:18px;scroll-behavior:smooth}
.chat-empty{margin:auto;max-width:640px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px 0}
.chat-empty .empty-icon{width:44px;height:44px;font-size:20px}
.suggestions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px;width:100%}
.suggestion{text-align:left;padding:10px 12px;border:1px solid var(--surface-200);border-radius:8px;background:#fff;font:400 13px/18px Inter;color:var(--surface-700);cursor:pointer}
.suggestion:hover{border-color:var(--primary-600);color:var(--primary-700);background:var(--primary-50)}
.msg{display:flex;flex-direction:column;gap:6px;max-width:100%}
.msg-user{align-items:flex-end}
.msg-user .bubble{background:var(--primary-600);color:#fff;border-radius:14px 14px 4px 14px;padding:10px 14px;max-width:78%;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:21px}
.msg-user .bubble.file{background:var(--primary-50);color:var(--primary-700);display:flex;align-items:center;gap:8px;white-space:normal}
.msg-ai{align-items:stretch}
.msg-ai .body{display:flex;gap:12px;align-items:flex-start}
.ai-mark{flex:0 0 28px;width:28px;height:28px;border-radius:8px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:13px;margin-top:2px}
.ai-mark.err{background:var(--danger-50);color:var(--danger-600)}
.ai-content{min-width:0;flex:1}
.steps{border:1px solid var(--surface-200);border-radius:8px;margin-bottom:10px;background:var(--surface-50);overflow:hidden}
.steps-head{display:flex;align-items:center;gap:8px;padding:6px 10px;font:500 12px/16px Inter;color:var(--surface-600);cursor:pointer;user-select:none}
.steps-head .pi-chevron-right{font-size:10px;transition:transform .15s;color:var(--surface-400)}
.steps.open .steps-head .pi-chevron-right{transform:rotate(90deg)}
.steps-body{display:none;border-top:1px solid var(--surface-200);padding:4px 0}
.steps.open .steps-body{display:block}
.step{display:flex;align-items:center;gap:8px;padding:4px 10px;font:400 12px/16px Inter;color:var(--surface-600)}
.step .s-ico{width:14px;text-align:center;font-size:11px;color:var(--surface-400)}
.step.ok .s-ico{color:var(--success-700)}
.step.err .s-ico{color:var(--danger-600)}
.step.run .s-ico{color:var(--primary-600)}
.step .s-name{font-weight:500;color:var(--surface-700)}
.step .s-args{color:var(--surface-400);font-family:ui-monospace,Menlo,monospace;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px}
.step .s-res{margin-left:auto;white-space:nowrap;color:var(--surface-500)}
.step .s-ms{color:var(--surface-400);font-variant-numeric:tabular-nums}
.spin{display:inline-block;width:11px;height:11px;border:2px solid var(--primary-100);border-top-color:var(--primary-600);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.status-line{display:flex;align-items:center;gap:8px;color:var(--surface-500);font-size:13px;margin:2px 0 6px}
.md{font-size:14px;line-height:22px;color:var(--surface-800);overflow-wrap:anywhere}
.md>*+*{margin-top:8px}
.md p{margin:0}
.md h1,.md h2,.md h3,.md h4{font-weight:600;color:var(--surface-900);line-height:1.3}
.md h1{font-size:18px}.md h2{font-size:16px}.md h3,.md h4{font-size:14px}
.md ul,.md ol{padding-left:22px}
.md li{margin:2px 0}
.md code{background:var(--surface-100);border-radius:4px;padding:1px 5px;font-size:12.5px}
.md pre{background:var(--surface-900);color:var(--surface-100);border-radius:8px;padding:12px 14px;overflow-x:auto;font-size:12.5px;line-height:18px}
.md pre code{background:transparent;padding:0;color:inherit}
.md table{border-collapse:collapse;width:auto;max-width:100%;display:block;overflow-x:auto;font-size:13px}
.md th,.md td{border:1px solid var(--surface-200);padding:5px 10px;text-align:left;vertical-align:top;white-space:nowrap}
.md th{background:var(--surface-50);font-weight:600;color:var(--surface-600)}
.md td.num,.md th.num{text-align:right;font-variant-numeric:tabular-nums}
.md blockquote{border-left:3px solid var(--surface-200);padding-left:12px;color:var(--surface-500)}
.md hr{border:0;border-top:1px solid var(--surface-200)}
.md a{color:var(--primary-600)}
.md .dl{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border:1px solid var(--primary-100);background:var(--primary-50);border-radius:6px;text-decoration:none;font-weight:500}
.md .src{color:var(--surface-500);font-size:12.5px;border-top:1px dashed var(--surface-200);padding-top:6px;margin-top:10px}
.md .cursor{display:inline-block;width:2px;height:16px;background:var(--primary-600);vertical-align:-3px;margin-left:1px;animation:blink 1s steps(2) infinite}
@keyframes blink{50%{opacity:0}}
.msg-tools{display:flex;gap:4px;align-items:center;margin-left:40px;opacity:0;transition:opacity .15s;min-height:20px}
.msg:hover .msg-tools,.msg.last .msg-tools{opacity:1}
.msg-tools button{border:0;background:transparent;color:var(--surface-400);font:400 12px Inter;cursor:pointer;display:inline-flex;align-items:center;gap:4px;padding:2px 6px;border-radius:4px}
.msg-tools button:hover{color:var(--primary-600);background:var(--surface-50)}
.msg-tools .meta{color:var(--surface-400);font-size:11px;margin-left:auto}
.msg-user .msg-tools{margin-left:0;justify-content:flex-end}
.composer{padding:8px 24px 12px;border-top:1px solid var(--surface-200);position:relative}
.composer-box{border:1px solid var(--surface-300);border-radius:12px;box-shadow:var(--shadow-1);background:#fff;transition:border-color .12s,box-shadow .12s}
.composer-box:focus-within{border-color:var(--primary-600);box-shadow:0 0 0 1px var(--primary-600)}
.composer-box textarea{display:block;width:100%;border:0;outline:0;resize:none;padding:12px 14px 4px;font:14px/21px Inter;color:var(--surface-800);min-height:44px;max-height:240px;background:transparent}
.composer-box textarea::placeholder{color:var(--surface-400)}
.composer-bar{display:flex;align-items:center;gap:8px;padding:4px 8px 8px 8px}
.composer-hint{font-size:12px;margin-left:2px}
.composer-status{margin-left:auto;font-size:12px;color:var(--surface-500);display:flex;align-items:center;gap:6px}
.composer-foot{padding:8px 4px 0;font-size:12px;display:flex;gap:6px;align-items:center}
.dropzone{position:absolute;inset:8px 24px 12px;border:2px dashed var(--primary-500);border-radius:12px;background:rgba(239,246,255,.95);display:none;align-items:center;justify-content:center;gap:8px;color:var(--primary-700);font-weight:500;z-index:3}
.composer.drag .dropzone{display:flex}
.cred-row{display:flex;gap:8px;align-items:center;margin-top:10px;flex-wrap:wrap}
.cred{font-size:16px;background:#fff;border:1px solid #bbf7d0;border-radius:6px;padding:6px 12px;letter-spacing:.04em}

/* ---------- login ---------- */
.login-body{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--surface-100);padding:24px}
.login-card{background:#fff;border-radius:16px;padding:36px 34px 28px;width:380px;max-width:100%;box-shadow:var(--shadow-1)}
.login-lockup{display:flex;align-items:center;gap:6px;margin-bottom:22px}
.login-lockup .logo-wm svg{height:16px}
.login-lockup .logo-suffix{font-size:16px;line-height:17px}
.login-title{font:600 20px/26px Inter;color:var(--surface-900)}
.login-sub{margin-top:4px;color:var(--surface-500);font-size:13px}
.login-card .btn{margin-top:22px}
.login-help{margin-top:14px;font-size:12.5px;color:var(--surface-500);text-align:center}

/* ---------- toasts ---------- */
.toasts{position:fixed;right:20px;bottom:20px;display:flex;flex-direction:column;gap:8px;z-index:70}
.toast{background:var(--surface-900);color:#fff;border-radius:8px;padding:10px 14px;font-size:13px;box-shadow:var(--shadow-dialog);display:flex;align-items:center;gap:8px;animation:toast-in .18s ease-out}
.toast.err{background:var(--danger-700)}
@keyframes toast-in{from{transform:translateY(8px);opacity:0}to{transform:none;opacity:1}}

/* ---------- responsive ---------- */
@media (max-width:1100px){.ai-layout{grid-template-columns:232px minmax(0,1fr)}}
@media (max-width:900px){
  .navbar{position:fixed;left:0;top:0;bottom:0;z-index:60;transform:translateX(-100%);transition:transform .18s;box-shadow:2px 0 24px rgba(15,23,42,.08);height:100vh}
  html.nav-open .navbar{transform:none}
  html.nav-collapsed .navbar{width:var(--nav-w);flex-basis:var(--nav-w);padding:8px 16px 20px;align-items:stretch}
  html.nav-collapsed .nav-text,html.nav-collapsed .nav-label,html.nav-collapsed .logo-lockup{display:initial}
  html.nav-collapsed .logo-badge{display:none}
  html.nav-collapsed .nav-item{width:auto;justify-content:flex-start;padding:10px;gap:12px}
  #navCollapse{display:none}
  .tb-burger{display:inline-flex;align-items:center;justify-content:center}
  .topbar{padding:0 16px}
  .page{padding:4px 12px 16px}
  .card{padding:18px 16px}
  .card-head,.issues{padding-left:16px;padding-right:16px}
  table.dt th:first-child,table.dt td:first-child{padding-left:16px}
  table.dt th:last-child,table.dt td:last-child{padding-right:16px}
  .ai-layout{grid-template-columns:1fr}
  .chatlist{display:none}
  .suggestions{grid-template-columns:1fr}
  .msg-user .bubble{max-width:92%}
  .composer-hint,.tb-meta{display:none}
  .page-ai{height:calc(100vh - 56px)}
  .page .cols2{grid-template-columns:minmax(0,1fr)}
  /* переключатель шире экрана прокручивается сам, а не растягивает страницу (в мини-приложении так и было) */
  .segmented{max-width:100%;overflow-x:auto}
}

/* ---------- мини-приложение Telegram (body.tg-mode: кука mv_tg) ----------
   Навбар и верхняя панель убраны: экран телефона внутри Telegram, разделы — вкладками снизу,
   «Назад» и главная кнопка — у самого Telegram (static/tg.js). */
.tg-mode .navbar,.tg-mode .topbar,.tg-mode .scrim,.tg-mode .chatlist,.tg-mode .composer-hint{display:none}
.tg-mode .page{padding:12px 12px calc(72px + env(safe-area-inset-bottom));gap:12px}
.tg-mode .card{padding:16px;border-radius:var(--radius-lg)}
.tg-mode .card-head,.tg-mode .issues{padding-left:16px;padding-right:16px}
.tg-mode .h1{font-size:20px;line-height:26px}
.tg-mode .ai-layout{grid-template-columns:1fr}
.tg-mode .page-ai{height:calc(var(--tg-vh, 100dvh) - 48px);padding:8px 8px calc(64px + env(safe-area-inset-bottom))}
.tg-mode .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
.tg-mode{overflow-x:hidden}
.tg-mode .content{max-width:100vw}
.tg-mode .card,.tg-mode .tscroll{overflow-x:auto}
.tg-mode .segmented{max-width:100%;overflow-x:auto}
.tg-mode .page .cols2{grid-template-columns:minmax(0,1fr)}
.tg-mode .card-head{flex-wrap:wrap;gap:8px}
.tg-mode .nt-pick .select{min-width:0;width:100%}
.tg-tabs{position:fixed;left:0;right:0;bottom:0;z-index:60;display:flex;background:#fff;border-top:1px solid var(--surface-200);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
.tg-tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:4px 0;font:500 11px/14px Inter;color:var(--surface-500);text-decoration:none;border-radius:8px}
.tg-tab .pi{font-size:18px}
.tg-tab.active{color:var(--primary-600)}
.tg-boot{display:flex;align-items:center;justify-content:center;min-height:100vh;background:var(--surface-100);padding:24px}
.tg-boot-card{background:#fff;border-radius:var(--radius-lg);padding:32px 24px;width:100%;max-width:380px;display:flex;flex-direction:column;align-items:center;gap:16px;text-align:center}
.tg-boot-status{font:500 15px/20px Inter;color:var(--surface-900);display:flex;align-items:center;gap:8px}
.tg-boot-text{color:var(--surface-600);font-size:14px;line-height:20px}
.tg-boot .btn{width:100%}

/* экран «Уведомления» */
.nt-form{display:flex;flex-direction:column;gap:16px}
.tg-mode .nt-form{gap:12px}
.nt-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;cursor:pointer}
.nt-row>span:first-child{display:flex;flex-direction:column;gap:2px}
.switch{appearance:none;-webkit-appearance:none;width:44px;height:26px;flex:0 0 44px;border-radius:13px;background:var(--surface-300);position:relative;cursor:pointer;transition:background .15s;margin-top:2px}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:10px;background:#fff;box-shadow:var(--shadow-1);transition:transform .15s}
.switch:checked{background:var(--primary-600)}
.switch:checked::after{transform:translateX(18px)}
.nt-sub{margin-top:16px;padding-top:16px;border-top:1px solid var(--surface-100)}
.nt-sub.off{opacity:.45;pointer-events:none}
.nt-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px 24px}
.nt-grid .field{display:flex;flex-direction:column;gap:6px}
.field-label{font:500 13px/18px Inter;color:var(--surface-700)}
.field-label .muted{font-weight:400}
.nt-range{display:flex;align-items:center;gap:10px}
.nt-range input[type=range]{flex:1;accent-color:var(--primary-600);min-width:0}
.nt-range output{font:600 16px/20px Inter;color:var(--surface-900);min-width:34px;text-align:right}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.chip{position:relative;cursor:pointer}
.chip input{position:absolute;opacity:0;width:0;height:0}
.chip span{display:inline-flex;align-items:center;min-height:32px;padding:6px 12px;border-radius:16px;border:1px solid var(--surface-200);background:#fff;font:500 13px/18px Inter;color:var(--surface-600);transition:all .12s;user-select:none}
.chip input:checked+span{background:var(--primary-50);border-color:var(--primary-600);color:var(--primary-700)}
.chip input:focus-visible+span{box-shadow:0 0 0 2px var(--primary-100)}
.nt-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.tg-msg{background:var(--surface-50);border:1px solid var(--surface-200);border-radius:12px 12px 12px 4px;padding:12px 14px;font-size:14px;line-height:20px;color:var(--surface-800);max-width:640px;overflow-wrap:anywhere}
.tg-msg pre{white-space:pre-wrap;font-size:12px}
.nt-pick .select{min-width:260px}
.small{font-size:12px}
.card-warn-soft{border:1px solid #fde68a;background:var(--warn-50)}
.row-dim td{color:var(--surface-400)}
.nt-log td{white-space:normal;vertical-align:top}
.nt-log td.mono{overflow-wrap:anywhere;font-size:12px;line-height:16px}

/* разметка: маски, длинные URL, предпросмотр */
.masks code{display:inline-block;margin:2px 4px 2px 0;font-size:12px;background:var(--surface-100);border-radius:4px;padding:1px 5px}
table.dt.urls td.url{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;max-width:520px;overflow-wrap:anywhere;white-space:normal;line-height:16px}
table.dt.compact th,table.dt.compact td{height:32px;padding:5px 10px;font-size:13px}
table.dt.compact th:first-child,table.dt.compact td:first-child{padding-left:12px}
table.dt.compact th:last-child,table.dt.compact td:last-child{padding-right:12px}
table.dt tr.row-edit td{background:var(--primary-50)}
.inline-form .grow{flex:1;min-width:240px}
.nowrap{white-space:nowrap}
textarea.input{resize:vertical;line-height:20px;padding:8px 11px}

/* видимость сайтов: две таблицы рядом, наша строка подсвечена */
.cols2{display:grid;grid-template-columns:repeat(auto-fit,minmax(420px,1fr));gap:16px;align-items:start}
.dt tr.row-own td{background:var(--primary-50);font-weight:600}
.empty-note{padding:20px 28px}

/* справочник категорий (экран «Разметка» → «Категории») */
.masks code.auto{border:1px dashed var(--primary-500);background:var(--primary-50);color:var(--primary-700)}
/* маска-догадка по транслитерации: цифр по такой категории не будет, пока её не проверит человек */
.masks code.auto.guess{border-color:var(--surface-400);background:var(--surface-100);color:var(--text-muted);text-decoration:underline dotted}
.auto-legend code.auto{display:inline-block;font-size:12px;border-radius:4px;padding:1px 5px}
table.dt.cats td.masks{max-width:260px;white-space:normal}
table.dt.cats td.num{white-space:nowrap}
table.dt.cats tr.cat-sub td:first-child{padding-left:32px}
table.dt.cats tr.cat-sub .cell-main::before{content:"↳ ";color:var(--surface-400)}
.cat-links{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}
.cat-links .field{display:flex;flex-direction:column;gap:4px}
.cat-links textarea{width:100%;min-height:72px;font-size:12px}
.small{font-size:12px;line-height:16px}
.mt16.card{margin-top:16px}

/* ---------- конструктор отчётов ---------- */
.bld-layout{display:grid;grid-template-columns:300px minmax(0,1fr);gap:16px;align-items:start}
.bld-left{padding:16px 12px;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto}
.bld-left-head{display:flex;justify-content:space-between;align-items:center;padding:0 8px 10px}
.bld-group{margin-bottom:10px}
.bld-group-title{display:flex;align-items:center;gap:6px;width:100%;border:0;background:transparent;cursor:pointer;text-align:left;font:500 12px/16px Inter;color:var(--surface-500);text-transform:uppercase;letter-spacing:.02em;padding:8px 8px 6px;border-radius:var(--radius)}
.bld-group-title:hover{background:var(--surface-50);color:var(--surface-700)}
.bld-group-title .pi{font-size:11px;color:var(--surface-400)}
.bld-group-count{margin-left:auto;font:400 12px/16px Inter;color:var(--surface-400);text-transform:none;letter-spacing:0}
.bld-group.open .bld-group-count{color:var(--primary-600)}
.bld-group-body{display:none}
.bld-group.open .bld-group-body{display:block}
.bld-domain{display:flex;align-items:center;gap:8px;padding:2px 8px 6px}
.bld-domain select{flex:1;height:30px;border:1px solid var(--surface-300);border-radius:var(--radius);font:400 13px Inter;color:var(--surface-700);background:#fff;padding:0 6px;min-width:0}
.bld-metric{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;text-align:left;border:1px solid transparent;background:transparent;border-radius:var(--radius);padding:7px 8px;cursor:pointer;font:400 14px/18px Inter;color:var(--surface-700)}
.bld-metric:hover{background:var(--surface-50)}
.bld-metric.on{background:var(--primary-50);border-color:var(--primary-100);color:var(--primary-700)}
.bld-metric.on .bld-m-title::before{content:"✓ ";color:var(--primary-600)}
.bld-metric.na{color:var(--surface-400)}
.bld-metric.na .bld-m-title{text-decoration:line-through;text-decoration-color:var(--surface-300)}
.bld-metric.full{cursor:not-allowed;opacity:.6}
.bld-metric.chip{margin-top:4px}
.bld-m-title{font-weight:500}
.bld-m-meta{font-size:12px;line-height:16px;color:var(--surface-400)}
.bld-m-why{font-size:12px;line-height:16px;color:var(--warn-700)}
.bld-m-why.ok{color:var(--surface-500)}
.bld-main{display:flex;flex-direction:column;gap:16px;min-width:0}
.bld-chart-card{border-radius:var(--radius-md)}
.bld-chart{height:300px}
.chart .ylab.right{fill:var(--surface-400)}
.chart .axis-title{font-weight:500}
.chart path.ln{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chart path.ln.stepped{stroke-dasharray:6 3;opacity:.85}
.chart path.ln.partial-line{stroke-dasharray:5 4;opacity:.7}
.bld-notes{margin-top:12px;display:flex;flex-direction:column;gap:2px}
.bld-notes .gap-rule{color:var(--surface-400)}
.bld-date{display:flex;align-items:center;gap:6px;height:32px;padding:0 8px;background:#fff;border:1px solid var(--surface-300);border-radius:var(--radius)}
.bld-date input{border:0;font:400 14px Inter;color:var(--surface-700);background:transparent;outline:none}
.bld-cat-menu{max-height:320px;overflow:auto}
/* селект категорий: сразу видны только крупнейшие, остальные достаются поиском */
.fs-find{display:block;width:100%;box-sizing:border-box;margin:2px 0 4px;padding:6px 8px;font:400 14px Inter;color:var(--surface-700);border:1px solid var(--surface-300);border-radius:6px;outline:none}
.fs-find:focus{border-color:var(--primary-400)}
.fs-opt.fs-rest,.fs-opt.fs-hidden{display:none}
.fs-menu.searching .fs-opt.fs-rest{display:block}
.fs-menu.searching .fs-opt.fs-hidden{display:none}
.fs-menu.searching .fs-note{display:none}
.fs-note{padding:6px 10px 4px;font:400 12px/16px Inter;color:var(--surface-500);white-space:normal;max-width:320px}
label.chk{display:inline-flex;align-items:center;gap:6px;font:400 13px Inter;color:var(--surface-600);cursor:pointer}
label.chk input{margin:0}
.filter-select.dimmed{opacity:.55}
.legend .item b{font-weight:500}
.legend .item .why{color:var(--warn-700)}
.legend .item.refused{cursor:default;color:var(--surface-500);border-color:var(--surface-200);background:var(--surface-50)}
.legend .item.refused .dot{background:transparent;border-color:var(--surface-300)}
.legend .item a.rm{color:var(--surface-400);text-decoration:none;margin-left:4px;padding:0 3px}
.legend .item a.rm:hover{color:var(--danger-600)}
.legend .item a.fix{color:var(--primary-600);margin-left:6px}
@media (max-width:1100px){.bld-layout{grid-template-columns:1fr}.bld-left{position:static;max-height:none}}
.bld-sets{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.bld-select{height:32px;min-width:220px;max-width:340px;border:1px solid var(--surface-300);border-radius:var(--radius);font:400 14px Inter;color:var(--surface-700);background:#fff;padding:0 8px}
.bld-set-title{font:500 14px/18px Inter;color:var(--primary-700)}
/* ---------- мини-приложение: меню, отчёты в чат, конструктор, поддержка ----------
   Стартовый экран в Telegram — плитки во весь экран телефона, а не копия навбара сайта. */
.menu{display:flex;flex-direction:column;gap:16px;max-width:720px}
.menu-head{padding:4px 4px 0}
.menu-hello{font:600 22px/28px Inter;color:var(--surface-900);letter-spacing:-.01em}
.menu-sub{margin-top:2px}
.menu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tile{position:relative;display:flex;flex-direction:column;justify-content:flex-start;gap:14px;min-height:150px;padding:16px;background:#fff;border-radius:var(--radius-xxl);text-decoration:none;color:var(--surface-700);box-shadow:var(--shadow-1);-webkit-tap-highlight-color:transparent;transition:transform .08s,box-shadow .12s}
.tile:active{transform:scale(.985)}
.tile:hover{box-shadow:0 4px 14px rgba(15,23,42,.08)}
.tile-ic{width:44px;height:44px;border-radius:12px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:20px;flex:0 0 44px}
.tile-text{display:flex;flex-direction:column;gap:4px;min-width:0}
.tile-text b{font:600 16px/20px Inter;color:var(--surface-900)}
.tile-text span{font:400 13px/18px Inter;color:var(--surface-500)}
.tile-wide{grid-column:1 / -1}
.tile-row{flex-direction:row;align-items:center;min-height:0;gap:14px}
.tile-row .tile-text{flex:1}
.tile-arrow{color:var(--surface-300);font-size:14px}
.tile-primary{background:var(--primary-600);color:#fff;flex-direction:row;align-items:center;min-height:0;padding:20px 16px}
.tile-primary .tile-ic{background:rgba(255,255,255,.18);color:#fff}
.tile-primary .tile-text{flex:1}
.tile-primary .tile-text b{color:#fff;font-size:18px;line-height:22px}
.tile-primary .tile-text span{color:rgba(255,255,255,.82)}
.tile-primary .tile-arrow{color:rgba(255,255,255,.7)}
.tile-primary:hover{background:var(--primary-700)}
.tile-off{opacity:.55}
.tile-badge{min-width:24px;height:24px;padding:0 8px;border-radius:12px;background:var(--warn-50);color:var(--warn-700);font:600 12px/24px Inter;text-align:center}
.menu-foot{padding:0 4px}
.page-home{max-width:none}
.tg-mode .page-home{padding-bottom:calc(16px + env(safe-area-inset-bottom))}
.tg-mode .menu-head{padding-top:4px}

/* отчёты в чат */
.rep-list{display:flex;flex-direction:column;gap:12px}
.rep-item{display:flex;flex-direction:column;gap:12px;padding:16px}
.rep-main{display:flex;gap:12px;align-items:flex-start}
.rep-ic{width:40px;height:40px;border-radius:10px;background:var(--primary-50);color:var(--primary-600);display:flex;align-items:center;justify-content:center;font-size:18px;flex:0 0 40px}
.rep-body{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}
.rep-title{font:600 15px/20px Inter;color:var(--surface-900);display:flex;align-items:center;gap:8px}
.rep-desc{font-size:13px;line-height:18px}
.rep-foot{display:flex;gap:8px;align-items:center;padding-left:52px}
.rep-foot .rep-arg{flex:1;min-width:0}
.rep-spacer{flex:1}
.rep-send{height:36px;padding:0 14px;flex:0 0 auto}
.rep-status{font:500 13px/18px Inter;color:var(--surface-600);display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-left:52px}
.rep-status.ok{color:var(--success-700)}
.rep-status.err{color:var(--danger-700)}
.rep-status .btn{height:28px;font-size:13px}
.rep-more{display:flex;align-items:center;gap:12px;padding:16px;text-decoration:none;color:inherit}
.rep-more .pi-chevron-right{color:var(--surface-300)}
#bStatus{padding-left:0}
.tg-mode .rep-foot,.tg-mode .rep-status{padding-left:0}
.tg-mode .rep-item{padding:14px}
.tg-mode .rep-actions{margin-left:0;width:100%}
.tg-mode .rep-actions .btn{flex:1}
.tg-mode #sendBtn{display:none}   /* в Telegram отправляет главная кнопка внизу */

/* поддержка */
.sup-text{height:auto;min-height:120px;resize:vertical;width:100%;padding:10px 12px;line-height:20px;font-family:inherit}
.sup-list{display:flex;flex-direction:column;gap:12px}
.sup-item{padding:12px 14px;border:1px solid var(--surface-200);border-radius:var(--radius-md);display:flex;flex-direction:column;gap:8px}
.sup-item.done{opacity:.7}
.sup-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px}
.sup-text-body{white-space:pre-wrap;color:var(--surface-800);line-height:20px;overflow-wrap:anywhere}
.sup-note{background:var(--surface-50);border-radius:8px;padding:8px 10px;font-size:13px;line-height:18px}
.sup-admin{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.sup-admin .grow{flex:1;min-width:160px}

/* полоска мини-приложения: «‹ Меню» и «×» — не зависят от кнопок Telegram */
.tg-bar{display:none}
.tg-mode .tg-bar{display:flex;align-items:center;gap:8px;padding:8px 8px 0;min-height:40px}
.tg-bar-btn{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 10px;border:0;border-radius:16px;background:#fff;color:var(--primary-600);font:500 14px/18px Inter;text-decoration:none;cursor:pointer;box-shadow:var(--shadow-1)}
.tg-bar-btn .pi{font-size:12px}
.tg-bar-close{width:32px;padding:0;justify-content:center;color:var(--surface-500)}
.tg-bar-close .pi{font-size:14px}
.tg-bar-title{font:600 15px/20px Inter;color:var(--surface-900);padding-left:8px}
.tg-bar-spacer{flex:1}
.tg-mode .page{padding-top:8px}

/* ИИ-режим на телефоне: плотнее шапка и сообщения, без подписи под полем, список чатов — шторкой по кнопке */
.tg-mode .body-ai .content{height:auto;min-height:0}
.tg-mode .chat{border-radius:var(--radius-lg)}
.tg-mode .chat-head{padding:12px 14px 10px;gap:8px}
.tg-mode .chat-title{font-size:16px;line-height:22px}
.tg-mode .chat-head-meta{font-size:12px}
.tg-mode .msgs{padding:12px 12px;gap:14px}
.tg-mode .msg-user .bubble{max-width:88%}
.tg-mode .msg-tools{opacity:1;margin-left:0}
.tg-mode .md table{display:block;max-width:100%;overflow-x:auto;font-size:13px}
.tg-mode .chat-empty{padding:12px 0}
.tg-mode .suggestions{grid-template-columns:1fr}
.tg-mode .composer{padding:8px 10px 10px}
.tg-mode .composer-foot{display:none}
.tg-mode .composer-box textarea{font-size:16px;line-height:22px;padding:10px 12px 2px}  /* 16px — iOS не зумит поле при фокусе */
.tg-mode.show-chatlist .chatlist{display:flex;position:fixed;left:8px;right:8px;top:48px;bottom:calc(64px + env(safe-area-inset-bottom));z-index:55;box-shadow:var(--shadow-dialog)}
.tg-mode.show-chatlist #btnChats{color:var(--primary-600);border-color:var(--primary-100);background:var(--primary-50)}
/* поле ввода ИИ-режима на телефоне — крупнее: выше поле, шрифт 17 px, кнопки 44 px */
.tg-mode .composer{padding:10px 10px 12px}
.tg-mode .composer-box{border-radius:16px}
.tg-mode .composer-box textarea{font-size:17px;line-height:24px;min-height:76px;max-height:200px;padding:14px 16px 4px}
.tg-mode .composer-bar{padding:4px 10px 10px}
.tg-mode .composer-bar .btn-icon,.tg-mode .composer-bar .btn-send{width:44px;height:44px;flex:0 0 44px;border-radius:12px}
.tg-mode .composer-bar .btn-icon .pi,.tg-mode .composer-bar .btn-send .pi{font-size:18px}
.tg-mode .composer-status{font-size:13px}
.chart-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
.chart-actions .rep-status{padding-left:0}
.bld-chat{min-width:160px;max-width:260px}
.bld-send-status{padding-left:0;margin-top:8px}
.md .md-chart{display:block;margin:8px 0}
.md .md-chart img{display:block;max-width:100%;border:1px solid var(--surface-200);border-radius:8px;background:#fff}
.bld-kind{min-width:150px;max-width:230px}
.bld-row-label{min-width:64px;color:var(--surface-500)}
.bld-actions{display:flex;flex-wrap:wrap;gap:24px 40px;padding:16px 28px}
.bld-actions-group{display:flex;flex-direction:column;gap:8px;min-width:0}
.bld-actions-title{font:500 14px/18px Inter;color:var(--surface-900)}
.bld-actions-title .muted{font-weight:400}
.bld-actions-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.bld-notes b{color:var(--surface-700);font-weight:500}

/* ---------- дашборды (/dashboards, /dashboard/<id>): несколько наборов конструктора на одной странице ---------- */
.brd-head{display:flex;flex-direction:column;gap:14px}
.brd-crumbs a{color:var(--surface-500);text-decoration:none}
.brd-crumbs a:hover{color:var(--primary-600)}
.brd-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.brd-status{padding-left:0}
.brd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
.brd-grid.one{grid-template-columns:1fr}
.brd-panel{padding:16px 20px;min-width:0}
.brd-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:8px}
.brd-panel-title{min-width:0}
.brd-panel-actions{display:flex;gap:6px;flex-shrink:0}
.btn-sm{height:28px;padding:4px 8px;font-size:13px}
.brd-chart{height:240px}
.brd-panel .legend{margin-bottom:8px}
.brd-panel .legend .item{font-size:12px;padding:2px 6px}
.brd-panel .bld-notes{font-size:12px}
.brd-error{color:var(--danger-700);display:flex;gap:8px;align-items:center;padding:24px 0;font-size:14px}
.brd-list-title{margin:8px 0 -4px}
.brd-item{text-decoration:none;color:inherit}
.brd-item .rep-main{align-items:center}
.brd-arrow{color:var(--surface-300);margin-left:auto}
@media (max-width:1100px){.brd-grid{grid-template-columns:1fr}.brd-btn-text{display:none}}
.tg-mode .brd-grid{grid-template-columns:1fr;gap:12px}
.tg-mode .brd-panel{padding:12px}
.tg-mode .brd-chart{height:200px}
.tg-mode .brd-actions .btn{flex:1 1 auto}
