:root {
  color-scheme: dark;
  --bg: #090d14;
  --panel: #111827;
  --panel-2: #151f2e;
  --text: #edf3fb;
  --muted: #8ea0b8;
  --line: #263244;
  --green: #36d399;
  --red: #fb7185;
  --cyan: #3ddbd9;
  --amber: #f6c85f;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 20% 0%, rgba(61, 219, 217, .12), transparent 34%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(30px, 4vw, 46px); letter-spacing: 0; }
h2 { margin-bottom: 16px; font-size: 22px; }
button, input, select { font: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 20px;
  background: rgba(13, 19, 30, .88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #031116;
  font-weight: 900;
}
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.nav { display: grid; gap: 6px; margin-top: 34px; }
.nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}
.nav a.active, .nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar-footer { position: absolute; left: 20px; right: 20px; bottom: 20px; }
.main { margin-left: 250px; padding: 28px; }
.page-head { margin-bottom: 22px; }
.page-head p, .muted { color: var(--muted); }
.eyebrow {
  display: inline-flex;
  padding: 4px 9px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
  font-weight: 800;
  font-size: 12px;
}

.filters, .toolbar, .section-head, .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filters, .toolbar { margin-bottom: 16px; justify-content: space-between; }
.section-head { justify-content: space-between; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metric-card, .panel, .login-card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.metric-card { padding: 16px; min-height: 128px; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin-top: 10px; font-size: 30px; letter-spacing: 0; }
.metric-card small { display: block; margin-top: 8px; font-weight: 800; }
.good { color: var(--green); }
.bad { color: var(--red); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .45fr);
  gap: 16px;
}
.panel { padding: 18px; margin-bottom: 16px; }
.wide { grid-column: span 1; }
.chart {
  min-height: 280px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding-top: 24px;
}
.chart.compact { min-height: 210px; }
.bar {
  flex: 1;
  min-width: 5px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--cyan), rgba(54, 211, 153, .28));
  border: 1px solid rgba(255,255,255,.08);
}
.bar.alt { background: linear-gradient(180deg, var(--amber), rgba(246,200,95,.25)); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
}
td, th { padding: 13px 10px; border-bottom: 1px solid var(--line); }
.table-link { font-weight: 800; color: var(--cyan); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0d1420;
  color: var(--text);
}
.btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: #0d1420;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--green)); color: #031116; border-color: transparent; }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.btn.danger { color: var(--red); }
.notice {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.notice.success { color: var(--green); }
.notice.danger { color: var(--red); }
.status { font-weight: 900; }
.status.success { color: var(--green); }
.status.failed { color: var(--red); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card { width: min(100%, 480px); padding: 24px; }
.login-brand { margin-bottom: 24px; }

@media (max-width: 920px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-footer { position: static; margin-top: 16px; }
  .main { margin-left: 0; padding: 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .filters, .toolbar, .section-head { align-items: stretch; }
  .filters > *, .toolbar > * { width: 100%; }
}
