:root {
  --bg: #f4f7fa;
  --ink: #0d2040;
  --muted: #5c7386;
  --line: #d6e2ec;
  --teal: #1b8a9c;
  --teal-dark: #126880;
  --teal-dim: rgba(27, 138, 156, 0.12);
  --card: #ffffff;
  --ok: #27ae60;
  --ok-bg: rgba(39, 174, 96, 0.12);
  --wait: #e8a020;
  --wait-bg: rgba(232, 160, 32, 0.14);
  --bad: #d94040;
  --bad-bg: rgba(217, 64, 64, 0.12);
  --info: #2e7cc4;
  --sidebar: 240px;
  --font: "Golos Text", Manrope, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  flex-shrink: 0;
}
.topbar img { height: 32px; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 13px; }
.spacer { margin-left: auto; }
.switch {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}
.switch button, .nav button, .btn {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 8px 12px;
}
.switch button[aria-pressed="true"] { background: #fff; color: var(--teal-dark); font-weight: 600; box-shadow: 0 1px 2px rgba(13, 32, 64, 0.08); }
.btn-primary { background: var(--teal); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { border: 1px solid var(--line); background: #fff; }

.params {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: end;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.params label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.params input[type="number"] {
  width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.params input:focus { outline: 2px solid rgba(27, 138, 156, 0.35); border-color: var(--teal); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; padding-bottom: 8px; color: var(--ink) !important; font-size: 14px !important; }

.shell { display: flex; flex: 1; min-height: 0; }
.nav {
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav button { text-align: left; color: var(--ink); }
.nav button[aria-current="page"] { background: var(--teal-dim); color: var(--teal-dark); font-weight: 600; }
.main { flex: 1; padding: 24px; overflow: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; margin-top: 6px; white-space: nowrap; }
.note { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--wait-bg);
  color: #7a5410;
}
.callout.bad { background: var(--bad-bg); color: #8d2c2c; }
.callout.ok { background: var(--ok-bg); color: #1c6b3c; }

.section-title { font-size: 21px; font-weight: 600; margin: 0 0 14px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid #e8eef3; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7fbfd; }
.right, td:nth-child(n+2) { white-space: nowrap; }
.right { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.pill.in_plan { background: var(--ok-bg); color: #1c6b3c; }
.pill.waiting { background: var(--wait-bg); color: #7a5410; }
.pill.blocked { background: var(--bad-bg); color: #8d2c2c; }
.test-tag { color: var(--muted); font-size: 12px; }

.group { margin-bottom: 8px; }
.group h3 { font-size: 15px; margin: 0; }
.group .meta { color: var(--muted); font-size: 13px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 32, 64, 0.35);
  display: grid;
  place-items: center;
  z-index: 20;
}
.overlay div {
  background: #fff;
  border-radius: 12px;
  padding: 24px 32px;
  font-weight: 600;
}

.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(13, 32, 64, 0.28);
  z-index: 15;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(520px, 100%);
  background: #fff;
  height: 100%;
  overflow: auto;
  padding: 24px;
  box-shadow: -8px 0 24px rgba(13, 32, 64, 0.08);
}
.drawer h2 { font-size: 21px; margin: 0 0 8px; }
.option {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}
.option.picked { border-color: var(--teal); background: var(--teal-dim); }

@media (max-width: 900px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .shell { display: block; }
}
