/* ══════════════════════════════════════════════════
   WORKS RH Intelligence · Design System
   Palette: Works Blue #1a30cc / Dark Navy / Glass
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── TOKENS ───────────────────────────────────────── */
:root {
  --works-blue:      #1a30cc;
  --works-blue-mid:  #2540e0;
  --works-blue-glow: rgba(26, 48, 204, 0.35);
  --accent-cyan:     #38bdf8;
  --accent-purple:   #818cf8;
  --accent-green:    #10b981;
  --accent-orange:   #f59e0b;
  --accent-red:      #ef4444;

  --bg-900:  #06081a;
  --bg-800:  #0c0e28;
  --bg-700:  #111332;
  --bg-600:  #181b3e;
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --border:  rgba(255,255,255,0.07);
  --border-blue: rgba(26, 48, 204, 0.4);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --sidebar-w: 260px;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow-card: 0 4px 40px rgba(0,0,0,0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-900);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SCROLLBAR ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--works-blue-mid); }

/* ─── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-800) 0%, var(--bg-900) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img {
  width: 160px;
  object-fit: contain;
  /* Make it visible on dark background – Works logo is blue on white so we invert smartly */
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.nav-btn.active {
  background: linear-gradient(135deg, rgba(26,48,204,0.3) 0%, rgba(129,140,248,0.15) 100%);
  border-color: var(--border-blue);
  color: #fff;
  box-shadow: 0 0 20px var(--works-blue-glow);
}
.nav-btn.active svg { color: var(--accent-cyan); }

/* ─── SIDEBAR BOTTOM ────────────────────────────────── */
.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition);
}
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); animation: pulse 2s infinite; }
.status-dot.error  { background: var(--accent-red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sync-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--works-blue) 0%, var(--works-blue-mid) 100%);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  letter-spacing: 0.3px;
}
.sync-btn svg { width: 15px; height: 15px; }
.sync-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--works-blue-glow);
}
.sync-btn:active { transform: translateY(0); }
.sync-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── MAIN LAYOUT ────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── TOPBAR ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 26, 0.8);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.topbar-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  transition: var(--transition);
}
.search-wrap:focus-within { border-color: var(--works-blue-mid); box-shadow: 0 0 0 3px var(--works-blue-glow); }
.search-wrap svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  width: 220px;
}
.search-wrap input::placeholder { color: var(--text-muted); }

/* ─── VIEWS ──────────────────────────────────────────── */
.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}
.view.active { display: block; }

/* ─── DASHBOARD FILTERS ───────────────────────────────── */
.dashboard-filters {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── KPI GRID ───────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--works-blue-mid), transparent);
  opacity: 0;
  transition: var(--transition);
}
.kpi-card:hover { border-color: var(--border-blue); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.kpi-card:hover::before { opacity: 1; }
.kpi-card.loading { animation: shimmer 1.5s infinite; }

@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.blue   { background: rgba(26,48,204,0.2);  color: var(--accent-cyan); }
.kpi-icon.green  { background: rgba(16,185,129,0.2); color: var(--accent-green); }
.kpi-icon.orange { background: rgba(245,158,11,0.2); color: var(--accent-orange); }
.kpi-icon.purple { background: rgba(129,140,248,0.2);color: var(--accent-purple); }
.kpi-icon.red    { background: rgba(239,68,68,0.2);  color: var(--accent-red); }

.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--text-primary); margin-top: 4px; }

/* ─── CHARTS GRID ────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 768px)  { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}
.chart-card:hover { border-color: var(--border-blue); }
.chart-card.col-2 { grid-column: span 2; }

.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.chart-wrap {
  position: relative;
  height: 220px;
}

/* ─── EMPLOYEES TABLE ────────────────────────────────── */
#view-employees { padding-top: 20px; }
.employees-toolbar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover { background: var(--surface-hover); color: var(--text-primary); }
.chip.active {
  background: rgba(26,48,204,0.25);
  border-color: var(--works-blue-mid);
  color: #fff;
}

