/* ===== Шрифты (локально) ===== */
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:400;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:400;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/ibm-plex-mono-cyrillic-500-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/ibm-plex-mono-cyrillic-600-normal.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* ===== Токены ===== */
:root{
  --bg:#e5e8ed;--panel:#fff;--tabs:#ecf1f4;--text:#1d2733;--muted:#545962;--faint:#6b747d;--line:#d5dce2;
  --hover:#f3f6f8;--sel:#e3f2fd;--selInk:#0b4f8a;--accent:#00796b;--accentHover:#00695c;--accentSoft:#e0f2f1;--brand:#009688;
  --navy:#004166;--gas:#f2c500;--meth:#3d2fd6;--open:#27c93f;--closed:#1c2127;--fault:#e53935;--tile:#2fd24a;--tileInk:#07260e;
  --pcell:#fff;--scrim:rgba(10,20,28,.45);--shadow:0 12px 40px rgba(10,20,28,.14);
  --font:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",sans-serif;--mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  color-scheme:light;
}
[data-theme="dark"]{
  --bg:#0f1519;--panel:#182127;--tabs:#1e2930;--text:#e4eaee;--muted:#b3bdc5;--faint:#8b97a0;--line:#2c3942;
  --hover:#223038;--sel:#173a57;--selInk:#a9d5ff;--accent:#12897c;--accentHover:#16a092;--accentSoft:#133a37;
  --navy:#8cc0e2;--gas:#e0b800;--meth:#8a80ff;--closed:#dfe5ea;--pcell:#2a353d;--scrim:rgba(0,0,0,.6);--shadow:0 12px 40px rgba(0,0,0,.5);
  color-scheme:dark;
}

/* ===== База ===== */
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font-family:var(--font);-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
button:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
svg{flex-shrink:0}
.sidebar svg,.topbar svg,.icon-btn svg,.tree svg,.tabs svg,.zoom svg,.sheet svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
[hidden]{display:none !important}

.app{display:grid;grid-template-columns:72px minmax(0,1fr);grid-template-rows:minmax(0,1fr);height:100vh;height:100dvh;overflow:hidden}
#layer{display:contents}

