/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface2:   #263044;
  --border:     #334155;
  --text:       #f1f5f9;
  --muted:      #94a3b8;
  --primary:    #3b82f6;
  --primary-d:  #2563eb;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #8b5cf6;
  --sidebar-w:  220px;
  --header-h:   56px;
  --radius:     8px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

a { color: var(--primary); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
      stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
.flex    { display: flex; }
.flex-col { flex-direction: column; }
.gap-1   { gap: 4px; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.gap-4   { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; } .text-lg { font-size: 18px; } .text-xl { font-size: 24px; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); } .text-danger { color: var(--danger); }
.text-warning { color: var(--warning); } .text-primary { color: var(--primary); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; font-size: 12px; }
.w-full { width: 100%; }

/* ── Brand ───────────────────────────────────────────────── */
.logo-x     { color: var(--primary); font-weight: 800; font-size: 1.2em; letter-spacing: -1px; }
.logo-ceed  { font-weight: 300; font-size: 1.2em; letter-spacing: 2px; }
.logo-tag   { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

/* ── Login Overlay ───────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.login-card {
  width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-x, .login-logo .logo-ceed { font-size: 2rem; }
.login-logo .logo-tag { margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-full { width: 100%; }

/* ── App Layout ──────────────────────────────────────────── */
.app-body { overflow: hidden; }
.app { display: flex; height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: #0a1020;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
}
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.active svg { stroke: #fff; }
.nav-item.disabled { opacity: 0.3; pointer-events: none; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--border);
  min-height: 64px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-email { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { color: var(--muted); }
.logout-btn:hover { color: var(--danger); }

/* ── Main ────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--header-h);
  background: #0a1020; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 13px; font-weight: 600; text-transform: uppercase;
              letter-spacing: 0.5px; color: var(--muted); }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--muted); }
.stat-card.primary  { border-left: 3px solid var(--primary); }
.stat-card.success  { border-left: 3px solid var(--success); }
.stat-card.warning  { border-left: 3px solid var(--warning); }
.stat-card.danger   { border-left: 3px solid var(--danger); }
.stat-card.info     { border-left: 3px solid var(--info); }

/* ── Grid layouts ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px; vertical-align: middle;
}
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-success  { background: rgba(16,185,129,.15); color: var(--success); }
.badge-danger   { background: rgba(239,68,68,.15);  color: var(--danger);  }
.badge-warning  { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-primary  { background: rgba(59,130,246,.15); color: var(--primary); }
.badge-info     { background: rgba(139,92,246,.15); color: var(--info);    }
.badge-muted    { background: rgba(100,116,139,.15); color: var(--muted);  }

/* Role badges */
.badge-leadership { background: rgba(139,92,246,.2); color: #a78bfa; }
.badge-management { background: rgba(59,130,246,.2); color: #60a5fa; }
.badge-employee   { background: rgba(16,185,129,.15); color: var(--success); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; line-height: 1;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary  { background: var(--primary);   color: #fff; }
.btn-primary:hover  { background: var(--primary-d); }
.btn-danger   { background: var(--danger);    color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-success  { background: var(--success);   color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover  { background: var(--surface2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
  background: none; border: none; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px; border-radius: 4px; transition: color .15s, background .15s;
}
.btn-icon:hover { color: var(--text); background: var(--surface2); }
.btn-icon svg { width: 16px; height: 16px; }
button { font-family: inherit; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius);
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
}
select { appearance: none; cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-top: 8px;
}
.alert-danger  { background: rgba(239,68,68,.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.alert-info    { background: rgba(59,130,246,.15); color: var(--primary); border: 1px solid rgba(59,130,246,.3); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 500;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: 540px; max-width: 95vw;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 1000;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; min-width: 260px;
  animation: slide-in .2s ease; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-danger  { border-left: 3px solid var(--danger);  }
.toast.toast-info    { border-left: 3px solid var(--primary); }
@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Progress bars ───────────────────────────────────────── */
.progress { background: var(--surface2); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width .3s; background: var(--primary); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger);  }

/* ── Log viewer ──────────────────────────────────────────── */
.log-view {
  background: #080d17; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  height: 320px; overflow-y: auto; font-family: Consolas, monospace;
  font-size: 12px; color: #94d3a2; line-height: 1.5;
}

/* ── File browser ────────────────────────────────────────── */
.file-tree { display: flex; flex-direction: column; gap: 2px; }
.file-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; transition: background .15s;
}
.file-item:hover { background: var(--surface2); }
.file-item.dir { color: var(--primary); }
.file-item.file { color: var(--text); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb span.sep { opacity: 0.5; }
.breadcrumb span.crumb { cursor: pointer; }
.breadcrumb span.crumb:hover { color: var(--primary); }

/* ── Live dot ────────────────────────────────────────────── */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

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

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 56px; }
  .nav-item span, .sidebar-brand .logo-ceed, .user-info { display: none; }
  .sidebar-brand { justify-content: center; display: flex; }
  .nav-item { justify-content: center; }
  .user-avatar { margin: 0 auto; }
}
