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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════ */
:root {
  /* Backgrounds — layered depth */
  --bg-base:      #07080E;
  --bg-surface:   #0C0D16;
  --bg-card:      #10111C;
  --bg-elevated:  #161828;
  --bg-input:     #0C0D16;
  --bg-hover:     rgba(255,255,255,0.032);
  --bg-active:    rgba(59,130,246,0.10);

  /* Brand */
  --primary:       #3B82F6;
  --primary-dark:  #2563EB;
  --primary-light: rgba(59,130,246,0.12);
  --primary-glow:  rgba(59,130,246,0.22);

  /* Semantic */
  --success:      #10B981;
  --success-light: rgba(16,185,129,0.12);
  --danger:       #F87171;
  --danger-light: rgba(248,113,113,0.12);
  --warning:      #F59E0B;
  --warning-light: rgba(245,158,11,0.12);
  --violet:       #8B5CF6;
  --violet-light: rgba(139,92,246,0.12);

  /* Borders */
  --border:        rgba(255,255,255,0.055);
  --border-strong: rgba(255,255,255,0.09);
  --border-focus:  rgba(59,130,246,0.55);

  /* Text */
  --text-primary:   #E8EEFF;
  --text-secondary: #6E7DA0;
  --text-muted:     #363D58;

  /* Legacy aliases — keeps all JS working */
  --primary-dark:   #2563EB;
  --gray-50:  #161828;
  --gray-100: #0C0D16;
  --gray-200: rgba(255,255,255,0.07);
  --gray-300: rgba(255,255,255,0.11);
  --gray-400: #3D4566;
  --gray-500: #5A6380;
  --gray-600: #6E7DA0;
  --gray-700: #B0BAD4;
  --gray-800: #D4DCF0;
  --gray-900: #E8EEFF;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.6);
  --shadow:    0 4px 20px rgba(0,0,0,0.55);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.55);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.65);
  --glow-sm:   0 0 16px rgba(59,130,246,0.18);
  --glow:      0 0 32px rgba(59,130,246,0.22);
}

/* ═══════════════════════════════════════
   BASE
═══════════════════════════════════════ */
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   BRAND
═══════════════════════════════════════ */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  user-select: none;
}
.brand-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(59,130,246,0.4));
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1;
}
.brand-name span:first-child { color: var(--text-primary); }
.brand-name span:last-child  { color: var(--primary); }
.brand-tagline {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Layered glow background */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 15% 20%, rgba(59,130,246,0.13) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 85% 80%, rgba(139,92,246,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(16,185,129,0.04) 0%, transparent 70%);
  pointer-events: none;
}

