/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #0F1720;
  --surface: #16212C;
  --surface-2: #1D2A37;
  --border: #263442;
  --text: #E6EDF3;
  --text-muted: #8B99A7;
  --accent: #35D399;      /* ok / connected */
  --accent-dim: #1F5C46;
  --warning: #F2B84B;
  --danger: #EF5F5F;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --radius: 10px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

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

h1, h2, h3 { font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; }

p { margin: 0 0 12px; color: var(--text-muted); }

/* ==========================================================================
   Layout
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
}

.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--text-muted); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

.container-narrow {
  max-width: 460px;
  margin: 64px auto;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ==========================================================================
   Forms
   ========================================================================== */
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 14px;
  transition: border-color .15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 70px; }

.field-hint { font-size: 12px; color: var(--text-muted); margin-top: -10px; margin-bottom: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #06231A;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s ease;
}
.btn:hover { opacity: 0.88; }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #2A0A0A; }
.btn-warning { background: var(--warning); color: #2A1B00; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   Badges & status
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-ok { background: rgba(53,211,153,0.12); color: var(--accent); }
.badge-warning { background: rgba(242,184,75,0.14); color: var(--warning); }
.badge-danger { background: rgba(239,95,95,0.14); color: var(--danger); }
.badge-neutral { background: rgba(139,153,167,0.12); color: var(--text-muted); }

.dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.dot-ok { background: var(--accent); }
.dot-warning { background: var(--warning); }
.dot-danger { background: var(--danger); animation: pulse 1.6s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239,95,95,0.55); }
  70% { box-shadow: 0 0 0 6px rgba(239,95,95,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,95,95,0); }
}
@media (prefers-reduced-motion: reduce) {
  .dot-danger { animation: none; }
}

/* ==========================================================================
   Alerts / flash messages
   ========================================================================== */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: rgba(53,211,153,0.1); border: 1px solid var(--accent-dim); color: var(--accent); }
.flash-error { background: rgba(239,95,95,0.1); border: 1px solid rgba(239,95,95,0.4); color: var(--danger); }

.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.banner-danger { background: rgba(239,95,95,0.08); border: 1px solid rgba(239,95,95,0.35); }
.banner-warning { background: rgba(242,184,75,0.08); border: 1px solid rgba(242,184,75,0.35); }
.banner-icon { font-family: var(--font-mono); font-size: 18px; line-height: 1; margin-top: 1px; }

/* ==========================================================================
   Table
   ========================================================================== */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: 10px 10px;
  white-space: nowrap;
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td { background: rgba(255,255,255,0.015); }
.table-wrap { overflow-x: auto; }

.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.small { font-size: 12.5px; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-2);
}
.tab.active { background: var(--accent); color: #06231A; border-color: var(--accent); font-weight: 600; }

.stat-row { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 120px;
}
.stat .num { font-family: var(--font-mono); font-size: 24px; font-weight: 600; }
.stat .label { font-size: 12px; color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.link-muted { color: var(--text-muted); font-size: 13px; }
.top-link { margin-bottom: 18px; display: inline-block; }
