/* Netryx web panel — matches the desktop panel's dark palette. */

:root {
  --bg: #0b0d12;
  --bg-elevated: #12151d;
  --bg-card: #161a23;
  --bg-hover: #1d222d;
  --border: #262c38;
  --border-strong: #333b4a;
  --text: #e6e9f0;
  --text-muted: #8b93a5;
  --text-dim: #5f6779;
  --accent: #4f8cff;
  --accent-hover: #6b9fff;
  --accent-dim: #1e3357;
  --green: #3ecf8e;
  --yellow: #f0b849;
  --red: #ff5c5c;
  --radius: 8px;
  --radius-sm: 5px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#root { height: 100%; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ── Layout ─────────────────────────────────────────────────────────── */

.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 52px; flex-shrink: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff;
}

.topbar-spacer { flex: 1; }

.conn-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 100px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.dot.ok { background: var(--green); box-shadow: 0 0 7px var(--green); }
.dot.err { background: var(--red); box-shadow: 0 0 7px var(--red); }
.dot.warn { background: var(--yellow); }

/* ── Tabs ───────────────────────────────────────────────────────────── */

.tabs {
  display: flex; gap: 2px; padding: 0 16px; flex-shrink: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 9px 14px; font-size: 13px; color: var(--text-muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 100px; background: var(--accent-dim);
  color: var(--accent-hover); font-size: 11px; font-weight: 600;
}

.main { flex: 1; overflow-y: auto; padding: 20px 16px 40px; }

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 620; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ── Stat tiles ─────────────────────────────────────────────────────── */

.stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.stat-value { font-size: 26px; font-weight: 680; margin-top: 6px; letter-spacing: -.02em; }
.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }

/* ── Tables ─────────────────────────────────────────────────────────── */

.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-card);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 620;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.mono { font-family: var(--mono); font-size: 12px; }

/* ── Badges ─────────────────────────────────────────────────────────── */

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.badge.online { background: rgba(62,207,142,.14); color: var(--green); }
.badge.offline { background: rgba(139,147,165,.14); color: var(--text-muted); }
.badge.pending { background: rgba(240,184,73,.14); color: var(--yellow); }
.badge.banned { background: rgba(255,92,92,.14); color: var(--red); }

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 13px; font-weight: 550;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--border-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: rgba(255,92,92,.12); border-color: rgba(255,92,92,.35); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: rgba(255,92,92,.2); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn.ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-strong);
  color: var(--text); outline: none; transition: border-color .12s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }
.hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; }

/* ── Login ──────────────────────────────────────────────────────────── */

.login-wrap {
  height: 100%; display: grid; place-items: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 26px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px; font-size: 19px; font-weight: 680;
}
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }

/* ── Empty state ────────────────────────────────────────────────────── */

.empty {
  padding: 44px 20px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 30px; opacity: .35; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }

/* ── Toast ──────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; bottom: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 8px; z-index: 100;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  padding: 11px 14px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border-strong);
  font-size: 13px; box-shadow: 0 8px 26px rgba(0,0,0,.45);
  animation: slide-in .18s ease-out;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }

/* ── Terminal ───────────────────────────────────────────────────────── */

.term {
  background: #05070b; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  height: 420px; overflow-y: auto; white-space: pre-wrap;
  word-break: break-word; color: #c8d0dc;
}
.term-line.err { color: var(--red); }
.term-line.ok { color: var(--green); }

/* ── Modal ──────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.62);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 20px;
}
.modal-title { font-size: 15px; font-weight: 650; margin-bottom: 14px; }

/* ── Scrollbars ─────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #46506380; }

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .main { padding: 14px 12px 32px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .tabs { padding: 0 12px; }
  .stat-value { font-size: 22px; }
  th, td { padding: 9px 10px; }
  .hide-sm { display: none; }
}
