/* ============================================
   TeamMid Design System v2 — Premium Light Theme
   Modern · Corporate · Professional
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Primary palette */
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #818CF8;
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-bg: rgba(79,70,229,0.06);

  /* Accent */
  --accent: #06B6D4;
  --accent-light: #67E8F9;

  /* Semantic */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  /* Surfaces */
  --bg-body: #F5F7FA;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-input: #F9FAFB;
  --bg-header: rgba(255,255,255,0.88);

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Borders */
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --border-focus: rgba(79,70,229,0.4);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 0 3px rgba(79,70,229,0.12);

  /* Layout */
  --sidebar-w: 256px;
  --header-h: 60px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 50%;

  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 10px;
}
.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.sidebar-brand-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Sidebar nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-item i, .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Nav Group (expandable) */
.nav-group { margin-bottom: 1px; }
.nav-group-toggle { cursor: pointer; }
.nav-group-toggle .nav-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
  width: 14px; height: 14px;
  color: var(--text-muted);
}
.nav-group.open .nav-group-toggle .nav-chevron { transform: rotate(180deg); }
.nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.nav-group.open .nav-group-items { max-height: 200px; }
.nav-sub {
  padding-left: 38px !important;
  font-size: 12px !important;
  color: var(--text-muted) !important;
}
.nav-sub:hover { color: var(--text-primary) !important; }
.nav-sub.active { color: var(--primary) !important; font-weight: 600 !important; }
.nav-sub::before { display: none !important; }

/* Profile Dropdown */
.profile-dropdown { position: relative; }
.profile-trigger { padding: 0 !important; border: none !important; }
.profile-menu {
  display: none;
  position: absolute; top: 46px; right: 0;
  width: 230px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: fadeInUp 0.15s ease-out;
}
.profile-dropdown.open .profile-menu { display: block; }
.profile-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
}
.profile-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0;
}
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 500;
  text-align: left;
}
.profile-menu-item:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

/* Celebrate Button */
.btn-celebrate {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff; font-size: 11px;
  padding: 4px 10px; border-radius: 6px;
  border: none; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-celebrate:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

/* Social Card */
.social-person {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  margin-bottom: 8px;
  transition: var(--transition);
}
.social-person:last-child { margin-bottom: 0; }
.social-person:hover { background: var(--primary-50); }

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

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

/* ===== HEADER ===== */
.header {
  height: var(--header-h);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.header-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  width: 220px;
  transition: var(--transition);
}
.header-search:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
  background: #fff;
  width: 280px;
}
.header-search input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13px; width: 100%;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search svg { color: var(--text-muted); width: 15px; height: 15px; flex-shrink: 0; }

.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.header-icon-btn:hover {
  background: var(--bg-body);
  color: var(--text-primary);
  border-color: var(--primary-100);
}
.header-icon-btn .badge-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 2px solid #fff;
}