/* ===== Левая панель ===== */
.sidebar{display:flex;flex-direction:column;background:var(--panel);border-right:1px solid var(--line);min-height:0}
.nav-item{position:relative;width:72px;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:var(--faint)}
.nav-item:hover{background:var(--hover);color:var(--text)}
.nav-item.is-on{background:var(--accentSoft);color:var(--accent)}
.nav-item.is-on::before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:3px;border-radius:0 3px 3px 0;background:var(--accent)}
.logo{height:72px;border-bottom:1px solid var(--line)}
.logo img{width:48px;height:48px;object-fit:contain;display:block}
.logo.is-on{background:none}.logo.is-on::before{display:none}
.nav-main{display:flex;flex-direction:column;padding-top:8px}
.nav-cap{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.nav-home-m,.nav-more{display:none}
.badge{position:absolute;top:9px;right:15px;min-width:16px;height:16px;border-radius:8px;background:var(--fault);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center;padding:0 4px}
.nav-foot{margin-top:auto;display:flex;flex-direction:column;align-items:center;padding-bottom:12px}
.avatar{width:72px;height:64px;display:flex;align-items:center;justify-content:center}
.avatar img{width:40px;height:40px;border-radius:50%;object-fit:cover;border:2px solid var(--line)}
.util{width:72px;height:48px;display:flex;align-items:center;justify-content:center;color:var(--faint)}
.util:hover{background:var(--hover);color:var(--text)}
.util svg{width:22px;height:22px}
.i-sun{display:none}[data-theme="dark"] .i-sun{display:block}[data-theme="dark"] .i-moon{display:none}

/* ===== Основная колонка ===== */
.main{display:flex;flex-direction:column;min-width:0;min-height:0}
.topbar{height:64px;flex-shrink:0;display:flex;align-items:center;gap:12px;padding:0 16px}
.topbar h1{margin:0;font-size:22px;font-weight:500;color:var(--muted);flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-logo{display:none;width:32px;height:32px}
.btn{height:36px;padding:0 16px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:14px;font-weight:500;white-space:nowrap;flex-shrink:0}
.btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.75}
.btn-primary{background:var(--accent);color:#fff}.btn-primary:hover{background:var(--accentHover)}
.btn-ghost{color:var(--accent);border:1px solid var(--line)}.btn-ghost:hover{background:var(--hover)}

.workspace{position:relative;flex:1;min-height:0;display:flex;padding:0 16px 16px;overflow:hidden}
.panel{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--panel);overflow:hidden}

/* ===== Вкладки ===== */
.tabs{height:40px;flex-shrink:0;display:flex;background:var(--tabs);border-bottom:1px solid var(--line);transition:padding-right .28s cubic-bezier(.2,.8,.2,1)}
.tabs-list{display:flex;flex:1;min-width:0;overflow:hidden}
.tab{height:40px;display:flex;align-items:center;gap:4px;padding:0 6px 0 14px;flex:0 1 250px;min-width:72px;color:var(--muted);font-size:13px;border-right:1px solid var(--line)}
.tab:hover{background:var(--hover)}
.tab.is-active{background:var(--panel);color:var(--text);font-weight:500;box-shadow:inset 0 2px 0 var(--brand)}
.tab-label{flex:1;min-width:0;height:40px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tab-x{width:24px;height:24px;border-radius:3px;display:flex;align-items:center;justify-content:center;color:var(--faint);flex-shrink:0}
.tab-x:hover{background:var(--line);color:var(--text)}
.tab-x svg{width:14px;height:14px;stroke-width:2}
.tabs-select{display:none;flex:1;min-width:0;height:40px;align-items:center;gap:8px;padding:0 12px;font-size:14px;font-weight:500;background:var(--panel);box-shadow:inset 0 2px 0 var(--brand)}
.tabs-select span{flex:1;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tabs-select small{font-size:12px;font-weight:500;color:var(--faint)}
.tabs-select svg{width:18px;height:18px}
.add{width:40px;height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--accent);color:#fff}
.add:hover{background:var(--accentHover)}
.add svg{width:20px;height:20px;stroke-width:2.25}
.app.tree-open .tabs{padding-right:360px}

/* ===== Мнемосхема ===== */
.view{position:relative;flex:1;min-height:0;display:flex}
.mnemo-layout{flex:1;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) 340px;min-height:0}
.stage{position:relative;min-width:0;min-height:0;overflow:hidden;touch-action:none}
.stage svg.mnemo{position:absolute;inset:0;width:100%;height:100%;display:block;font-family:var(--font);user-select:none;-webkit-user-select:none}
.stage.can-pan{cursor:grab}.stage.panning{cursor:grabbing}
.zoom{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:6px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.08)}
.zoom button{width:36px;height:36px;display:flex;align-items:center;justify-content:center;color:var(--muted)}
.zoom button+button{border-top:1px solid var(--line)}
.zoom button:hover{background:var(--hover);color:var(--text)}
.zoom svg{width:18px;height:18px}

.pipe.p-gas{fill:var(--gas)}.pipe.p-meth{fill:var(--meth)}
.g-open{fill:var(--open)}.g-closed{fill:var(--closed)}
.g-fault{fill:var(--fault);animation:blink 1s steps(2,start) infinite}
@keyframes blink{50%{opacity:.35}}
.glyph{stroke:rgba(0,0,0,.35);stroke-width:.8}
.hit{fill:transparent}
.valve{cursor:pointer;outline:none}
.valve:hover .hit,.valve:focus-visible .hit{fill:rgba(0,150,136,.2)}
.valve:focus-visible .hit{stroke:var(--brand);stroke-width:1.5}
.vlabel{font-size:9px;fill:var(--muted);pointer-events:none}
.mt{font-size:9.5px;fill:var(--muted)}
.mt.t-title{font-size:12.5px;font-weight:600;fill:var(--text)}
.mt.t-r{font-size:10px;fill:var(--text)}
.mt.t-metran{font-size:9px;fill:var(--faint);text-decoration:underline}
.a-gas{fill:var(--gas)}.a-meth{fill:var(--meth)}
.tile-num{font-size:9.5px;fill:var(--muted)}
.tile-box{fill:none;stroke:var(--muted);stroke-width:1}
.tile-p{fill:var(--pcell)}
.tile-pt{font-size:9.5px;fill:var(--text)}
.tile-v{fill:var(--tile)}.tile-v.is-zero{fill:var(--line)}
.tile-vt{font-family:var(--mono);font-weight:600;font-size:12px;fill:var(--tileInk)}
.tile-vt.is-zero{fill:var(--muted)}
.tile-u{font-size:8.5px;fill:var(--faint)}
.mini rect,.dp rect{fill:var(--panel);stroke:var(--line)}
.dp rect{stroke:var(--muted)}
.mini text,.dp text{font-size:8.5px;fill:var(--muted);pointer-events:none}
.mini.is-on rect,.dp.is-on rect{fill:var(--navy);stroke:var(--navy)}
.mini.is-on text,.dp.is-on text{fill:var(--panel)}
.mini,.dp{cursor:pointer}
.mini:hover rect,.dp:hover rect{stroke:var(--brand)}
.stem{fill:var(--closed)}
.big-label{font-size:9.5px;fill:var(--text)}

/* Сводка */
.summary{border-left:1px solid var(--line);padding:28px;display:flex;flex-direction:column;gap:20px;min-height:0;overflow:hidden}
.overline{font-size:12px;font-weight:500;letter-spacing:.06em;text-transform:uppercase;color:var(--faint)}
.updated{font-size:12px;color:var(--faint);margin-top:4px}
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.stat{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:12px}
.stat b{display:block;font-family:var(--mono);font-size:24px;font-weight:600;line-height:1.2}
.stat span{font-size:12px;color:var(--muted)}
.stat.is-alarm b{color:var(--fault)}
.legend{display:flex;flex-direction:column;gap:10px}
.lg{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted)}
.lg .sw{width:28px;display:flex;justify-content:center;align-items:center}
.summary-note{margin-top:auto;font-size:12px;line-height:18px;color:var(--faint)}