/* Subtle grid overlay */
.login-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.login-card {
  background: rgba(16, 17, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59,130,246,0.06), inset 0 1px 0 rgba(255,255,255,0.06);
  padding: 48px 44px 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.5s ease;
}

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

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}
.login-logo .logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo .logo-icon img {
  width: 46px; height: 46px;
  filter: drop-shadow(0 0 12px rgba(59,130,246,0.5));
}
.login-logo .logo-icon .logo-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
}
.login-logo .logo-icon .logo-text span:first-child { color: var(--text-primary); }
.login-logo .logo-icon .logo-text span:last-child  { color: var(--primary); }
.login-logo h1 { display: none; }
.login-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-input);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  background: rgba(59,130,246,0.04);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.10);
}
.form-group select { cursor: pointer; }
.form-group select option { background: var(--bg-elevated); color: var(--text-primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.28);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4B8EF8, #3574F0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 28px rgba(59,130,246,0.4);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  box-shadow: 0 0 16px rgba(16,185,129,0.25);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #15C98F, #10A876);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  box-shadow: 0 0 16px rgba(239,68,68,0.22);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #F55555, #E73535);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.14);
  color: var(--text-primary);
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════
   ALERTS
═══════════════════════════════════════ */
.alert {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
  border-left: 3px solid;
}
.alert-error {
  background: rgba(248,113,113,0.08);
  color: #FDA4A4;
  border-color: #F87171;
  border: 1px solid rgba(248,113,113,0.2);
  border-left: 3px solid #F87171;
  display: block;
}
.alert-success {
  background: rgba(16,185,129,0.08);
  color: #6EE7B7;
  border: 1px solid rgba(16,185,129,0.2);
  border-left: 3px solid #10B981;
  display: block;
}
.alert-warning {
  background: rgba(245,158,11,0.08);
  color: #FCD34D;
  border: 1px solid rgba(245,158,11,0.2);
  border-left: 3px solid var(--warning);
  display: block;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   CHAT PAGE
═══════════════════════════════════════ */
.chat-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  position: relative;
}

/* Subtle background texture */
.chat-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 90% 100%, rgba(139,92,246,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.chat-header {
  background: rgba(7,8,14,0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-info h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.chat-header-info p {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.chat-header-actions { display: flex; gap: 6px; }
.chat-header-actions button {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font);
  letter-spacing: -0.01em;
}
.chat-header-actions button:hover {
  background: var(--primary-light);
  border-color: rgba(59,130,246,0.35);
  color: #93C5FD;
}

.bot-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(59,130,246,0.3), rgba(59,130,246,0.08));
  border: 1px solid rgba(59,130,246,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 6px;
  box-shadow: 0 0 12px rgba(59,130,246,0.15);
}
.bot-avatar img { width: 100%; height: 100%; object-fit: contain; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
  position: relative;
  z-index: 1;
}

/* Fade-in animation for messages */
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 72%;
  animation: msgIn 0.3s ease;
}
.message-wrapper.user { align-self: flex-end; flex-direction: row-reverse; }
.message-wrapper.bot  { align-self: flex-start; }

.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
}
.message-wrapper.user .message-bubble {
  background: linear-gradient(135deg, #3B82F6, #2D6FE3);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.message-wrapper.bot .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

/* Markdown in bot bubbles */
.message-wrapper.bot .message-bubble strong { color: #fff; font-weight: 600; }
.message-wrapper.bot .message-bubble em { color: #B0BBDD; font-style: italic; }
.message-wrapper.bot .message-bubble h1,
.message-wrapper.bot .message-bubble h2,
.message-wrapper.bot .message-bubble h3 {
  color: #93C5FD;
  margin: 10px 0 5px;
  font-size: 13.5px;
  font-weight: 700;
}
.message-wrapper.bot .message-bubble ul,
.message-wrapper.bot .message-bubble ol { padding-left: 18px; margin: 6px 0; }
.message-wrapper.bot .message-bubble li { margin: 4px 0; }
.message-wrapper.bot .message-bubble hr {
  border: none;
  border-top: 1px solid var(--border-strong);
  margin: 10px 0;
}
.message-wrapper.bot .message-bubble code {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.15);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  color: #93C5FD;
}

.message-time {
  font-size: 10.5px;
  margin-top: 4px;
  opacity: 0.5;
  letter-spacing: 0.01em;
}
.message-wrapper.user .message-time { text-align: right; color: var(--text-secondary); }
.message-wrapper.bot  .message-time { color: var(--text-muted); }

/* Typing indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: 64px;
}
.typing-indicator.show { display: flex; }
.typing-dot {
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingBounce 1.3s ease infinite;
  opacity: 0.8;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
  40%           { transform: translateY(-7px) scale(1.1); opacity: 1; }
}

/* ─ Chat input ─ */
.chat-input-area {
  background: rgba(7,8,14,0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  outline: none;
  max-height: 130px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-input);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-area textarea::placeholder { color: var(--text-muted); }
.chat-input-area textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}

.send-btn {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(59,130,246,0.35);
}
.send-btn:hover    { box-shadow: 0 0 26px rgba(59,130,246,0.55); transform: scale(1.05); }
.send-btn:active   { transform: scale(0.95); }
.send-btn:disabled {
  background: var(--bg-elevated);
  box-shadow: none;
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* ─ Empty / welcome state ─ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  animation: fadeUp 0.5s ease;
}
.empty-state .empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.7;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.empty-state p { font-size: 14px; color: var(--text-muted); max-width: 300px; margin: 0 auto; }

/* Suggestion pills */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}
.suggestion-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font);
  font-weight: 500;
}
.suggestion-pill:hover {
  background: var(--primary-light);
  border-color: rgba(59,130,246,0.35);
  color: #93C5FD;
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: overlayIn 0.2s ease; }
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 22px 24px; }

