/* SentriNet design system.
   Hand-built, no framework, no build step, no CDN. Works offline. */

:root {
  --bg:            #0b0f17;
  --bg-elevated:   #121826;
  --bg-hover:      #1a2234;
  --surface:       #151d2e;
  --border:        #232d43;
  --border-strong: #2f3b55;

  --text:          #e8ecf4;
  --text-muted:    #97a3b8;
  --text-faint:    #6b7689;

  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-soft:   rgba(59, 130, 246, 0.12);

  --ok:            #10b981;
  --info:          #38bdf8;
  --low:           #22c55e;
  --medium:        #f59e0b;
  --high:          #f97316;
  --critical:      #ef4444;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.22);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas,
          "Liberation Mono", monospace;
}

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

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

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

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-name {
  font-size: 17px; font-weight: 650; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.brand-tenant {
  font-size: 12px; color: var(--text-faint); margin-top: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: #93c5fd; }
.nav-item .badge { margin-left: auto; }

.nav-footer { padding: 12px; border-top: 1px solid var(--border); font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(11,15,23,.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }

.content { padding: 24px; max-width: 1500px; width: 100%; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.card-head .sub { font-size: 12px; color: var(--text-faint); }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ---------- stat tiles ---------- */
.stat { padding: 16px 18px; }
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
}
.stat-value {
  font-size: 27px; font-weight: 650; margin-top: 6px;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-value.danger { color: var(--critical); }
.stat-value.warn   { color: var(--medium); }
.stat-value.ok     { color: var(--ok); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-info     { background: rgba(56,189,248,.14); color: #7dd3fc; }
.badge-low      { background: rgba(34,197,94,.14);  color: #86efac; }
.badge-medium   { background: rgba(245,158,11,.14); color: #fcd34d; }
.badge-high     { background: rgba(249,115,22,.16); color: #fdba74; }
.badge-critical { background: rgba(239,68,68,.16);  color: #fca5a5; }
.badge-open         { background: rgba(239,68,68,.14);  color: #fca5a5; }
.badge-acknowledged { background: rgba(245,158,11,.14); color: #fcd34d; }
.badge-resolved     { background: rgba(16,185,129,.14); color: #6ee7b7; }
.badge-neutral  { background: var(--bg-hover); color: var(--text-muted); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-on  { background: var(--ok);   box-shadow: 0 0 0 3px rgba(16,185,129,.16); }
.dot-off { background: var(--text-faint); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 9px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.ip { font-family: var(--mono); font-size: 12.5px; }

.table-wrap { overflow-x: auto; }

/* ---------- alerts ---------- */
.alert-row { display: flex; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--bg-hover); }
.alert-bar { width: 3px; border-radius: 2px; flex-shrink: 0; }
.alert-bar.info{background:var(--info)} .alert-bar.low{background:var(--low)}
.alert-bar.medium{background:var(--medium)} .alert-bar.high{background:var(--high)}
.alert-bar.critical{background:var(--critical)}
.alert-main { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.alert-why { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.alert-meta {
  font-size: 11.5px; color: var(--text-faint); margin-top: 6px;
  display: flex; gap: 12px; flex-wrap: wrap;
}
.alert-fix {
  margin-top: 9px; padding: 9px 12px;
  background: var(--accent-soft); border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px; color: #bfdbfe;
}

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 6px; color: var(--text-muted); }
input, select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 550;
  cursor: pointer; transition: background .12s, opacity .12s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 15px; }
.msg-error { background: rgba(239,68,68,.11); border: 1px solid rgba(239,68,68,.28); color: #fca5a5; }
.msg-ok    { background: rgba(16,185,129,.11); border: 1px solid rgba(16,185,129,.28); color: #6ee7b7; }
.msg-info  { background: var(--accent-soft); border: 1px solid rgba(59,130,246,.28); color: #bfdbfe; }

/* ---------- auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head .brand-name { justify-content: center; font-size: 21px; }
.auth-head p { color: var(--text-muted); font-size: 14px; margin: 9px 0 0; }

/* ---------- misc ---------- */
.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }
.empty-title { font-size: 15px; color: var(--text-muted); margin-bottom: 6px; font-weight: 550; }
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 210px; }
.code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 11px 13px;
  overflow-x: auto; white-space: pre; color: #a5d6ff;
}
.mut { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-faint);
}
.live .dot-on { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
