:root {
  --bg: #08111d;
  --bg-elevated: #111c2b;
  --bg-soft: #162436;
  --border: rgba(189, 215, 255, 0.12);
  --text: #edf5ff;
  --muted: #8fa7c2;
  --accent: #59c8ff;
  --accent-strong: #1de5b5;
  --danger: #ff6b7a;
  --warning: #ffbb52;
  --success: #38d996;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(89, 200, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom left, rgba(29, 229, 181, 0.14), transparent 26%),
    linear-gradient(180deg, #06101b 0%, #0a1422 100%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 28px;
  border-right: 1px solid var(--border);
  background: rgba(7, 15, 27, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.brand-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.nav-links {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}
.nav-links a {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
}
.nav-links a.active,
.nav-links a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.sidebar-footer {
  display: grid;
  gap: 12px;
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
}
.main-content { padding: 28px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
}
.toolbar, .inline-form, .action-strip, .action-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.summary-grid,
.card-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.two-col { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.three-col { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.summary-card, .panel, .setting-card {
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.95), rgba(11, 18, 29, 0.96));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.summary-card {
  padding: 18px;
}
.summary-label {
  color: var(--muted);
  font-size: 0.9rem;
}
.summary-value {
  margin-top: 12px;
  font-size: 1.5rem;
  font-weight: 700;
}
.summary-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.panel { padding: 18px; }
.chart-grid .panel {
  min-height: 360px;
}
.chart-grid canvas {
  display: block;
  width: 100% !important;
  height: 280px !important;
  max-height: 280px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.input, .textarea, .search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.textarea { resize: vertical; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, #3aa8ff, #26d7b0);
  color: #06101b;
}
.btn-danger { background: var(--danger); color: white; }
.btn-muted,
.btn-action {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-full { width: 100%; }
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono-cell, .log-window {
  font-family: Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.status-pill,
.severity-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-healthy, .status-success, .severity-low { background: rgba(56, 217, 150, 0.12); color: var(--success); }
.status-down, .status-failed, .severity-critical, .severity-high { background: rgba(255, 107, 122, 0.12); color: var(--danger); }
.status-degraded, .status-warning, .severity-medium { background: rgba(255, 187, 82, 0.12); color: var(--warning); }
.status-unknown, .status-n-a, .status-info { background: rgba(143, 167, 194, 0.12); color: var(--muted); }
.flash-stack { display: grid; gap: 10px; margin-bottom: 16px; }
.flash {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.flash-success { background: rgba(56, 217, 150, 0.12); }
.flash-danger { background: rgba(255, 107, 122, 0.12); }
.flash-warning { background: rgba(255, 187, 82, 0.12); }
.flash-info { background: rgba(89, 200, 255, 0.12); }
.timeline-list { display: grid; gap: 12px; }
.timeline-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}
.empty-state {
  color: var(--muted);
  padding: 16px;
  text-align: center;
}
.metric-pair {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-list { display: grid; gap: 10px; }
.settings-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.setting-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}
.setting-key { font-weight: 700; }
.setting-description { color: var(--muted); font-size: 0.9rem; }
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(440px, calc(100vw - 32px));
}
.login-panel {
  padding: 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.97), rgba(11, 18, 29, 0.98));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.login-brand { font-size: 1.5rem; font-weight: 700; }
.login-copy { color: var(--muted); margin: 8px 0 20px; }
.login-form { display: grid; gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.heartbeat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.heartbeat::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(56, 217, 150, 0.7);
  animation: pulse 2s infinite;
}
.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 16, 0.78);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-panel {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.modal-header, .modal-footer {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-body { padding: 0 18px 18px; }
.icon-button {
  background: transparent;
  color: var(--text);
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
}
.inline-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(89, 200, 255, 0.1);
}
.hidden { display: none !important; }
.log-window {
  max-height: 420px;
  overflow: auto;
  background: #060d17;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 217, 150, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(56, 217, 150, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 217, 150, 0); }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 20px;
  }
  .topbar { flex-direction: column; }
  .chart-grid .panel {
    min-height: 320px;
  }
  .chart-grid canvas {
    height: 240px !important;
    max-height: 240px;
  }
}
