﻿:root {
  --bg: #0B0F1A;
  --bg2: #111830;
  --card: rgba(255, 255, 255, 0.055);
  --card-brd: rgba(255, 255, 255, 0.09);
  --text: #EEF2FF;
  --muted: #8B93B0;
  --accent: #5B8CFF;
  --green: #2ED573;
  --red: #FF5C6C;
  --orange: #FFA940;
  --blue: #4DA3FF;
  --violet: #9B6DFF;
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(91, 140, 255, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(155, 109, 255, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- PIN ---------- */

.pin-screen {
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 32px) 24px calc(env(safe-area-inset-bottom) + 24px);
  gap: 14px;
}

.pin-head { text-align: center; }
.pin-head h1 { font-size: 26px; margin: 14px 0 4px; letter-spacing: -0.5px; }
.pin-head p { margin: 0; color: var(--muted); font-size: 15px; }

.pin-logo {
  width: 74px; height: 74px;
  margin: 0 auto;
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, #5B8CFF, #8A5CFF);
  box-shadow: 0 14px 40px rgba(91, 140, 255, 0.4);
}

.pin-dots { display: flex; gap: 18px; margin-top: 26px; }
.pin-dots span {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.15s;
}
.pin-dots span.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake 0.4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pin-error { color: var(--red); font-size: 14px; min-height: 18px; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 16px;
  margin-top: 6px;
}

.key {
  height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 28px;
  font-weight: 500;
  transition: transform 0.08s, background 0.15s;
}
.key:active { transform: scale(0.93); background: rgba(255, 255, 255, 0.14); }
.key-fn { color: var(--muted); font-size: 22px; }

.pin-hint { color: var(--muted); font-size: 13px; text-align: center; margin-top: 10px; }

/* ---------- APP ---------- */

.app-screen {
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 18px) 20px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(11, 15, 26, 0.92), rgba(11, 15, 26, 0.65) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.status-dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(139, 147, 176, 0.5);
}
.status-dot.online {
  background: var(--green);
  animation: pulse 2.2s infinite;
}
.status-dot.offline { background: var(--red); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(46, 213, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0); }
}

.pc-name { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.pc-sub { font-size: 13px; color: var(--muted); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 14px;
  border: 1px solid var(--card-brd);
  background: var(--card);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tab-page {
  padding: 8px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- РљР°СЂС‚РѕС‡РєРё ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 600;
}

.ip-hero {
  text-align: center;
  padding: 22px 18px 20px;
  position: relative;
  overflow: hidden;
}
.ip-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 140px;
  background: radial-gradient(closest-side, rgba(91, 140, 255, 0.35), transparent);
  pointer-events: none;
}
.ip-hero-label { font-size: 13px; color: var(--muted); letter-spacing: 0.6px; position: relative; }
.ip-hero-value {
  font-size: clamp(26px, 8vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  margin: 6px 0 2px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  position: relative;
  word-break: break-all;
}
.ip-hero-sub { font-size: 13px; color: var(--muted); position: relative; margin-bottom: 14px; }

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
}
.ghost-btn:active { background: rgba(255, 255, 255, 0.14); }
.ghost-btn.danger-text { color: var(--red); border-color: rgba(255, 92, 108, 0.35); margin-top: 12px; }
.ghost-btn.block { display: block; width: 100%; }

/* ---------- РљРЅРѕРїРєРё СѓРїСЂР°РІР»РµРЅРёСЏ ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ctrl {
  border: 1px solid var(--card-brd);
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform 0.1s;
}
.ctrl:active { transform: scale(0.96); }
.ctrl.wide { grid-column: span 2; flex-direction: row; justify-content: center; gap: 14px; }
.ctrl.wide .ctrl-hint { position: absolute; right: 16px; font-size: 12px; color: var(--muted); }

.ctrl-icon {
  width: 54px; height: 54px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow 0.2s;
}
.ctrl-label { font-size: 15px; font-weight: 600; }
.ctrl-hint { font-size: 12px; color: var(--muted); }

.ctrl.danger .ctrl-icon { background: rgba(255, 92, 108, 0.16); color: var(--red); box-shadow: 0 6px 18px rgba(255, 92, 108, 0.18); }
.ctrl.warn .ctrl-icon { background: rgba(255, 169, 64, 0.16); color: var(--orange); box-shadow: 0 6px 18px rgba(255, 169, 64, 0.16); }
.ctrl.blue .ctrl-icon { background: rgba(77, 163, 255, 0.16); color: var(--blue); box-shadow: 0 6px 18px rgba(77, 163, 255, 0.16); }
.ctrl.violet .ctrl-icon { background: rgba(155, 109, 255, 0.16); color: var(--violet); box-shadow: 0 6px 18px rgba(155, 109, 255, 0.18); }
.ctrl.green .ctrl-icon { background: rgba(46, 213, 115, 0.16); color: var(--green); box-shadow: 0 6px 18px rgba(46, 213, 115, 0.18); }
.ctrl.gray .ctrl-icon { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.ctrl:disabled { opacity: 0.45; pointer-events: none; }
body.offline .ctrl:not([data-action="wake"]):not([data-action="cancel"]) { opacity: 0.4; pointer-events: none; }

/* ---------- РћС„С„Р»Р°Р№РЅ / СЃС‚Р°С‚СѓСЃ ---------- */

body.offline .ip-hero-value { color: var(--muted); }

.pending {
  border: 1px dashed rgba(255, 169, 64, 0.5);
  background: rgba(255, 169, 64, 0.08);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.pending-text { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

.tip {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(91, 140, 255, 0.07);
  border: 1px solid rgba(91, 140, 255, 0.16);
  border-radius: 18px;
  padding: 14px 16px;
}
.tip b { color: var(--text); }

/* ---------- РЎРїРёСЃРєРё / СЃС‚СЂРѕРєРё ---------- */

.ip-list { display: flex; flex-direction: column; gap: 10px; }
.ip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px 14px;
}
.ip-item .iface { font-size: 13px; color: var(--muted); }
.ip-item .addr { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 15px; font-weight: 600; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.row:last-of-type { border-bottom: none; }
.row-key { color: var(--muted); font-size: 14px; }
.row-val { font-weight: 600; text-align: right; word-break: break-all; }
.row.muted { color: var(--muted); font-size: 13px; display: block; padding-top: 6px; }

/* ---------- РќР°СЃС‚СЂРѕР№РєРё ---------- */

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 13px 15px;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.field input:focus { border-color: var(--accent); }

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #5B8CFF, #8A5CFF);
  box-shadow: 0 10px 26px rgba(91, 140, 255, 0.32);
}
.primary-btn:active { transform: scale(0.98); }

.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; margin-top: 8px; }

.steps { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.9; }

/* ---------- РўР°Р±Р±Р°СЂ ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(11, 15, 26, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 30;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: 14px;
  transition: color 0.15s;
}
.tab.active { color: var(--accent); }
.tab:active { transform: scale(0.95); }

/* ---------- РњРѕРґР°Р»РєР° ---------- */

.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 26px;
  animation: fadeIn 0.2s;
}

