:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f9fbfe;
  --text: #102033;
  --muted: #66758a;
  --border: #dbe3ee;
  --blue: #1769e8;
  --blue-dark: #0d3f91;
  --green: #15805a;
  --green-bg: #e8f7f0;
  --amber: #b86f00;
  --amber-bg: #fff4df;
  --red: #c83532;
  --red-bg: #fff0ef;
  --shadow: 0 16px 40px rgba(16, 32, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #0e1b2c;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #2e7cf6, #4ad3ff);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #9fb2c8;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  background: transparent;
  color: #b7c4d7;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.engineer-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.engineer-card span,
.engineer-card small {
  display: block;
  color: #9fb2c8;
  font-size: 12px;
}

.engineer-card strong {
  display: block;
  margin: 8px 0;
  font-size: 15px;
}

.main-panel {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.topbar,
.panel-heading,
.topbar-actions,
.legend {
  display: flex;
  align-items: center;
}

.topbar,
.panel-heading {
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

p {
  color: var(--muted);
  margin-top: 5px;
  font-size: 14px;
}

.topbar-actions {
  gap: 12px;
}

select,
.ghost-button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
}

.ghost-button {
  cursor: pointer;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  background: var(--green-bg);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}

.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 18px;
}

.kpi-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 28px;
  line-height: 1;
}

.kpi-card small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 360px;
  gap: 20px;
}

.panel {
  padding: 20px;
}

.chart-panel canvas {
  width: 100%;
  height: 360px;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f9fbfe);
}

.legend {
  margin-top: 12px;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.line-blue {
  background: var(--blue);
}

.line-amber {
  background: #f2a21b;
}

.alert-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.compact {
  align-items: flex-start;
}

.system-state {
  border-radius: 8px;
  padding: 18px;
  font-weight: 800;
  text-align: center;
}

.system-state.healthy {
  color: var(--green);
  background: var(--green-bg);
}

.system-state.warning {
  color: var(--amber);
  background: var(--amber-bg);
}

.system-state.critical {
  color: var(--red);
  background: var(--red-bg);
}

.fault-list {
  display: grid;
  gap: 10px;
}

.fault-item {
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.fault-item strong,
.fault-item span {
  display: block;
}

.fault-item strong {
  margin-bottom: 4px;
}

.fault-item span {
  color: var(--muted);
  font-size: 13px;
}

.fault-item.warning {
  border-left-color: var(--amber);
}

.fault-item.critical {
  border-left-color: var(--red);
}

.fault-item.healthy {
  border-left-color: var(--green);
}

.timestamp {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 14px 10px;
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status.ok {
  color: var(--green);
  background: var(--green-bg);
}

.status.warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.status.crit {
  color: var(--red);
  background: var(--red-bg);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .dashboard-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