/* ===== PAGE CONTENT ===== */
.page-content { flex: 1; padding: 24px 28px 40px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.kpi-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20%, -20%);
}
.kpi-card.violet::after { background: var(--primary); }
.kpi-card.cyan::after { background: var(--accent); }
.kpi-card.green::after { background: var(--success); }
.kpi-card.orange::after { background: var(--warning); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.kpi-icon.violet { background: var(--primary-50); color: var(--primary); }
.kpi-icon.cyan { background: #ECFEFF; color: #0891B2; }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.orange { background: var(--warning-bg); color: #D97706; }

.kpi-value { font-size: 26px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.kpi-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; margin-top: 6px;
}
.kpi-trend.up { background: var(--success-bg); color: var(--success); }
.kpi-trend.down { background: var(--danger-bg); color: var(--danger); }

/* Content Grid */
.content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.content-grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: #059669; }
.badge-warning { background: var(--warning-bg); color: #D97706; }
.badge-danger { background: var(--danger-bg); color: #DC2626; }
.badge-info { background: var(--info-bg); color: #2563EB; }
.badge-primary { background: var(--primary-50); color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; transition: var(--transition);
  letter-spacing: -0.1px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(79,70,229,0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
  color: #fff;
}
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg-body);
  color: var(--text-primary);
  border-color: var(--primary-100);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 11px 26px; font-size: 14px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 9px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px;
  transition: var(--transition); outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
  background: #fff;
}
.form-control::placeholder { color: var(--text-muted); }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 10px 14px;
  text-align: left; border-bottom: 1px solid var(--border);
  background: var(--bg-body);
}
.table td {
  padding: 12px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.table tr:hover td { background: var(--bg-body); }
.table tr:last-child td { border-bottom: none; }

/* ===== AVATAR ===== */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

/* ===== TIMELINE ===== */
.timeline-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-text { font-size: 13px; color: var(--text-primary); }
.timeline-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state svg { margin: 0 auto 14px; color: var(--text-muted); opacity: 0.3; }
.empty-state p { color: var(--text-muted); font-size: 13px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5F7FA 0%, #E8ECF4 50%, #EEF2FF 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(79,70,229,0.08), transparent 70%);
  top: -200px; right: -150px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,0.06), transparent 70%);
  bottom: -150px; left: -100px;
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 38px;
  width: 100%; max-width: 410px;
  position: relative; z-index: 1;
  box-shadow: var(--shadow-xl);
}
.login-logo {
  display: flex; align-items: center;
  justify-content: center; gap: 10px;
  margin-bottom: 28px;
}
.login-title {
  text-align: center; font-size: 21px;
  font-weight: 700; color: var(--text-primary);
  margin-bottom: 6px; letter-spacing: -0.3px;
}
.login-subtitle {
  text-align: center; font-size: 13px;
  color: var(--text-muted); margin-bottom: 28px;
}
.login-error {
  background: var(--danger-bg);
  border: 1px solid #FECACA;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px; margin-bottom: 18px;
}
.login-footer {
  text-align: center; margin-top: 18px;
  font-size: 11px; color: var(--text-muted);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in { animation: fadeInUp 0.35s ease-out both; }
.animate-in-1 { animation-delay: 0.04s; }
.animate-in-2 { animation-delay: 0.08s; }
.animate-in-3 { animation-delay: 0.12s; }
.animate-in-4 { animation-delay: 0.16s; }
.animate-in-5 { animation-delay: 0.20s; }

/* ===== UTILITY ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-md { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== PDKS Buttons ===== */
.pdks-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 40px; border-radius: 16px; border: none;
  font-size: 18px; font-weight: 700; cursor: pointer;
  transition: all 0.3s; font-family: inherit; letter-spacing: 0.5px;
}
.pdks-btn-in {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff; box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}
.pdks-btn-in:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}
.pdks-btn-out {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff; box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}
.pdks-btn-out:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.5);
}
.pdks-btn:active { transform: translateY(0) scale(0.98); }

/* PDKS Clock */
.pdks-clock {
  font-size: 38px; font-weight: 800;
  letter-spacing: -1px; color: var(--primary);
}
.pdks-card { padding: 24px 16px; }
.pdks-summary-row {
  display: flex; gap: 20px; justify-content: center;
  align-items: center; margin-bottom: 12px; flex-wrap: wrap;
}
.pdks-summary-divider {
  font-size: 24px; color: var(--border);
}

/* ===== RESPONSIVE ===== */

/* Hamburger menu - hidden on desktop */
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: none; background: none;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.hamburger-btn:hover { background: var(--bg-body); }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; opacity: 1; }
body.sidebar-open { overflow: hidden; }

/* Tablet (1200px) */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .header-search { width: 180px; }
  .header-search:focus-within { width: 220px; }
}

