:root {
  --sidebar: #0b2a4a;
  --sidebar-deep: #071c33;
  --sidebar-hover: #133a63;
  --accent: #3db8ff;
  --accent-soft: rgba(61, 184, 255, 0.14);
  --gold: #e8b84a;
  --bg: #eef2f6;
  --panel: #ffffff;
  --text: #1a2433;
  --muted: #5b6b7c;
  --line: #d7e0ea;
  --ok: #1a9a6a;
  --warn: #c47a12;
  --run: #1d6fd8;
  --hold: #7a5af5;
  --danger: #c0392b;
  --shadow: 0 10px 30px rgba(15, 36, 64, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  color: #e8f1fa;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3db8ff, #1a6fb5);
  display: grid; place-items: center;
  font-weight: 700; color: white; letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(61,184,255,0.35);
}
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.brand p { font-size: 11px; color: #8fb0cc; margin-top: 1px; }

.nav {
  padding: 14px 10px;
  overflow-y: auto;
  flex: 1;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #7fa0bc;
  padding: 10px 12px 6px;
  font-weight: 600;
}

.menu-item { margin-bottom: 2px; }
.menu-btn {
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: background .15s;
}
.menu-btn:hover { background: var(--sidebar-hover); }
.menu-item.open > .menu-btn,
.menu-item.active > .menu-btn {
  background: var(--accent-soft);
  color: #fff;
}
.menu-btn .icon {
  width: 20px; text-align: center; opacity: 0.9;
}
.chev {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.65;
  transition: transform .2s;
}
.menu-item.open .chev { transform: rotate(90deg); }

.submenu {
  display: none;
  padding: 2px 0 6px 18px;
}
.menu-item.open .submenu { display: block; }
.submenu a {
  display: block;
  color: #c5d8ea;
  text-decoration: none;
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 7px;
  border-left: 2px solid transparent;
}
.submenu a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.submenu a.current {
  color: #fff;
  background: rgba(61,184,255,0.12);
  border-left-color: var(--accent);
}

.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #2a5a86;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #dff;
}
.user-meta { font-size: 12.5px; line-height: 1.25; }
.user-meta span { display: block; color: #8fb0cc; font-size: 11px; }

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 600; }
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: #f4f7fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  width: 280px;
  gap: 8px;
}
.search input {
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 13.5px; width: 100%; color: var(--text);
}
.search-icon { opacity: 0.55; }
.chip {
  font-size: 12px;
  background: #e8f6ee;
  color: #157a4f;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.content { padding: 24px 28px 40px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-head h2 { font-size: 22px; font-weight: 700; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.4px; }
.stat .d { font-size: 11.5px; margin-top: 4px; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-bar h3 { font-size: 15px; font-weight: 600; }
.db-status-body { padding: 18px; }
.db-status-message { margin-top: 10px; }
.filters { display: flex; gap: 8px; }
.filters button, .btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 11px;
  border-radius: 7px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
}
.filters button.active {
  background: #0b2a4a;
  color: #fff;
  border-color: #0b2a4a;
}
.btn-primary {
  background: #0b2a4a;
  color: #fff;
  border-color: #0b2a4a;
  font-weight: 600;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f6fafd; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; font-weight: 500; color: #0b2a4a; }
.muted { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.s-run { background: #e8f1fc; color: var(--run); }
.s-ok { background: #e6f6ef; color: var(--ok); }
.s-wait { background: #f8eedc; color: var(--warn); }
.s-hold { background: #eee8ff; color: var(--hold); }
.s-fail { background: #fdecea; color: var(--danger); }

.prio-high { color: var(--danger); font-weight: 600; }
.prio-med { color: var(--warn); font-weight: 600; }
.prio-low { color: var(--muted); }

@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .search { width: 200px; }
}
@media (max-width: 820px) {
  .sidebar { width: 220px; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
