:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1d232d;
  --line: #2a323e;
  --text: #e6eaf0;
  --muted: #8b97a8;
  --accent: #4f8cff;
  --accent-soft: #1b2b47;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand svg { color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item svg { flex: none; }

.sidebar-foot { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: var(--muted); }

.main { padding: 28px 32px 64px; max-width: 1080px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input[type="text"], input[type="email"], input[type="password"], select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  min-width: 0;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.grow { flex: 1 1 220px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 550;
}

.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid var(--line); color: var(--bad); }
.btn.small { padding: 5px 9px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: #1d3a24; background: #10231a; }
.pill.warn { color: var(--warn); border-color: #3d3117; background: #241d0f; }
.pill.bad { color: var(--bad); border-color: #3d1d1d; background: #241111; }

.code { font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, monospace; font-size: 13px; }
.body-text { white-space: pre-wrap; word-break: break-word; max-width: 520px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 13px; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: min(420px, 100%); }

.hidden { display: none !important; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 380px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.4);
}
.toast.bad { border-left-color: var(--bad); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .brand { padding-bottom: 8px; width: 100%; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 48px; }
}