/* Пустые состояния */
.empty{flex:1;display:flex;align-items:center;justify-content:center;padding:24px}
.empty-in{max-width:440px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:12px}
.empty-in h2{margin:0;font-size:18px;font-weight:500}
.empty-in p{margin:0;font-size:14px;line-height:21px;color:var(--muted)}
.empty-in svg{width:56px;height:56px;fill:none;stroke:var(--faint);stroke-width:1.25;stroke-linecap:round;stroke-linejoin:round}
.app.tree-open .empty{padding-right:384px}

/* ===== Страницы разделов ===== */
.page{flex:1;min-height:0;padding:32px 40px;display:flex;flex-direction:column;gap:20px;overflow:hidden}
.page h2{margin:0;font-size:20px;font-weight:500}
.page .lead{margin:6px 0 0;font-size:14px;color:var(--muted)}
.card{background:var(--panel);border:1px solid var(--line);border-radius:6px}
.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;max-width:1000px}
.hcard{padding:20px;display:flex;flex-direction:column;gap:8px;text-align:left;min-height:120px}
.hcard:hover{border-color:var(--brand);box-shadow:0 2px 10px rgba(0,0,0,.06)}
.hcard b{font-size:16px;font-weight:500;overflow-wrap:anywhere;hyphens:auto}
.hcard span{font-size:13px;color:var(--muted)}
.hcard i{margin-top:auto;font-style:normal;font-size:13px;font-weight:500;color:var(--accent)}
.table-wrap{overflow:hidden;max-width:1000px;flex-shrink:1;min-height:0}
table{width:100%;border-collapse:collapse;font-size:13px}
th{font-weight:500;color:var(--faint);text-align:left;padding:10px 16px;border-bottom:1px solid var(--line);background:var(--hover)}
td{padding:10px 16px;border-bottom:1px solid var(--line);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:0}
td.mono{font-family:var(--mono)}
.table-empty{padding:32px 16px;text-align:center;font-size:14px;color:var(--muted)}
.more-note{padding:10px 16px;font-size:12px;color:var(--faint)}
.alerts{display:flex;flex-direction:column;gap:10px;max-width:760px}
.alert{padding:16px 20px;display:flex;align-items:center;gap:16px}
.alert .dot{width:10px;height:10px;border-radius:50%;background:var(--fault);flex-shrink:0}
.alert .txt{flex:1;min-width:0}
.alert b{display:block;font-size:15px;font-weight:500}
.alert small{display:block;font-size:13px;color:var(--muted);margin-top:2px}
.alert-actions{display:flex;gap:8px}