.modal {
  width: 100%;
  max-width: 330px;
  background: #171E33;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  padding: 24px 20px 18px;
  text-align: center;
  animation: pop 0.22s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.modal-text { font-size: 14px; color: var(--muted); line-height: 1.5; margin-bottom: 20px; white-space: pre-line; word-break: break-all; }

.modal-actions { display: flex; gap: 10px; }
.modal-btn {
  flex: 1;
  border: none;
  border-radius: 15px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}
.modal-btn.primary { background: linear-gradient(135deg, #FF5C6C, #FF7B54); color: #fff; }
.modal-btn:active { transform: scale(0.96); }

/* ---------- РўРѕСЃС‚ ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(23, 30, 51, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 13px 20px;
  border-radius: 16px;
  font-size: 14.5px;
  font-weight: 600;
  z-index: 200;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.28s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.toast.err { border-color: rgba(255, 92, 108, 0.5); color: #FFB3BB; }
@keyframes toastIn { from { transform: translate(-50%, 18px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (min-width: 640px) {
  .tab-page { max-width: 560px; margin: 0 auto; width: 100%; }
  .topbar { padding-left: max(20px, calc((100vw - 560px) / 2)); padding-right: max(20px, calc((100vw - 560px) / 2)); }
}

/* ---------- РЎРїРёСЃРѕРє СѓСЃС‚СЂРѕР№СЃС‚РІ / РёСЃС‚РѕСЂРёРё ---------- */

.topbar-actions { display: flex; gap: 8px; }

.seg { display: flex; gap: 8px; margin-bottom: 16px; }
.seg button {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  border-radius: 14px;
  padding: 12px 8px;
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg button.on svg { color: #fff; }

.comp-list { display: flex; flex-direction: column; gap: 12px; }
.comp-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: 20px;
  padding: 14px;
  cursor: pointer;
}
.comp-card:active { transform: scale(0.985); }
.comp-ic {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 15px;
  background: rgba(91, 140, 255, 0.14);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.comp-info { flex: 1; min-width: 0; }
.comp-name {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comp-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
}
.mini-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mini-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(46, 213, 115, 0.7); }
.mini-dot.off { background: var(--red); }
.comp-act {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.comp-act:active { transform: scale(0.93); }
.act-wake { color: var(--green); }

.empty-box { text-align: center; padding: 26px 20px; }
.empty-box svg { color: var(--muted); }
.empty-box p { color: var(--muted); font-size: 14.5px; line-height: 1.5; margin: 10px 0 16px; }
.plus { font-size: 19px; line-height: 0; vertical-align: -2px; }

/* ---------- РђРєРєР°СѓРЅС‚С‹ ---------- */

.err-text { color: var(--red); }

.modal-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--text);
  font-size: 17px;
  text-align: center;
  padding: 12px 14px;
  margin: 4px 0 16px;
  outline: none;
}
.modal-input:focus { border-color: var(--accent); }
