/* ------------------------------------------------------------ темы */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f9f9f9;
  --hover: #ececec;
  --active: #e3e3e3;
  --text: #0d0d0d;
  --text2: #5d5d5d;
  --text3: #8f8f8f;
  --line: #e5e5e5;
  --line2: #d9d9d9;
  --bubble: #f4f4f4;
  --input: #ffffff;
  --card: #ffffff;
  --code: #f9f9f9;
  --solid: #0d0d0d;
  --solid-fg: #ffffff;
  --shadow: 0 4px 16px rgba(0,0,0,.06), 0 0 1px rgba(0,0,0,.12);
  --menu-shadow: 0 8px 28px rgba(0,0,0,.12), 0 0 1px rgba(0,0,0,.2);
  --link: #2964d9;
  --danger: #d93838;
  --good: #0a8f20;
  /* графики — порядок слотов фиксирован */
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600; --s5: #ee7fac; --s6: #008a17;
  --grid: #ececec;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #212121;
  --side: #171717;
  --hover: #2a2a2a;
  --active: #303030;
  --text: #ececec;
  --text2: #b4b4b4;
  --text3: #8a8a8a;
  --line: #333333;
  --line2: #424242;
  --bubble: #303030;
  --input: #303030;
  --card: #262626;
  --code: #171717;
  --solid: #ececec;
  --solid-fg: #0d0d0d;
  --shadow: 0 0 0 1px rgba(255,255,255,.04);
  --menu-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 0 1px #3a3a3a;
  --link: #7ab7ff;
  --danger: #f06a6a;
  --good: #3ccf55;
  --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05; --s5: #e24d8b; --s6: #0aac23;
  --grid: #2f2f2f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.6 ui-sans-serif, -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--text2); }
.small { font-size: 12.5px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace; font-size: .88em; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ------------------------------------------------------------ кнопки */
.btn { border: 1px solid var(--line2); background: var(--bg); border-radius: 999px; padding: 7px 16px; font-size: 14px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--solid); color: var(--solid-fg); border-color: var(--solid); font-weight: 500; }
.btn.primary:hover { opacity: .88; }
.icon-btn { border: 0; background: transparent; color: var(--text2); padding: 7px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.round-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; }
.round-btn.solid { background: var(--solid); color: var(--solid-fg); }
.round-btn.solid:disabled { opacity: .25; cursor: default; }
.round-btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line2); }
.round-btn.ghost:hover { background: var(--hover); }
.round-btn svg.i { width: 18px; height: 18px; stroke-width: 2.2; }

/* ------------------------------------------------------------ вход */
.login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-box { display: grid; gap: 12px; width: min(340px, 90vw); text-align: center; }
.login-box h1 { margin: 4px 0 10px; font-size: 26px; font-weight: 600; }
.login-box input { padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--bg); }
.login-box .btn { padding: 11px; }
.logo-big { justify-self: center; } .logo-big svg.i { width: 40px; height: 40px; }
.err { color: var(--danger); min-height: 1.2em; font-size: 14px; }

/* ------------------------------------------------------------ каркас */
.app { display: flex; height: 100dvh; }
.sidebar { width: 260px; flex: none; background: var(--side); display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; }
.brand-logo svg.i { width: 22px; height: 22px; }
.side-nav { padding: 4px 8px; display: grid; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; text-align: left; font-size: 14px; color: var(--text); }
.nav-item:hover { background: var(--hover); }
.nav-item.on { background: var(--active); }
.nav-search { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 9px; color: var(--text2); }
.nav-search:focus-within { background: var(--hover); }
.nav-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; padding: 2px 0; color: var(--text); }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.chat-group { color: var(--text3); font-size: 12px; font-weight: 500; padding: 14px 10px 4px; }
.chat-item { display: flex; align-items: center; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item .pin svg.i { width: 14px; height: 14px; color: var(--text3); }
.side-foot { padding: 8px; border-top: 1px solid var(--line); display: grid; gap: 1px; }
.scrim { display: none; }

.view { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 56px; }
.view-title { margin: 0 4px; font-size: 18px; font-weight: 600; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--hover); color: var(--text2); }

