:root {
  --bg: #0b0e13;
  --panel: #11161f;
  --panel-2: #161d28;
  --line: #1f2937;
  --text: #e5e9f0;
  --muted: #8b98ab;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-loading {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--muted);
  font-family: var(--mono);
}

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

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

.brand {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 18px 8px;
}
.brand small { color: var(--muted); letter-spacing: 0; }

.nav-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: #17313a; color: var(--accent); }

.sidebar footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  padding: 0 8px;
}
.sidebar footer button { margin-top: 8px; width: 100%; }

.main { padding: 26px 30px 60px; max-width: 1200px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--text); }
.sub { color: var(--muted); margin: 0 0 22px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.card .value { font-size: 28px; font-weight: 600; margin-top: 6px; font-family: var(--mono); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 7px; }
.dot.online { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.tag.ok { color: var(--ok); border-color: #14532d; }
.tag.err { color: var(--danger); border-color: #7f1d1d; }
.tag.warn { color: var(--warn); border-color: #78350f; }

button, .btn {
  background: #1b2737;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: #2c3b50; background: #20303f; }
button.primary { background: #0e7490; border-color: #0e7490; color: #ecfeff; }
button.primary:hover { background: #0891b2; }
button.danger { color: var(--danger); border-color: #7f1d1d; }
button.small { padding: 4px 9px; font-size: 12px; }

input, select, textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
}
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); }

.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 22px 0 18px; }
.tab { padding: 9px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

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

pre.out {
  background: #0a0f16;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  max-height: 420px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.login-wrap { display: grid; place-items: center; min-height: 100vh; }
.login {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
}
.login h1 { margin-bottom: 18px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash.err { background: #2a1215; border: 1px solid #7f1d1d; color: #fecaca; }

.event-line { font-family: var(--mono); font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid #141b24; color: var(--muted); }
.event-line b { color: var(--text); font-weight: 500; }
.event-line .t { color: #4b5b70; margin-right: 8px; }

.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { width: 100%; margin-bottom: 6px; }
  .sidebar footer { display: none; }
  .split, .row, .row-3 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}
