/* BGS SysOps Portal — Design System */
:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --border:   #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --accent:   #58a6ff;
  --accent2:  #1f6feb;
  --green:    #3fb950;
  --yellow:   #d29922;
  --red:      #f85149;
  --orange:   #e3b341;
  --radius:   8px;
  --font:     'Inter', 'Segoe UI', system-ui, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

nav.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

nav.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
nav.sidebar-nav a:hover,
nav.sidebar-nav a.active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}
nav.sidebar-nav a .nav-icon { width: 16px; opacity: .7; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sidebar-footer .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sidebar-footer .avatar {
  width: 28px; height: 28px;
  background: var(--accent2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  text-transform: uppercase;
}
.sidebar-footer a { color: var(--muted); font-size: 12px; }
.sidebar-footer a:hover { color: var(--red); }

.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 28px 32px;
  max-width: calc(100vw - 220px);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 600; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}

/* ── Stat cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card.green { border-left: 3px solid var(--green); }
.stat-card.blue  { border-left: 3px solid var(--accent); }
.stat-card.yellow { border-left: 3px solid var(--yellow); }
.stat-card.red   { border-left: 3px solid var(--red); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── Badges / Status ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge.online  { background: rgba(63,185,80,.15); color: var(--green); }
.badge.offline { background: rgba(248,81,73,.12); color: var(--red); }
.badge.unknown { background: rgba(139,148,158,.12); color: var(--muted); }
.badge.warning { background: rgba(211,153,34,.15); color: var(--yellow); }
.badge.info    { background: rgba(88,166,255,.12); color: var(--accent); }
.badge.critical { background: rgba(248,81,73,.2); color: var(--red); }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot.online  { background: var(--green); box-shadow: 0 0 0 2px rgba(63,185,80,.3); }
.dot.offline { background: var(--red); }
.dot.unknown { background: var(--muted); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all .15s;
}
.btn-primary  { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color:#fff; text-decoration:none; }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface); text-decoration:none; }
.btn-danger    { background: rgba(248,81,73,.15); color: var(--red); border-color: rgba(248,81,73,.3); }
.btn-danger:hover { background: rgba(248,81,73,.25); text-decoration:none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 4px; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing:.04em; }
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--accent); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control option { background: var(--surface2); }

/* ── Alerts / Flash ─────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(63,185,80,.1); border-color: rgba(63,185,80,.3); color: var(--green); }
.alert-error   { background: rgba(248,81,73,.1); border-color: rgba(248,81,73,.3); color: var(--red); }
.alert-info    { background: rgba(88,166,255,.1); border-color: rgba(88,166,255,.3); color: var(--accent); }

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
}
.login-box .login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-box .login-logo h1 { font-size: 20px; font-weight: 700; }
.login-box .login-logo p  { font-size: 12px; color: var(--muted); }

/* ── Quick links ────────────────────────────────────────── */
.quick-links {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.quick-link {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color .15s, background .15s;
  text-decoration: none;
}
.quick-link:hover { border-color: var(--accent); background: var(--surface2); text-decoration: none; color: var(--text); }
.quick-link .ql-icon { font-size: 20px; }

/* ── Section header ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h2 { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing:.04em; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; padding: 16px; max-width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Misc ───────────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-accent { color: var(--accent); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mt-1 { margin-top: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.tag {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}
pre, code {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-item label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-item p {
  font-size: 13.5px;
  color: var(--text);
}
