/* RemoteDesk — интерфейс. Палитра: «туман», «бумага», тёмно-синие чернила, сигнальный синий. */
:root {
  --bg: #E8EDF4;
  --surface: #FFFFFF;
  --surface-2: #F3F6FA;
  --ink: #0F1D33;
  --muted: #56647C;
  --line: #D3DBE6;
  --line-2: #E4E9F1;
  --accent: #2458D6;
  --accent-2: #1C47B3;
  --accent-soft: #E3EBFC;
  --on-accent: #FFFFFF;
  --ok: #13A06B;
  --busy: #E0951F;
  --sleep: #6A5AE0;
  --off: #8E98AB;
  --danger: #D2423E;
  --bezel: #18233A;
  --shadow: 0 1px 2px rgba(15, 29, 51, .06), 0 8px 24px -12px rgba(15, 29, 51, .18);
  --radius: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", "DejaVu Sans", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1322; --surface: #121C2F; --surface-2: #17233A; --ink: #E6ECF6; --muted: #95A4BC;
    --line: #25334D; --line-2: #1C2940; --accent: #4F7DFF; --accent-2: #6B91FF; --accent-soft: #1A2A50;
    --bezel: #060A12; --ok: #22C383; --busy: #F0A93A; --sleep: #8C7DFF; --off: #6F7B91;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1322; --surface: #121C2F; --surface-2: #17233A; --ink: #E6ECF6; --muted: #95A4BC;
  --line: #25334D; --line-2: #1C2940; --accent: #4F7DFF; --accent-2: #6B91FF; --accent-soft: #1A2A50;
  --bezel: #060A12; --ok: #22C383; --busy: #F0A93A; --sleep: #8C7DFF; --off: #6F7B91;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.ic.sm { width: 18px; height: 18px; }
svg.ic.lg { width: 28px; height: 28px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
a { color: var(--accent); }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }

.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > .label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row2 { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* переключатель */
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .45; }

/* сегментный выбор */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 0;
  border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* значок «?» */
.q {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12.5px;
  font-weight: 700; line-height: 1; cursor: help; padding: 0;
}
.q:hover, .q[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.popover {
  position: fixed; z-index: 90; max-width: min(320px, calc(100vw - 24px)); padding: 10px 12px;
  border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.popover b { display: block; margin-bottom: 2px; }

/* ---------- каркас ---------- */
.shell { min-height: 100%; display: grid; grid-template-columns: 1fr; }
.rail { display: none; }
.main { min-width: 0; padding: 0 16px calc(84px + var(--safe-b)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  height: 60px; margin: 0 -16px; padding: 0 12px 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.brand-mark svg.ic { width: 18px; height: 18px; stroke-width: 2; }
.topbar .spacer { flex: 1; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column;
  grid-auto-columns: 1fr; padding: 6px 6px calc(6px + var(--safe-b)); background: var(--surface);
  border-top: 1px solid var(--line); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none;
  font-size: 12px; font-weight: 600; border-radius: 10px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.page-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 18px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.page-head .sub { color: var(--muted); }
.me-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.me-chip .av { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex: none; }
.conn-dot.on { background: var(--ok); }

@media (min-width: 900px) {
  .shell { grid-template-columns: 92px 1fr; }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; position: sticky; top: 0; height: 100vh;
    padding: 18px 0; background: var(--surface); border-right: 1px solid var(--line); }
  .rail .brand-mark { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 18px; }
  .rail .brand-mark svg.ic { width: 22px; height: 22px; }
  .rail a { display: grid; justify-items: center; gap: 4px; width: 76px; padding: 10px 0; border-radius: 14px;
    color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; text-align: center; }
  .rail a:hover { background: var(--surface-2); color: var(--ink); }
  .rail a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .rail .grow { flex: 1; }
  .main { padding: 0 36px 48px; }
  .topbar { margin: 0 -36px; padding: 0 28px 0 36px; height: 68px; }
  .topbar .brand { display: none; }
  .tabbar { display: none; }
}

/* ---------- плитки компьютеров ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); }
.tile { position: relative; display: grid; gap: 14px; padding: 14px 14px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.monitor { position: relative; display: block; width: 100%; padding: 0; border: 0; margin: 0 0 12px; background: none; cursor: pointer; }
.monitor .bezel { position: relative; aspect-ratio: 16 / 10; border-radius: 12px; background: var(--bezel); padding: 6px; }
.monitor .bezel::after { content: ""; position: absolute; right: 9px; bottom: -1px; width: 5px; height: 2px; border-radius: 2px; background: #3a4660; }
.monitor .stand { position: absolute; left: 50%; bottom: -12px; width: 30%; height: 12px; transform: translateX(-50%);
  background: linear-gradient(var(--bezel), color-mix(in srgb, var(--bezel) 80%, #fff)); clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); }
.screen { position: relative; height: 100%; border-radius: 7px; overflow: hidden; display: grid; place-items: center;
  text-align: center; padding: 10px; color: #fff; transition: filter .2s; }
.monitor:hover .screen { filter: brightness(1.08); }
.screen .big { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.screen .small { font-size: 12.5px; opacity: .85; }
.screen svg.ic { width: 30px; height: 30px; }
.st-online .screen { background: radial-gradient(130% 110% at 15% 0%, #6FB3FF 0%, #2E6BEA 42%, #18337E 100%); }
.st-online .screen::before { content: ""; position: absolute; inset: auto 0 0 0; height: 18%; background: rgba(8, 18, 45, .38); }
.st-busy .screen { background: linear-gradient(155deg, #FFD27A 0%, #F0A33A 55%, #D9791C 100%); color: #3B2304; }
.st-sleep .screen { background: radial-gradient(120% 100% at 80% 0%, #4B3FA8 0%, #241D57 55%, #130F33 100%); color: #CFC8FF; }
.st-offline .screen { background: #222B3C; color: #7F8AA0; }
.led { position: absolute; left: 50%; bottom: 1px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #39445a; }
.st-online .led { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.st-busy .led { background: var(--busy); box-shadow: 0 0 8px var(--busy); }
.st-sleep .led { background: var(--sleep); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .25; } }
.tile-info { display: flex; align-items: flex-start; gap: 8px; }
.tile-info .who { flex: 1; min-width: 0; }
.tile-name { font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-status { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.online { background: var(--ok); } .dot.busy { background: var(--busy); } .dot.sleep { background: var(--sleep); } .dot.offline { background: var(--off); }
.tile-actions { display: flex; gap: 8px; }
.tile-actions .btn { flex: 1; }
.empty { display: grid; justify-items: start; gap: 12px; max-width: 560px; padding: 28px; border: 1.5px dashed var(--line);
  border-radius: 18px; background: var(--surface); }
.empty h2 { margin: 0; font-size: 19px; }
.empty ol { margin: 0; padding-left: 20px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 20px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- панели, листы, диалоги ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.card .lead { margin: 0 0 16px; color: var(--muted); }
.settings { display: grid; gap: 16px; max-width: 760px; }
.optrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.optrow:first-child { border-top: 0; }
.optrow .t { flex: 1; min-width: 0; }
.optrow .t .s { display: block; font-size: 13px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line); }

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 26, .45); display: grid; place-items: end center; }
.scrim.center { place-items: center; padding: 16px; }
.sheet { width: min(560px, 100%); max-height: min(86vh, 760px); overflow: auto; background: var(--surface); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); box-shadow: 0 -12px 40px rgba(0,0,0,.25);
  animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 12px; }
.sheet h3 { margin: 4px 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sheet .sec + .sec { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.dialog { width: min(440px, 100%); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .16s ease-out; }
.dialog h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; }
.dialog p { margin: 0 0 14px; color: var(--muted); }
.dialog .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@media (min-width: 700px) {
  .scrim.sheet-wrap { place-items: center; }
  .scrim.sheet-wrap .sheet { border-radius: 22px; padding-bottom: 18px; }
}

/* строки меню (как в RuDesktop): иконка — текст — «?» — значение */
.mrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 4px; border: 0;
  background: transparent; text-align: left; cursor: pointer; border-radius: 12px; color: inherit; }
.mrow:hover { background: var(--surface-2); }
.mrow .mi { color: var(--accent); }
.mrow .mt { flex: 1; min-width: 0; font-size: 15.5px; }
.mrow .mt small { display: block; color: var(--muted); font-size: 12.5px; }
.mrow.disabled { opacity: .5; }
.mrow .edit { color: var(--accent); }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); flex: none; position: relative; }
.radio.on { border-color: var(--accent); }
.radio.on::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.checkbox { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; color: #fff; }
.checkbox.on { background: var(--accent); border-color: var(--accent); }
.checkbox svg.ic { width: 16px; height: 16px; stroke-width: 2.6; }
.range { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 4px 4px 10px; }
.range input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }

/* жесты */
.gestures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 8px; margin-top: 18px; }
.gesture { display: grid; justify-items: center; text-align: center; gap: 4px; }
.gesture .gi { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.gesture .gh { font-size: 12px; color: var(--muted); line-height: 1.3; }
.gesture .ga { font-size: 14px; font-weight: 600; line-height: 1.25; }
@media (min-width: 560px) { .gestures { grid-template-columns: repeat(6, 1fr); } }

/* тосты */
.toasts { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 95;
  display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.28); font-size: 14.5px; animation: up .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast .tx { flex: 1; }
.toast button { border: 0; background: rgba(255,255,255,.18); color: inherit; border-radius: 8px; padding: 4px 10px; font-weight: 600; cursor: pointer; }

/* ---------- сеанс ---------- */
.session { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: 1fr auto; background: #070B13; color: #fff; }
.viewport { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewport canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; image-rendering: auto; box-shadow: 0 0 0 1px rgba(255,255,255,.04); }
.viewport.desktop canvas { cursor: default; }
.viewport.viewonly canvas { cursor: not-allowed; }
.vcursor, .rcursor { position: absolute; left: 0; top: 0; width: 22px; height: 22px; pointer-events: none; z-index: 3; }
.vcursor svg, .rcursor svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.7)); }
.rcursor { opacity: .75; }
.overlay-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; z-index: 4; }
.overlay-msg .box { display: grid; justify-items: center; gap: 12px; max-width: 420px; }
.overlay-msg .box p { margin: 0; color: #B9C4D8; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: #fff; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stats { position: absolute; top: 10px; left: 10px; z-index: 5; padding: 6px 10px; border-radius: 10px; background: rgba(6, 10, 20, .72);
  font-size: 12.5px; line-height: 1.5; color: #DCE5F5; pointer-events: none; font-variant-numeric: tabular-nums; }
.chips { position: absolute; top: 10px; right: 10px; z-index: 5; display: grid; gap: 6px; justify-items: end; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; background: rgba(6,10,20,.72);
  font-size: 12.5px; color: #E7EDF8; }
.chip.rec { background: #C62828; }
.chip.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: breathe 1.2s infinite; }
.chip.warn { background: rgba(224,149,31,.92); color: #2b1800; }

.bar { display: flex; align-items: center; justify-content: space-around; gap: 2px; padding: 6px 8px calc(6px + var(--safe-b));
  background: var(--accent); color: #fff; }
.bar .bbtn { display: grid; place-items: center; flex: 1 1 0; min-width: 0; max-width: 58px; height: 46px; border: 0; border-radius: 12px;
  background: transparent; color: #fff; cursor: pointer; position: relative; }
.bar .bbtn:hover, .bar .bbtn[aria-expanded="true"] { background: rgba(255,255,255,.16); }
.bar .bbtn:disabled { opacity: .45; }
.bar .bbtn svg.ic { width: 25px; height: 25px; }
.bar .badge { position: absolute; top: 6px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: #FF5A4E; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.bar .qbar { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); background: transparent;
  color: #fff; font-weight: 700; cursor: help; }
.floatbtn { position: absolute; right: 14px; bottom: calc(14px + var(--safe-b)); z-index: 6; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); cursor: pointer; }
.session.barless { grid-template-rows: 1fr 0; }
.session.barless .bar { display: none; }

.kbbar { display: flex; gap: 6px; overflow-x: auto; padding: 8px; background: #0F1828; scrollbar-width: none; }
.kbbar::-webkit-scrollbar { display: none; }
.kbbar button { flex: none; min-width: 46px; height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid #2A3954;
  background: #1A2740; color: #E3EAF7; font-weight: 600; font-size: 14px; cursor: pointer; }
.kbbar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.kbbar .q { background: transparent; border-color: #3A4A68; color: #9FB0CC; align-self: center; }
.kbinput { position: absolute; left: -2000px; top: 0; width: 200px; height: 40px; opacity: 0; }

.sidepanel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 8; width: min(380px, 100%); display: grid;
  grid-template-rows: auto 1fr auto; background: var(--surface); color: var(--ink); box-shadow: -10px 0 40px rgba(0,0,0,.35); }
.sidepanel header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.sidepanel header .t { flex: 1; }
.msgs { overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-color: transparent; }
.msg .who { display: block; font-size: 12px; font-weight: 600; opacity: .75; margin-bottom: 2px; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer .input { min-height: 44px; }

.banner { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; padding: 8px 14px; border-radius: 12px;
  background: rgba(224,149,31,.95); color: #2b1800; font-weight: 600; font-size: 13.5px; max-width: calc(100% - 24px); text-align: center; }
.progress { position: absolute; left: 10px; bottom: 10px; z-index: 6; display: grid; gap: 6px; width: min(320px, calc(100% - 20px)); }
.progress .p { padding: 8px 10px; border-radius: 10px; background: rgba(6,10,20,.82); font-size: 12.5px; }
.progress .p i { display: block; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- помощник ---------- */
.assist { display: grid; grid-template-rows: auto 1fr auto; gap: 0; height: calc(100vh - 60px - 84px - var(--safe-b));
  max-width: 900px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
@media (min-width: 900px) { .assist { height: calc(100vh - 68px - 120px); } }
.assist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.assist-head .t { flex: 1; min-width: 200px; }
.assist-head .t b { display: block; }
.assist-head .t span { font-size: 13px; color: var(--muted); }
.amsgs { overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.amsg { max-width: 92%; line-height: 1.55; overflow-wrap: anywhere; }
.amsg.user { align-self: flex-end; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--accent); color: #fff; white-space: pre-wrap; }
.amsg.assistant { align-self: flex-start; padding: 2px 2px; }
.amsg.assistant p { margin: 0 0 10px; }
.amsg.assistant pre { margin: 8px 0 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  overflow: auto; font-size: 13px; line-height: 1.5; white-space: pre; }
.amsg.assistant code { font-family: "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; font-size: .92em; }
.amsg.assistant :not(pre) > code { padding: 1px 5px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); }
.amsg.assistant ul, .amsg.assistant ol { margin: 0 0 10px; padding-left: 22px; }
.amsg.assistant h4 { margin: 12px 0 6px; font-size: 15.5px; }
.amsg .imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.amsg .imgs img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid rgba(255,255,255,.6); }
.amsg.err { align-self: stretch; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.acomposer { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 72px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumb button svg.ic { width: 14px; height: 14px; }
.acomposer .line { display: flex; gap: 8px; align-items: flex-end; }
.acomposer textarea { flex: 1; min-height: 48px; max-height: 200px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: breathe 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.privacy { font-size: 12.5px; color: var(--muted); padding: 0 4px; }

/* ---------- панель на ПК («кто подключён») ---------- */
.panel-page { min-height: 100%; padding: 14px; background: var(--bg); }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.panel-card + .panel-card { margin-top: 12px; }
.panel-user { display: flex; align-items: center; gap: 10px; }
.panel-user .av { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.panel-user .n { flex: 1; min-width: 0; }
.panel-user .n b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-row { display: flex; gap: 8px; margin-top: 12px; }
.perm { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.perm[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- телефоны: компактные плитки и панель ---------- */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .tile { grid-template-columns: 128px 1fr; align-items: center; gap: 8px 14px; padding: 12px; border-radius: 16px; }
  .tile .monitor { grid-row: 1 / span 2; margin: 0 0 12px; }
  .tile .tile-info, .tile .tile-actions { grid-column: 2; }
  .monitor .bezel { padding: 4px; border-radius: 9px; }
  .monitor .stand { bottom: -10px; height: 10px; }
  .screen { padding: 4px; border-radius: 5px; }
  .screen .big { font-size: 12px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .screen .small { font-size: 10px; line-height: 1.25; }
  .screen svg.ic { width: 20px; height: 20px; }
  .tile-name { font-size: 15.5px; }
  .tile-actions .btn { min-height: 38px; padding: 0 10px; font-size: 14px; }
  .page-head h1 { font-size: 23px; }
}
@media (max-width: 440px) {
  .bar { padding-left: 2px; padding-right: 2px; }
  .bar .bbtn.voice { display: none; }
  .bar .bbtn svg.ic { width: 23px; height: 23px; }
  .bar .qbar { width: 26px; height: 26px; flex: none; }
}

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