/* Thin Web — веб-панель. */
:root {
  --bg: #0d1117; --panel: #161b22; --line: #30363d; --line-soft: rgba(255,255,255,0.08);
  --fg: #e6edf3; --fg-strong: #f0f6fc; --muted: #8b949e; --dim: #6e7681;
  --green: #3fb950; --green-soft: #7ee787; --red: #f85149; --red-soft: #ff7b72;
  --blue: #388bfd; --blue-soft: #79c0ff; --amber: #d29922; --amber-soft: #e3b341; --orange: #ff9e57;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 15% 0%, rgba(56,99,180,0.22), transparent 55%),
                    radial-gradient(ellipse at 100% 100%, rgba(32,140,120,0.14), transparent 50%);
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-soft); }
.wrap { max-width: 1500px; margin: 0 auto; padding: 36px 48px 40px; }

/* верх */
.top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.clock { font-size: 56px; font-weight: 300; letter-spacing: -1px; color: var(--fg-strong); line-height: 1.05; }
.date { color: var(--muted); font-size: 16px; }
.spacer { flex: 1; }
.chip { background: rgba(255,255,255,0.06); border: 1px solid var(--line-soft); border-radius: 999px;
        padding: 8px 16px; color: #c9d1d9; font-size: 14px; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.06);
       border: 1px solid var(--line-soft); border-radius: 14px; padding: 9px 14px; cursor: pointer;
       font-size: 14px; color: var(--fg); text-decoration: none; }
