:root {
  --bg:      #0f0f0f;
  --surface: #1a1a1a;
  --border:  #2a2a2a;
  --text:    #f0f0f0;
  --muted:   #888;
  --accent:  #3b82f6;
  --green:   #22c55e;
  --red:     #ef4444;
  --yellow:  #f59e0b;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  min-height: 100vh;
}

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

/* ── Nav ── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.nav-badge {
  font-size: 0.65rem;
  background: var(--red);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-env { font-size: 0.75rem; color: var(--muted); }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}

.login-card h1 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.login-card p  { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ── Form elements ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.3rem; }
.field input  { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 0.875rem; padding: 0.55rem 0.75rem; }
.field input:focus { outline: none; border-color: var(--accent); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.875rem; font-weight: 500; cursor: pointer; border: none; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-sm       { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-full     { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* ── Error ── */
.error-msg { font-size: 0.8rem; color: var(--red); margin-bottom: 0.75rem; display: none; }
.error-msg.show { display: block; }

/* ── Main layout ── */
.main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.4rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-value.green  { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }

/* ── Section ── */
.section { margin-bottom: 2.5rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.section-header h2 { font-size: 0.95rem; font-weight: 700; }
.section-count { font-size: 0.75rem; color: var(--muted); }

/* ── Table ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

table { width: 100%; border-collapse: collapse; }
thead th { background: var(--surface); padding: 0.6rem 0.85rem; text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

.mono { font-family: monospace; font-size: 0.8rem; color: var(--muted); }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-online  { background: rgba(34,197,94,0.15);  color: var(--green); }
.badge-offline { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--yellow); }

/* ── Empty state ── */
.empty-row td { color: var(--muted); text-align: center; padding: 2rem; }

/* ── Toast ── */
.toast-wrap { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 300; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 1rem; font-size: 0.85rem; max-width: 300px; animation: slide-in 0.2s ease; }
.toast.error { border-color: var(--red); color: var(--red); }

/* ── Utility ── */
.is-hidden   { display: none }
.actions-bar { display: flex; gap: .5rem; align-items: center }

@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Confirm modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; width: 100%; max-width: 380px; }
.modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal p  { font-size: 0.875rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