/* выбор модели и меню */
.model-wrap { position: relative; }
.model-btn { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; font-size: 17px; font-weight: 500; padding: 6px 10px; border-radius: 10px; max-width: 60vw; }
.model-btn:hover { background: var(--hover); }
.model-btn #modelName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-btn svg.i { width: 16px; height: 16px; color: var(--text2); }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 260px; max-width: 340px; max-height: 60vh; overflow-y: auto;
  background: var(--bg); border-radius: 14px; box-shadow: var(--menu-shadow); padding: 6px; }
[data-theme="dark"] .menu { background: #2f2f2f; }
.menu.right { left: auto; right: 0; min-width: 210px; }
.menu.up { top: auto; bottom: calc(100% + 8px); min-width: 210px; }
.menu-label { font-size: 12px; color: var(--text3); padding: 8px 10px 4px; display: flex; justify-content: space-between; align-items: center; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px; text-align: left; font-size: 14px; }
.menu-item:hover { background: var(--hover); }
[data-theme="dark"] .menu-item:hover { background: #3a3a3a; }
.menu-item.danger { color: var(--danger); }
.menu-item .chk { margin-left: auto; }
.menu-item .sub { color: var(--text3); font-size: 12px; margin-left: auto; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-note { padding: 8px 10px; font-size: 13px; color: var(--text2); }
.menu-note.bad { color: var(--danger); }

/* ------------------------------------------------------------ сообщения */
.messages { flex: 1; overflow-y: auto; padding: 8px 16px 24px; }
.msg { max-width: 768px; margin: 0 auto 28px; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .bubble { background: var(--bubble); border-radius: 22px; padding: 10px 18px; max-width: 80%; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { word-wrap: break-word; }
.acts { display: flex; gap: 2px; align-items: center; color: var(--text3); font-size: 12.5px; margin-top: 4px; min-height: 30px; }
.acts .icon-btn { padding: 6px; }
.acts .icon-btn svg.i { width: 16px; height: 16px; }
.msg.user .acts { opacity: 0; transition: opacity .15s; }
.msg.user:hover .acts { opacity: 1; }
.acts .stat { margin-left: 6px; }
.err-box { color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent);
  padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-top: 8px; white-space: pre-wrap; }
.think { margin: 0 0 12px; color: var(--text2); font-size: 14px; }
.think summary { cursor: pointer; user-select: none; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.think summary::-webkit-details-marker { display: none; }
.think summary::after { content: "›"; transition: transform .15s; }
.think[open] summary::after { transform: rotate(90deg); }
.think .think-body { white-space: pre-wrap; margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line); }
.shimmer { background: linear-gradient(90deg, var(--text3) 0%, var(--text) 50%, var(--text3) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: sh 1.6s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.dot-live { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text); animation: pulse 1s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .5; } }

/* вложения в сообщении */
.m-atts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; justify-content: flex-end; margin-bottom: 8px; max-width: 80%; }
.m-img { width: 220px; max-height: 260px; object-fit: cover; border-radius: 16px; cursor: zoom-in; border: 1px solid var(--line); }
.m-atts.many .m-img { width: 120px; height: 120px; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg); max-width: 260px; text-decoration: none; color: var(--text); }
.file-chip .fi { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--s1); color: #fff; flex: none; }
.file-chip .fi svg.i { width: 18px; height: 18px; }
.file-chip .fn { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fs { font-size: 12px; color: var(--text2); }
.file-chip > div { min-width: 0; }

/* markdown */
.md p { margin: 0 0 12px; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 8px; line-height: 1.3; font-weight: 600; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 26px; }
.md li { margin: 4px 0; }
.md a { color: var(--link); }
.md blockquote { margin: 0 0 12px; padding-left: 14px; border-left: 3px solid var(--line2); color: var(--text2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md :not(pre) > code { background: var(--bubble); padding: 2px 6px; border-radius: 6px; }
.md table { border-collapse: collapse; margin: 0 0 12px; display: block; overflow-x: auto; font-size: 14px; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.md th { font-weight: 600; border-bottom-color: var(--line2); }
.code { margin: 0 0 12px; border-radius: 14px; overflow: hidden; background: var(--code); border: 1px solid var(--line); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 16px; color: var(--text2); font-size: 12.5px; }
.code-head .icon-btn { font-size: 12.5px; gap: 5px; display: flex; padding: 4px 8px; }
.code-head .icon-btn svg.i { width: 14px; height: 14px; }
.code pre { margin: 0; padding: 4px 16px 14px; overflow-x: auto; font: 13.5px/1.55 ui-monospace, "Cascadia Code", Consolas, Menlo, monospace; }
.edit-box { width: 100%; max-width: 768px; background: var(--bubble); border-radius: 22px; padding: 12px 14px; display: grid; gap: 8px; }
.edit-box textarea { width: 100%; min-height: 60px; background: transparent; border: 0; outline: 0; resize: vertical; }
.edit-box .row { display: flex; gap: 8px; justify-content: flex-end; }

/* ------------------------------------------------------------ поле ввода */
.bottom { padding: 0 16px calc(8px + env(safe-area-inset-bottom)); }
.hero { display: none; text-align: center; }
.hero h1 { font-size: 28px; font-weight: 500; margin: 0 0 26px; letter-spacing: -.01em; }
.chat-view.empty .messages { display: none; }
.chat-view.empty .bottom { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 12vh; }
.chat-view.empty .hero { display: block; }
.chat-view.empty .foot-note { visibility: hidden; }
.composer { position: relative; max-width: 768px; margin: 0 auto; width: 100%; background: var(--input); border: 1px solid var(--line2); border-radius: 28px;
  box-shadow: var(--shadow); padding: 10px 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; }
[data-theme="dark"] .composer { border-color: transparent; }
.composer textarea { resize: none; border: 0; outline: 0; background: transparent; max-height: 40vh; padding: 4px 8px; font-size: 16px; line-height: 1.5; }
.comp-actions { display: flex; align-items: center; gap: 8px; }
.composer.drag { outline: 2px dashed var(--s1); outline-offset: 2px; }
.drop-hint { position: absolute; inset: 0; border-radius: 28px; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 85%, transparent); font-weight: 500; z-index: 2; }
.att-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 2px 4px; }
.att-row:empty { display: none; }
.att { position: relative; }
.att img { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; display: block; border: 1px solid var(--line); }
.att .file-chip { height: 64px; }
.att .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--solid); color: var(--solid-fg); display: grid; place-items: center; padding: 0; }
.att .x svg.i { width: 12px; height: 12px; stroke-width: 2.6; }
.att.loading::after { content: ""; position: absolute; inset: 0; border-radius: 14px; background: color-mix(in srgb, var(--bg) 55%, transparent); }
.att.loading::before { content: ""; position: absolute; z-index: 1; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border: 2px solid var(--text3); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot-note { text-align: center; font-size: 12px; color: var(--text3); padding: 8px 0 2px; }

/* камера и картинки */
.cam-dlg { width: min(720px, 96vw); padding: 0; background: #000; border: 0; }
.cam-wrap video { width: 100%; display: block; max-height: 70vh; background: #000; }
.cam-actions { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: #111; }
.cam-actions .btn { background: transparent; color: #fff; border-color: #555; }
.shutter { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 3px #111; }
.shutter:active { transform: scale(.94); }
.img-dlg { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
.img-dlg img { max-width: 96vw; max-height: 94vh; display: block; border-radius: 10px; }

/* ------------------------------------------------------------ диалоги */
.dlg { border: 0; border-radius: 18px; background: var(--bg); color: var(--text); padding: 0; width: min(520px, 94vw); box-shadow: var(--menu-shadow); }
[data-theme="dark"] .dlg:not(.cam-dlg):not(.img-dlg) { background: #2f2f2f; }
.dlg.wide-dlg { width: min(720px, 96vw); }
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg-body { padding: 22px 24px; display: grid; gap: 12px; max-height: 88vh; overflow: hidden auto; }
.dlg h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.dlg h3 { margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.dlg label { display: grid; gap: 5px; font-size: 14px; color: var(--text2); }
.dlg input, .dlg textarea, .dlg select { background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; color: var(--text); min-width: 0; width: 100%; }
[data-theme="dark"] .dlg input, [data-theme="dark"] .dlg textarea, [data-theme="dark"] .dlg select { background: #212121; }
.dlg textarea { resize: vertical; }
.dlg-actions { display: flex; gap: 8px; margin-top: 10px; }
.hint { color: var(--text3); font-size: 12.5px; margin: 0; font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2.tight { grid-template-columns: 1fr 90px; gap: 6px; }
.prov { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.6fr) minmax(0,1fr) auto auto; gap: 6px; align-items: center; }
.prov .p-res { grid-column: 1 / -1; }
.prov .p-res.ok { color: var(--good); }
.prov .p-res.bad { color: var(--danger); }
#provList { display: grid; gap: 10px; }

/* ------------------------------------------------------------ умный дом */
.home-scroll { flex: 1; overflow-y: auto; padding: 4px 24px 40px; }
.home-scroll > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.tile .lbl { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.tile .lbl svg.i { width: 15px; height: 15px; }
.tile .val { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 15px; font-weight: 500; color: var(--text2); margin-left: 3px; }
.tile .sub { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.delta-up { color: var(--danger); } .delta-down { color: var(--good); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.seg { display: inline-flex; background: var(--hover); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; color: var(--text2); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.chart { position: relative; height: 220px; }
.chart.tall { height: 260px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .ax { fill: var(--text3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .dl { font-size: 11.5px; fill: var(--text); font-weight: 500; }
.chart .xh { stroke: var(--text3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text2); margin: -2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--bg); color: var(--text); border-radius: 10px; box-shadow: var(--menu-shadow);
  padding: 8px 11px; font-size: 12.5px; line-height: 1.5; min-width: 120px; }
[data-theme="dark"] .tip { background: #2f2f2f; }
.tip b { font-weight: 600; }
.tip .r { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.section-title { font-size: 16px; font-weight: 600; margin: 22px auto 10px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.fact .em { font-size: 26px; line-height: 1; }
.fact .ft { font-size: 14px; color: var(--text2); }
.fact .fv { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.room { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.room-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.room-head h4 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.room-head .rt { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.room-head .rh { font-size: 13px; color: var(--text2); }
.dev { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dev .dn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .ds { color: var(--text2); font-size: 13px; }
.dev .ds.on { color: var(--text); font-weight: 500; }
.dev svg.i { width: 16px; height: 16px; color: var(--text3); }
.dev.is-on svg.i { color: var(--s4); }
.sw { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line2); border: 0; padding: 0; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.sw.on { background: var(--good); }
.sw.on::after { transform: translateX(16px); }

/* ------------------------------------------------------------ мобильные */
.only-mobile { display: none !important; }
@media (max-width: 800px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .22s ease; width: 82vw; max-width: 310px; border-right: 0; }
  .app.side-open .sidebar { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.4); }
  .topbar { padding: 6px 8px; min-height: 50px; }
  .model-btn { font-size: 16px; }
  .messages { padding: 8px 12px 20px; }
  .bottom { padding: 0 10px calc(6px + env(safe-area-inset-bottom)); }
  .hero h1 { font-size: 23px; }
  .msg.user .acts { opacity: 1; }
  .home-scroll { padding: 4px 12px 32px; }
  .grid2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile .val { font-size: 23px; }
  .row2 { grid-template-columns: 1fr; }
  .prov { grid-template-columns: 1fr auto auto; }
  .prov .p-url, .prov .p-key { grid-column: 1 / -1; }
  #homeUpd { display: none; }
}

/* голосовой ввод */
#micBtn.recording { background: #e5484d; color: #fff; animation: micPulse 1.2s ease-in-out infinite; }
#micBtn.busy { opacity: .55; cursor: progress; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .45); } 50% { box-shadow: 0 0 0 7px rgba(229, 72, 77, 0); } }
