@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&family=Syne:wght@400;500;600;700;800&family=Inter:wght@300;400;500&display=swap');

/* ── Design tokens ─────────────────────────────── */
:root {
  --bg-base:       #0c0d0f;
  --bg-surface:    #111316;
  --bg-elevated:   #181a1e;
  --bg-hover:      #1e2026;
  --bg-active:     #232730;

  --border:        rgba(255,255,255,0.06);
  --border-mid:    rgba(255,255,255,0.10);
  --border-bright: rgba(255,255,255,0.18);

  --text-primary:  #e8e9eb;
  --text-secondary:#8b8d96;
  --text-muted:    #52545c;

  --accent:        #4ade80;       /* sharp green — the one color that pops */
  --accent-dim:    rgba(74,222,128,0.12);
  --accent-glow:   rgba(74,222,128,0.25);

  --danger:        #f87171;
  --warn:          #fbbf24;
  --info:          #60a5fa;

  --sidebar-w:     220px;
  --header-h:      0px;

  --font-display:  'Syne', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'DM Mono', monospace;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea {
  font: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Layout ─────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 16px; height: 16px; color: #000; }
.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}
.logo-text span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}
.nav-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 400;
  transition: all .12s;
  cursor: pointer;
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-active);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.nav-badge.live {
  background: rgba(74,222,128,0.1);
  color: var(--accent);
  border-color: rgba(74,222,128,0.2);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: background .12s;
}
.user-card:hover { background: var(--bg-hover); }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-active);
  border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-role.role-super, .user-role.role-admin { color: var(--accent); }
.user-role.role-mgr { color: var(--info); }
.user-role.role-dev { color: var(--warn); }
.user-role.role-qa  { color: #c084fc; }

.logout-btn {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all .12s;
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ── Main content ─────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  padding: 32px 40px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-title-area {}
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}
.page-subtitle {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.page-body {
  padding: 28px 40px 40px;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-body { padding: 20px; }

/* ── Dashboard grid ──────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
}
.module-card::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .2s;
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
}
.module-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.module-card:hover::after { opacity: 1; }

.module-card-icon {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  position: relative; z-index: 1;
}
.module-card-icon svg { width: 18px; height: 18px; }

.module-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  position: relative; z-index: 1;
}
.module-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  position: relative; z-index: 1;
}
.module-card-arrow {
  position: absolute;
  top: 20px; right: 20px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 1;
}
.module-card:hover .module-card-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* ── Stat row ─────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.stat-value.accent { color: var(--accent); }
.stat-value.warn   { color: var(--warn); }
.stat-value.danger { color: var(--danger); }

/* ── Table ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── Badges / Pills ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-green  { background: rgba(74,222,128,.1);  color: #4ade80; border-color: rgba(74,222,128,.2); }
.badge-red    { background: rgba(248,113,113,.1); color: #f87171; border-color: rgba(248,113,113,.2); }
.badge-yellow { background: rgba(251,191,36,.1);  color: #fbbf24; border-color: rgba(251,191,36,.2); }
.badge-blue   { background: rgba(96,165,250,.1);  color: #60a5fa; border-color: rgba(96,165,250,.2); }
.badge-purple { background: rgba(192,132,252,.1); color: #c084fc; border-color: rgba(192,132,252,.2); }
.badge-gray   { background: var(--bg-elevated);   color: var(--text-muted); border-color: var(--border); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: all .12s;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #6ee79a; box-shadow: 0 0 12px var(--accent-glow); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--border-bright); color: var(--text-primary); background: var(--bg-hover); }
.btn-danger {
  background: rgba(248,113,113,.1);
  border-color: rgba(248,113,113,.2);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
}

/* ── Forms ─────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ── Login page ─────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-shell::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74,222,128,0.04) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.login-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 400px;
  width: 100%;
  gap: 0;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  animation: fadeUp .4s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 20px; height: 20px; color: #000; }
.login-logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.login-logo-text small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error {
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  color: var(--danger);
}
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all .12s;
  cursor: pointer;
  margin-bottom: 4px;
}
.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

/* ── Placeholder/coming soon ─────────────────── */
.placeholder-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.placeholder-icon {
  width: 56px; height: 56px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.placeholder-icon svg { width: 24px; height: 24px; color: var(--text-muted); }
.placeholder-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.placeholder-desc { font-size: 13px; color: var(--text-muted); max-width: 300px; }
.placeholder-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.2);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ── Pending page ─────────────────────────────── */
.pending-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pending-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 400px;
  text-align: center;
}

/* ── Select override ─────────────────────────── */
select option { background: var(--bg-elevated); }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page-header, .page-body { padding-left: 20px; padding-right: 20px; }
}
