:root {
  --bg: #eef1f4;
  --ink: #17202a;
  --muted: #667085;
  --panel: #ffffff;
  --line: #cfd6df;
  --accent: #0f766e;
  --accent-2: #b42318;
  --soft: #e6f4f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.10), transparent 30%),
    linear-gradient(315deg, rgba(23, 32, 42, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

.sidebar {
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  padding: 22px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

nav { display: grid; gap: 7px; }

.nav-item,
.primary-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}

.nav-item {
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.nav-item:hover,
.nav-item.active {
  background: var(--soft);
  border-color: #b6ddd6;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.main { padding: 28px; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 22px;
}

h1, h2, p { margin-top: 0; }

h1 { font-size: 28px; margin-bottom: 4px; }
h2 { font-size: 18px; margin-bottom: 14px; }

#page-subtitle { color: var(--muted); margin-bottom: 0; }

.view { display: none; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel,
.status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 32, 42, 0.06);
}

.metric { padding: 18px; }
.metric span { display: block; font-size: 32px; font-weight: 800; }
.metric small { color: var(--muted); }

.panel { padding: 18px; margin-bottom: 16px; overflow: hidden; }

.status {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-color: #f2b8b5;
  color: var(--accent-2);
}
.status.hidden { display: none; }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f8fa;
  font-weight: 800;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }

input, select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.chart-grid { display: grid; gap: 16px; }
canvas { width: 100%; max-width: 100%; height: auto; background: #fff; }

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

.form-panel button { justify-self: start; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: stretch; flex-direction: column; }
  .form-panel form { grid-template-columns: 1fr; }
}
