/* ============================================
   AMG Portal — Modern Stripe-inspired CSS
   ============================================ */

:root {
  /* Colors - Stripe-inspired */
  --color-bg: #f6f9fc;
  --color-bg-alt: #ffffff;
  --color-surface: #ffffff;
  --color-border: #e6ebf1;
  --color-border-strong: #d5dae0;
  --color-text: #0a2540;
  --color-text-secondary: #425466;
  --color-text-muted: #8898aa;
  --color-text-inverse: #ffffff;

  --color-primary: #635bff;
  --color-primary-hover: #5048e5;
  --color-primary-light: #f5f4ff;
  --color-accent: #0570de;
  --color-success: #00d4a3;
  --color-success-bg: #ecfdf5;
  --color-warning: #ffc043;
  --color-warning-bg: #fff8e6;
  --color-danger: #df1b41;
  --color-danger-bg: #fef2f4;
  --color-info: #0570de;
  --color-info-bg: #ebf5ff;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #635bff 0%, #0570de 100%);
  --gradient-soft: linear-gradient(180deg, #f6f9fc 0%, #ffffff 100%);
  --gradient-hero: radial-gradient(ellipse at top left, rgba(99, 91, 255, 0.15), transparent 50%),
                   radial-gradient(ellipse at bottom right, rgba(5, 112, 222, 0.12), transparent 50%);

  /* Shadows - Stripe uses very subtle layered shadows */
  --shadow-xs: 0 1px 2px 0 rgba(10, 37, 64, 0.04);
  --shadow-sm: 0 2px 5px 0 rgba(50, 50, 93, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(50, 50, 93, 0.11), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 13px 27px -5px rgba(50, 50, 93, 0.18), 0 8px 16px -8px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 30px 60px -12px rgba(50, 50, 93, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.22);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Sidebar */
  --sidebar-width: 248px;
  --sidebar-bg: #0a2540;
  --sidebar-bg-active: #1a3a5c;
  --sidebar-text: #adbdcc;
  --sidebar-text-active: #ffffff;

  /* Topbar */
  --topbar-height: 64px;

  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary-hover); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

img, svg { display: block; max-width: 100%; }

/* ============================================
   LAYOUT
   ============================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.sidebar-brand-name {
  color: white;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}
.sidebar-brand-name-long {
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  padding: 12px 12px 8px;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition-fast);
  position: relative;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}
.sidebar-nav a.active {
  background: rgba(99,91,255,0.18);
  color: white;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 0 3px 3px 0;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-name { color: white; font-weight: 600; font-size: 13px; line-height: 1.2; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 11px; text-transform: capitalize; }

.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 16px;
}
.topbar-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}
.icon-btn:hover { background: var(--color-bg); color: var(--color-text); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px;
  background: var(--color-danger); border-radius: 50%;
  border: 2px solid white;
}

.page-content {
  padding: 32px;
  max-width: 1400px;
  width: 100%;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); letter-spacing: -0.02em; color: var(--color-text); }
h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-header-text h1 { margin-bottom: 6px; }
.page-header-text p { color: var(--color-text-secondary); font-size: 14px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: #b48109; }
.text-primary { color: var(--color-primary); }

.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-card-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-text);
  line-height: 1.1;
}
.stat-card-meta {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin-top: 6px;
}
.stat-card-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}
.stat-card-icon.success { background: var(--color-success-bg); color: var(--color-success); }
.stat-card-icon.warning { background: var(--color-warning-bg); color: #b48109; }
.stat-card-icon.danger { background: var(--color-danger-bg); color: var(--color-danger); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 1px 1px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.04), inset 0 -1px 0 rgba(0,0,0,0.05);
}
.btn-primary:hover { background: var(--color-primary-hover); color: white; box-shadow: 0 2px 4px rgba(99,91,255,0.3); }

.btn-secondary {
  background: white;
  color: var(--color-text);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--color-bg); color: var(--color-text); }

.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }

.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #00b88f; color: white; }

.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #b8112f; color: white; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 18px; font-size: 14.5px; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-row .form-group { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--color-danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  background: white;
  color: var(--color-text);
  transition: all var(--transition-fast);
  line-height: 1.4;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,91,255,0.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238898aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }

.checkbox-group { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; }
.checkbox-group label { font-size: 13.5px; cursor: pointer; }

/* ============================================
   TABLES
   ============================================ */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 12px 18px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}
.table th {
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--color-bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-success-bg); color: #00875f; }
.badge-warning { background: var(--color-warning-bg); color: #b48109; }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-neutral { background: #f3f5f8; color: var(--color-text-secondary); }

.badge-dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ============================================
   AVATARS
   ============================================ */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-info { line-height: 1.3; }
.user-cell-name { font-weight: 500; color: var(--color-text); font-size: 13.5px; }
.user-cell-meta { font-size: 12px; color: var(--color-text-muted); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-lg { max-width: 800px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--color-bg); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid;
}
.alert-success { background: var(--color-success-bg); border-color: rgba(0,212,163,0.25); color: #006e4a; }
.alert-danger { background: var(--color-danger-bg); border-color: rgba(223,27,65,0.2); color: var(--color-danger); }
.alert-info { background: var(--color-info-bg); border-color: rgba(5,112,222,0.2); color: var(--color-info); }
.alert-warning { background: var(--color-warning-bg); border-color: rgba(255,192,67,0.3); color: #946400; }

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--color-bg);
  background-image: var(--gradient-hero);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: 
    repeating-linear-gradient(45deg, transparent, transparent 80px, rgba(99,91,255,0.02) 80px, rgba(99,91,255,0.02) 81px);
  pointer-events: none;
}
.auth-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  border: 1px solid var(--color-border);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(99,91,255,0.3);
}
.auth-brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .subtitle { color: var(--color-text-secondary); margin-bottom: 28px; font-size: 14px; }

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 1024px) { .dashboard-grid { grid-template-columns: 1fr; } }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 13.5px; color: var(--color-text); }
.activity-time { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }

