:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel2: #181c27;
  --border: #252a38;
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #6c8cff;
  --accent2: #a78bfa;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #1a1f2e 0%, var(--bg) 60%);
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card .logo-mark {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px;
}
.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login-card .muted { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* App shell */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.tag {
  font-size: 11px; font-weight: 500;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px;
  color: var(--muted);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 12px; padding: 4px 10px;
  background: var(--panel2); border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
.main { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  transition: .15s;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: var(--panel2); color: var(--text); font-weight: 500; }
.content { flex: 1; padding: 20px 24px; overflow: auto; }
.footer {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
  background: var(--panel);
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

/* Buttons */
.btn {
  border: none; border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b7cfa);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--panel2); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(248,113,113,.12); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Cards / panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat .value { font-size: 24px; font-weight: 600; }

/* Tables */
.table-wrap { overflow: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--panel2); color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.form-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  min-width: 160px;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { min-height: 100px; width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }

/* Status pills */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.pill-ok { background: rgba(52,211,153,.15); color: var(--ok); }
.pill-warn { background: rgba(251,191,36,.15); color: var(--warn); }
.pill-danger { background: rgba(248,113,113,.15); color: var(--danger); }
.pill-muted { background: var(--panel2); color: var(--muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow: auto;
  padding: 22px 24px;
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* Inbox preview */
.inbox-list { list-style: none; }
.inbox-list li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.inbox-list li:last-child { border-bottom: none; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .nav-item { font-size: 0; padding: 12px; text-align: center; }
  .nav-item::first-letter { font-size: 14px; }
  .content { padding: 14px; }
}