/* ===== Дерево объектов ===== */
.tree{position:absolute;top:0;right:16px;bottom:16px;width:360px;display:flex;flex-direction:column;background:var(--panel);border-left:1px solid var(--line);transform:translateX(calc(100% + 16px));transition:transform .28s cubic-bezier(.2,.8,.2,1),box-shadow .28s;visibility:hidden;z-index:5}
.app.tree-open .tree{transform:none;visibility:visible;box-shadow:-8px 0 24px rgba(0,0,0,.08)}
.tree-head{height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 3px 0 16px;background:var(--hover);border-bottom:1px solid var(--line);font-size:13px;font-weight:500;color:var(--muted)}
.tree-hint{padding:8px 16px;font-size:12px;line-height:17px;background:var(--accentSoft)}
.tree-search{height:44px;flex-shrink:0;display:flex;align-items:center;gap:8px;padding:0 5px 0 16px;border-bottom:1px solid var(--line)}
.tree-search .i-search{width:20px;height:20px;color:var(--faint)}
.tree-search input{flex:1;min-width:0;height:32px;border:0;background:transparent;color:var(--text);font:inherit;font-size:13px}
.tree-search input::placeholder{color:var(--faint)}
.tree-search input:focus{outline:none}
.icon-btn{width:34px;height:34px;border-radius:4px;display:flex;align-items:center;justify-content:center;color:var(--faint);flex-shrink:0}
.icon-btn:hover{background:var(--line);color:var(--text)}
.icon-btn svg{width:20px;height:20px}
.icon-btn.sm{width:28px;height:28px}.icon-btn.sm svg{width:14px;height:14px;stroke-width:2}
.icon-btn.is-on{color:var(--accent);background:var(--accentSoft)}
.tree-rows{flex:1;min-height:0;overflow:hidden;padding:4px 0}
.trow{width:100%;height:36px;display:flex;align-items:center;gap:4px;padding-right:12px;font-size:13px;text-align:left}
.trow:hover{background:var(--hover)}
.trow.lvl1{font-weight:500}
.trow.is-sel{background:var(--sel);color:var(--selInk);font-weight:500}
.chev{width:20px;height:20px;display:flex;align-items:center;justify-content:center;color:var(--faint);transition:transform .15s;flex-shrink:0}
.chev svg{width:16px;height:16px;stroke-width:2}
.chev.is-open{transform:rotate(90deg)}
.tlabel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trow mark{background:#ffe08a;color:#1d2733;border-radius:2px}
.tree-empty{padding:24px 16px;font-size:13px;color:var(--muted)}

/* ===== Слои: модалки, меню ===== */
.scrim{position:fixed;inset:0;background:var(--scrim);display:flex;align-items:center;justify-content:center;padding:16px;z-index:40;animation:fade .15s ease-out}
@keyframes fade{from{opacity:0}}
.dialog{width:540px;max-width:100%;padding:28px 32px;display:flex;flex-direction:column;gap:14px;box-shadow:var(--shadow)}
.dialog-head{display:flex;justify-content:space-between;align-items:center}
.dialog h2{margin:0;font-size:20px;font-weight:500}
.dialog p{margin:0 0 8px;font-size:14px;line-height:22px;color:var(--muted)}
.dialog p b{color:var(--text);font-weight:500}
.dialog .btn{align-self:flex-end}
.login{position:fixed;inset:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:60;padding:16px}
.login .card{width:380px;max-width:100%;padding:36px;display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center}
.login img{width:104px;height:100px}
.login h2{margin:0;font-size:20px;font-weight:500}
.login p{margin:0;font-size:14px;color:var(--muted)}
.menu{position:fixed;z-index:45;background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow);padding:6px;min-width:240px;animation:fade .12s ease-out}
.menu-item{width:100%;min-height:44px;display:flex;align-items:center;gap:10px;padding:0 10px;border-radius:6px;font-size:14px;text-align:left}
.menu-item:hover{background:var(--hover)}
.menu-item.is-active{background:var(--sel);color:var(--selInk);font-weight:500}
.menu-item .grow{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.menu-item svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.menu-row{display:flex;align-items:center;gap:4px}.menu-row .menu-item{flex:1;width:auto;min-width:0}
.menu-x{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:4px;color:var(--faint)}
.menu-x:hover{background:var(--line);color:var(--text)}
.menu-x svg{width:14px;height:14px;stroke-width:2}
.sheet-scrim{position:fixed;inset:0;background:var(--scrim);z-index:44;animation:fade .15s}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:45;background:var(--panel);border-radius:16px 16px 0 0;padding:8px 12px calc(12px + env(safe-area-inset-bottom));box-shadow:var(--shadow);animation:up .2s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(100%)}}
.sheet-grip{width:36px;height:4px;border-radius:2px;background:var(--line);margin:4px auto 10px}
.sheet-user{display:flex;align-items:center;gap:12px;padding:6px 10px 12px;border-bottom:1px solid var(--line);margin-bottom:6px}
.sheet-user img{width:40px;height:40px;border-radius:50%;object-fit:cover}
.sheet-user b{font-size:15px;font-weight:500}.sheet-user small{display:block;font-size:12px;color:var(--muted)}

