:root {
  --bg: #060912;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e9edf9;
  --muted: #8d96ac;
  --accent: #7c9cff;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--accent); text-decoration: none; }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; direction: ltr; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }

.bg-glow {
  position: fixed;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}
.bg-glow-a { background: #3b5bdb; top: -280px; right: -160px; }
.bg-glow-b { background: #6d28d9; bottom: -340px; left: -180px; opacity: 0.22; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 46px);
  background: rgba(6, 9, 18, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 16px; letter-spacing: 0.4px; }
.brand p { font-size: 11px; color: var(--muted); margin-top: -2px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: #b9c6ff;
  background: linear-gradient(140deg, rgba(124, 156, 255, 0.22), rgba(167, 139, 250, 0.12));
  border: 1px solid rgba(124, 156, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  background: var(--panel);
  white-space: nowrap;
}
.pill-ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.28); background: rgba(52, 211, 153, 0.08); }
.pill-bad { color: var(--bad); border-color: rgba(251, 113, 133, 0.3); background: rgba(251, 113, 133, 0.08); }
.pill-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }
.pill-muted { color: var(--muted); }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn:hover { background: var(--panel-strong); border-color: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; }
.btn-mini { padding: 5px 10px; border-radius: 9px; font-size: 11.5px; }

/* ---------------- layout ---------------- */
.page {
  position: relative;
  z-index: 1;
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 46px) 60px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 18px;
  flex-wrap: wrap;
}
.hero h2 { font-size: clamp(19px, 2.4vw, 26px); font-weight: 700; letter-spacing: -0.3px; }
.hero p { margin-top: 4px; font-size: 12.5px; max-width: 720px; }
.hero-meta { font-size: 12px; }

.alert {
  border: 1px solid rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.07);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 0 0 18px;
}
.alert-title { font-weight: 700; color: #ffc2cb; margin-bottom: 4px; }
.alert pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12.5px;
  color: #ffd9de;
}

/* ---------------- stats ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  padding: 15px 18px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.stat-label { display: block; color: var(--muted); font-size: 11.5px; }
.stat strong { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-top: 2px; }

/* ---------------- country cards ---------------- */
.countries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}

.country-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(124, 156, 255, 0.1), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.022));
  box-shadow: var(--shadow);
  padding: 16px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.country-card:hover { border-color: rgba(124, 156, 255, 0.28); transform: translateY(-2px); }

.country-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.country-title { display: flex; align-items: center; gap: 10px; }
.flag { font-size: 27px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
.country-title h3 { font-size: 15.5px; font-weight: 700; }
.cc { font-size: 10.5px; color: var(--muted); letter-spacing: 1.4px; }

.socks {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(6, 9, 18, 0.55);
  border: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--muted);
}
.socks code { color: #c7d3ff; font-size: 11.5px; direction: ltr; }

.country-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  margin: 10px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.slots { display: flex; flex-direction: column; gap: 6px; }

.slot {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(4, 7, 14, 0.35);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.slot:hover { background: rgba(4, 7, 14, 0.6); border-color: rgba(255, 255, 255, 0.07); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12); }
.dot.dead { background: var(--bad); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.12); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12); animation: pulse 1.6s infinite; }
.dot.unknown { background: var(--muted); box-shadow: 0 0 0 4px rgba(141, 150, 172, 0.1); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.slot-main { min-width: 0; }
.slot-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.server { font-size: 12.5px; font-weight: 700; direction: ltr; }
.city { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.slot-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.bar-wrap { display: inline-flex; align-items: center; gap: 6px; }
.bar {
  display: inline-block;
  width: 54px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5b8cff, #a78bfa);
}

.status {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status.up { color: var(--ok); background: rgba(52, 211, 153, 0.09); border-color: rgba(52, 211, 153, 0.2); }
.status.dead { color: var(--bad); background: rgba(251, 113, 133, 0.09); border-color: rgba(251, 113, 133, 0.2); }
.status.warn { color: var(--warn); background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.2); }
.status.unknown { color: var(--muted); background: rgba(255, 255, 255, 0.04); border-color: var(--border); }

.empty, .empty-state {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* ---------------- servers panel ---------------- */
.servers-panel {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; }
.panel-head p { font-size: 11.5px; margin-top: 2px; }

.select {
  appearance: none;
  background: rgba(6, 9, 18, 0.65);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 34px 8px 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(0% + 14px) 50%, calc(0% + 19px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td {
  padding: 10px 18px;
  text-align: right;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}
.table th { color: var(--muted); font-weight: 500; font-size: 11px; background: rgba(0, 0, 0, 0.16); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  flex-wrap: wrap;
}

/* ---------------- login ---------------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 500px at 80% -10%, rgba(59, 91, 219, 0.25), transparent 60%),
    radial-gradient(600px 500px at 0% 110%, rgba(109, 40, 217, 0.22), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-wrap { width: min(420px, 100%); }
.login-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
  padding: 34px 30px 26px;
  text-align: center;
  backdrop-filter: blur(14px);
}
.login-card .brand-mark { margin: 0 auto 14px; }
.login-card h1 { font-size: 24px; letter-spacing: 0.5px; }
.login-card .muted { font-size: 12px; margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; text-align: right; }
.login-form label { font-size: 11.5px; color: var(--muted); }
.login-form input {
  background: rgba(4, 7, 14, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.login-form input:focus {
  outline: none;
  border-color: rgba(124, 156, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.12);
}
.login-form button {
  margin-top: 8px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b8cff, #8b5cf6);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(91, 140, 255, 0.28);
  transition: filter 0.18s ease, transform 0.18s ease;
}
.login-form button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.login-foot { margin-top: 18px; font-size: 10.5px; color: var(--muted); }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  bottom: 22px;
  right: 50%;
  transform: translateX(50%);
  z-index: 50;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: rgba(12, 17, 30, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.toast-ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.3); }
.toast-error { color: var(--bad); border-color: rgba(251, 113, 133, 0.3); }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .countries { grid-template-columns: 1fr; }
  .slot { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .slot .status { display: none; }
  .hero h2 { font-size: 20px; }
}