.employees-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: var(--surface);
  max-height: calc(100vh - 220px);
}

.employees-table {
  width: 100%;
  border-collapse: collapse;
}
.employees-table thead {
  position: sticky; top: 0;
  background: var(--bg-700);
  z-index: 1;
}
.employees-table th {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.employees-table td {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.employees-table tbody tr:last-child td { border-bottom: none; }
.employees-table tbody tr:hover td { background: var(--surface-hover); color: var(--text-primary); }

.employee-name { font-weight: 600; color: var(--text-primary) !important; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.badge-red   { background: rgba(239,68,68,0.15);  color: var(--accent-red); }

.loading-row {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px !important;
}

/* ─── AI CHAT ────────────────────────────────────────── */
#view-ai { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  padding: 24px 32px;
  gap: 16px;
}

.chat-header-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(26,48,204,0.15) 0%, rgba(129,140,248,0.08) 100%);
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}
.ai-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--works-blue), var(--accent-purple));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-avatar svg { width: 24px; height: 24px; color: white; }
.chat-header-card h2 { font-size: 16px; font-weight: 700; }
.chat-header-card p  { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.suggested-questions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.sq-label { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.sq-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sq-btn:hover {
  background: rgba(26,48,204,0.15);
  border-color: var(--works-blue-mid);
  color: #fff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: fadeUp 0.3s ease;
}
.message.user { flex-direction: row-reverse; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msg-avatar.bot {
  background: linear-gradient(135deg, var(--works-blue), var(--accent-purple));
}
.msg-avatar.user { background: var(--bg-600); border: 1px solid var(--border); }
.msg-avatar svg  { width: 18px; height: 18px; color: white; }

.msg-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
}
.message.bot  .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.message.bot  .msg-bubble strong { color: var(--text-primary); }
.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--works-blue) 0%, var(--works-blue-mid) 100%);
  color: #fff;
  border: 1px solid var(--works-blue-mid);
}

.typing-indicator { display: flex; gap: 4px; padding: 6px 0; align-items: center; }
.typing-dot {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-8px); opacity: 1; }
}

.chat-input-area { flex-shrink: 0; }
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  transition: var(--transition);
}
.chat-input-wrap:focus-within {
  border-color: var(--works-blue-mid);
  box-shadow: 0 0 0 3px var(--works-blue-glow);
}

.chat-input-wrap textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
}
.chat-input-wrap textarea::placeholder { color: var(--text-muted); }

.send-btn {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--works-blue), var(--works-blue-mid));
  border: none;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.send-btn svg { width: 16px; height: 16px; color: #fff; }
.send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px var(--works-blue-glow); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ─── TOAST ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--bg-600);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transform: translateY(80px);
  opacity: 0;
  transition: var(--transition);
  z-index: 9999;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: rgba(16,185,129,0.2); border-color: var(--accent-green); }
.toast.error   { background: rgba(239,68,68,0.2);  border-color: var(--accent-red); }

/* ─── AI SETTINGS ────────────────────────────────────── */
.sidebar-settings {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  transition: var(--transition);
}
.settings-header:hover {
  color: var(--text-primary);
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  animation: fadeDown 0.25s ease;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-input, .text-input {
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.select-input:focus, .text-input:focus {
  border-color: var(--works-blue-mid);
  box-shadow: 0 0 0 2px var(--works-blue-glow);
}

.select-input option {
  background: var(--bg-800);
  color: var(--text-primary);
}

.select-input optgroup {
  color: var(--accent-cyan);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── SAVE SETTINGS BUTTON ──────────────────────────── */
.save-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  width: 100%;
  background: rgba(26, 48, 204, 0.2);
  border: 1px solid var(--border-blue);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.save-settings-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.save-settings-btn:hover {
  background: rgba(26, 48, 204, 0.35);
  box-shadow: 0 0 12px var(--works-blue-glow);
  color: #fff;
}
.save-settings-btn.saved {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-green);
  color: var(--accent-green);
  animation: savedPulse 0.4s ease;
}
@keyframes savedPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ─── CHAT DRAWER & BUBBLE WIDGET ────────────────────── */

/* Floating Chat Bubble Button */
.chat-bubble-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--works-blue) 0%, var(--works-blue-mid) 100%);
  border: 1px solid var(--border-blue);
  box-shadow: 0 8px 32px var(--works-blue-glow), 0 0 0 1px rgba(255,255,255,0.1) inset;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  animation: floatBtn 3s ease-in-out infinite;
}
.chat-bubble-btn svg {
  width: 18px;
  height: 18px;
  color: #fff;
  transition: var(--transition);
}
.chat-bubble-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 40px rgba(26, 48, 204, 0.5), 0 0 0 2px var(--accent-cyan);
}
.chat-bubble-btn .bubble-lbl {
  max-width: 100px;
  overflow: hidden;
  transition: var(--transition);
}
.chat-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: pulseIndicator 2s infinite;
}