/* Mobile (768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 280px;
    --header-h: 52px;
  }
  html { font-size: 13.5px; }

  /* Sidebar: off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: var(--sidebar-w);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 30px rgba(0,0,0,0.15);
  }

  /* Hamburger visible */
  .hamburger-btn { display: flex; }

  /* Main */
  .main-content { margin-left: 0; }

  /* Header - compact */
  .header {
    padding: 0 10px;
    height: var(--header-h);
    position: sticky; top: 0;
  }
  .header-left { gap: 6px; }
  .header-title { font-size: 14px; }
  .header-subtitle { font-size: 10px; display: none; }
  .header-search { display: none; }
  .header-right { gap: 4px; }
  .header-icon-btn { width: 32px; height: 32px; border: none; }
  .header-icon-btn .badge-dot { top: 5px; right: 5px; width: 6px; height: 6px; }
  .hamburger-btn { width: 36px; height: 36px; }

  /* Page content - tight */
  .page-content {
    padding: 10px 10px 60px;
  }

  /* Cards - compact */
  .card {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
  }
  .card:hover { box-shadow: var(--shadow-xs); }
  .card-title { font-size: 13px; }

  /* KPI grid — ALWAYS 2 columns on mobile */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 10px;
  }
  .kpi-card {
    padding: 12px;
    border-radius: var(--radius-sm);
  }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 10px; }
  .kpi-icon {
    width: 32px; height: 32px;
    margin-bottom: 8px;
    border-radius: 8px;
  }
  .kpi-icon i, .kpi-icon svg { width: 16px; height: 16px; }

  /* Tables - scrollable with fade hint */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
    position: relative;
  }
  .table-container::after {
    content: '';
    position: sticky;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, var(--bg-card), transparent);
    pointer-events: none;
  }
  .table { min-width: 520px; }
  .table th, .table td {
    padding: 8px 6px;
    font-size: 11px;
    white-space: nowrap;
  }
  .table th {
    font-size: 9px;
    letter-spacing: 0.5px;
  }

  /* Buttons */
  .btn { padding: 7px 12px; font-size: 12px; min-height: 34px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; min-height: 30px; }

  /* Forms */
  .form-control { padding: 10px 12px; font-size: 14px; }
  .form-label { font-size: 12px; }

  /* Flex layout fixes */
  .flex.items-center.justify-between {
    flex-wrap: wrap;
    gap: 8px;
  }
  .flex.gap-sm { flex-wrap: wrap; gap: 6px; }

  /* PDKS buttons - full width on mobile */
  .pdks-btn {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 12px;
    width: 100%;
    justify-content: center;
  }

  /* Avatar */
  .avatar-sm { width: 26px; height: 26px; font-size: 9px; }

  /* Content grid */
  .content-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Profile dropdown */
  .profile-menu {
    position: fixed;
    right: 8px;
    top: calc(var(--header-h) + 4px);
    width: calc(100vw - 16px);
    max-width: 300px;
  }

  /* Login page */
  .login-card {
    width: calc(100% - 24px) !important;
    max-width: 400px;
    padding: 20px !important;
    margin: 12px;
  }

  /* Social cards */
  .social-person {
    padding: 8px 10px;
  }

  /* Sidebar footer & brand compact */
  .sidebar-footer { padding: 10px 14px; }
  .sidebar-brand { height: 48px; padding: 0 14px; }
  .sidebar-brand-text { font-size: 15px; }
  .sidebar-brand-icon { width: 30px; height: 30px; font-size: 13px; }
  .sidebar-avatar { width: 30px; height: 30px; font-size: 11px; }

  /* Responsive form grids */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Badge on mobile */
  .badge { font-size: 10px; padding: 2px 6px; }

  /* Dashboard attendance card */
  .card[style*="padding:16px 24px"] {
    padding: 10px 12px !important;
  }

  /* Quick action cards (admin dashboard) */
  .card[style*="background:var(--primary-50)"],
  .card[style*="background:var(--success-bg)"],
  .card[style*="background:var(--warning-bg)"] {
    padding: 10px 12px;
  }

  /* Org chart responsive */
  .org-chart { overflow-x: auto; }

  /* Empty state */
  .empty-state { padding: 20px 12px; }
  .empty-state p { font-size: 13px; }

  /* PDKS stats on attendance page */
  div[style*="font-size:42px"] { font-size: 32px !important; }
  div[style*="font-size:20px"] { font-size: 16px !important; }

  /* Admin employee table actions */
  .table td:last-child { white-space: nowrap; }

  /* Filter section mobile */
  .card > div[style*="margin-bottom:16px"] {
    margin-bottom: 10px !important;
  }

  /* PDKS responsive */
  .pdks-clock { font-size: 28px; }
  .pdks-card { padding: 16px 10px !important; }
  .pdks-summary-row { gap: 12px; }
  .pdks-summary-divider { font-size: 18px; }
  .pdks-summary-row .fw-700 { font-size: 16px !important; }
}

