:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #18202e;
  --muted: #697386;
  --line: #d9dee8;
  --accent: #176b5f;
  --accent-2: #2454a6;
  --danger: #b42318;
  --ok: #0f7a46;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--text);
}

.sidebar {
  background: #151a22;
  color: #fff;
  padding: 22px 16px;
}

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

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #1f8a78;
  font-weight: 800;
}

h1, h2, h3, p { margin: 0; }
.brand h1 { font-size: 18px; }
.brand p { color: #aab3c2; font-size: 12px; margin-top: 3px; }

nav { display: grid; gap: 6px; }
.nav {
  border: 0;
  background: transparent;
  color: #cbd3df;
  padding: 11px 12px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.nav.active, .nav:hover { background: #242b36; color: #fff; }

main { min-width: 0; }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.topbar h2 { font-size: 21px; }
.topbar p { margin-top: 5px; color: var(--muted); font-size: 13px; }

.view { display: none; padding: 24px 28px; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel, .stack, .note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metric { padding: 18px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }

.panel { overflow: hidden; }
.panel-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 600; background: #fbfcfe; }
td.error { color: var(--danger); max-width: 420px; white-space: normal; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 160px 2fr 120px 140px 100px 120px;
  gap: 10px;
  margin-bottom: 16px;
}
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stack {
  display: grid;
  gap: 10px;
  padding: 16px;
}
.narrow { max-width: 560px; }

input, select, button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}
label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
label input[type="checkbox"] { width: 16px; height: 16px; }
label input:not([type="checkbox"]) { width: 100%; margin-left: 8px; }
button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 650;
}
.icon-btn {
  width: 38px;
  padding: 0;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  font-size: 18px;
}

.list { display: grid; gap: 10px; }
.item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.item h3 { font-size: 15px; margin-bottom: 6px; }
.item p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.item .danger { background: var(--danger); border-color: var(--danger); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #edf7f3;
  color: var(--ok);
}
.badge.off { background: #f3f4f6; color: var(--muted); }
.note {
  margin-top: 14px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
}
output {
  min-height: 32px;
  color: var(--accent-2);
  word-break: break-all;
}

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .metrics, .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .view { padding: 18px 16px; }
}