/* Leave balance grid */
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}
.balance-card:hover { border-color: var(--border-strong); }
.balance-card .leave-name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.balance-card .leave-remaining {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin: 4px 0 2px;
  letter-spacing: -1px;
}
.balance-card .leave-detail { font-size: 11.5px; color: var(--text-muted); }

/* ═══════════════════════════════════════
   APP LAYOUT (Admin / Approvals / Timesheet)
═══════════════════════════════════════ */
.app-layout { height: 100vh; display: flex; flex-direction: column; background: var(--bg-base); }

.app-header {
  background: rgba(7,8,14,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
}
.app-header h1 { display: none; }
.app-header .header-brand { display: flex; align-items: center; }
.app-header .header-user { display: flex; align-items: center; gap: 8px; }
.app-header .header-user span {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 4px;
}
.app-header .header-user button {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.18s;
  letter-spacing: -0.01em;
}
.app-header .header-user button:hover {
  background: var(--primary-light);
  border-color: rgba(59,130,246,0.35);
  color: #93C5FD;
}

.app-body { flex: 1; display: flex; overflow: hidden; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  width: 210px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 8px;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-nav { list-style: none; }
.sidebar-nav li a,
.sidebar-nav li button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: all 0.15s;
  letter-spacing: -0.01em;
}
.sidebar-nav li a:hover,
.sidebar-nav li button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-nav li.active a,
.sidebar-nav li.active button {
  background: var(--bg-active);
  color: #93C5FD;
  font-weight: 600;
}

.sidebar-section {
  padding: 18px 12px 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ─ Main content area ─ */
.main-content { flex: 1; overflow-y: auto; padding: 28px; }
.page-section { display: none; }
.page-section.active { display: block; }

.page-header { margin-bottom: 24px; }
.page-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-strong); }

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255,255,255,0.015);
}
.card-header h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.card-body { padding: 20px; }

/* ═══════════════════════════════════════
   TABLES
═══════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: rgba(255,255,255,0.025);
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: var(--bg-hover); color: var(--text-primary); }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 4px;
}
.badge-pending  { background: rgba(245,158,11,0.12); color: #FBB054; border: 1px solid rgba(245,158,11,0.2); }
.badge-approved { background: rgba(16,185,129,0.12);  color: #34D399; border: 1px solid rgba(16,185,129,0.2); }
.badge-rejected { background: rgba(248,113,113,0.12); color: #FCA5A5; border: 1px solid rgba(248,113,113,0.2); }
.badge-cancelled{ background: var(--bg-elevated);     color: var(--text-muted); border: 1px solid var(--border); }
.badge-admin    { background: var(--violet-light);    color: #C4B5FD; border: 1px solid rgba(139,92,246,0.2); }
.badge-manager  { background: var(--primary-light);   color: #93C5FD; border: 1px solid rgba(59,130,246,0.2); }
.badge-employee { background: var(--bg-elevated);     color: var(--text-secondary); border: 1px solid var(--border); }

/* ═══════════════════════════════════════
   DROP ZONE
═══════════════════════════════════════ */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}
.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.04), transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
}
.drop-zone:hover::before,
.drop-zone.drag-over::before { opacity: 1; }
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(59,130,246,0.06);
  color: #93C5FD;
}
.drop-zone .drop-icon { font-size: 36px; margin-bottom: 14px; display: block; }
.drop-zone h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.drop-zone p  { font-size: 13px; }

/* ═══════════════════════════════════════
   STATS ROW
═══════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
}
.stat-card .stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════════════════════
   APPROVAL CARDS
═══════════════════════════════════════ */
.approval-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.approval-card:hover { border-color: var(--border-strong); border-left-color: var(--warning); box-shadow: var(--shadow); }
.approval-card.processed { border-left-color: var(--border); opacity: 0.6; }

