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

:root {
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  
  --emerald: #10B981;
  --emerald-light: #ECFDF5;
  --amber: #F59E0B;
  --amber-light: #FFFBEB;
  --rose: #EF4444;
  --rose-light: #FEF2F2;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  
  --border-color: #E2E8F0;
  --border-light: #F1F5F9;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.01);
  --shadow-lg: 0 20px 35px -10px rgba(79, 70, 229, 0.12);
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sidebar-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 2.5rem;
}

.sidebar-scroll-body::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroll-body::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}
.sidebar-scroll-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.35rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(135deg, #0F172A 0%, #4338CA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  font-weight: 700;
  margin: 1rem 0.75rem 0.35rem;
  flex-shrink: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-item a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active a {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.user-profile-widget {
  margin-top: auto;
  flex-shrink: 0;
  padding: 0.85rem 1rem;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.user-info-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}

.user-info-role {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem 2.5rem;
  max-width: calc(100% - 280px);
}

/* Top Header Bar */
.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.badge-block {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.stat-val {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-heading);
  line-height: 1.1;
  margin-top: 0.3rem;
}

.stat-lbl {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-emerald { background: var(--emerald-light); color: var(--emerald); }
.stat-icon-amber { background: var(--amber-light); color: var(--amber); }
.stat-icon-rose { background: var(--rose-light); color: var(--rose); }

/* Card & Glass Panels */
.card-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 0.85rem 1rem;
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  vertical-align: middle;
}

.custom-table tr:hover {
  background-color: #F1F5F9;
}

/* Status Badges */
.badge-status {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-success { background: var(--emerald-light); color: var(--emerald); }
.badge-warning { background: var(--amber-light); color: var(--amber); }
.badge-danger { background: var(--rose-light); color: var(--rose); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* Anjungan Presensi Mandiri Page */
.kiosk-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.kiosk-header {
  text-align: center;
  margin-bottom: 2rem;
}

.kiosk-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.webcam-box {
  width: 100%;
  max-width: 440px;
  height: 320px;
  margin: 0 auto 1.5rem;
  background: #0F172A;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  border: 3px solid var(--primary);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.25);
}

.webcam-box video, .webcam-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  top: 15%;
  left: 20%;
  right: 20%;
  bottom: 15%;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-md);
  pointer-events: none;
  animation: pulseFrame 2s infinite ease-in-out;
}

@keyframes pulseFrame {
  0% { border-color: rgba(255, 255, 255, 0.4); }
  50% { border-color: #10B981; box-shadow: inset 0 0 15px rgba(16, 185, 129, 0.5); }
  100% { border-color: rgba(255, 255, 255, 0.4); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-emerald {
  background: var(--emerald);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-emerald:hover {
  background: #059669;
}

.btn-secondary {
  background: var(--border-light);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-lg {
  padding: 1.1rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 1rem;
}

.modal-backdrop.show {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 92vw;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0) !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Mobile & Laptop Responsive Adjustments */
@media (max-width: 991px) {
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 285px !important;
    height: 100vh !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(-100%) !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.5) !important;
    z-index: 10005 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .sidebar.show {
    transform: translateX(0) !important;
  }

  .sidebar-close-btn {
    display: inline-flex !important;
  }

  .sidebar-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 10000 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease !important;
  }

  .sidebar-overlay.show {
    display: block !important;
    opacity: 1 !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    max-width: 100% !important;
    padding: 1rem 0.85rem !important;
  }
  
  .top-navbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  #sidebarToggle {
    display: inline-flex !important;
    z-index: 1001 !important;
    cursor: pointer !important;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    width: 94vw !important;
    max-width: 94vw !important;
    padding: 1.25rem !important;
    margin: 0.5rem auto !important;
    max-height: 92vh !important;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .custom-table {
    font-size: 0.85rem;
  }

  .custom-table th, .custom-table td {
    padding: 0.65rem 0.75rem;
  }
}

/* GKJ AI Copilot Pro High-End Glassmorphic Styling */
.ai-fab-btn {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 99990;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1 0%, #a855f7 50%, #ec4899 100%);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6), 0 0 20px rgba(168, 85, 247, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: fabGlowPulse 3s infinite ease-in-out;
}

.ai-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #10B981;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 99px;
  border: 2px solid #0B0F17;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

@keyframes fabGlowPulse {
  0% { transform: scale(1); box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6); }
  50% { transform: scale(1.06); box-shadow: 0 16px 40px rgba(236, 72, 153, 0.7), 0 0 25px rgba(99, 102, 241, 0.5); }
  100% { transform: scale(1); box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6); }
}

.ai-fab-btn:hover {
  transform: scale(1.12) rotate(8deg);
  box-shadow: 0 20px 45px rgba(168, 85, 247, 0.8);
}

/* Offcanvas Ultra Glass Drawer */
.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(11, 15, 23, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: #F8FAFC;
  font-family: var(--font-body);
}

.ai-drawer.show {
  transform: translateX(0);
}

/* Header Styling */
.ai-drawer-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.4) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

.ai-avatar-ring {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366F1 0%, #a855f7 50%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.ai-drawer-title {
  font-weight: 800;
  font-size: 1.15rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-pro-tag {
  background: linear-gradient(90deg, #ec4899, #8b5cf6);
  color: white;
  padding: 0.12rem 0.5rem;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.ai-drawer-status {
  font-size: 0.76rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
}

.ai-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #94A3B8;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Chat Body */
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.12) 0%, rgba(11, 15, 23, 0) 70%), #0B0F17;
  -webkit-overflow-scrolling: touch;
}

.ai-msg {
  max-width: 90%;
  padding: 0.95rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.ai-msg-assistant {
  align-self: flex-start;
  background: rgba(26, 34, 52, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #F1F5F9;
  border-bottom-left-radius: 4px;
}

.ai-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 50%, #4338CA 100%);
  color: white;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.ai-msg-header {
  margin-bottom: 0.5rem;
}

.ai-badge-sm {
  font-size: 0.72rem;
  font-weight: 800;
  color: #818CF8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Prompt Pills Bar */
.ai-prompt-bar {
  padding: 0.85rem 1.25rem;
  background: rgba(11, 15, 23, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ai-prompt-bar::-webkit-scrollbar {
  display: none;
}

.ai-prompt-pill {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(165, 180, 252, 0.22);
  color: #E0E7FF;
  padding: 0.55rem 1rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.ai-prompt-pill:hover, .ai-prompt-pill:active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(236, 72, 153, 0.3) 100%);
  border-color: #A5B4FC;
  color: white;
  transform: translateY(-1px);
}

/* Input Wrapper & Capsule */
.ai-input-wrapper {
  padding: 1rem 1.25rem;
  background: #0B0F17;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-input-capsule {
  background: rgba(30, 41, 59, 0.85);
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  border-radius: 24px;
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: border-color 0.2s ease;
}

.ai-input-capsule:focus-within {
  border-color: #818CF8;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.ai-input-capsule input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--font-body);
}

.ai-input-capsule input::placeholder {
  color: #64748B;
}

.ai-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366F1 0%, #ec4899 100%);
  color: white;
  border: none;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(236, 72, 153, 0.6);
}

.badge-cohort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Dedicated Mobile HP Enhancements (Screen <= 768px & <= 991px) */
@media (max-width: 991px) {
  #sidebarToggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #EEF2FF !important;
    color: #4F46E5 !important;
    border: 1px solid #C7D2FE !important;
    border-radius: 12px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 1.4rem !important;
    cursor: pointer !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-100%) !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.6) !important;
    z-index: 10005 !important;
    overflow-y: auto !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .sidebar.show {
    transform: translateX(0) !important;
  }

  .sidebar-close-btn {
    display: inline-flex !important;
  }

  .sidebar-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 10000 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease !important;
  }

  .sidebar-overlay.show {
    display: block !important;
    opacity: 1 !important;
  }

  .main-content {
    margin-left: 0 !important;
    max-width: 100% !important;
    padding: 1rem 0.75rem !important;
  }

  .top-navbar {
    padding-bottom: 0.85rem !important;
    margin-bottom: 1.25rem !important;
  }

  .page-title {
    font-size: 1.25rem !important;
  }

  .page-subtitle {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 768px) {
  /* AI Assistant Mobile Ultra Polish */
  .ai-fab-btn {
    bottom: 1.25rem !important;
    right: 1.25rem !important;
    width: 56px !important;
    height: 56px !important;
    font-size: 1.6rem !important;
  }

  .ai-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-left: none !important;
    border-radius: 0 !important;
  }

  .ai-drawer-header {
    padding: 1rem 1.15rem !important;
  }

  .ai-msg {
    max-width: 92% !important;
    font-size: 0.88rem !important;
    padding: 0.8rem 1rem !important;
  }

  .ai-prompt-bar {
    padding: 0.75rem 1rem !important;
  }

  .ai-prompt-pill {
    font-size: 0.76rem !important;
    padding: 0.45rem 0.85rem !important;
  }

  .ai-input-wrapper {
    padding: 0.85rem 1rem !important;
  }

  /* Demographics & Dashboard Cards Mobile Layout */
  .demographics-report-container {
    padding-bottom: 1.5rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 1.25rem 1rem !important;
    margin: 0.5rem auto !important;
    border-radius: 18px !important;
  }

  /* Table horizontal touch scroll */
  .table-responsive, table {
    -webkit-overflow-scrolling: touch;
  }
}