/* ============================================
   ATTENDANCE PUNCH
   ============================================ */
.punch-card {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}
.punch-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.punch-time {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}
.punch-date { opacity: 0.9; font-size: 14px; margin-bottom: 4px; }
.punch-actions { display: flex; gap: 12px; margin-top: 20px; }
.punch-status {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.18);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}
.punch-btn {
  background: white;
  color: var(--color-primary);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}
.punch-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); color: var(--color-primary); }
.punch-btn.logout-btn { background: rgba(255,255,255,0.18); color: white; }
.punch-btn.logout-btn:hover { background: rgba(255,255,255,0.28); color: white; }
.punch-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============================================
   CALENDAR
   ============================================ */
.calendar {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.calendar-month {
  font-size: 16px;
  font-weight: 600;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.calendar-day-name {
  padding: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.calendar-day {
  min-height: 70px;
  padding: 8px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
  font-size: 13px;
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day:hover { background: var(--color-bg); }
.calendar-day.other-month { color: var(--color-text-muted); background: #fafbfc; }
.calendar-day.today { background: var(--color-primary-light); font-weight: 600; }
.calendar-day.selected { background: var(--color-primary); color: white; }
.calendar-day.holiday { background: var(--color-danger-bg); }
.calendar-day.weekoff { background: #fafbfc; color: var(--color-text-muted); }
.calendar-day .day-dot {
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
}
.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-warning);
}

/* ============================================
   UTILITY
   ============================================ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}
.empty-state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: var(--color-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
}
.empty-state h3 { margin-bottom: 6px; color: var(--color-text); }
.empty-state p { font-size: 13.5px; }

/* Mobile */
.mobile-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-toggle { display: inline-flex; }
  .page-content { padding: 20px; }
  .topbar { padding: 0 16px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d5dae0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b8c0c8; }

/* Loading */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(99,91,255,0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Print */
@media print {
  .sidebar, .topbar, .btn, .page-header-actions { display: none !important; }
  .main-area { margin-left: 0; }
  body { background: white; }
}

/* ============================================
   Additional components: attendance, chat v2, calendar, notifications
   ============================================ */

/* Grid helpers */
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid-2-1 { grid-template-columns: 1fr; } }

/* Punch card v2 (used by attendance.php) */
.punch-card {
  background: linear-gradient(135deg, #635BFF 0%, #0570DE 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.punch-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  margin: 12px 0;
}
.punch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  backdrop-filter: blur(8px);
}
.punch-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #00C896;
  box-shadow: 0 0 8px rgba(0,200,150,0.6);
}
.punch-pill .dot-grey { background: #ccc; box-shadow: none; }
.btn-punch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: white;
  color: var(--color-primary);
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}
.btn-punch:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.btn-punch.btn-logout { background: rgba(255,255,255,0.2); color: white; }
.btn-punch.btn-logout:hover { background: rgba(255,255,255,0.3); }
.punch-done {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  margin-top: 8px;
}

/* Mini stats */
.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; padding: 0 24px 24px; }
.mini-stat { text-align: center; padding: 16px; background: var(--color-bg); border-radius: var(--radius); }
.mini-stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.mini-stat-label { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Calendar */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 0 24px 16px;
}
.cal-head {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0;
}
.cal-day {
  aspect-ratio: 1 / 1;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 13px;
  position: relative;
  transition: var(--transition);
}
.cal-day:hover { transform: scale(1.03); box-shadow: var(--shadow-sm); }
.cal-empty { background: transparent; }
.cal-num { font-weight: 600; }
.cal-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.85;
}
.cal-day.cal-today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.cal-day.cal-present { background: #e8f9f0; color: #066e51; }
.cal-day.cal-leave { background: #fff4d6; color: #8a5a00; }
.cal-day.cal-lop { background: #fde3e3; color: #a82626; }
.cal-day.cal-holiday { background: #e1efff; color: #0a4b8c; }
.cal-day.cal-weekoff { background: #ededf2; color: #6b7280; }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 24px 20px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}
.cal-legend .leg {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}
.leg-present { background: #e8f9f0; }
.leg-leave { background: #fff4d6; }
.leg-lop { background: #fde3e3; }
.leg-holiday { background: #e1efff; }
.leg-weekoff { background: #ededf2; }


/* User pick list (chat new conversation) */
.user-pick-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.user-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: var(--transition);
}
.user-pick-item:last-child { border-bottom: none; }
.user-pick-item:hover { background: var(--color-bg); }
.user-pick-item input[type="checkbox"] { margin-right: 4px; }

/* Notifications page */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: white;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.notif-card.unread { border-left: 3px solid var(--color-primary); background: #faf9ff; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-title { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; }
.notif-message { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 4px; }
.notif-meta { font-size: 11.5px; color: var(--color-text-muted); }
.notif-actions { display: flex; gap: 8px; align-items: center; }

/* Settings - check grid */
.check-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 700px) { .check-grid { grid-template-columns: repeat(3, 1fr); } }
.check-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}
.check-card input { display: none; }
.check-card.checked { border-color: var(--color-primary); background: var(--color-primary-light); }
.check-card.checked .check-day { color: var(--color-primary); font-weight: 600; }
.check-day { font-size: 13px; color: var(--color-text-secondary); }

/* Filter bar */
.filter-bar { background: white; padding: 14px 20px; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; }

/* Doc cell */
.doc-cell { display: flex; gap: 12px; align-items: center; }
.doc-icon {
  width: 40px; height: 40px;
  background: var(--color-primary-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* Helper text classes for new pages */
.text-success { color: #00C896; }
.text-warning { color: #FFC043; }
.text-danger  { color: #FF5C5C; }
.muted { color: var(--color-text-muted); font-size: 13px; }
.muted-small { color: var(--color-text-muted); font-size: 12px; }
.cell-strong { font-weight: 600; color: var(--color-text); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.req { color: var(--color-danger); }
.empty { text-align: center; padding: 40px 20px; color: var(--color-text-muted); font-style: italic; }
.row-muted { opacity: 0.6; }
.row-notes td { background: #fafbfc; padding: 6px 16px; }
.stat-unit { font-size: 14px; color: var(--color-text-muted); font-weight: 500; }
.stat-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.modal-lg .modal-content { max-width: 720px; }

/* Page header refinements */
.page-actions { display: flex; gap: 10px; align-items: center; }

/* Form layout */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* Responsive: chat */
@media (max-width: 900px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-shell.show-sidebar .chat-sidebar { display: flex; }
  .chat-shell.show-sidebar .chat-thread { display: none; }
}

/* ============================================
   Chat v4 — WhatsApp-style, viewport-fit, polished
   ============================================ */

/* When chat page is active, the .page-content wrapper from header.php
   should not impose padding or overflow — chat fills the viewport. */
body.page-chat .page-content {
    padding: 0;
    max-width: none;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}

.chat-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100%;
    background: white;
    overflow: hidden;
}

/* ---- Left sidebar ---- */
.chat-sidebar {
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 1px solid #e9eaee;
    min-height: 0;
}

.chat-sidebar-header {
    flex: 0 0 auto;
    padding: 18px 18px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f1f3;
}
.chat-sidebar-header h3 {
    font-size: 19px;
    font-weight: 700;
    color: #0a2540;
    letter-spacing: -0.01em;
    margin: 0;
}

.chat-new-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    background: #f4f4f9;
    color: #4b4d5c;
    cursor: pointer;
    transition: all .15s ease;
}
.chat-new-btn:hover {
    background: #635bff;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.30);
}

.chat-search-wrap {
    flex: 0 0 auto;
    padding: 10px 14px 8px;
    background: white;
}
.chat-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f4f5f8;
    border-radius: 100px;
    padding: 0 14px 0 38px;
    height: 38px;
    transition: background .15s, box-shadow .15s;
}
.chat-search-box:focus-within {
    background: white;
    box-shadow: 0 0 0 2px rgba(99,91,255,.18), 0 1px 3px rgba(0,0,0,.04);
}
.chat-search-icon {
    position: absolute;
    left: 14px;
    color: #8a8d99;
}
.chat-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    color: #1a1f36;
    outline: none;
    height: 100%;
    font-family: inherit;
}
.chat-search-box input::placeholder { color: #8a8d99; }

.chat-list-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 8px 16px;
    min-height: 0;
}
.chat-list-scroll::-webkit-scrollbar { width: 6px; }
.chat-list-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-list-scroll::-webkit-scrollbar-thumb { background: #d8dae0; border-radius: 3px; }
.chat-list-scroll::-webkit-scrollbar-thumb:hover { background: #b8bbc4; }

.chat-section { margin-top: 10px; }
.chat-section:first-child { margin-top: 6px; }
.chat-section-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8d99;
    padding: 8px 12px 6px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background .12s ease;
    margin-bottom: 1px;
    cursor: pointer;
}
.chat-item:hover { background: #f4f5f8; }
.chat-item.active {
    background: #eeeefe;
}
.chat-item.active .chat-item-name { color: #0a2540; }

.chat-item-body { flex: 1; min-width: 0; }
.chat-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1f36;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.chat-item-preview {
    font-size: 12.5px;
    color: #6b6e7c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item-time {
    font-size: 11px;
    color: #8a8d99;
    white-space: nowrap;
    margin-left: 4px;
}

/* Avatars */
.chat-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.chat-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.chat-avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.chat-avatar-group {
    background: linear-gradient(135deg, #635bff 0%, #8b80ff 100%);
}

.chat-empty-small {
    padding: 24px 12px;
    text-align: center;
    color: #8a8d99;
    font-size: 13px;
}
.chat-search-empty {
    padding: 24px 12px;
    text-align: center;
    color: #8a8d99;
    font-size: 13px;
}

/* ---- Right pane (thread) ---- */
.chat-thread {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #f7f8fa;
    overflow: hidden;
}

.chat-thread-header {
    flex: 0 0 auto;
    padding: 14px 22px;
    background: white;
    border-bottom: 1px solid #e9eaee;
    display: flex;
    align-items: center;
    gap: 14px;
}
.chat-thread-info { min-width: 0; }
.chat-thread-name {
    font-size: 15.5px;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 2px;
}
.chat-thread-meta {
    font-size: 12px;
    color: #6b6e7c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

/* Subtle pattern background like WhatsApp */
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 24px;
    background-color: #f0f2f5;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(99,91,255,0.03) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(99,91,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 0;
}
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d8dae0; border-radius: 4px; }

.chat-blank-state {
    text-align: center;
    padding: 60px 20px;
    color: #8a8d99;
    font-size: 14px;
}

/* Message bubbles */
.msg {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    max-width: 100%;
}
.msg-me { justify-content: flex-end; }
.msg-them { justify-content: flex-start; }

.msg-bubble {
    max-width: 65%;
    width: fit-content;
    min-width: 80px;
    padding: 8px 12px 6px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
    position: relative;
    display: inline-block;
}
.msg-them .msg-bubble {
    background: white;
    color: #1a1f36;
    border-top-left-radius: 4px;
}
.msg-me .msg-bubble {
    background: #635bff;
    color: white;
    border-top-right-radius: 4px;
}
.msg-sender {
    font-size: 11.5px;
    font-weight: 700;
    color: #635bff;
    margin-bottom: 3px;
}
.msg-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
}
.msg-time {
    font-size: 10.5px;
    margin-top: 3px;
    text-align: right;
    opacity: 0.75;
    white-space: nowrap;
}
.msg-them .msg-time { color: #8a8d99; }
.msg-me .msg-time { color: rgba(255,255,255,0.85); }

.msg-image {
    max-width: 280px;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    margin-top: 4px;
}
.msg-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    margin-top: 4px;
    font-size: 12.5px;
}
.msg-me .msg-file { background: rgba(255,255,255,0.18); }
.msg-file:hover { opacity: 0.85; }

/* Composer */
.chat-composer {
    flex: 0 0 auto;
    padding: 12px 18px;
    background: white;
    border-top: 1px solid #e9eaee;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-attach {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #f4f5f8;
    color: #4b4d5c;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .15s;
}
.chat-attach:hover { background: #eeeefe; color: #635bff; }
.chat-file-name {
    font-size: 12px;
    color: #6b6e7c;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-composer-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border-radius: 100px;
    background: #f4f5f8;
    border: 1px solid transparent;
    font-size: 14px;
    color: #1a1f36;
    outline: none;
    transition: background .15s, border-color .15s;
    font-family: inherit;
}
.chat-composer-input:focus {
    background: white;
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99,91,255,.12);
}
.chat-composer-input::placeholder { color: #8a8d99; }

.chat-send-btn {
    height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 100px;
    background: #635bff;
    color: white;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    background: #4f47e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,91,255,.30);
}

/* Empty thread state */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: #6b6e7c;
}
.chat-empty-illustration {
    color: #d8dae0;
    margin-bottom: 18px;
}
.chat-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 6px;
}
.chat-empty p {
    font-size: 13.5px;
    color: #6b6e7c;
    max-width: 320px;
}

/* User picker inside modals (rebrand on .chat-avatar) */
.user-pick-item .chat-avatar-sm { margin-right: 2px; }

/* Mobile: stack panes */
@media (max-width: 768px) {
    .chat-shell { grid-template-columns: 1fr; }
    .chat-sidebar { display: flex; }
    .chat-thread { display: none; }
    body.page-chat .chat-shell.thread-open .chat-sidebar { display: none; }
    body.page-chat .chat-shell.thread-open .chat-thread { display: flex; }
}

/* ============================================
   Chat v5 — Group info drawer + message actions
   ============================================ */

/* When info panel is open, shell becomes 3-column */
.chat-shell { transition: grid-template-columns .25s ease; }
.chat-shell.info-open { grid-template-columns: 340px 1fr 340px; }
.chat-info-panel { display: none; }
.chat-shell.info-open .chat-info-panel { display: flex; }

/* Clickable group header */
.chat-thread-header-clickable { cursor: pointer; transition: background .15s; }
.chat-thread-header-clickable:hover { background: #fafbfc; }
.chat-thread-header-chevron {
    margin-left: auto;
    color: #8a8d99;
    display: inline-flex;
    transition: transform .2s;
}
.chat-shell.info-open .chat-thread-header-chevron { transform: rotate(90deg); }

/* Info panel */
.chat-info-panel {
    flex-direction: column;
    background: white;
    border-left: 1px solid #e9eaee;
    min-height: 0;
    overflow: hidden;
}
.chat-info-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #f0f1f3;
}
.chat-info-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: #0a2540;
    margin: 0;
    letter-spacing: -0.01em;
}
.chat-info-close {
    width: 32px; height: 32px;
    border: none; background: transparent;
    border-radius: 8px;
    color: #6b6e7c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.chat-info-close:hover { background: #f4f5f8; color: #1a1f36; }
.chat-info-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}
.chat-info-section {
    padding: 14px 0;
    border-bottom: 1px solid #f0f1f3;
}
.chat-info-section:last-child { border-bottom: none; }
.chat-info-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.chat-info-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8d99;
    margin-bottom: 6px;
}
.chat-info-name-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: #0a2540;
}
.chat-info-edit-link, .chat-info-add-btn {
    background: transparent;
    border: none;
    color: #635bff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.chat-info-edit-link:hover, .chat-info-add-btn:hover { background: #eeeefe; }
.chat-info-name-edit input { font-size: 14px; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.chat-info-members {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-info-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 6px;
    border-radius: 8px;
    transition: background .12s;
}
.chat-info-member:hover { background: #f8f9fb; }
.chat-info-member-body { flex: 1; min-width: 0; }
.chat-info-member-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1a1f36;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.chat-info-member-meta {
    font-size: 11.5px;
    color: #8a8d99;
    margin-top: 1px;
}
.chat-info-tag {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    background: #eef0f4;
    color: #6b6e7c;
    border-radius: 4px;
}
.chat-info-tag-creator { background: #fff3d6; color: #8a6700; }
.chat-info-remove-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #d04545;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}
.chat-info-remove-btn:hover { background: #fde3e3; }

/* ============================================
   Message hover menu (...) + action dropdown
   ============================================ */
.msg-bubble { position: relative; }
.msg-menu-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px; height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.msg-bubble:hover .msg-menu-btn { opacity: 0.7; }
.msg-menu-btn:hover { opacity: 1 !important; background: rgba(0,0,0,0.1); }
.msg-me .msg-menu-btn:hover { background: rgba(255,255,255,0.18); }

/* Add right padding to bubble when menu button present to avoid overlap */
.msg-bubble:has(.msg-menu-btn) { padding-right: 30px; }

.msg-action-menu {
    position: fixed;
    display: none;
    background: white;
    border: 1px solid #e9eaee;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    min-width: 200px;
    z-index: 1000;
    animation: msgMenuIn 120ms ease;
}
@keyframes msgMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.msg-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: #1a1f36;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    font-family: inherit;
}
.msg-action:hover { background: #f4f5f8; }
.msg-action svg { color: #6b6e7c; }
.msg-action[data-action="delete_for_all"]:hover { background: #fde3e3; color: #c93030; }
.msg-action[data-action="delete_for_all"]:hover svg { color: #c93030; }

/* Deleted placeholder */
.msg-deleted {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-style: italic;
    opacity: 0.7;
    font-size: 12.5px;
}
.msg-me .msg-deleted { color: rgba(255,255,255,0.85); }
.msg-them .msg-deleted { color: #6b6e7c; }

/* Edited indicator */
.msg-edited {
    font-style: italic;
    opacity: 0.85;
}

/* Mobile: info panel becomes full-width overlay */
@media (max-width: 900px) {
    .chat-shell.info-open { grid-template-columns: 0 0 1fr; }
    .chat-shell.info-open .chat-sidebar,
    .chat-shell.info-open .chat-thread { display: none; }
}

/* ============================================
   Chat v6 — In-thread message search
   ============================================ */

/* Search icon in header */
.chat-header-search-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #6b6e7c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    margin-left: auto;
    flex-shrink: 0;
}
.chat-header-search-btn:hover {
    background: #f4f5f8;
    color: #635bff;
}
/* When search btn is followed by chevron, remove auto-margin */
.chat-thread-header .chat-header-search-btn + .chat-thread-header-chevron {
    margin-left: 4px;
}

/* Search bar (slides down from below header) */
.chat-msg-search-bar {
    flex: 0 0 auto;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #fafbfc;
    border-bottom: 1px solid #e9eaee;
    animation: searchBarSlide 180ms cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-msg-search-bar.open { display: flex; }

@keyframes searchBarSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e9eaee;
    border-radius: 100px;
    padding: 0 14px 0 38px;
    height: 38px;
    transition: border-color .15s, box-shadow .15s;
    min-width: 0;
}
.chat-msg-search-input-wrap:focus-within {
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99,91,255,.12);
}
.chat-msg-search-icon {
    position: absolute;
    left: 14px;
    color: #8a8d99;
}
.chat-msg-search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    color: #1a1f36;
    outline: none;
    height: 100%;
    font-family: inherit;
    min-width: 0;
}
.chat-msg-search-input-wrap input::placeholder { color: #8a8d99; }

.chat-msg-search-count {
    font-size: 12px;
    font-weight: 600;
    color: #6b6e7c;
    padding: 0 6px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.chat-msg-search-count.chat-msg-search-noresult {
    color: #c93030;
}

.chat-msg-search-nav, .chat-msg-search-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #6b6e7c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.chat-msg-search-nav:hover:not(:disabled),
.chat-msg-search-close:hover {
    background: #eeeefe;
    color: #635bff;
}
.chat-msg-search-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.chat-msg-search-close { color: #8a8d99; }
.chat-msg-search-close:hover { background: #fde3e3; color: #c93030; }

/* Highlight matches inside messages */
.chat-msg-hl {
    background: #fff3a3;
    color: #5a4a00;
    padding: 1px 2px;
    border-radius: 3px;
    font-weight: 600;
}
.msg-me .chat-msg-hl {
    background: #fff3a3;
    color: #5a4a00;
}
.chat-msg-hl-active {
    background: #ffb800;
    color: #1a1f36;
    box-shadow: 0 0 0 2px rgba(255, 184, 0, 0.4);
    animation: matchPulse 0.4s ease;
}
@keyframes matchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* ============================================
   View Picker (Zoho-style filter dropdown)
   ============================================ */
.view-picker {
    position: relative;
    display: inline-block;
}
.view-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    letter-spacing: -0.01em;
}
.view-picker-trigger:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,91,255,.10);
}
.view-picker-trigger svg {
    color: var(--color-text-muted);
    transition: transform .15s;
}
.view-picker-menu.open + .view-picker-trigger svg,
.view-picker:has(.view-picker-menu.open) .view-picker-trigger svg {
    transform: rotate(180deg);
}
.view-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    padding: 6px;
    display: none;
    z-index: 50;
    animation: viewMenuIn 140ms ease;
}
.view-picker-menu.open { display: block; }
@keyframes viewMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.view-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .12s;
}
.view-picker-item:hover { background: var(--color-bg); }
.view-picker-item .vp-check {
    color: var(--color-primary);
    opacity: 0;
    flex-shrink: 0;
}
.view-picker-item.active .vp-check { opacity: 1; }
.view-picker-item.active { color: var(--color-primary); font-weight: 600; }
.view-picker-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 8px;
}
.view-count {
    margin-top: 4px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Stat pills for import results */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
}
.stat-pill strong { font-size: 16px; font-weight: 700; }
.stat-pill-success { background: #d4f5dc; color: #116b2f; }
.stat-pill-danger  { background: #fde3e3; color: #c93030; }

/* ============================================
   Delete employee modal (aesthetic in-app prompt)
   ============================================ */
.delete-modal { max-width: 480px; }
.delete-modal-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 24px 0;
}
.delete-modal-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fde3e3;
    color: #c93030;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.delete-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #8a8d99;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.delete-modal-close:hover { background: #f4f5f8; color: #1a1f36; }
.delete-modal-body { padding-top: 14px; }
.delete-modal-title {
    font-size: 19px;
    font-weight: 700;
    color: #0a2540;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.delete-modal-subtitle {
    font-size: 13.5px;
    color: #6b6e7c;
    line-height: 1.55;
    margin-bottom: 18px;
}
.delete-modal-subtitle strong { color: #1a1f36; }

.delete-warning-box {
    background: #fff8f8;
    border: 1px solid #fde3e3;
    border-radius: 10px;
    padding: 14px 16px;
}
.delete-warning-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c93030;
    margin-bottom: 8px;
}
.delete-warning-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.delete-warning-list li {
    font-size: 13px;
    color: #5a3030;
    padding: 3px 0 3px 22px;
    position: relative;
    line-height: 1.5;
}
.delete-warning-list li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #c93030;
}

.delete-target-name {
    background: #f4f5f8;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 13px;
    font-weight: 600;
    color: #1a1f36;
    margin: 6px 0 10px;
    border: 1px dashed #d8dae0;
    user-select: all;
}

.delete-input-wrap {
    position: relative;
}
.delete-input-wrap .form-control {
    padding-right: 42px;
    transition: border-color .15s, box-shadow .15s;
}
.delete-input-wrap .form-control.match-ok {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}
.delete-input-wrap .form-control.match-bad {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}
.delete-match-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.delete-match-icon.match-ok { color: #22c55e; }
.delete-match-icon.match-bad { color: #ef4444; }

/* Slightly stronger disabled style for the danger button so the gating is obvious */
.btn-danger:disabled {
    background: #d8dae0 !important;
    color: #8a8d99 !important;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================
   Holiday list — date cell styling
   ============================================ */
.holiday-date-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 6px 10px;
    background: #f4f5f8;
    border-radius: 8px;
    line-height: 1.1;
}
.holiday-date-day {
    font-size: 18px;
    font-weight: 700;
    color: #0a2540;
    letter-spacing: -0.02em;
}
.holiday-date-mon {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #6b6e7c;
    margin-top: 2px;
}
.row-muted .holiday-date-cell {
    background: #fafbfc;
    opacity: 0.7;
}
.row-muted td { color: #8a8d99; }
.row-muted .cell-strong { color: #6b6e7c; font-weight: 500; }

/* ============================================
   Events + Documents page polish
   ============================================ */
.cell-strong-sm {
    font-size: 13px;
    font-weight: 600;
    color: #1a1f36;
}
.event-notes-preview {
    margin-top: 4px;
    font-size: 12px;
    color: #6b6e7c;
    background: #f8f9fb;
    border-left: 2px solid #d8dae0;
    padding: 4px 8px;
    border-radius: 0 4px 4px 0;
    max-width: 280px;
    line-height: 1.4;
}
.doc-cell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.doc-file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.doc-cell-info { min-width: 0; flex: 1; }

/* ============================================
   Leave page v3 — radio pills, auto-flag row
   ============================================ */
.radio-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.radio-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border: 1.5px solid #e3e8ee;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
    font-size: 13px;
    user-select: none;
}
.radio-pill input[type="radio"] {
    margin-right: 8px;
    accent-color: #635bff;
}
.radio-pill:has(input[type="radio"]:checked) {
    border-color: #635bff;
    background: #f5f4ff;
    color: #635bff;
    font-weight: 600;
}
.row-flag-auto {
    background: #fff8f0 !important;
}
.row-flag-auto:hover {
    background: #fff2e3 !important;
}

/* ============================================
   v3: Segmented control (Leave type, Half period)
   ============================================ */
.seg-control {
    display: inline-flex;
    background: #f4f5f8;
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
}
.seg-btn {
    border: none;
    background: transparent;
    color: #6b6e7c;
    font-weight: 500;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.seg-btn:hover { color: #1a1f36; }
.seg-btn.active {
    background: #fff;
    color: #1a1f36;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ============================================
   v3: Reports page — legend chips + sticky grid
   ============================================ */
.report-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.leg-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1f36;
    border: 1px solid rgba(0,0,0,0.06);
}
.report-grid {
    min-width: max-content;
    font-size: 11px;
}
.report-grid thead th {
    position: sticky;
    top: 0;
    background: #1a1f36;
    color: #fff;
    z-index: 1;
}
.report-grid tbody tr:hover td {
    background: rgba(99, 91, 255, 0.04);
}
.report-grid tbody tr:hover td[style*="position:sticky"] {
    background: #f4f5f8 !important;
}

/* Better cancel button for leave row */
.btn-ghost.text-danger:hover {
    background: rgba(229, 69, 69, 0.08);
    color: #c43838;
}

/* ============================================
   Global top-loading progress bar
   ============================================ */
#global-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
#global-progress.active { opacity: 1; }
.global-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #635bff 0%, #8b85ff 50%, #635bff 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(99, 91, 255, 0.5);
    animation: gp-fill 1.6s ease-in-out infinite, gp-shimmer 1.2s linear infinite;
}
@keyframes gp-fill {
    0%   { width: 0%; }
    50%  { width: 70%; }
    100% { width: 95%; }
}
@keyframes gp-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Disabled submit during AJAX in flight */
button[type="submit"]:disabled,
button:not([type]):disabled {
    opacity: 0.6;
    cursor: progress;
}

/* ============================================
   AMG branding — logo images
   ============================================ */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand-image {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.auth-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    padding: 14px 16px;
    background: #1a1f36;
    border-radius: 10px;
}
.auth-brand-image {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.auth-brand-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    text-align: left;
    letter-spacing: -0.01em;
    line-height: 1.3;
    max-width: 220px;
}

/* Dashboard greeting: add a small AMG mark next to "Hi, <name>" */
.dashboard-amg-mark {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: url('../img/amg-logo.png') center/cover no-repeat;
    vertical-align: middle;
    margin-left: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* ============================================
   Lead Report — editable grid
   ============================================ */
.lead-report-grid { font-size: 12px; }
.lead-report-grid thead tr { background: #1a1f36; }
.lead-report-grid th {
    background: #1a1f36;   /* dark navy default so white text reads */
    font-size: 11px;
    color: #ffffff;
    padding: 6px 4px;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    border-bottom: 1px solid #2a2f4a;
}
.lead-report-grid td.lr-editable { cursor: pointer; transition: filter 0.12s; }
.lead-report-grid td.lr-editable:hover { filter: brightness(0.94); outline: 1px solid #635bff; }
.lead-report-grid td.lr-editing  { padding: 2px !important; }
.lead-report-grid td.lr-holiday  { color: #4a6fa5; font-weight: 700; cursor: not-allowed; }
.lead-report-grid td.lr-weekoff  { color: #6c7388; font-weight: 700; cursor: not-allowed; }
.lr-edit-input {
    width: 100%;
    min-width: 40px;
    padding: 4px 2px;
    border: 2px solid #635bff;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background: #fff;
    color: #1a1f36;
    -moz-appearance: textfield;
}
.lr-edit-input::-webkit-outer-spin-button,
.lr-edit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================
   Event Logging — bad-entry row styling
   ============================================ */
.event-row-bad { background: #fff8f8; }
.event-row-bad td { opacity: 0.65; }
.event-row-bad .cell-strong,
.event-row-bad .cell-strong-sm { text-decoration: line-through; }
.badge.badge-bad {
    display: inline-block;
    background: #fde2e2;
    color: #a32626;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}
.btn.text-warning { color: #b56e00; }
.btn.text-warning:hover { background: #fff3cd; }

/* ============================================
   Chat: reply quote in a message bubble
   ============================================ */
.msg-reply-quote {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 6px 8px 6px 0;
    margin: 0 0 6px;
    background: rgba(0, 0, 0, 0.05);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.15s;
    overflow: hidden;
}
.msg-reply-quote:hover { background: rgba(0, 0, 0, 0.09); }
.msg-me .msg-reply-quote { background: rgba(255, 255, 255, 0.2); }
.msg-me .msg-reply-quote:hover { background: rgba(255, 255, 255, 0.3); }
.msg-reply-bar {
    width: 3px;
    background: #635bff;
    border-radius: 2px;
    flex-shrink: 0;
}
.msg-me .msg-reply-bar { background: #fff; }
.msg-reply-body { min-width: 0; flex: 1; padding: 2px 0; }
.msg-reply-sender {
    font-size: 11px;
    font-weight: 700;
    color: #635bff;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-me .msg-reply-sender { color: #fff; }
.msg-reply-text {
    font-size: 12px;
    color: #555;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-me .msg-reply-text { color: rgba(255, 255, 255, 0.85); }

/* Flash highlight when scrolled to via "click reply quote" */
.msg.msg-flash .msg-bubble {
    animation: msg-flash-anim 1.4s ease-out;
}
@keyframes msg-flash-anim {
    0%   { box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(99, 91, 255, 0); }
}

/* ============================================
   Chat: reply preview bar above composer
   ============================================ */
.chat-reply-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 8px 12px;
    background: #f4f5fb;
    border-top: 1px solid var(--color-border);
}
.chat-reply-bar-content {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
}
.chat-reply-bar-bar {
    width: 3px;
    background: #635bff;
    border-radius: 2px;
    flex-shrink: 0;
}
.chat-reply-bar-body { min-width: 0; flex: 1; }
.chat-reply-bar-label {
    font-size: 11px;
    font-weight: 700;
    color: #635bff;
    margin-bottom: 2px;
}
.chat-reply-bar-text {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-reply-bar-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0 6px;
    color: #888;
    border-radius: 4px;
}
.chat-reply-bar-close:hover { background: rgba(0,0,0,0.06); color: #333; }

/* ============================================
   Chat: emoji reactions row + picker popover
   ============================================ */
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.msg-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 11px;
    line-height: 1.3;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.msg-reaction:hover { background: rgba(0, 0, 0, 0.10); }
.msg-reaction.is-mine {
    background: rgba(99, 91, 255, 0.16);
    border-color: rgba(99, 91, 255, 0.45);
}
.msg-me .msg-reaction {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.msg-me .msg-reaction:hover { background: rgba(255, 255, 255, 0.32); }
.msg-me .msg-reaction.is-mine {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.7);
}
.msg-reaction-emoji { font-size: 14px; line-height: 1; }
.msg-reaction-count { font-weight: 600; }

.emoji-picker {
    position: fixed;
    display: none;
    z-index: 9000;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 6px 8px;
    flex-direction: row;
    gap: 2px;
}
.emoji-pick {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 6px;
    font-size: 22px;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.12s, transform 0.12s;
}
.emoji-pick:hover { background: rgba(0, 0, 0, 0.06); transform: scale(1.15); }

/* ============================================
   Chat: read receipts (✓ sent, ✓✓ read)
   ============================================ */
.msg-receipt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
    color: rgba(255, 255, 255, 0.55);  /* sent state (own msg = white-on-purple bubble) */
    line-height: 1;
}
.msg-receipt-sent svg { opacity: 0.7; }
.msg-receipt-read    { color: #5fc8ff; }   /* WhatsApp-blue checks */
.msg-receipt-read svg { opacity: 1; }
.msg-receipt-time {
    font-size: 10.5px;
    font-weight: 600;
    color: #5fc8ff;
}
.msg-receipt-btn {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #5fc8ff;
}
.msg-receipt-btn:hover { text-decoration: underline; }
.msg-receipt-count {
    font-size: 10.5px;
    font-weight: 600;
}

/* If your "msg-me" bubble is light, override colors for readability:
   the current theme uses dark purple bubbles for own messages, so the
   blue/white checks already pop. No change needed there. */

/* ============================================
   Chat: Readers popover (group chat "Read by N/M" tap)
   ============================================ */
.readers-popover {
    position: fixed;
    display: none;
    z-index: 9100;
    width: 260px;
    max-height: 320px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
.readers-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 700;
    color: #1a1f36;
    background: #f7f8fc;
}
.readers-popover-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 2px;
    color: #888;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}
.readers-popover-close:hover { background: rgba(0, 0, 0, 0.06); color: #333; }
.readers-popover-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
}
.readers-popover-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f3;
}
.readers-popover-row:last-child { border-bottom: 0; }
.readers-popover-name {
    color: #1a1f36;
    font-weight: 600;
}
.readers-popover-time {
    color: #888;
    font-size: 11px;
}
.readers-popover-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 12px;
}

/* ============================================
   Chat: Reactions popover (who reacted with what)
   ============================================ */
.reactions-popover-row {
    align-items: center;
}
.reactions-popover-row-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.reactions-popover-emoji {
    font-size: 18px;
    line-height: 1;
}
.reactions-popover-row.is-mine .readers-popover-name {
    font-weight: 700;
    color: #635bff;
}
.reactions-popover-remove {
    background: transparent;
    border: 1px solid var(--color-border);
    color: #888;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.reactions-popover-remove:hover {
    background: #fde2e2;
    color: #a32626;
    border-color: #f0bdbd;
}

/* ============================================
   Password show/hide toggle (eye icon button)
   ============================================ */
.pw-wrap {
    position: relative;
    display: block;
}
.pw-wrap > input[type="password"],
.pw-wrap > input[type="text"] {
    padding-right: 42px; /* room for the toggle */
    width: 100%;
}
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #888;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    transition: color 0.12s, background 0.12s;
}
.pw-toggle:hover { color: #1a1f36; background: rgba(0, 0, 0, 0.05); }
.pw-toggle:focus { outline: none; color: #1a1f36; }
.pw-toggle:active { background: rgba(0, 0, 0, 0.08); }

/* ============================================
   Notification bell — numeric unread badge
   ============================================ */
.icon-btn-notif { position: relative; }
.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ff3b3b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    letter-spacing: 0.2px;
}

/* ============================================
   Dashboard expandable stat cards
   Click → reveals an inline name list. No navigation.
   ============================================ */
.stat-card-expandable {
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
}
.stat-card-expandable:hover {
    background: #f9fafc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.stat-card-expandable .stat-card-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.stat-card-chevron {
    transition: transform 0.2s;
    color: #888;
    flex-shrink: 0;
}
.stat-card-expandable.expanded .stat-card-chevron {
    transform: rotate(180deg);
}
.stat-card-list {
    display: none;
    margin-top: 12px;
    max-height: 260px;
    overflow-y: auto;
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}
.stat-card-expandable.expanded .stat-card-list {
    display: block;
}
.stat-card-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f3;
}
.stat-card-list-row:last-child {
    border-bottom: none;
}
.stat-card-list-name {
    color: #1a1f36;
    font-weight: 600;
}
.stat-card-list-meta {
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
}
.stat-card-list-empty {
    padding: 12px 0;
    text-align: center;
    color: #888;
    font-size: 12px;
}

/* ============================================
   Chat sidebar — unread badge & item right column
   ============================================ */
.chat-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
}
.chat-unread-badge {
    background: #25d366;        /* WhatsApp-green; switch to #ef4444 if you prefer red */
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    letter-spacing: 0.2px;
}
/* Hide the badge for the currently-open conversation — they're reading it */
.chat-item.active .chat-unread-badge { display: none !important; }
/* Make items with unread messages visually weightier */
.chat-item:has(.chat-unread-badge:not([style*="display:none"])) .chat-item-name {
    font-weight: 700;
    color: #1a1f36;
}

/* ============================================
   Profile pictures
   ============================================ */
/* When an avatar has an uploaded image as background, kill any stray text
   inside it so the colored initials never bleed through. */
.has-pic { color: transparent !important; font-size: 0 !important; }

/* Profile page: edit/remove buttons floating on the avatar */
.profile-avatar-wrap {
    position: relative;
    display: inline-block;
}
.profile-avatar-edit, .profile-avatar-remove {
    position: absolute;
    border: 2px solid #fff;
    background: var(--color-primary, #635BFF);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: background 0.12s, transform 0.12s;
}
.profile-avatar-edit:hover, .profile-avatar-remove:hover {
    transform: scale(1.08);
}
.profile-avatar-edit {
    bottom: 4px;
    right: 4px;
    width: 30px;
    height: 30px;
}
.profile-avatar-remove {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: #ef4444;
}

/* ============================================
   Pagination bar (events page, future pages)
   ============================================ */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.pagination-info {
    color: #6b7280;
    font-size: 13px;
}
.pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    user-select: none;
}
.pagination-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.pagination-btn-current {
    background: var(--color-primary, #635BFF);
    border-color: var(--color-primary, #635BFF);
    color: #fff;
    cursor: default;
}
.pagination-btn-current:hover {
    background: var(--color-primary, #635BFF);
    border-color: var(--color-primary, #635BFF);
}
.pagination-btn-disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: #fafafa;
}
.pagination-btn-disabled:hover {
    background: #fafafa;
    border-color: var(--color-border);
}
.pagination-ellipsis {
    color: #9ca3af;
    padding: 0 4px;
    font-size: 14px;
}
