:root {
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #1e293b;
  --border: #273449;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #6366f1;
  --ok: #22c55e;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
code { background: rgba(148,163,184,0.15); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #1e293b 0%, #0b1120 65%);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}
.brand-badge {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff;
  margin-bottom: 14px;
}
.brand-badge.sm { width: 38px; height: 38px; font-size: 15px; margin: 0; border-radius: 10px; }
.subtitle { color: var(--muted); font-size: 14px; line-height: 1.5; }
.sso-pill {
  margin: 18px 0 22px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.28);
  color: var(--accent);
  font-size: 13px;
}
.login-foot { margin-top: 20px; color: var(--muted); font-size: 12px; }

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-lg { width: 100%; padding: 13px 18px; font-size: 15px; }
.btn-ghost {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  background: transparent;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  flex-shrink: 0;
}
.brand-row { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.module-nav { flex: 1; margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.4); color: var(--accent); font-weight: 600; }
.nav-pill { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.nav-pill.active { background: rgba(34,197,94,0.18); color: var(--ok); }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 14px; }
.ext-link { display: block; color: var(--accent); text-decoration: none; font-size: 13px; margin-bottom: 12px; }
.user-box { background: var(--panel-2); padding: 10px 12px; border-radius: 10px; }
.user-name { font-weight: 600; font-size: 13px; }
.user-email { color: var(--muted); font-size: 12px; word-break: break-all; }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar h2 { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }
.topbar-badges { display: flex; gap: 8px; }
.badge { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { border-color: rgba(34,197,94,0.4); color: var(--ok); background: rgba(34,197,94,0.1); }

.view-body { padding: 24px 28px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-val { font-size: 26px; font-weight: 700; margin-top: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
input, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
}
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
pre { background: #020617; padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 12px; border: 1px solid var(--border); }

@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .view-body, .topbar { padding: 16px; }
}