.approval-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 8px;
}
.approval-card-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.approval-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.approval-detail { font-size: 13px; color: var(--text-secondary); }
.approval-detail strong {
  color: var(--text-muted);
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
  font-weight: 700;
}
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.reject-form { margin-top: 14px; display: none; }
.reject-form textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px; font-family: var(--font);
  resize: vertical; outline: none;
  background: var(--bg-input); color: var(--text-primary);
  transition: border-color 0.2s;
}
.reject-form textarea:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(248,113,113,0.10); }
.reject-form .reject-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ═══════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════ */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.filter-bar select,
.filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px; font-family: var(--font);
  outline: none;
  background: var(--bg-input); color: var(--text-primary);
  transition: border-color 0.2s;
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,0.10); }

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
  font-weight: 500;
}
.toast.success {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.25);
  color: #6EE7B7;
  border-left: 3px solid #10B981;
}
.toast.error {
  background: rgba(248,113,113,0.12);
  border-color: rgba(248,113,113,0.25);
  color: #FCA5A5;
  border-left: 3px solid #F87171;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ═══════════════════════════════════════
   SPINNER
═══════════════════════════════════════ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ═══════════════════════════════════════
   PENDING ACTION CONFIRMATION BUTTONS
═══════════════════════════════════════ */
.action-confirm-box {
  margin-top: 12px;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 12px;
  padding: 14px 16px;
  animation: fadeUp 0.25s ease;
}
.action-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}
.action-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.action-btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font);
  letter-spacing: -0.01em;
}
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.action-btn-confirm {
  background: linear-gradient(135deg, #16A34A, #15803D);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
}
.action-btn-confirm:hover:not(:disabled) {
  background: linear-gradient(135deg, #15803D, #166534);
  box-shadow: 0 4px 14px rgba(22,163,74,0.45);
  transform: translateY(-1px);
}
.action-btn-cancel {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.action-btn-cancel:hover:not(:disabled) {
  background: rgba(239,68,68,0.1);
  color: #FCA5A5;
  border-color: rgba(239,68,68,0.4);
}
.action-result {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}
.action-result-success { background: rgba(22,163,74,0.12); color: #4ADE80; }
.action-result-cancel  { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.action-result-error   { background: rgba(239,68,68,0.12); color: #FCA5A5; }

/* Timesheet suggestion chip */
.ts-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(234,179,8,0.12);
  border: 1px solid rgba(234,179,8,0.3);
  color: #FCD34D;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
}
.ts-suggestion-chip:hover { background: rgba(234,179,8,0.22); }

/* ═══════════════════════════════════════
   THEME TOGGLE BUTTON
═══════════════════════════════════════ */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover {
  background: var(--primary-light);
  border-color: rgba(59,130,246,0.35);
  color: var(--primary);
}
/* Floating toggle on login page */
.login-theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 10;
}

/* Specificity overrides — prevent parent button rules from distorting the toggle */
.chat-header-actions .theme-toggle,
.app-header .header-user .theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  min-width: unset;
  flex-shrink: 0;
}

/* Smooth theme transitions */
body, .app-header, .chat-header, .chat-input-area,
.modal, .card, .sidebar, .login-card,
.message-wrapper.bot .message-bubble,
.approval-card, .stat-card, .balance-card,
thead th, tbody td, .drop-zone, .toast, .btn-ghost,
.form-group input, .form-group select, .form-group textarea {
  transition:
    background-color 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

/* ═══════════════════════════════════════
   LIGHT THEME
═══════════════════════════════════════ */
[data-theme="light"] {
  /* Backgrounds */
  --bg-base:     #F5F7FC;
  --bg-surface:  #ECEEF6;
  --bg-card:     #FFFFFF;
  --bg-elevated: #E8EBF4;
  --bg-input:    #EEF0F8;
  --bg-hover:    rgba(0,0,0,0.035);
  --bg-active:   rgba(59,130,246,0.09);

  /* Brand stays the same */
  --primary-light: rgba(59,130,246,0.10);
  --primary-glow:  rgba(59,130,246,0.14);

  /* Borders */
  --border:        rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.13);
  --border-focus:  rgba(59,130,246,0.50);

  /* Text */
  --text-primary:   #0D0F1C;
  --text-secondary: #4C5470;
  --text-muted:     #9AA3BE;

  /* Shadows — lighter for light bg */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow:    0 4px 16px rgba(0,0,0,0.09);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.10);
  --shadow-lg: 0 20px 56px rgba(0,0,0,0.13);
  --glow-sm:   0 0 16px rgba(59,130,246,0.10);
  --glow:      0 0 32px rgba(59,130,246,0.14);

  /* Legacy aliases */
  --gray-50:  #E8EBF4;
  --gray-100: #EEF0F8;
  --gray-200: rgba(0,0,0,0.07);
  --gray-300: rgba(0,0,0,0.12);
  --gray-400: #9AA3BE;
  --gray-500: #7880A0;
  --gray-600: #4C5470;
  --gray-700: #252B45;
  --gray-800: #131827;
  --gray-900: #0D0F1C;
}

/* Login page — light mode overrides */
[data-theme="light"] .login-page {
  background: #F5F7FC;
}
[data-theme="light"] .login-page::before {
  background:
    radial-gradient(ellipse 70% 60% at 15% 20%, rgba(59,130,246,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 85% 80%, rgba(139,92,246,0.07) 0%, transparent 70%);
}
[data-theme="light"] .login-page::after {
  background-image:
    linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
}
[data-theme="light"] .login-card {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 0 0 1px rgba(59,130,246,0.06);
}

/* Chat page — light mode overrides */
[data-theme="light"] .chat-page::before {
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 90% 100%, rgba(139,92,246,0.04) 0%, transparent 60%);
}
[data-theme="light"] .chat-header,
[data-theme="light"] .chat-input-area {
  background: rgba(245,247,252,0.88);
}
[data-theme="light"] .chat-header-actions button:hover {
  background: var(--primary-light);
  border-color: rgba(59,130,246,0.25);
  color: var(--primary);
}
[data-theme="light"] .message-wrapper.bot .message-bubble {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.10);
}
[data-theme="light"] .message-wrapper.bot .message-bubble strong { color: #0D0F1C; }
[data-theme="light"] .message-wrapper.bot .message-bubble h1,
[data-theme="light"] .message-wrapper.bot .message-bubble h2,
[data-theme="light"] .message-wrapper.bot .message-bubble h3 { color: var(--primary); }
[data-theme="light"] .message-wrapper.bot .message-bubble code {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.14);
  color: #2563EB;
}
[data-theme="light"] .typing-indicator {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.10);
}