/* Small phones (420px) — keep 2-col KPI */
@media (max-width: 420px) {
  .page-content { padding: 8px 8px 60px; }
  .card { padding: 10px; }
  .header { padding: 0 8px; }
  .header-title { font-size: 13px; }
  .hamburger-btn { width: 34px; height: 34px; }
  .hamburger-btn svg { width: 20px; height: 20px; }

  /* KPI still 2 columns! */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
  }
  .kpi-card { padding: 10px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 9px; }
  .kpi-icon { width: 28px; height: 28px; margin-bottom: 6px; border-radius: 6px; }
  .kpi-icon i, .kpi-icon svg { width: 14px; height: 14px; }

  .btn-sm { padding: 4px 8px; font-size: 10px; }
  .pdks-btn { font-size: 14px; padding: 12px 16px; }

  .card-title { font-size: 12px; }

  /* Table even more compact */
  .table th, .table td { padding: 6px 5px; font-size: 10px; }
}

/* iOS safe areas */
@supports (padding: env(safe-area-inset-bottom)) {
  .page-content {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
  .sidebar-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .header {
    padding-top: env(safe-area-inset-top);
  }
}

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 11px 10px; min-height: 44px; }
  .btn { min-height: 38px; }
  .table td, .table th { padding: 10px 6px; }
  .header-icon-btn { width: 36px; height: 36px; }
  .profile-menu-item { padding: 12px 16px; min-height: 44px; }
  .nav-sub { padding-left: 38px !important; min-height: 40px; display: flex; align-items: center; }
  /* Remove hover effects on touch */
  .card:hover { box-shadow: var(--shadow-xs); }
  .kpi-card:hover { transform: none; }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .sidebar { width: 260px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .page-content { padding: 8px 12px 30px; }
  :root { --header-h: 46px; }
}

/* Print */
@media print {
  .sidebar, .header, .hamburger-btn, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
}
/* ===== Sprint 22: Mobile Enhancements ===== */
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
  .kpi-card { padding: 10px !important; }
  .kpi-value { font-size: 18px !important; }
  .content-grid { grid-template-columns: 1fr !important; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 600px; }
  .card { padding: 12px !important; }
  .form-control { font-size: 16px !important; } /* Prevent zoom on iOS */
  .header { padding: 8px 12px !important; }
  .page-content { padding: 12px !important; }
  .sidebar { z-index: 1001; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .header .flex { flex-wrap: wrap; gap: 4px; }
  .page-title { font-size: 16px !important; }
  .btn-sm { padding: 6px 10px !important; font-size: 11px !important; }
}

/* Safe area insets for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
  .header { padding-top: calc(8px + env(safe-area-inset-top)) !important; }
  .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
  .nav-item { min-height: 44px; }
  .btn, .btn-sm { min-height: 40px; }
  .table td, .table th { padding: 10px 8px; }
}

/* ===== CRITICAL: Prevent horizontal scroll on mobile ===== */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
}
.app-layout {
  overflow-x: hidden;
  max-width: 100vw;
}
.main-content {
  overflow-x: hidden;
  max-width: 100%;
}
.page-content {
  overflow-x: hidden;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  .card {
    overflow: hidden;
    max-width: 100%;
  }
  .card > * {
    max-width: 100%;
    overflow-wrap: break-word;
  }
  .card .flex,
  .card div[style*="display:flex"] {
    flex-wrap: wrap !important;
  }
  .card div[style*="grid-template-columns:1fr 1fr"],
  .card div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .card div[style*="display:flex"][style*="gap"] {
    flex-wrap: wrap !important;
    overflow: hidden;
  }
  img, video, canvas, svg, table {
    max-width: 100% !important;
  }
  .mobile-bottom-nav {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  .page-content {
    padding: 10px !important;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }
}