.btn:hover { background: rgba(255,255,255,0.12); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: #238636; border-color: transparent; color: #fff; }
.btn.primary:hover { background: #2ea043; }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(248,81,73,0.4); }
.btn.flat { background: transparent; border-color: var(--line); color: #c9d1d9; }
.btn:disabled { opacity: .5; cursor: default; }

.section { font-size: 12px; font-weight: 600; letter-spacing: 2px; color: var(--dim);
           text-transform: uppercase; margin: 30px 0 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.banner { margin-top: 24px; border: 1px solid rgba(248,81,73,0.5); background: rgba(248,81,73,0.08);
          color: #ffdcd7; border-radius: 14px; padding: 12px 16px; }

/* VPN и сессии */
.pill { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.09); border-radius: 14px; padding: 9px 14px; cursor: pointer;
        user-select: none; }
.pill:hover { background: rgba(255,255,255,0.10); border-color: rgba(121,192,255,0.45); }
.pill.up { border-color: rgba(63,185,80,0.45); background: rgba(46,160,67,0.08); }
.pill.connecting { border-color: rgba(210,153,34,0.5); }
.pill.error { border-color: rgba(248,81,73,0.5); }
.pill.add { border-style: dashed; background: transparent; color: var(--muted); }
.pill.static { cursor: default; }
.pill .name { font-weight: 500; color: var(--fg-strong); }
.pill .kind { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.pill .ip { font-family: var(--mono); font-size: 13px; color: var(--green-soft); }
.pill .err { font-size: 13px; color: var(--red-soft); max-width: 340px; overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.pill .x { color: var(--dim); padding: 0 2px 0 6px; background: none; border: 0; cursor: pointer; font-size: 15px; }
.pill .x:hover { color: var(--red); }
.pill .edit { color: var(--dim); background: none; border: 0; cursor: pointer; padding: 0 0 0 4px; display: flex; }
.pill .edit:hover { color: var(--fg); }
.pill .edit svg { width: 15px; height: 15px; }
.dot { width: 9px; height: 9px; border-radius: 99px; background: #484f58; flex: none; }
.dot.up { background: var(--green); box-shadow: 0 0 8px rgba(63,185,80,0.9); }
.dot.down, .dot.error { background: var(--red); }
.dot.connecting { background: var(--amber); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .35 } to { opacity: 1 } }

/* плитки */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.tile { position: relative; background-color: rgba(255,255,255,0.045); border: 1px solid var(--line-soft);
        border-radius: 22px; padding: 22px; min-height: 168px; display: flex; flex-direction: column;
        gap: 12px; cursor: pointer; transition: border-color .12s, background-color .12s; outline: none; }
.tile:hover, .tile:focus-visible { border-color: rgba(121,192,255,0.65); background-color: rgba(255,255,255,0.075); }
.tile.live { border-color: rgba(63,185,80,0.45); }
.tile.add { border-style: dashed; background: transparent; align-items: center; justify-content: center;
            color: var(--muted); font-size: 18px; }
.tile.add .plus { font-size: 40px; font-weight: 200; color: var(--dim); line-height: 1; }
.tile .head { display: flex; align-items: flex-start; gap: 12px; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
          font-size: 22px; font-weight: 700; flex: none; }
.badge { margin-left: auto; border-radius: 8px; padding: 3px 9px; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.rdp .avatar, .badge.rdp { background: rgba(56,139,253,0.16); color: var(--blue-soft); }
.ssh .avatar, .badge.ssh { background: rgba(46,160,67,0.16); color: var(--green-soft); }
.vnc .avatar, .badge.vnc { background: rgba(210,153,34,0.16); color: var(--amber-soft); }
.pve .avatar, .badge.pve { background: rgba(229,83,0,0.16); color: var(--orange); }
.tile .name { font-size: 20px; font-weight: 600; color: var(--fg-strong); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }
.tile .host { font-family: var(--mono); font-size: 13px; color: var(--muted); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; margin-top: -6px; }
.tile .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; min-height: 30px; }
.tile .status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tile .status.live { color: var(--green-soft); }
.tile .via { font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.06); border-radius: 7px;
             padding: 2px 8px; max-width: 130px; min-width: 0; flex-shrink: 1; overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.tile .via.up { color: var(--green-soft); background: rgba(46,160,67,0.12); }
.tile .acts { margin-left: auto; display: flex; gap: 4px; }
.iconbtn { width: 32px; height: 32px; border-radius: 10px; border: 1px solid transparent; background: transparent;
           color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.iconbtn:hover { background: rgba(255,255,255,0.10); color: var(--fg); border-color: var(--line-soft); }
.iconbtn svg { width: 17px; height: 17px; }

.hint { color: var(--dim); font-size: 13px; margin-top: 28px; }
.kbd { background: rgba(255,255,255,0.08); border-radius: 6px; padding: 2px 7px; color: #c9d1d9; font-size: 12px; }

/* диалоги */
dialog { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 18px;
         padding: 26px 28px; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(1,4,9,0.65); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
dialog .note { color: var(--dim); font-size: 13px; margin: 0 0 14px; }
.form { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; align-items: center; margin: 14px 0 20px; }
.form label.f { color: var(--muted); font-size: 13px; text-align: right; }
.form .full { grid-column: 1 / -1; }
.form input[type=text], .form input[type=password], .form input[type=number], .form select, .form textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  outline: none; min-width: 0; }
.form textarea { font-family: var(--mono); font-size: 12px; min-height: 120px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--blue); }
.form .check { display: flex; gap: 8px; align-items: flex-start; color: #c9d1d9; font-size: 14px; }
.form .sub { color: var(--dim); font-size: 12px; margin-top: 4px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* тосты */
#toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex;
          flex-direction: column; gap: 8px; z-index: 50; width: min(720px, calc(100vw - 32px)); }
.toast { background: #1f2937; border: 1px solid rgba(248,81,73,0.5); border-radius: 14px; padding: 12px 18px;
         color: #ffdcd7; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.toast.ok { border-color: rgba(63,185,80,0.5); color: #d2f8d9; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(400px, 100%); background: rgba(22,27,34,0.85); border: 1px solid var(--line);
               border-radius: 22px; padding: 30px 28px; }
.login h1 { margin: 0; font-size: 22px; font-weight: 600; }
.login .sub { color: var(--muted); margin: 4px 0 22px; font-size: 14px; }
.login input { width: 100%; margin-bottom: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
               padding: 12px 14px; outline: none; font-size: 16px; }
.login input:focus { border-color: var(--blue); }
.login .remember { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin: 4px 0 0; cursor: pointer; }
.login .remember[hidden] { display: none; }
.login .remember input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.login .btn { width: 100%; justify-content: center; margin-top: 14px; padding: 12px; font-size: 15px; }
.login .msg { min-height: 22px; color: var(--red-soft); font-size: 14px; margin-top: 10px; }

/* вкладки */
.tabs { display: flex; gap: 4px; margin-top: 28px; border-bottom: 1px solid var(--line-soft); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer;
       color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: -1px; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg-strong); border-bottom-color: var(--blue); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.role { font-size: 11px; font-weight: 700; letter-spacing: 1px; border-radius: 7px; padding: 2px 7px;
        background: rgba(56,139,253,0.15); color: var(--blue-soft); text-transform: uppercase; }
.role.user { background: rgba(255,255,255,0.08); color: var(--muted); }
.pill .who { font-size: 12px; color: var(--muted); }

/* таблицы: пользователи, журнал */
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.tbl th { text-align: left; color: var(--dim); font-weight: 600; font-size: 12px; letter-spacing: 1px;
          text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr.off td { opacity: .5; }
.tbl .mono { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tbl .ev { font-weight: 500; }
.tbl .ev.bad { color: var(--red-soft); }
.tbl .ev.good { color: var(--green-soft); }
.tbl td.r { text-align: right; white-space: nowrap; }
.tblwrap { overflow-x: auto; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.toolbar input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
                 outline: none; min-width: 220px; }
.checks { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto;
          border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.pwrow { display: flex; gap: 8px; }
.pwrow input { flex: 1; }

/* вкладка «Сервер»: нагрузка */
.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gauge { background: rgba(255,255,255,0.045); border: 1px solid var(--line-soft); border-radius: 18px;
         padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring { --pct: 0; --c: var(--green); width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center;
        background: conic-gradient(var(--c) calc(var(--pct) * 1%), rgba(255,255,255,0.08) 0); }
.ring.warn { --c: var(--amber); }
.ring.bad { --c: var(--red); }
.ring span { width: 70px; height: 70px; border-radius: 50%; background: var(--panel); display: grid;
             place-items: center; font-size: 17px; font-weight: 600; color: var(--fg-strong); }
.ring.flat { background: rgba(56,139,253,0.14); }
.ring.flat span { font-size: 15px; font-family: var(--mono); }
.gauge .lbl { font-size: 13px; color: var(--muted); text-align: center; }
.gauge .lbl b { display: block; font-weight: 400; color: var(--dim); font-size: 12px; }

/* вкладка «Сервер»: службы, настройки */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.card { background: rgba(255,255,255,0.045); border: 1px solid var(--line-soft); border-radius: 18px; padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--fg-strong); }
.card .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .meta { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.card .note { color: var(--dim); font-size: 13px; margin: 8px 0 0; }
.card .actions { margin-top: 14px; }
.card .form { margin: 12px 0 14px; grid-template-columns: 110px 1fr; }
.state { font-size: 11px; font-weight: 700; letter-spacing: 1px; border-radius: 7px; padding: 3px 8px;
         text-transform: uppercase; background: rgba(255,255,255,0.08); color: var(--muted); }
.state.on { background: rgba(46,160,67,0.16); color: var(--green-soft); }
.state.off { background: rgba(248,81,73,0.12); color: var(--red-soft); }
.note-box { margin-top: 24px; border: 1px dashed var(--line); border-radius: 14px; padding: 14px 16px; color: var(--muted); }
.tbl .routes { font-family: var(--mono); font-size: 13px; color: var(--blue-soft); }
.tbl td .dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.toolbar .sub { color: var(--dim); font-size: 13px; }

/* подключение клиента: QR */
.qr { display: flex; justify-content: center; margin: 6px 0 10px; }
.qr img { width: min(300px, 70vw); height: auto; image-rendering: pixelated; border-radius: 12px;
          background: #fff; padding: 10px; }
dialog details { margin-top: 10px; color: #c9d1d9; font-size: 14px; }
dialog details summary { cursor: pointer; color: var(--muted); }
dialog details textarea { width: 100%; margin-top: 8px; background: var(--bg); border: 1px solid var(--line);
                          border-radius: 10px; padding: 9px 11px; font-family: var(--mono); font-size: 12px;
                          min-height: 190px; resize: vertical; white-space: pre; }
dialog details ol { margin: 8px 0 0; padding-left: 20px; }
dialog .warnbox { border: 1px solid rgba(210,153,34,0.5); background: rgba(210,153,34,0.08); color: #f2dfae;
                  border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 10px; }

/* ───────── камеры (в духе DS Cam) ───────── */
.cv { position: relative; display: flex; flex-direction: column; margin-top: 18px; background: #0b0e13; border: 1px solid var(--line-soft);
      border-radius: 16px; overflow: hidden; height: calc(100vh - 230px); min-height: 540px; }
.cv-top { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #161b22;
          border-bottom: 1px solid var(--line-soft); flex: none; }
.cv-ib { width: 42px; height: 42px; border: 0; background: none; border-radius: 10px; color: #58a6ff; cursor: pointer;
         display: grid; place-items: center; padding: 0; flex: none; }
.cv-ib:hover { background: rgba(255,255,255,0.07); }
.cv-ib svg { width: 26px; height: 26px; }
.cv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 6px; }
.cv-title b { font-size: 18px; font-weight: 600; color: var(--fg-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-title span { font-size: 13px; color: var(--muted); }
.cv-body { flex: 1; min-height: 0; display: flex; }
.cv-side { width: 230px; flex: none; overflow: auto; border-right: 1px solid var(--line-soft); padding: 8px;
           display: flex; flex-direction: column; gap: 2px; background: #0f1319; }
.cv-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
           border-radius: 10px; padding: 10px 12px; cursor: pointer; color: var(--fg); font-size: 15px; }
.cv-item:hover { background: rgba(255,255,255,0.06); }
.cv-item.on { background: rgba(56,139,253,0.16); color: var(--fg-strong); }
.cv-item .txt { display: flex; flex-direction: column; min-width: 0; }
.cv-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-item .st { font-size: 12px; color: var(--red-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-item.plain { color: #c9d1d9; }
.cv-ico { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); flex: none; }
.cv-ico svg { width: 18px; height: 18px; }
.cv-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.rdot { width: 10px; height: 10px; border-radius: 50%; background: #484f58; flex: none; display: inline-block; }
.rdot.on { background: #f85149; box-shadow: 0 0 6px rgba(248,81,73,0.8); }
.rdot.bad { background: var(--amber); }
.cv-stage { flex: 1; min-width: 0; overflow: auto; background: #000; position: relative; }
.cv-empty { color: var(--muted); padding: 80px 20px; text-align: center; }
.cv-grid { display: grid; gap: 2px; align-content: start; }
.cv-grid.l1 { grid-template-columns: 1fr; }
.cv-grid.l2 { grid-template-columns: 1fr; }
.cv-grid.l4 { grid-template-columns: repeat(2, 1fr); }
.cv-grid.l9 { grid-template-columns: repeat(3, 1fr); }
.ct { display: flex; flex-direction: column; background: #000; min-width: 0; }
.ct-head { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: #1c2128; color: #f0f6fc;
           font-size: 14px; font-weight: 600; }
.ct-head .nm { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-head .warn { font-size: 12px; font-weight: 500; color: var(--amber-soft); min-width: 10px; }
.ct-v { position: relative; aspect-ratio: 16 / 9; background: #000; cursor: pointer; overflow: hidden; }
.ct-v video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.ct-v:fullscreen { aspect-ratio: auto; }
.ct-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 86%; text-align: center;
          color: #c9d1d9; font-size: 13px; background: rgba(0,0,0,0.6); border-radius: 10px; padding: 8px 12px; }
.ct-msg[hidden] { display: none; }
.cv.single .ct-head { display: none; }
/* компьютер: сетка камер — по высоте окна, без прокрутки */
body:not(.cams-app) .cv:not(.single) .cv-grid { height: 100%; grid-auto-rows: minmax(0, 1fr); }
body:not(.cams-app) .cv:not(.single) .ct { min-height: 0; }
body:not(.cams-app) .cv:not(.single) .ct-v { flex: 1; aspect-ratio: auto; min-height: 0; }
body:not(.cams-app) .cv:not(.single) .cv-stage:has(.cv-dots) .cv-grid { height: calc(100% - 28px); }
.cv.single .cv-stage { display: flex; flex-direction: column; justify-content: center; }
.cv.single .cv-grid { flex: 1; align-content: center; }
.cv.single .ct-v { cursor: default; max-height: calc(100vh - 380px); aspect-ratio: auto; height: 100%; min-height: 220px; }
.cv-dots { display: flex; justify-content: center; gap: 8px; padding: 10px; }
.cv-dots button { width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; background: #484f58; cursor: pointer; }
.cv-dots button.on { background: #58a6ff; }
.cv-setup { padding: 4px 16px 20px; background: var(--bg); min-height: 100%; }

.cv-dock { flex: none; background: #161b22; border-top: 1px solid var(--line-soft); user-select: none; }
.cv-ctl { display: flex; align-items: center; gap: 8px; padding: 10px 10px 2px; }
.cv-btn { min-width: 46px; height: 36px; border: 0; border-radius: 6px; background: #30363d; color: #f0f6fc;
          font-weight: 600; font-size: 15px; cursor: pointer; display: grid; place-items: center; padding: 0 10px; }
.cv-btn svg { width: 20px; height: 20px; }
.cv-btn:disabled { opacity: .45; cursor: default; }
.cv-btn.wide { flex: 1; font-weight: 500; font-size: 14px; }
.cv-live { background: #1f6feb; color: #fff; font-weight: 700; letter-spacing: .5px; }
.cv-live.off { background: #30363d; color: #c9d1d9; }
.cv-bubble { position: relative; background: #f0f6fc; color: #1f6feb; border-radius: 6px; padding: 6px 16px;
             font: 600 18px/1.2 var(--mono); white-space: nowrap; }
.cv-bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
                    border: 7px solid transparent; border-top-color: #f0f6fc; border-bottom: 0; }
.cv-bubble.live { color: #cf222e; }
.cv-tl { position: relative; height: 84px; overflow: hidden; cursor: grab; touch-action: none; margin-top: 4px; }
.cv-tl:active { cursor: grabbing; }
.cv-tl .bar { position: absolute; left: 0; right: 0; top: 50px; height: 34px; background: #2d333b; }
.cv-tl .blk { position: absolute; top: 50px; height: 34px; background: #6e7681; }
.cv-tl .fut { position: absolute; top: 50px; height: 34px;
              background: repeating-linear-gradient(135deg, #2d333b 0 5px, #3d444d 5px 10px); }
.cv-tl .sel { position: absolute; top: 46px; height: 42px; background: rgba(31,111,235,0.45);
              border-left: 2px solid #58a6ff; border-right: 2px solid #58a6ff; }
.cv-tl .tk { position: absolute; top: 36px; height: 14px; border-left: 2px solid #8b949e; }
.cv-tl .tk.small { top: 42px; height: 8px; border-left-width: 1px; border-color: #6e7681; }
.cv-tl .tk span { position: absolute; top: -32px; left: 0; transform: translateX(-50%); color: #b1bac4;
                  font-size: 15px; white-space: nowrap; }
.cv-tl .center { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff;
                 box-shadow: 0 0 4px rgba(0,0,0,0.6); pointer-events: none; }
.cv-act { display: flex; justify-content: space-around; gap: 2px; padding: 8px 4px 10px; border-top: 1px solid #0d1117; }
.cv-act button { flex: 1; background: none; border: 0; color: #f0f6fc; display: flex; flex-direction: column; align-items: center;
                 gap: 4px; font-size: 12px; cursor: pointer; padding: 4px 0; min-width: 0; }
.cv-act button svg { width: 30px; height: 30px; }
.cv-act button:disabled { color: #545d68; cursor: default; }
.cv-export { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid #0d1117; background: #1c2128; }
.cv-export b { font-size: 15px; }
.cv-export select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.cv-export .row2 { display: flex; gap: 8px; }
.cv-layer { position: absolute; inset: 0; z-index: 20; background: rgba(1,4,9,0.6); }
.cv-layer.drawer .cv-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(82%, 320px); background: #161b22;
                             overflow: auto; padding: calc(env(safe-area-inset-top) + 12px) 10px 20px;
                             box-shadow: 4px 0 24px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 2px; }
.cv-who { color: var(--muted); font-size: 13px; padding: 4px 12px 10px; }
.cv-layer.menu .cv-sheet-box { position: absolute; right: 8px; top: calc(env(safe-area-inset-top) + 54px); min-width: 230px;
                               background: #1c2128; border: 1px solid var(--line); border-radius: 12px; padding: 6px;
                               box-shadow: 0 12px 30px rgba(0,0,0,0.5); }
.cv-mi { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; color: var(--fg);
         padding: 11px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; text-align: left; }
.cv-mi:hover { background: rgba(255,255,255,0.06); }
.cv-mi svg { width: 20px; height: 20px; color: #58a6ff; flex: none; }

/* телефон: камеры — на весь экран, как отдельное приложение */
body.cams-app { overflow: hidden; }
body.cams-app .wrap > .top, body.cams-app .wrap > .tabs, body.cams-app #banners { display: none !important; }
body.cams-app .cv { position: fixed; inset: 0; margin: 0; border: 0; border-radius: 0; height: auto; min-height: 0; z-index: 10;
                    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); background: #000; }
body.cams-app .cv-side { display: none; }
body.cams-app .cv.single .ct-v { max-height: none; }

.setup { display: flex; flex-direction: column; gap: 16px; }
.cv-setup .card { max-width: 720px; margin-top: 16px; }
.banner.inline { margin: 0; padding: 7px 12px; font-size: 13px; }
.probe { display: flex; flex-direction: column; gap: 4px; margin: -6px 0 12px; font-size: 13px; }
.probe .good { color: var(--green-soft); }
.probe .bad { color: var(--red-soft); }
.checks.flat { max-height: none; }

/* телефон как приложение (PWA): вырезы экрана */
@supports (padding: max(0px)) {
  .wrap { padding-top: max(36px, calc(env(safe-area-inset-top) + 12px));
          padding-left: max(48px, env(safe-area-inset-left)); padding-right: max(48px, env(safe-area-inset-right)); }
}

@media (max-width: 640px) {
  @supports (padding: max(0px)) {
    .wrap { padding-top: max(20px, calc(env(safe-area-inset-top) + 8px)); padding-bottom: 32px;
            padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  }
  /* шапка на телефоне — компактно, одной строкой */
  .top { align-items: center; flex-wrap: nowrap; gap: 8px; }
  .top .clock { font-size: 30px; }
  .top .date { display: none; }
  .top .chip { padding: 6px 10px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .top .chip .role { display: none; }
  .top .btn { padding: 7px 10px; font-size: 13px; }
  .tabs { margin-top: 14px; overflow-x: auto; scrollbar-width: none; }
  .tab { white-space: nowrap; }
  .gauges { grid-template-columns: repeat(2, 1fr); }
  .cards, .cards.two { grid-template-columns: 1fr; }
  .card .form { grid-template-columns: 1fr; }
  #clients td.r { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
  #clients td.r .btn { justify-content: center; padding: 7px 10px; }
  #clients td:first-child { word-break: break-word; }
  .tbl .hide-sm { display: none; }
  .clock { font-size: 40px; }
  .top .chip.hide-sm { display: none; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .tile { min-height: 0; padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .form label.f { text-align: left; margin-bottom: -6px; }
  .hint { display: none; }
}
