:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e273b;
  --border: #2a3550;
  --text: #e6ecf7;
  --muted: #8b98b3;
  --accent: #5b8cff;
  --accent-2: #7c5cff;
  --green: #2ecc71;
  --red: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2540 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}
.app { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 24px; font-weight: 700;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.3px; }
.brand-sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 10px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text); background: var(--panel-2); transition: transform .1s, filter .15s, background .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-secondary { background: var(--panel-2); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); }
.btn-sm { padding: 7px 11px; font-size: 12px; }

.toast {
  background: rgba(91, 140, 255, .12); border: 1px solid rgba(91, 140, 255, .35);
  color: #cfe0ff; padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 13px;
}

.status-banner { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; }
.status-banner.hidden { display: none; }
.status-text { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 7px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.status-detail { margin-top: 8px; color: var(--muted); font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat-value { font-size: 30px; font-weight: 700; margin: 8px 0 4px; }
.stat-value.small { font-size: 16px; margin-top: 14px; }
.unit { font-size: 14px; color: var(--muted); margin-left: 3px; }
.stat-foot { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; }
.panel-head h2 { margin: 0; font-size: 16px; }

.filters { display: flex; gap: 10px; padding: 0 20px 18px; flex-wrap: wrap; }
.filters input, .filters select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; outline: none;
}
.filters input { flex: 1; min-width: 180px; }
.filters input:focus, .filters select:focus { border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; padding: 12px 20px; background: var(--panel-2); border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 13px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.endpoint { display: flex; align-items: center; gap: 10px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #cfe0ff; }
.copy-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px;
  padding: 3px 8px; font-size: 11px; cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-socks5 { background: rgba(91,140,255,.16); color: #8fb2ff; }
.badge-socks4 { background: rgba(124,92,255,.16); color: #b39bff; }
.badge-http { background: rgba(46,204,113,.14); color: #6ee7a8; }
.badge-https { background: rgba(46,204,113,.14); color: #6ee7a8; }

.latency { font-weight: 600; }
.latency.good { color: var(--green); }
.latency.ok { color: #f1c40f; }
.latency.slow { color: var(--red); }
.muted { color: var(--muted); }
.delete-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.delete-btn:hover { color: var(--red); background: rgba(255,107,107,.12); }

.empty { text-align: center; padding: 60px 20px; border-top: 1px solid var(--border); }
.empty-icon { font-size: 40px; color: var(--border); }
.empty p { font-size: 16px; font-weight: 600; margin: 12px 0 4px; }
.empty span { color: var(--muted); }
.footer { margin-top: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.footer a { color: var(--accent); text-decoration: none; }

@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; align-items: flex-start; }
}