/* App header — light mode */
[data-theme="light"] .app-header {
  background: rgba(245,247,252,0.90);
}
[data-theme="light"] .app-header .header-user button:hover {
  color: var(--primary);
}

/* Sidebar — light mode */
[data-theme="light"] .sidebar { background: #ECEEF6; }
[data-theme="light"] .sidebar-nav li a:hover,
[data-theme="light"] .sidebar-nav li button:hover { background: rgba(0,0,0,0.05); }
[data-theme="light"] .sidebar-nav li.active a,
[data-theme="light"] .sidebar-nav li.active button { background: rgba(59,130,246,0.09); }

/* Cards — light mode */
[data-theme="light"] .card { box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
[data-theme="light"] .card-header { background: rgba(0,0,0,0.015); }

/* Stat cards */
[data-theme="light"] .stat-card::before {
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.6;
}

/* Drop zone */
[data-theme="light"] .drop-zone { background: #ECEEF6; }
[data-theme="light"] .drop-zone::before {
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.06), transparent 70%);
}

/* Scrollbar for light */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* Suggestion pills — light */
[data-theme="light"] .suggestion-pill { background: #ECEEF6; }
[data-theme="light"] .suggestion-pill:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .balance-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .approval-details { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 16px; }
  .message-wrapper { max-width: 90%; }
  .login-card { padding: 36px 28px 32px; }
  .chat-messages { padding: 20px 14px; }
  .chat-input-area { padding: 12px 14px; }
}
