:root {
  --canvas: #040406;
  --panel: #0a0a0c;
  --raised: #121214;
  --field: #0e0e11;
  --line: #18181c;
  --edge: #26262c;
  --text: #e8e8ee;
  --dim: #8b8b96;
  --faint: #5c5c66;
  --accent: #4a8cff;
  --accent-soft: #4a8cff22;
  --ok: #3ecf8e;
  --warn: #e2b341;
  --bad: #ef5a5a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ---------------------------------------------------------------- layout */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: 208px;
  flex: 0 0 208px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
}

.mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--accent), #2a5fd0);
  box-shadow: 0 0 0 1px #ffffff12 inset;
}

.brand span { font-weight: 600; letter-spacing: .2px; }
.brand small { display: block; color: var(--faint); font-size: 11px; font-weight: 400; letter-spacing: .3px; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav button {
  all: unset;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background .12s, color .12s;
}

.nav button:hover { background: var(--raised); color: var(--text); }
.nav button.active { background: var(--accent-soft); color: var(--text); }
.nav button.active::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }

.rail-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.rail-foot .who { color: var(--faint); font-size: 11px; word-break: break-all; }

.main { flex: 1; padding: 30px 34px 60px; max-width: 1180px; }

h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.2px; }
.sub { color: var(--dim); font-size: 13px; margin: 0 0 26px; }

/* ----------------------------------------------------------------- cards */

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

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

.card h2 {
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin: 0 0 10px;
}

.metric { font-size: 26px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.metric small { font-size: 12px; color: var(--faint); font-weight: 400; margin-left: 5px; }

/* ----------------------------------------------------------------- forms */

label { display: block; font-size: 12px; color: var(--dim); margin: 0 0 6px; }

input, select, textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--edge);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder { color: var(--faint); }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

button.act {
  all: unset;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: filter .12s, opacity .12s;
}

button.act:hover { filter: brightness(1.1); }
button.act:disabled { opacity: .45; cursor: default; filter: none; }

button.ghost {
  all: unset;
  cursor: pointer;
  background: var(--raised);
  border: 1px solid var(--edge);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  transition: background .12s;
}

button.ghost:hover { background: #1a1a1f; }
button.ghost.danger { color: var(--bad); border-color: #ef5a5a33; }
button.ghost.danger:hover { background: #ef5a5a14; }

/* ----------------------------------------------------------------- table */

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

th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--faint);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--line);
}

td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #ffffff04; }

.mono { font-family: "Cascadia Code", "Consolas", monospace; font-size: 12px; color: var(--dim); }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--raised);
  color: var(--dim);
  border: 1px solid var(--edge);
}

.pill.ok { color: var(--ok); border-color: #3ecf8e33; background: #3ecf8e10; }
.pill.warn { color: var(--warn); border-color: #e2b34133; background: #e2b34110; }
.pill.bad { color: var(--bad); border-color: #ef5a5a33; background: #ef5a5a10; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ----------------------------------------------------------------- login */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
  box-shadow: 0 24px 70px #00000070;
}

.gate-card .mark { width: 34px; height: 34px; border-radius: 9px; margin-bottom: 18px; }
.gate-card h1 { font-size: 18px; margin-bottom: 2px; }
.gate-card .sub { margin-bottom: 22px; }

/* ----------------------------------------------------------------- misc */

.msg {
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.msg.bad { background: #ef5a5a10; border-color: #ef5a5a33; color: #ffb3b3; }
.msg.ok { background: #3ecf8e10; border-color: #3ecf8e33; color: #a8f0d0; }

.empty { color: var(--faint); font-size: 13px; padding: 26px 0; text-align: center; }

.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; font-weight: 600; margin: 0; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail { width: auto; flex: none; flex-direction: row; overflow-x: auto; padding: 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand, .rail-foot { display: none; }
  .nav { flex-direction: row; }
  .main { padding: 20px 16px 50px; }
}
