/* Все цвета и размеры — здесь. Подогнать под ваш кабинет можно, поменяв переменные. */
:root {
  --bg: #000;
  --surface: #101010;
  --surface-2: #181818;
  --line: #262626;
  --line-strong: #3a3a3a;
  --text: #f2f2f2;
  --muted: #8d8d8d;
  --accent: #f2f2f2;        /* основная кнопка: светлая на тёмном */
  --accent-text: #000;
  --ok: #3ddc84;
  --bad: #ff6b6b;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", "SF Pro Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* кнопки */
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  font: inherit; font-weight: 600; padding: 11px 18px; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); border-color: #555; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* вход */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 380px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; font-size: 17px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: #000; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.auth h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.025em; margin: 40px 0 8px; font-weight: 700; }
.auth p.sub { color: var(--muted); margin: 0 0 28px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 16px; padding: 13px 14px; border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.field input:hover { border-color: var(--line-strong); }
.field input:focus { border-color: var(--text); outline: none; }
.auth .btn { width: 100%; justify-content: center; padding: 14px; margin-top: 8px; }
.form-error { color: var(--bad); font-size: 14px; min-height: 22px; margin-top: 12px; }

/* кабинет */
.top { border-bottom: 1px solid var(--line); }
.top-in { max-width: 960px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.who { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.who .btn { padding: 8px 14px; font-size: 14px; }
main { max-width: 960px; margin: 0 auto; padding: 48px 24px 80px; }
main h1 { font-size: 34px; letter-spacing: -.03em; line-height: 1.1; margin: 0 0 8px; }
main .lead { color: var(--muted); margin: 0 0 40px; }
.section-title { font-size: 13px; color: var(--muted); margin: 0 0 12px; font-weight: 500; }

.device { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 16px; }
.device-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; }
.device-name { display: flex; align-items: center; gap: 12px; }
.device-name h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 132, .15); }
.dot.off { background: var(--bad); }
.state { font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); border-top: 1px solid var(--line); }
.fact { padding: 16px 24px; border-right: 1px solid var(--line); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact dt { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.fact dd { margin: 0; font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); }
.skeleton { height: 150px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }

/* терминал */
body.term { display: flex; flex-direction: column; height: 100vh; }
.term-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.term-bar .title { font-weight: 600; }
.term-bar .meta { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.term-bar .spacer { flex: 1; }
.term-bar .btn { padding: 7px 12px; font-size: 14px; }
#term { flex: 1; min-height: 0; padding: 12px 8px 8px 14px; background: #000; }
#term .xterm-viewport { background: #000 !important; }
.overlay { position: fixed; inset: 49px 0 0 0; background: rgba(0,0,0,.82); display: none; place-items: center; padding: 24px; }
.overlay.show { display: grid; }
.overlay .panel { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 24px; }
.overlay h3 { margin: 0 0 4px; font-size: 18px; }
.overlay p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.overlay .btn { width: 100%; justify-content: center; }

@media (max-width: 560px) {
  main { padding-top: 32px; }
  main h1 { font-size: 28px; }
  .fact { border-right: 0; border-bottom: 1px solid var(--line); }
  .fact:last-child { border-bottom: 0; }
  .actions .btn { flex: 1; justify-content: center; }
  .who .phone { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- оболочка: меню слева, раздел справа (первая вкладка, 03.10) ---------- */
body.shell { display: flex; height: 100vh; overflow: hidden; }
.side { width: 248px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.side-toggle { display: none; padding: 7px 9px; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-weight: 500; }
.side-nav a svg { width: 18px; height: 18px; flex: none; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.current { background: var(--text); color: #000; }
.nav-group { margin-top: 14px; }
.nav-dev { display: flex; align-items: center; gap: 8px; padding: 4px 12px 6px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.side-foot .btn { padding: 7px 12px; font-size: 13px; }

.stage { flex: 1; min-width: 0; position: relative; }
.view { display: none; position: absolute; inset: 0; overflow-y: auto; }
.view.active { display: block; }
.view-frame.active { display: flex; flex-direction: column; overflow: hidden; }
.frame-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.frame-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-title svg { width: 18px; height: 18px; flex: none; }
.frame-bar .spacer { flex: 1; }
.frame-bar .btn { padding: 6px 11px; font-size: 13px; }
.view-frame iframe { flex: 1; width: 100%; border: 0; background: #000; }

/* терминал внутри оболочки: без кнопки «Назад» */
body.term.embed .term-back { display: none; }

@media (max-width: 860px) {
  body.shell { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-top { border-bottom: 0; padding: 12px 14px; }
  .side-toggle { display: inline-flex; }
  .side-nav, .side-foot { display: none; }
  body.nav-open .side-nav, body.nav-open .side-foot { display: flex; }
  body.nav-open .side-nav { max-height: 60vh; border-top: 1px solid var(--line); }
  .frame-bar .btn span, .frame-bar a.btn { font-size: 12px; }
  .frame-bar a.btn { display: none; }
}
.net-kind { font-family: var(--font); color: var(--muted); font-size: 12.5px; }
.traffic { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; padding: 18px 24px 20px; border-top: 1px solid var(--line); }
.tr-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tr-dot { width: 9px; height: 9px; border-radius: 3px; }
.tr-dot.vpn { background: var(--ok); }
.tr-dot.direct { background: #6b6b6b; }
.tr-val { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.tr-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: #6b6b6b; overflow: hidden; margin-top: 8px; }
.tr-bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s; }
.tr-since { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .traffic { grid-template-columns: 1fr; } }
