:root {
  --bg: #07111f;
  --bg-2: #0a1627;
  --panel: rgba(10, 20, 36, 0.82);
  --panel-2: rgba(9, 27, 44, 0.72);
  --text: #ebf6ff;
  --muted: #88a3bb;
  --line: rgba(108, 194, 255, 0.16);
  --brand: #2af0ff;
  --brand-2: #5dfc9b;
  --danger: #ff6b8a;
  --warning: #ffc14d;
  --shadow: 0 25px 60px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(42,240,255,.13), transparent 24%),
    radial-gradient(circle at top right, rgba(93,252,155,.10), transparent 22%),
    linear-gradient(180deg, #050b15 0%, var(--bg) 48%, #040812 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(42,240,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,240,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.82), transparent 96%);
}

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  position: relative;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg, rgba(4,12,23,.94) 0%, rgba(4,13,24,.76) 100%);
  border-right: 1px solid rgba(93,252,155,.12);
  box-shadow: inset -1px 0 0 rgba(42,240,255,.06);
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 14px 12px;
  border: 1px solid rgba(42,240,255,.08);
  border-radius: 22px;
  pointer-events: none;
}
.brand-block {
  position: relative;
  z-index: 1;
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(42,240,255,.08);
}
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(42,240,255,.10);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .04em;
  text-shadow: 0 0 18px rgba(42,240,255,.22);
}
.sidebar-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.nav-group { position: relative; z-index: 1; }
.nav-group-bottom { margin-top: auto; }
.nav-caption {
  color: rgba(136,163,187,.84);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 0 10px 10px;
}
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link, .logout {
  border: 1px solid transparent;
  background: transparent;
  color: #c6ebff;
  text-align: left;
  padding: 13px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: .18s ease;
}
.nav-link:hover, .logout:hover {
  border-color: rgba(42,240,255,.18);
  background: rgba(17, 44, 66, .42);
}
.nav-link.active {
  color: #06131f;
  border-color: rgba(42,240,255,.28);
  background: linear-gradient(135deg, rgba(42,240,255,.98) 0%, rgba(93,252,155,.90) 100%);
  box-shadow: 0 0 22px rgba(42,240,255,.18);
}
.logout {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: #ffb9c7;
  border-color: rgba(255,107,138,.14);
}

.content { padding: 24px; }
.page { display: none; }
.page.current { display: block; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: .02em;
}
.page-tip, .muted { color: var(--muted); }
.status-chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(42,240,255,.18);
  background: rgba(12, 30, 50, .72);
  color: var(--brand);
  font-size: 12px;
  letter-spacing: .14em;
  font-weight: 800;
}