@keyframes floatBtn {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseIndicator {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* Chat Drawer Container */
.chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}
.chat-drawer.active {
  visibility: visible;
  pointer-events: auto;
}

/* Backdrop Overlay */
.chat-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 20, 0.5);
  backdrop-filter: blur(0px);
  opacity: 0;
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}
.chat-drawer.active .chat-drawer-backdrop {
  opacity: 1;
  backdrop-filter: blur(8px);
}

/* Drawer Sliding Content Panel */
.chat-drawer-content {
  position: relative;
  z-index: 2;
  width: 480px;
  max-width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(8, 10, 30, 0.95) 0%, rgba(12, 14, 40, 0.98) 100%);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-drawer.active .chat-drawer-content {
  transform: translateX(0);
}

/* Drawer Header */
.chat-drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.chat-drawer-header .ai-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--works-blue), var(--accent-purple));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-drawer-header .ai-avatar svg {
  width: 20px;
  height: 20px;
  color: white;
}
.chat-drawer-header .chat-header-info {
  flex: 1;
  min-width: 0;
}
.chat-drawer-header .chat-header-info h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-drawer-header .chat-header-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.close-drawer-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.close-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: rotate(90deg);
}
.close-drawer-btn svg {
  width: 16px;
  height: 16px;
}

/* Horizontal Suggested Questions in Drawer */
.chat-drawer .suggested-questions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.chat-drawer .suggested-questions::-webkit-scrollbar {
  height: 4px;
}
.chat-drawer .suggested-questions::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}
.chat-drawer .sq-btn {
  padding: 6px 12px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Scrollable Messages list inside Drawer */
.chat-drawer .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
.chat-drawer .msg-bubble {
  max-width: 85%;
  font-size: 13px;
  line-height: 1.6;
}

/* Hide chat bubble when drawer is open */
.chat-drawer.active ~ #chatBubbleBtn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* ─── LOGIN OVERLAY & CARD ────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Glowing background effect on login card */
.login-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(26, 48, 204, 0.15) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.login-logo img {
  width: 160px;
  height: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.login-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-card .form-group {
  margin-bottom: 20px;
  text-align: left;
}
.login-card .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Icon input styling */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrap svg {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: var(--transition);
}
.input-icon-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}
.input-icon-wrap input::placeholder {
  color: var(--text-muted);
}
.input-icon-wrap input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--works-blue-mid);
  box-shadow: 0 0 12px var(--works-blue-glow);
}
.input-icon-wrap input:focus + svg,
.input-icon-wrap input:focus ~ svg {
  color: var(--accent-cyan);
}

.login-error {
  font-size: 12px;
  color: var(--accent-red);
  margin-bottom: 20px;
  display: none;
  text-align: center;
  font-weight: 500;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--works-blue) 0%, var(--works-blue-mid) 100%);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(26, 48, 204, 0.3);
}
.login-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 48, 204, 0.45);
}
.login-submit-btn:active {
  transform: translateY(0);
}

/* Spinner inside button */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── LOGOUT BUTTON ────────────────────────────────── */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius);
  color: var(--accent-red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}
.logout-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