/* ===== Средние экраны: 768–1279 ===== */
@media (max-width:1279px){
  .mnemo-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
  .summary{order:-1;border-left:0;border-bottom:1px solid var(--line);padding:10px 16px;flex-direction:row;align-items:center;gap:16px}
  .summary .legend,.summary-note{display:none}
  .summary-head{flex:1;min-width:0}
  .stats{display:flex;gap:8px}
  .stat{padding:4px 10px;display:flex;align-items:baseline;gap:6px}
  .stat b{display:inline;font-size:16px}
  .app.tree-open .tabs{padding-right:0}
  .app.tree-open .empty{padding-right:24px}
  .app.tree-open .tree{box-shadow:-12px 0 32px rgba(0,0,0,.16)}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .page{padding:24px}
}

/* ===== Телефоны: < 768 или низкий экран (телефон в альбомной ориентации) ===== */
@media (max-width:767px),(max-height:560px){
  .app{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
  .sidebar{order:2;flex-direction:row;border-right:0;border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)}
  .logo,.nav-foot,.nav-desk{display:none}
  .nav-main{flex-direction:row;flex:1;padding:0}
  .nav-home-m,.nav-more{display:flex}
  .nav-item{flex:1;width:auto;height:58px}
  .nav-item svg{width:22px;height:22px}
  .nav-cap{position:static;width:auto;height:auto;clip:auto;font-size:10.5px;font-weight:500}
  .nav-item.is-on::before{left:25%;right:25%;top:0;bottom:auto;width:auto;height:3px;border-radius:0 0 3px 3px}
  .badge{top:5px;right:calc(50% - 20px)}
  .topbar{height:52px;padding:0 8px 0 12px;gap:10px}
  .topbar-logo{display:block}
  .topbar h1{font-size:16px;color:var(--text)}
  .topbar .btn{width:40px;height:40px;padding:0}
  .topbar .btn-label{display:none}
  .workspace{padding:0}
  .tabs-list{display:none}
  .tabs-select{display:flex}
  .tree{position:fixed;inset:0;right:0;bottom:0;width:auto;z-index:30;border-left:0;transform:translateX(100%)}
  .tree-head{height:52px;font-size:15px}
  .trow{height:44px;font-size:14px}
  .summary{padding:8px 12px;gap:8px}
  .summary .overline{display:none}
  .updated{margin:0}
  .stat{padding:3px 8px}
  .stat b{font-size:14px}.stat span{font-size:11px}
  .page{padding:16px;gap:14px}
  .page h2{font-size:18px}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .hcard{padding:14px;min-height:0;gap:6px}
  .hcard b{font-size:14px}.hcard span{font-size:12px}
  .hcard i{display:none}
  th,td{padding:8px 10px}
  .col-user{display:none}
  .alert{flex-wrap:wrap;padding:14px}
  .alert-actions{width:100%}
  .alert-actions .btn{flex:1}
  .dialog{padding:20px}
  .zoom{right:8px;bottom:8px}
}
@media (max-height:560px){
  .summary{padding:4px 12px}.summary-head{display:none}.summary .stats{margin-left:auto}
  .topbar{height:48px}
  .nav-item{height:50px}
  .cards{grid-template-columns:repeat(3,minmax(0,1fr))}
  .hcard span{display:none}
}

@media (prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important}
}
