:root {
  --bg: #0f1419; --panel: #1a2029; --panel2: #222b36; --line: #2c3540;
  --text: #e6edf3; --muted: #8b98a5; --accent: #3b82f6; --accent2: #2563eb;
  --ok: #22c55e; --warn: #f59e0b; --err: #ef4444; --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--err); margin-top: 8px; min-height: 18px; font-size: 13px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px; width: 340px; display: flex; flex-direction: column; gap: 6px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.login-card input, input, select {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 9px 10px; font-size: 14px;
}
.login-card button {
  margin-top: 18px; background: var(--accent2); color: #fff; border: 1px solid var(--accent2);
  border-radius: 6px; padding: 10px; cursor: pointer; font-size: 14px;
}
.login-card button:hover { background: var(--accent); }

/* App shell */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { font-weight: 700; padding: 18px 20px; border-bottom: 1px solid var(--line); letter-spacing: .3px; }
#nav { flex: 1; padding: 10px 0; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--muted);
  text-decoration: none; border-left: 3px solid transparent; cursor: pointer;
}
#nav a:hover { background: var(--panel2); color: var(--text); }
#nav a.active { color: var(--text); border-left-color: var(--accent); background: var(--panel2); }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.who { color: var(--muted); margin-bottom: 8px; }
.who b { color: var(--text); }
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }

.content { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 18px; }
.view { padding: 24px; overflow: auto; }

/* Cards / metrics */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card .n { font-size: 28px; font-weight: 700; }
.card .l { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--panel2); }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Buttons + badges */
.btn { background: var(--accent2); border: 1px solid var(--accent2); color: #fff; border-radius: 6px; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12px; margin-left: 6px; }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--err); color: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.err { color: var(--err); border-color: var(--err); }
.badge.info { color: var(--accent); border-color: var(--accent); }

/* Forms / toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.section-title { margin: 24px 0 10px; font-size: 15px; }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); max-width: 380px; }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