/* ─── TOPBAR ACTION BUTTON ─────────────────────────── */
.topbar-action-btn {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.topbar-action-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.topbar-action-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── EXPORT BUTTON ────────────────────────────────── */
.export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  margin-left: auto;
}
.export-btn svg {
  width: 14px;
  height: 14px;
}
.export-btn:hover {
  background: rgba(26, 48, 204, 0.15);
  border-color: var(--border-blue);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--works-blue-glow);
}

/* ─── EMPLOYEE DETAIL DRAWER ───────────────────────── */
.emp-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  pointer-events: none;
}
.emp-detail-drawer.active {
  visibility: visible;
  pointer-events: auto;
}
.emp-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 20, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.emp-detail-drawer.active .emp-detail-backdrop {
  opacity: 1;
}
.emp-detail-content {
  position: relative;
  z-index: 2;
  width: 520px;
  max-width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(8, 10, 30, 0.98) 0%, rgba(12, 14, 40, 0.99) 100%);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.emp-detail-drawer.active .emp-detail-content {
  transform: translateX(0);
}
.emp-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.emp-detail-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.emp-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.detail-section {
  margin-bottom: 20px;
}
.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.detail-item label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.detail-table th {
  background: var(--bg-700);
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.detail-table td {
  padding: 8px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.detail-table tbody tr:last-child td {
  border-bottom: none;
}
.detail-table tbody tr:hover td {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ─── DRILL-DOWN MODAL ──────────────────────────────── */
.drilldown-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}
.drilldown-modal.active {
  visibility: visible;
  pointer-events: auto;
}
.drilldown-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 20, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drilldown-modal.active .drilldown-backdrop {
  opacity: 1;
}
.drilldown-content {
  position: relative;
  z-index: 2;
  width: 640px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.drilldown-modal.active .drilldown-content {
  transform: scale(1);
}
.drilldown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drilldown-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.drilldown-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ─── HEATMAP ───────────────────────────────────────── */
#heatmapWrap::-webkit-scrollbar {
  height: 6px;
}

/* ══════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════ */
/* ─── PRINT LOGO (hidden on screen, visible on print) ── */
.print-logo {
  display: none;
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
    display: block !important;
    height: auto !important;
  }
  .sidebar,
  .chat-drawer,
  .chat-bubble-btn,
  .topbar-action-btn,
  .export-btn,
  .hamburger-btn,
  .sidebar-overlay,
  .toast,
  #loginOverlay,
  .emp-detail-drawer,
  .drilldown-modal {
    display: none !important;
  }
  .print-logo {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 2px solid #1a30cc;
  }
  .print-logo img {
    height: 36px;
    width: auto;
  }
  .print-logo span {
    font-size: 11px;
    color: #666;
    font-weight: 500;
  }
  .main {
    margin-left: 0 !important;
    overflow: visible !important;
  }
  .view {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .view:not(.active) {
    display: block !important;
  }
  .topbar {
    border-bottom: 2px solid #000 !important;
    background: #fff !important;
    padding: 12px 0 !important;
  }
  .topbar-title h1 { color: #000 !important; }
  .topbar-title p { color: #666 !important; }
  .kpi-card {
    border: 1px solid #ddd !important;
    background: #f8f8f8 !important;
    break-inside: avoid;
  }
  .kpi-value { color: #000 !important; }
  .kpi-label { color: #666 !important; }
  .chart-card {
    border: 1px solid #ddd !important;
    background: #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .chart-card h3 {
    color: #333 !important;
  }
  .employees-table th,
  .employees-table td {
    color: #333 !important;
    border-color: #ddd !important;
  }
  .employees-table thead { background: #f0f0f0 !important; }
  .dashboard-filters,
  .filter-chips,
  #searchWrap,
  .employees-toolbar {
    display: none !important;
  }
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }
  .charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .chart-card.col-2 {
    grid-column: span 2 !important;
  }
  @page {
    margin: 1.5cm;
  }
}

/* ══════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════ */

/* Hamburger button (hidden on desktop) */
.hamburger-btn {
  display: none;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.hamburger-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.hamburger-btn svg {
  width: 18px;
  height: 18px;
}

/* Sidebar overlay (mobile only) */
.sidebar-overlay {
  display: none;
}

@media (max-width: 768px) {
  /* ─── HAMBURGER ─────────────────────────────── */
  .hamburger-btn {
    display: flex;
  }

  /* ─── SIDEBAR ───────────────────────────────── */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 1001;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    left: 0;
  }

  /* Sidebar overlay backdrop */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 20, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* ─── TOPBAR ────────────────────────────────── */
  .topbar {
    padding: 16px;
  }
  .topbar-title h1 {
    font-size: 16px;
  }
  .topbar-title p {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .search-wrap {
    display: none;
  }
  #searchWrap.search-wrap {
    display: none !important;
  }

  /* ─── VIEWS ─────────────────────────────────── */
  .view {
    padding: 16px;
  }

  /* ─── KPI GRID ──────────────────────────────── */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 14px;
    gap: 12px;
  }
  .kpi-icon {
    width: 36px;
    height: 36px;
  }
  .kpi-icon svg {
    width: 16px;
    height: 16px;
  }
  .kpi-value {
    font-size: 18px;
  }

  /* ─── CHARTS GRID ───────────────────────────── */
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .chart-card.col-2 {
    grid-column: span 1;
  }
  .chart-card {
    padding: 14px;
  }
  .chart-wrap {
    height: 180px;
  }
  .chart-header h3 {
    font-size: 12px;
  }

  /* ─── EMPLOYEES TABLE ───────────────────────── */
  .employees-table-wrap {
    max-height: none;
    overflow-x: auto;
  }
  .employees-table th,
  .employees-table td {
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .filter-chips {
    flex-wrap: wrap;
  }
  .chip {
    font-size: 11px;
    padding: 4px 10px;
  }

  /* ─── CHAT DRAWER ───────────────────────────── */
  .chat-drawer-content {
    width: 100%;
    padding: 16px;
  }
  .chat-drawer .msg-bubble {
    max-width: 90%;
    font-size: 12px;
  }
  .chat-drawer .suggested-questions {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .chat-drawer-header .chat-header-info h2 {
    font-size: 13px;
  }
  .chat-drawer-header .chat-header-info p {
    font-size: 11px;
  }

  /* ─── CHAT BUBBLE ───────────────────────────── */
  .chat-bubble-btn {
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 12px;
  }
  .chat-bubble-btn .bubble-lbl {
    display: none;
  }

  /* ─── LOGIN ─────────────────────────────────── */
  .login-card {
    max-width: 340px;
    padding: 28px 20px;
    margin: 16px;
  }
  .login-header h2 {
    font-size: 18px;
  }

  /* ─── TOAST ─────────────────────────────────── */
  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    font-size: 12px;
  }

  /* ─── SETTINGS ──────────────────────────────── */
  .sidebar-settings {
    padding: 10px;
  }
  .settings-header {
    font-size: 11px;
  }

  /* ─── EMPLOYEE DETAIL (mobile) ────────────── */
  .emp-detail-content {
    width: 100% !important;
  }
  .detail-grid {
    grid-template-columns: 1fr !important;
  }
  .emp-detail-header {
    padding: 16px;
  }
  .emp-detail-header h2 {
    font-size: 16px;
  }
  .emp-detail-body {
    padding: 12px 16px;
  }

  /* ─── DRILL-DOWN (mobile) ──────────────────── */
  .drilldown-content {
    width: 100% !important;
    max-width: 100vw !important;
    max-height: 90vh !important;
    border-radius: 12px 12px 0 0 !important;
    margin: 0 12px;
  }

  /* ─── EXPORT BUTTON (mobile) ───────────────── */
  .export-btn span {
    display: none;
  }

  /* ─── PROFILE KPIS (mobile) ────────────────── */
  #profileKpiGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ─── PRINT BUTTON (mobile) ────────────────── */
  .topbar-action-btn {
    width: 32px;
    height: 32px;
  }
}