.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(8, 22, 39, .95) 0%, rgba(8, 19, 33, .88) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42,240,255,.48), transparent);
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
.stat .k {
  color: rgba(136,163,187,.9);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stat .v {
  font-size: 36px;
  font-weight: 800;
  margin-top: 12px;
  color: #f4fbff;
  text-shadow: 0 0 16px rgba(42,240,255,.16);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-account { display: grid; grid-template-columns: 1.4fr .9fr; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-card {
  border: 1px solid rgba(42,240,255,.10);
  background: linear-gradient(180deg, rgba(9, 27, 44, .78) 0%, rgba(7, 20, 34, .68) 100%);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.row-title { font-weight: 700; }
.row-meta { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.55; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.account-main { min-width: 0; }
.account-inline-panels {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.inline-block {
  border-top: 1px solid rgba(42,240,255,.08);
  padding-top: 12px;
}
.inline-form {
  margin-top: 10px;
}
.feature-list { display: flex; flex-direction: column; gap: 10px; }
.feature-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  background: rgba(10, 30, 48, .48);
  border: 1px solid rgba(42,240,255,.10);
  border-radius: 16px;
}
.feature-tag {
  min-width: 60px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #06131f;
  background: linear-gradient(135deg, rgba(42,240,255,.95), rgba(93,252,155,.92));
  padding: 7px 10px;
  border-radius: 999px;
  letter-spacing: .08em;
}

.form-inline, .toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.form-block { display: flex; flex-direction: column; gap: 12px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid rgba(42,240,255,.16);
  background: rgba(5, 15, 28, .84);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(93,252,155,.03);
}
input::placeholder, textarea::placeholder { color: rgba(136,163,187,.72); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(42,240,255,.38);
  box-shadow: 0 0 0 3px rgba(42,240,255,.10);
}
textarea { resize: vertical; min-height: 140px; }
.form-inline input, .form-inline select { flex: 1 1 220px; }

.button {
  border: 1px solid rgba(42,240,255,.28);
  background: linear-gradient(135deg, rgba(42,240,255,.16) 0%, rgba(93,252,155,.16) 100%);
  color: #f4fbff;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .02em;
  transition: .18s ease;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(42,240,255,.10);
}
.button.secondary {
  background: rgba(13, 30, 48, .78);
  color: #bfe6ff;
}
.button.danger {
  border-color: rgba(255,107,138,.26);
  background: linear-gradient(135deg, rgba(255,107,138,.16) 0%, rgba(255,74,117,.16) 100%);
  color: #ffd4dd;
}
.btn-sm { padding: 10px 12px; font-size: 13px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(42,240,255,.08);
  vertical-align: top;
  font-size: 14px;
}
.table th {
  color: rgba(136,163,187,.92);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.status-empty { background: rgba(125, 140, 160, .18); color: #c8d7e7; }
.status-qr_pending, .status-phone_code_pending, .status-password_pending { background: rgba(255,193,77,.16); color: #ffd98b; }
.status-session_saved { background: rgba(42,240,255,.16); color: #9af7ff; }
.status-connected { background: rgba(93,252,155,.16); color: #abffd0; }
.status-revoked { background: rgba(255,193,77,.16); color: #ffd98b; }
.status-deactivated, .status-banned { background: rgba(255,107,138,.16); color: #ffb7c8; }
.status-error { background: rgba(255,107,138,.16); color: #ffb7c8; }

.status-inline {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(42,240,255,.08);
  color: #9af7ff;
  border: 1px solid rgba(42,240,255,.16);
}
.qr-panel {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(9, 27, 44, .72);
  border: 1px dashed rgba(42,240,255,.18);
  text-align: center;
}
.qr-panel img {
  max-width: 220px;
  width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}
.secret {
  margin-top: 10px;
  word-break: break-all;
  color: var(--muted);
  font-size: 12px;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(5, 20, 32, .92);
  color: #f3fbff;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(42,240,255,.16);
  box-shadow: var(--shadow);
}
.logs-box {
  margin: 0;
  min-height: 420px;
  max-height: 70vh;
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(42,240,255,.10);
  background: rgba(4, 12, 22, .92);
  color: #bfe6ff;
  font: 12px/1.6 Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.hidden { display: none !important; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-grid {
  width: min(1100px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: .95fr .9fr;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(42,240,255,.14);
  box-shadow: var(--shadow);
  background: rgba(7, 17, 31, .68);
}
.login-side {
  padding: 42px;
  background:
    radial-gradient(circle at top left, rgba(42,240,255,.16), transparent 28%),
    linear-gradient(180deg, rgba(8, 20, 34, .95) 0%, rgba(5, 14, 25, .92) 100%);
  border-right: 1px solid rgba(42,240,255,.08);
}
.login-side-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(42,240,255,.12);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}
.login-side h1 {
  margin: 18px 0 12px;
  font-size: 42px;
  line-height: 1.12;
}
.login-side p {
  color: var(--muted);
  max-width: 420px;
  line-height: 1.8;
}
.login-side-lines { display: flex; gap: 10px; margin-top: 32px; }
.login-side-lines span {
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(42,240,255,.22), rgba(93,252,155,.4));
}
.login-card {
  padding: 32px;
  background: linear-gradient(180deg, rgba(8, 22, 39, .95) 0%, rgba(6, 17, 30, .92) 100%);
}
.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(42,240,255,.96) 0%, rgba(93,252,155,.92) 100%);
  color: #04111b;
  font-weight: 900;
  letter-spacing: .08em;
  margin-bottom: 18px;
}
.login-card h2 { margin: 0 0 10px; font-size: 28px; }
.alert.error {
  padding: 12px 14px;
  background: rgba(255,107,138,.12);
  color: #ffc4d1;
  border: 1px solid rgba(255,107,138,.24);
  border-radius: 14px;
  margin-bottom: 12px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 16, .72);
  backdrop-filter: blur(8px);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(42,240,255,.18);
  background: linear-gradient(180deg, rgba(8, 22, 39, .98) 0%, rgba(6, 17, 30, .96) 100%);
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}
.modal-close {
  border: 1px solid rgba(42,240,255,.16);
  background: rgba(7, 20, 34, .78);
  color: #dff7ff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
}

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-account { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    gap: 10px;
  }
  .sidebar::after { display: none; }
  .brand-block { border-bottom: 0; padding-bottom: 0; min-width: max-content; }
  .nav-group { min-width: max-content; }
  .nav { flex-direction: row; }
  .nav-group-bottom { margin-top: 0; }
  .logout { margin-left: auto; min-width: max-content; }
  .content { padding: 18px; }
  .cards { grid-template-columns: 1fr; }
  .login-grid { grid-template-columns: 1fr; }
  .login-side { border-right: 0; border-bottom: 1px solid rgba(42,240,255,.08); }
}
