/* ============================================================
   1RFitness — Premium Design System
   app.css — Complete stylesheet (no framework dependency)
   ============================================================ */

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

/* ============================================================
   1. CSS Variables / Design Tokens
   ============================================================ */
:root {
  /* Brand — premium gold palette */
  --brand-50:  #fffbeb;
  --brand-100: #fef3c7;
  --brand-200: #fde68a;
  --brand-300: #f5c252;
  --brand-400: #e8a020;
  --brand-500: #e8a020;
  --brand-600: #c47d10;
  --brand-700: #9e600c;
  --brand-800: #7a4808;
  --brand-gradient: linear-gradient(135deg, #f5c252, #e8a020, #c47d10);
  --brand-shadow: 0 4px 16px rgba(232, 160, 32, 0.4);

  /* Backgrounds */
  --bg-page:    #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-white:   #ffffff;
  --bg-subtle:  #f1f5f9;

  /* Dark palette */
  --dark-900: #0f172a;
  --dark-800: #1e293b;
  --dark-700: #334155;
  --dark-600: #475569;
  --dark-500: #64748b;
  --dark-400: #94a3b8;
  --dark-300: #cbd5e1;
  --dark-200: #e2e8f0;
  --dark-100: #f1f5f9;
  --dark-50:  #f8fafc;

  /* Semantic */
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  /* Status */
  --success:     #10b981;
  --success-bg:  #d1fae5;
  --success-border: #a7f3d0;
  --warning:     #f59e0b;
  --warning-bg:  #fef3c7;
  --warning-border: #fde68a;
  --danger:      #ef4444;
  --danger-bg:   #fef2f2;
  --danger-border: #fecaca;
  --info:        #3b82f6;
  --info-bg:     #dbeafe;
  --info-border: #bfdbfe;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.06);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dark-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--dark-400); }

/* ============================================================
   3. Layout Structure
   ============================================================ */

/* App wrapper */
.app-wrapper {
  min-height: 100vh;
}

/* Main content area shifts right on desktop */
.main-area {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: padding-left var(--transition-normal);
}

@media (min-width: 1024px) {
  .main-area {
    padding-left: var(--sidebar-width);
  }
}

/* Page content */
.page-content {
  flex: 1;
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .page-content {
    padding: 1.75rem;
  }
}

@media (max-width: 1023px) {
  .page-content {
    padding-bottom: 90px;
  }
}

/* ============================================================
   4. Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  inset-y: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #080c14 0%, #0d1520 100%);
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  will-change: transform;
}

.sidebar.sidebar-open,
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); }
}

@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
  }
}

/* Sidebar logo area */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
  animation: pulse-glow 3s ease-in-out infinite;
  padding: 2px;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.875rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 12px rgba(232,160,32,0.4); }
  50%       { box-shadow: 0 4px 20px rgba(232,160,32,0.7); }
}

.sidebar-logo-text {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-logo-role {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--brand-500);
  margin-top: 1px;
  letter-spacing: 0.03em;
}

.sidebar-close-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.07);
  border: none;
  color: var(--dark-400);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

@media (min-width: 1024px) {
  .sidebar-close-btn { display: none; }
}

/* Sidebar user card */
.sidebar-user {
  margin: 10px 10px 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  border: 2px solid var(--brand-500);
  object-fit: cover;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.6875rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar navigation */
.sidebar-nav {
  flex: 1;
  padding: 6px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  padding: 10px 10px 6px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #334155;
}

/* Nav link */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.nav-link.active {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 3px 10px rgba(245,158,11,0.3);
}

.nav-link .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  transition: background var(--transition-fast);
}

.nav-link.active .nav-icon {
  background: rgba(255,255,255,0.2);
}

.nav-link:hover:not(.active) .nav-icon {
  background: rgba(255,255,255,0.08);
}

.nav-active-dot {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.nav-link-logout {
  color: #f87171 !important;
}

.nav-link-logout .nav-icon {
  background: rgba(239,68,68,0.12) !important;
  color: #f87171 !important;
}

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   5. Top Header
   ============================================================ */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 1.25rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.header-hamburger {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--dark-600);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.header-hamburger:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

@media (min-width: 1024px) {
  .header-hamburger { display: none; }
}

.header-title {
  flex: 1;
  min-width: 0;
}

.header-title h1 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--dark-500);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
  text-decoration: none;
}

.header-icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* User dropdown trigger */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  border: none;
  background: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-menu-btn:hover {
  background: var(--bg-subtle);
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--brand-400);
  flex-shrink: 0;
  object-fit: cover;
}

.user-menu-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dark-700);
  display: none;
}

@media (min-width: 640px) {
  .user-menu-name { display: block; }
}

/* Dropdown panel */
.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  z-index: 100;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--dark-600);
  text-decoration: none;
  transition: background var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dropdown-item-danger {
  color: var(--danger);
}

.dropdown-item-danger:hover {
  background: var(--danger-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ============================================================
   6. Cards
   ============================================================ */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-sm { padding: 1rem; border-radius: var(--radius-md); }
.card-lg { padding: 1.75rem; border-radius: var(--radius-xl); }

.card-hover {
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-glass {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.5);
}

/* Stat cards */
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 1.125rem;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card-amber::before  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card-green::before  { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card-blue::before   { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card-red::before    { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card-teal::before   { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.stat-icon-amber  { background: #fef3c7; color: #d97706; }
.stat-icon-green  { background: #d1fae5; color: #059669; }
.stat-icon-blue   { background: #dbeafe; color: #2563eb; }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; }
.stat-icon-red    { background: #fee2e2; color: #dc2626; }
.stat-icon-teal   { background: #ccfbf1; color: #0d9488; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark-900);
  line-height: 1;
  margin-bottom: 3px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
}

.stat-delta-up   { color: var(--success); }
.stat-delta-down { color: var(--danger); }

/* Card header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  color: var(--brand-500);
}

/* ============================================================
   7. Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Sizes */
.btn-xs  { padding: 5px 10px; font-size: 0.75rem; border-radius: 7px; }
.btn-sm  { padding: 7px 13px; font-size: 0.8125rem; border-radius: 8px; }
.btn-lg  { padding: 12px 24px; font-size: 1rem; border-radius: 14px; }
.btn-xl  { padding: 15px 30px; font-size: 1.0625rem; border-radius: 14px; }
.btn-full { width: 100%; }

/* Variants */
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--brand-shadow);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(245,158,11,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--dark-600);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--dark-100); border-color: var(--dark-300); }

.btn-outline {
  background: transparent;
  color: var(--brand-600);
  border: 1.5px solid var(--brand-400);
}
.btn-outline:hover { background: var(--brand-50); }

.btn-ghost {
  background: transparent;
  color: var(--dark-600);
  border: none;
}
.btn-ghost:hover { background: var(--bg-subtle); }

.btn-danger {
  background: var(--danger-bg);
  color: #dc2626;
  border: 1.5px solid var(--danger-border);
}
.btn-danger:hover { background: #fee2e2; }

.btn-danger-solid {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 3px 10px rgba(239,68,68,0.3);
}
.btn-danger-solid:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-success {
  background: #10b981;
  color: #fff;
  box-shadow: 0 3px 10px rgba(16,185,129,0.3);
}
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-dark {
  background: var(--dark-900);
  color: #fff;
}
.btn-dark:hover { background: var(--dark-800); }

/* Icon-only button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
}
.btn-icon-sm { width: 30px; height: 30px; border-radius: 7px; }
.btn-icon-lg { width: 42px; height: 42px; border-radius: 11px; }

/* ============================================================
   8. Badges & Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-amber   { background: var(--brand-100); color: #92400e; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-red     { background: var(--danger-bg); color: #b91c1c; }
.badge-blue    { background: var(--info-bg); color: #1d4ed8; }
.badge-purple  { background: #f3e8ff; color: #7e22ce; }
.badge-gray    { background: var(--bg-subtle); color: var(--dark-600); }
.badge-dark    { background: var(--dark-800); color: var(--dark-300); }
.badge-teal    { background: #ccfbf1; color: #0f766e; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-pink    { background: #fce7f3; color: #9d174d; }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Role badges */
.role-badge-SUPER_ADMIN { background: #4c1d95; color: #ddd6fe; }
.role-badge-ADMIN       { background: #1e1b4b; color: #c7d2fe; }
.role-badge-MANAGER     { background: #1e3a5f; color: #bfdbfe; }
.role-badge-TRAINER     { background: #14532d; color: #bbf7d0; }
.role-badge-DIETICIAN   { background: #064e3b; color: #a7f3d0; }
.role-badge-NUTRITIONIST{ background: #022c22; color: #6ee7b7; }
.role-badge-PAID_USER   { background: #78350f; color: #fde68a; }
.role-badge-DEMO_USER   { background: #374151; color: #d1d5db; }
.role-badge-FREE_USER   { background: #374151; color: #d1d5db; }
.role-badge-AI_AGENT    { background: #581c87; color: #e9d5ff; }
.role-badge-VISITOR     { background: #1f2937; color: #9ca3af; }

/* ============================================================
   9. Forms
   ============================================================ */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dark-700);
  margin-bottom: 6px;
}

.form-label-required::after {
  content: ' *';
  color: var(--danger);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Base input styles */
.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
  background: #fff;
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.input-with-icon {
  position: relative;
}

.input-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.input-icon-left + input,
.input-icon-left + .form-input {
  padding-left: 38px;
}

.input-icon-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.input-icon-right:hover { color: var(--dark-600); }

input:has(+ .input-icon-right) { padding-right: 38px; }

/* Input states */
.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1) !important;
}

.input-success {
  border-color: var(--success) !important;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  accent-color: var(--brand-500);
  margin-top: 1px;
}

.form-check input[type="radio"] {
  border-radius: 50%;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--dark-700);
  cursor: pointer;
  line-height: 1.5;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--dark-300);
  transition: background var(--transition-fast);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-track { background: var(--brand-500); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* Search input */
.search-input-wrap {
  position: relative;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.search-input {
  padding-left: 36px !important;
  padding-right: 12px;
  border-radius: var(--radius-pill) !important;
}

/* File upload */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  background: var(--bg-subtle);
}

.file-drop-zone:hover {
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.file-drop-zone.dragover {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

/* ============================================================
   10. Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--dark-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--dark-700);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #fafafa; }

.data-table-sm th { padding: 8px 12px; }
.data-table-sm td { padding: 8px 12px; font-size: 0.8125rem; }

/* Table cell helpers */
.td-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   11. Progress Bars
   ============================================================ */
.progress-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand-gradient);
  transition: width 0.6s ease;
}

.progress-bar-green   { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-bar-blue    { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.progress-bar-red     { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar-purple  { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.progress-sm  { height: 4px; }
.progress-md  { height: 8px; }
.progress-lg  { height: 12px; }
.progress-xl  { height: 16px; }

/* Progress with label */
.progress-labeled {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-labeled .progress-wrap { flex: 1; }

/* ============================================================
   12. Toast Notifications
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

@media (max-width: 640px) {
  #toast-container {
    bottom: 90px;
    left: 12px;
    right: 12px;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-xl);
  background: #fff;
  border: 1px solid var(--border-light);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.toast-exit {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: #d1fae5; color: #059669; }
.toast-error   .toast-icon { background: var(--danger-bg); color: #dc2626; }
.toast-warning .toast-icon { background: var(--brand-100); color: #d97706; }
.toast-info    .toast-icon { background: var(--info-bg); color: #2563eb; }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 0.8125rem; font-weight: 700; color: var(--dark-800); }
.toast-message { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--text-primary); }

/* ============================================================
   13. Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-panel {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-panel-sm { max-width: 380px; }
.modal-panel-lg { max-width: 680px; }
.modal-panel-xl { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-800);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   14. Avatars
   ============================================================ */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  flex-shrink: 0;
  object-fit: cover;
}

.avatar-xs  { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar-sm  { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md  { width: 40px; height: 40px; font-size: 0.875rem; }
.avatar-lg  { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl  { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-2xl { width: 96px; height: 96px; font-size: 1.75rem; }

.avatar-ring { border: 3px solid var(--brand-400); }
.avatar-ring-white { border: 3px solid #fff; }

/* Avatar group */
.avatar-group {
  display: flex;
  flex-direction: row-reverse;
}

.avatar-group .avatar {
  margin-right: -8px;
  border: 2px solid #fff;
}

/* ============================================================
   15. Mobile Bottom Navigation
   ============================================================ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: none;
}

@media (max-width: 1023px) {
  .mobile-bottom-nav { display: block; }
}

.mobile-bottom-nav-inner {
  display: grid;
  align-items: stretch;
  padding: 4px 0;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;          /* centres multi-line labels (e.g. "IMPORT / EXPORT") under the icon */
  gap: 3px;
  padding: 6px 4px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  min-width: 0;                /* allow shrink in 5-column grid on narrow phones */
  word-break: break-word;
}

.mobile-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mobile-nav-item.active {
  color: var(--brand-600);
}

.mobile-nav-item.active .mobile-nav-icon {
  background: var(--brand-100);
  color: var(--brand-600);
}

.mobile-nav-item:hover:not(.active) {
  color: var(--dark-500);
}

/* ============================================================
   16. Flash Messages / Alerts
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.alert-title { font-weight: 700; margin-bottom: 2px; }
.alert-body { line-height: 1.5; }

.alert-success { background: #f0fdf4; border: 1px solid var(--success-border); color: #166534; }
.alert-success .alert-icon { background: #dcfce7; }

.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: #991b1b; }
.alert-error .alert-icon { background: #fee2e2; }

.alert-warning { background: var(--brand-50); border: 1px solid var(--brand-200); color: #92400e; }
.alert-warning .alert-icon { background: var(--brand-100); }

.alert-info { background: #eff6ff; border: 1px solid var(--info-border); color: #1e40af; }
.alert-info .alert-icon { background: var(--info-bg); }

/* ============================================================
   17. Section Headers
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--dark-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-sm {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-100);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Page header (top of page) */
.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--dark-900);
  margin-bottom: 4px;
}

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

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb-sep { color: var(--dark-300); }
.breadcrumb-current { color: var(--dark-600); font-weight: 500; }

/* ============================================================
   18. Welcome Banner
   ============================================================ */
.welcome-banner {
  background: var(--brand-gradient);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: 40%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.welcome-content { position: relative; z-index: 1; }
.welcome-greeting { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; }
.welcome-sub { color: rgba(255,255,255,0.8); font-size: 0.875rem; }

/* ============================================================
   19. Empty States
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.empty-state-icon {
  width: 68px;
  height: 68px;
  background: var(--bg-subtle);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
  margin: 0 auto 1rem;
}

.empty-state-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-700);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

/* ============================================================
   20. Dividers
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: 1rem 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ============================================================
   21. Utility Classes
   ============================================================ */

/* Gradient text */
.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Text truncation */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Flex utilities */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start  { display: flex; align-items: center; justify-content: flex-start; }
.flex-end    { display: flex; align-items: center; justify-content: flex-end; }
.flex-col    { display: flex; flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.gap-1 { gap: 4px; }  .gap-2 { gap: 8px; }   .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; }  .gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-end   { align-items: flex-end; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

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

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Spacing */
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0 !important; }

/* Visibility */
.hidden { display: none !important; }
.visible { display: block !important; }

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fadeInUp 0.3s ease both; }
.animate-fade { animation: fadeIn 0.3s ease both; }
.animate-scale { animation: scaleIn 0.25s ease both; }
.animate-spin { animation: spin 0.8s linear infinite; }

/* Stagger children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* Tooltip */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark-800);
  color: var(--dark-100);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
}

[data-tip]:hover::after { opacity: 1; }

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(245,158,11,0.25);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ============================================================
   22. Chat UI
   ============================================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}

.chat-bubble-wrap.user-msg {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
}

.chat-bubble.user {
  background: var(--brand-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  background: var(--bg-subtle);
  color: var(--dark-700);
  border-bottom-left-radius: 4px;
}

.chat-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Typing dots */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--dark-400);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-area {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chat-input {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}

.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-gradient);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.chat-send-btn:hover { opacity: 0.9; transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.4; }

/* ============================================================
   23. Quick action tiles
   ============================================================ */
.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
}

.quick-action-tile:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.quick-action-icon {
  font-size: 1.5rem;
}

.quick-action-label {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================================
   24. Health / Step Progress
   ============================================================ */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.step-item.completed:not(:last-child)::after {
  background: var(--brand-500);
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  z-index: 1;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.step-item.completed .step-circle {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
}

.step-item.current .step-circle {
  border-color: var(--brand-500);
  color: var(--brand-600);
  box-shadow: 0 0 0 4px rgba(245,158,11,0.15);
}

.step-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.step-item.current .step-label { color: var(--brand-600); }
.step-item.completed .step-label { color: var(--dark-600); }

/* ============================================================
   25. Responsive Grid Helpers
   ============================================================ */
.col-span-2-md { }
.col-span-3-md { }

@media (min-width: 768px) {
  .md\:grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .md\:grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}

/* ============================================================
   26. Public / Landing Page
   ============================================================ */
.public-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 5%;
  transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

.public-nav.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.public-section {
  padding: 5rem 5%;
}

.public-section-sm {
  padding: 3.5rem 5%;
}

.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #0f172a 100%);
  position: relative;
  overflow: hidden;
  padding: 7rem 5% 5rem;
}

.feature-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.pricing-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 2rem;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
}

.pricing-card.popular {
  border-color: var(--brand-500);
  box-shadow: 0 8px 30px rgba(245,158,11,0.15);
  transform: scale(1.02);
}

.pricing-card:hover {
  box-shadow: var(--shadow-lg);
}

.pricing-card.popular:hover {
  box-shadow: 0 12px 40px rgba(245,158,11,0.25);
}

.popular-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 16px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Testimonial card */
.testimonial-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* Blog card */
.blog-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.blog-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.blog-card-gradient {
  width: 100%;
  height: 200px;
  background: var(--brand-gradient);
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

.blog-card-body {
  padding: 1.25rem;
}

/* Footer */
.public-footer {
  background: var(--dark-900);
  color: var(--dark-300);
  padding: 3.5rem 5% 1.5rem;
}

/* ============================================================
   27. Print
   ============================================================ */
@media print {
  .sidebar, .top-header, .mobile-bottom-nav, .sidebar-overlay { display: none !important; }
  .main-area { padding-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ============================================================
   28. Dark mode (future / partial support)
   ============================================================ */
/* Can be expanded later */

/* ============================================================
   29. Extended Utility Classes (Dashboard compat layer)
   ============================================================ */

/* ── Display ── */
.flex        { display: flex; }
.inline-flex { display: inline-flex; }
.grid        { display: grid; }
.block       { display: block; }
.inline      { display: inline; }
.inline-block{ display: inline-block; }

/* ── Flex direction ── */
.flex-row          { flex-direction: row; }
.flex-row-reverse  { flex-direction: row-reverse; }
.flex-column       { flex-direction: column; }
.flex-col-reverse  { flex-direction: column-reverse; }

/* ── Flex align / justify ── */
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start   { justify-content: flex-start; }
.justify-end     { justify-content: flex-end; }
.justify-around  { justify-content: space-around; }
.self-end        { align-self: flex-end; }
.self-start      { align-self: flex-start; }
.flex-wrap       { flex-wrap: wrap; }
.flex-nowrap     { flex-wrap: nowrap; }
.flex-1          { flex: 1; }
.flex-shrink-0   { flex-shrink: 0; }
.flex-grow       { flex-grow: 1; }
.min-w-0         { min-width: 0; }

/* ── Grid columns ── */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive: lg: breakpoint (≥1024px) */
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:col-span-2  { grid-column: span 2; }
  .lg\:col-span-3  { grid-column: span 3; }
}

/* Responsive: sm: breakpoint (≥640px) */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Responsive: md: breakpoint (≥768px) */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Gap ── */
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-5  { gap: 20px; }
.gap-6  { gap: 24px; }
.gap-8  { gap: 32px; }
.gap-10 { gap: 40px; }

/* ── Spacing: margin ── */
.m-0   { margin: 0; }
.m-1   { margin: 4px; }
.m-2   { margin: 8px; }
.m-3   { margin: 12px; }
.m-4   { margin: 16px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }
.mt-0  { margin-top: 0; }   .mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; } .mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }.mt-5  { margin-top: 20px; }
.mt-6  { margin-top: 24px; }.mt-8  { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }    .mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }  .mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; } .mb-5  { margin-bottom: 20px; }
.mb-6  { margin-bottom: 24px; } .mb-8  { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.ml-1 { margin-left: 4px; }  .ml-2 { margin-left: 8px; }
.mr-1 { margin-right: 4px; } .mr-2 { margin-right: 8px; }

/* ── Spacing: padding ── */
.p-0  { padding: 0; }        .p-1  { padding: 4px; }
.p-2  { padding: 8px; }      .p-3  { padding: 12px; }
.p-4  { padding: 16px; }     .p-5  { padding: 20px; }
.p-6  { padding: 24px; }     .p-8  { padding: 32px; }
.px-1 { padding-left:4px; padding-right:4px; }
.px-2 { padding-left:8px; padding-right:8px; }
.px-3 { padding-left:12px; padding-right:12px; }
.px-4 { padding-left:16px; padding-right:16px; }
.px-5 { padding-left:20px; padding-right:20px; }
.py-1 { padding-top:4px; padding-bottom:4px; }
.py-2 { padding-top:8px; padding-bottom:8px; }
.py-3 { padding-top:12px; padding-bottom:12px; }
.py-4 { padding-top:16px; padding-bottom:16px; }
.py-6 { padding-top:24px; padding-bottom:24px; }
.py-8 { padding-top:32px; padding-bottom:32px; }
.py-10{ padding-top:40px; padding-bottom:40px; }
.py-12{ padding-top:48px; padding-bottom:48px; }
.pt-0 { padding-top: 0; } .pb-0 { padding-bottom: 0; }

/* ── Sizing ── */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.w-auto  { width: auto; }
.h-auto  { height: auto; }
.max-w-sm  { max-width: 24rem; }
.max-w-md  { max-width: 28rem; }
.max-w-lg  { max-width: 32rem; }
.max-w-xl  { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.w-8  { width: 32px; }   .h-8  { height: 32px; }
.w-9  { width: 36px; }   .h-9  { height: 36px; }
.w-10 { width: 40px; }   .h-10 { height: 40px; }
.w-12 { width: 48px; }   .h-12 { height: 48px; }
.w-14 { width: 56px; }   .h-14 { height: 56px; }
.w-16 { width: 64px; }   .h-16 { height: 64px; }

/* ── Border radius ── */
.rounded      { border-radius: 6px; }
.rounded-md   { border-radius: 8px; }
.rounded-lg   { border-radius: 12px; }
.rounded-xl   { border-radius: 16px; }
.rounded-2xl  { border-radius: 20px; }
.rounded-full { border-radius: 9999px; }

/* ── Text sizing ── */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }
.text-4xl  { font-size: 2.25rem; }

/* ── Font weight ── */
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold{ font-weight: 800; }

/* ── Text colors ── */
.text-white       { color: #ffffff; }
.text-black       { color: #000000; }
.text-gray-400    { color: #9ca3af; }
.text-gray-500    { color: #6b7280; }
.text-gray-600    { color: #4b5563; }
.text-gray-700    { color: #374151; }
.text-gray-800    { color: #1f2937; }
.text-amber-100   { color: #fef3c7; }
.text-amber-600   { color: #d97706; }
.text-amber-700   { color: #b45309; }
.text-emerald-600 { color: #059669; }
.text-blue-600    { color: #2563eb; }
.text-purple-600  { color: #7c3aed; }
.text-red-600     { color: #dc2626; }
.text-red-500     { color: #ef4444; }
.text-teal-600    { color: #0d9488; }
.text-emerald-500 { color: #10b981; }
.text-emerald-800 { color: #065f46; }
.text-red-700     { color: #b91c1c; }
.text-blue-700    { color: #1d4ed8; }

/* ── Text colors (extended) ── */
.text-emerald-700 { color: #047857; }
.text-blue-700    { color: #1d4ed8; }
.text-purple-700  { color: #6d28d9; }
.text-amber-700   { color: #b45309; }
.text-amber-800   { color: #92400e; }
.text-teal-700    { color: #0f766e; }
.text-slate-300   { color: #cbd5e1; }
.text-slate-400   { color: #94a3b8; }
.text-slate-500   { color: #64748b; }
.text-slate-700   { color: #334155; }
.text-slate-800   { color: #1e293b; }

/* ── Background colors ── */
.bg-white        { background-color: #ffffff; }
.bg-gray-50      { background-color: #f9fafb; }
.bg-gray-100     { background-color: #f3f4f6; }
.bg-gray-200     { background-color: #e5e7eb; }
.bg-amber-50     { background-color: #fffbeb; }
.bg-amber-100    { background-color: #fef3c7; }
.bg-amber-200    { background-color: #fde68a; }
.bg-amber-500    { background-color: #f59e0b; }
.bg-amber-600    { background-color: #d97706; }
.bg-emerald-50   { background-color: #ecfdf5; }
.bg-emerald-100  { background-color: #d1fae5; }
.bg-emerald-500  { background-color: #10b981; }
.bg-blue-100     { background-color: #dbeafe; }
.bg-blue-500     { background-color: #3b82f6; }
.bg-purple-100   { background-color: #ede9fe; }
.bg-purple-50    { background-color: #f5f3ff; }
.bg-red-50       { background-color: #fef2f2; }
.bg-red-500      { background-color: #ef4444; }
.bg-orange-50    { background-color: #fff7ed; }

/* ── Background gradients ── */
.bg-gradient-to-r   { background-image: linear-gradient(to right, var(--tw-gradient-stops, #f59e0b, #d97706)); }
.from-amber-500     { --tw-gradient-from: #f59e0b; }
.to-amber-600       { --tw-gradient-to: #d97706; }
.from-amber-50      { --tw-gradient-from: #fffbeb; }
.to-orange-50       { --tw-gradient-to: #fff7ed; }
.from-emerald-50    { --tw-gradient-from: #ecfdf5; }
.to-teal-50         { --tw-gradient-to: #f0fdfa; }

/* Practical gradient combos used in pages */
.bg-gradient-amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}
.bg-gradient-to-r.from-amber-500.to-amber-600 {
  background: linear-gradient(to right, #f59e0b, #d97706);
}
.bg-gradient-to-br.from-amber-50.to-orange-50 {
  background: linear-gradient(to bottom right, #fffbeb, #fff7ed);
}
.bg-gradient-to-r.from-emerald-500.to-emerald-600 {
  background: linear-gradient(to right, #10b981, #059669);
}
.bg-gradient-to-r.from-emerald-600.to-teal-600 {
  background: linear-gradient(to right, #059669, #0d9488);
}
.bg-gradient-to-r.from-slate-800.to-slate-700 {
  background: linear-gradient(to right, #1e293b, #334155);
}
.bg-gradient-to-r.from-blue-600.to-blue-700 {
  background: linear-gradient(to right, #2563eb, #1d4ed8);
}

/* Opacity backgrounds (Tailwind bg-color/opacity pattern) */
.bg-white\/20  { background: rgba(255,255,255,0.2); }
.bg-white\/10  { background: rgba(255,255,255,0.1); }
.bg-black\/10  { background: rgba(0,0,0,0.1); }
.bg-amber-500\/20 { background: rgba(245,158,11,0.2); }

/* Additional text size */
.text-4xl  { font-size: 2.25rem; }
.text-5xl  { font-size: 3rem; }

/* Rounded full shorthand */
.rounded-3xl { border-radius: 24px; }

/* min-height */
.min-h-screen { min-height: 100vh; }

/* Object cover for images */
.object-cover { object-fit: cover; }

/* Vertical alignment */
.align-middle { vertical-align: middle; }

/* Line height */
.leading-none    { line-height: 1; }
.leading-tight   { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }

/* Hover state: color changes */
.hover\:bg-gray-200:hover { background-color: #e5e7eb; }
.hover\:text-amber-700:hover { color: #b45309; }
.hover\:bg-emerald-50:hover { background-color: #ecfdf5; }

/* Last child no border */
.last\:border-0:last-child { border: 0; }

/* Focus outline */
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(245,158,11,0.4); }

/* Disabled styling */
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }

/* Negative margin shorthand */
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Width auto */
.w-auto { width: auto; }

/* Table width */
.w-full { width: 100%; }

/* Break words */
.break-words { word-break: break-word; overflow-wrap: break-word; }

/* Container max-width helper */
.container-narrow { max-width: 800px; margin: 0 auto; }

/* Border left colored accent */
.border-l-4 { border-left: 4px solid; }
.border-l-amber { border-left-color: #f59e0b; }
.border-l-emerald{ border-left-color: #10b981; }
.border-l-red    { border-left-color: #ef4444; }
.border-l-blue   { border-left-color: #3b82f6; }

/* ── Border ── */
.border         { border: 1px solid #e2e8f0; }
.border-2       { border: 2px solid #e2e8f0; }
.border-gray-100{ border-color: #f3f4f6; }
.border-gray-200{ border-color: #e5e7eb; }
.border-gray-300{ border-color: #d1d5db; }
.border-amber-200{ border-color: #fde68a; }
.border-emerald-200{ border-color: #a7f3d0; }
.border-red-200 { border-color: #fecaca; }
.border-b       { border-bottom: 1px solid #e2e8f0; }
.border-b-0     { border-bottom: 0; }
.border-t       { border-top: 1px solid #e2e8f0; }

/* ── Overflow ── */
.overflow-hidden   { overflow: hidden; }
.overflow-x-auto   { overflow-x: auto; }
.overflow-y-auto   { overflow-y: auto; }

/* ── Position ── */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }

/* ── Text align ── */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ── Text decoration ── */
.underline     { text-decoration: underline; }
.no-underline  { text-decoration: none; }

/* ── Whitespace ── */
.whitespace-nowrap  { white-space: nowrap; }
.whitespace-pre-line{ white-space: pre-line; }

/* ── Opacity ── */
.opacity-50 { opacity: 0.5; }
.opacity-80 { opacity: 0.8; }

/* ── Cursor ── */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ── Resize ── */
.resize-none { resize: none; }

/* ── Space between children (vertical) ── */
.space-y-1 > * + * { margin-top: 4px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

/* ── Divide (border between children) ── */
.divide-y > * + *         { border-top: 1px solid #e5e7eb; }
.divide-gray-50 > * + *   { border-top-color: #f9fafb; }
.divide-gray-100 > * + *  { border-top-color: #f3f4f6; }
.divide-gray-200 > * + *  { border-top-color: #e5e7eb; }

/* ── Hover utilities ── */
.hover\:bg-gray-50:hover   { background-color: #f9fafb; }
.hover\:bg-amber-50:hover  { background-color: #fffbeb; }
.hover\:opacity-80:hover   { opacity: 0.8; }
.hover\:underline:hover    { text-decoration: underline; }
.hover\:text-amber-600:hover { color: #d97706; }
.hover\:bg-amber-50:hover  { background-color: #fffbeb; }

/* ── Transition ── */
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.transition-opacity{ transition: opacity 0.15s ease; }

/* ── Shadow ── */
.shadow-sm  { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.shadow     { box-shadow: 0 2px 6px rgba(0,0,0,0.1); }

/* ── Object fit ── */
.object-fit-cover { object-fit: cover; }

/* ── Italic ── */
.italic { font-style: italic; }

/* ── Max width / height ── */
.max-h-full { max-height: 100%; }

/* ── Disabled ── */
.disabled\:opacity-50:disabled { opacity: 0.5; }

/* ── Welcome banner content shortcut ── */
.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

/* ── Dashboard stat icon circles ── */
.icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.icon-circle-amber  { background: #fef3c7; color: #d97706; }
.icon-circle-green  { background: #d1fae5; color: #059669; }
.icon-circle-blue   { background: #dbeafe; color: #2563eb; }
.icon-circle-purple { background: #ede9fe; color: #7c3aed; }
.icon-circle-red    { background: #fee2e2; color: #dc2626; }
.icon-circle-teal   { background: #ccfbf1; color: #0d9488; }

/* ── Inline pill / badge variant ── */
.pill-white-20 {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Appointment highlight box ── */
.appt-highlight {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 1rem;
}

/* ── Quick link item ── */
.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dark-600);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.quick-link:hover {
  background: var(--brand-50);
  color: var(--brand-600);
}
.quick-link .ql-icon {
  color: var(--brand-500);
  flex-shrink: 0;
}

/* ── Chat layout ── */
.chat-page {
  display: flex;
  flex-direction: column;
  /* Fill the viewport minus header + bottom nav. Use dynamic viewport on iOS
     so the address-bar collapse doesn't crop the input. */
  height: calc(100vh - 140px);
  height: calc(100dvh - 140px);
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;     /* smoother iOS scrolling */
  overscroll-behavior: contain;          /* don't bounce the whole page */
}

/* ── Mobile chat (≤820px) ── */
@media (max-width: 820px) {
  .chat-page {
    height: calc(100vh - 175px);
    height: calc(100dvh - 175px);
    margin: 0;
  }
  .chat-messages { padding: 1rem 0.75rem; gap: 0.85rem; border-radius: 14px; }
  .chat-bubble    { max-width: 86% !important; font-size: 0.92rem !important; line-height: 1.5; }
  .chat-bubble p  { font-size: 0.92rem !important; }
  .chat-input-area {
    /* Stick the compose bar to the visible bottom, above the iOS-style nav */
    position: sticky; bottom: 0; left: 0; right: 0; z-index: 5;
    background: #fff; padding: 8px; border-radius: 14px;
    box-shadow: 0 -4px 14px rgba(0,0,0,.05);
    border: 1px solid var(--border-light);
  }
  .chat-input { font-size: 1rem !important; min-height: 44px; padding: 11px 14px !important; }
  .chat-send-btn { width: 44px !important; height: 44px !important; }
  .chat-prompts { padding: 0 4px; }
  .chat-prompt-btn { font-size: 0.78rem !important; padding: 8px 14px; }
}
@media (max-width: 480px) {
  .chat-page {
    height: calc(100vh - 165px);
    height: calc(100dvh - 165px);
  }
  .chat-bubble { max-width: 92% !important; }
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.chat-prompt-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--dark-600);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  font-family: inherit;
}
.chat-prompt-btn:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

/* ── Meal analysis result box ── */
.analysis-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
}
.analysis-box-title {
  font-weight: 700;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.nutrient-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0.75rem;
}
.nutrient-cell {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-size: 0.75rem;
}
.nutrient-cell .val { font-weight: 700; font-size: 0.875rem; }

/* ── Meal history item ── */
.meal-item {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem;
  transition: background var(--transition-fast);
}
.meal-item:hover { background: #fafafa; }
.meal-item + .meal-item { margin-top: 12px; }

/* ── Score badge ── */
.score-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}
.score-high   { background: #d1fae5; color: #059669; }
.score-medium { background: #fef3c7; color: #d97706; }
.score-low    { background: #fee2e2; color: #dc2626; }

/* ── Health form grid ── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .health-grid { grid-template-columns: repeat(3, 1fr); }
}
.health-grid-2 {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .health-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ── BMI display ── */
.bmi-box {
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bmi-value { font-size: 2rem; font-weight: 800; color: var(--dark-900); }
.bmi-label-underweight { color: #2563eb; }
.bmi-label-normal      { color: #059669; }
.bmi-label-overweight  { color: #d97706; }
.bmi-label-obese       { color: #dc2626; }

/* ── Alert inline ── */
.alert-inline {
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-inline-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.alert-inline-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ── Stats grid layout ── */
.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 1024px) {
  .stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Dashboard 2-col / 3-col grids ── */
.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .dashboard-grid-3 { grid-template-columns: 2fr 1fr; }
}

.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 1024px) {
  .dashboard-grid-2 { grid-template-columns: 2fr 1fr; }
}

.dashboard-cols-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .dashboard-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Meal log grid ── */
.meal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .meal-grid { grid-template-columns: 1fr 2fr; }
}

/* ── Activity list ── */
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.activity-item + .activity-item { margin-top: 12px; }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: 0.75rem; font-weight: 500; color: var(--dark-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time  { font-size: 0.6875rem; color: var(--text-muted); }
.activity-amount { font-size: 0.875rem; font-weight: 600; flex-shrink: 0; }
.activity-amount-credit { color: #059669; }
.activity-amount-debit  { color: #dc2626; }

/* ── Table inline (not data-table full) ── */
.table-inline { width: 100%; font-size: 0.875rem; }
.table-inline th {
  text-align: left;
  padding: 8px;
  color: var(--dark-500);
  font-weight: 600;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
.table-inline td {
  padding: 8px;
  vertical-align: middle;
  border-bottom: 1px solid #f9fafb;
  color: var(--dark-700);
}
.table-inline tbody tr:last-child td { border-bottom: none; }
.table-inline tbody tr:hover td { background: #fafafa; }

/* ── Truncate max-width ── */
.max-w-100 { max-width: 100px; }

/* ── Height calc helpers ── */
.h-screen-minus-180 { height: calc(100vh - 180px); }

/* ── Page sections ── */
.page-section { margin-bottom: 1.5rem; }

/* ============================================================
   PREMIUM VISUAL UPGRADE — Colorful, Rich, Professional
   ============================================================ */

/* ── Page background ── */
body { background: #f0f4f8; }

/* ── Sidebar premium glow ── */
.sidebar {
  background: linear-gradient(180deg, #060c18 0%, #0c1628 40%, #0f172a 100%);
  border-right: 1px solid rgba(245,158,11,0.08);
  box-shadow: 4px 0 24px rgba(0,0,0,0.25);
}
.sidebar-logo {
  background: rgba(245,158,11,0.06);
  border-bottom: 1px solid rgba(245,158,11,0.1);
  padding: 1.1rem 1.25rem;
}
.sidebar-user {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin: 0;
}
.nav-link {
  margin: 2px 10px;
  border-radius: 10px;
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(232,160,32,0.12));
  border: 1px solid rgba(245,158,11,0.25);
  box-shadow: 0 2px 12px rgba(245,158,11,0.15);
}
.nav-link:hover:not(.active) {
  background: rgba(255,255,255,0.06);
}
.nav-link.active .nav-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(245,158,11,0.4);
}
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
  padding: 10px;
}

/* ── Top header premium ── */
.top-header {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  box-shadow: 0 1px 16px rgba(0,0,0,0.06);
}

/* ── Welcome banner – rich mesh gradient ── */
.welcome-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 35%, #1a1230 65%, #1e293b 100%);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(245,158,11,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -100px; left: 30%;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-greeting {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #fcd34d 60%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.welcome-sub { color: rgba(255,255,255,0.65); font-size: 0.875rem; }
.pill-white-20 {
  background: rgba(245,158,11,0.18);
  border: 1px solid rgba(245,158,11,0.3);
  color: #fcd34d;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ── Stat cards – full gradient backgrounds ── */
.stat-card {
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  border: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.15); }
.stat-card::before { display: none; } /* remove old top border */

/* Decorative circle on each card */
.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

.stat-card-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 60%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(245,158,11,0.35);
}
.stat-card-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 60%, #047857 100%);
  box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}
.stat-card-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%);
  box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}
.stat-card-purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 60%, #6d28d9 100%);
  box-shadow: 0 6px 20px rgba(139,92,246,0.35);
}
.stat-card-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #b91c1c 100%);
  box-shadow: 0 6px 20px rgba(239,68,68,0.35);
}
.stat-card-teal {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 60%, #0f766e 100%);
  box-shadow: 0 6px 20px rgba(20,184,166,0.35);
}

/* Icon overrides on colored cards */
.stat-card-amber .stat-icon,
.stat-card-green .stat-icon,
.stat-card-blue .stat-icon,
.stat-card-purple .stat-icon,
.stat-card-red .stat-icon,
.stat-card-teal .stat-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.stat-card-amber .stat-value,
.stat-card-green .stat-value,
.stat-card-blue .stat-value,
.stat-card-purple .stat-value,
.stat-card-red .stat-value,
.stat-card-teal .stat-value { color: #fff; font-size: 1.625rem; }

.stat-card-amber .stat-label,
.stat-card-green .stat-label,
.stat-card-blue .stat-label,
.stat-card-purple .stat-label,
.stat-card-red .stat-label,
.stat-card-teal .stat-label { color: rgba(255,255,255,0.8); }

/* ── Cards – premium polish ── */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,0.7);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 0 0 1px rgba(255,255,255,0.8) inset;
}
.card-hover:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.1);
  border-color: rgba(245,158,11,0.2);
  transform: translateY(-2px);
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}
.section-header h2::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  border-radius: 2px;
  margin-right: 10px;
  vertical-align: middle;
}

/* ── Card title ── */
.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-title-icon { color: #f59e0b; }

/* ── Quick action tiles ── */
.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 1.1rem 0.75rem;
  border-radius: 14px;
  text-decoration: none;
  transition: all 0.18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1.5px solid transparent;
}
.quick-action-tile.bg-amber-50 {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-color: rgba(245,158,11,0.2);
}
.quick-action-tile.bg-blue-50 {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: rgba(59,130,246,0.2);
}
.quick-action-tile.bg-purple-50 {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-color: rgba(139,92,246,0.2);
}
.quick-action-tile.bg-emerald-50 {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: rgba(16,185,129,0.2);
}
.quick-action-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  opacity: 1;
}
.quick-action-tile.bg-amber-50:hover  { border-color: rgba(245,158,11,0.5); }
.quick-action-tile.bg-blue-50:hover   { border-color: rgba(59,130,246,0.5); }
.quick-action-tile.bg-purple-50:hover { border-color: rgba(139,92,246,0.5); }
.quick-action-tile.bg-emerald-50:hover{ border-color: rgba(16,185,129,0.5); }
.quick-action-label { font-size: 0.75rem; font-weight: 700; color: #374151; }

/* ── Icon circles ── */
.icon-circle {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.icon-circle-amber  { background: linear-gradient(135deg,#fef3c7,#fde68a); color: #d97706; }
.icon-circle-green  { background: linear-gradient(135deg,#d1fae5,#a7f3d0); color: #059669; }
.icon-circle-blue   { background: linear-gradient(135deg,#dbeafe,#bfdbfe); color: #2563eb; }
.icon-circle-purple { background: linear-gradient(135deg,#ede9fe,#ddd6fe); color: #7c3aed; }
.icon-circle-red    { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #dc2626; }
.icon-circle-teal   { background: linear-gradient(135deg,#ccfbf1,#99f6e4); color: #0d9488; }

/* ── Appointment highlight ── */
.appt-highlight {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 1.125rem;
}

/* ── Activity items ── */
.activity-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.activity-title { font-size: 0.8125rem; font-weight: 600; color: #334155; }
.activity-time  { font-size: 0.6875rem; color: #94a3b8; margin-top: 1px; }
.activity-amount { font-size: 0.875rem; font-weight: 700; }

/* ── Badges – vibrant ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-amber  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-blue   { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-gray   { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-red    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-purple { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }

/* ── Buttons ── */
.btn-primary, [class*="btn-primary"] {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 3px 10px rgba(245,158,11,0.35);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover, [class*="btn-primary"]:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 6px 20px rgba(245,158,11,0.45);
  transform: translateY(-1px);
}
.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1.5px solid #e2e8f0;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.btn-sm { padding: 7px 14px; font-size: 0.8125rem; }

/* ── Empty states ── */
.empty-state-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  color: #94a3b8;
  margin: 0 auto 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ── Flash / Alert ── */
.flash-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: 10px;
  color: #991b1b;
  font-size: 0.875rem;
}

/* ── Mobile bottom nav ── */
.mobile-bottom-nav {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(226,232,240,0.8);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.mobile-nav-item.active {
  color: #d97706;
}
.mobile-nav-item.active .mobile-nav-icon {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.08));
  color: #d97706;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Animations ── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
  50%       { box-shadow: 0 4px 24px rgba(245,158,11,0.6); }
}
@keyframes pulse-brand {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
@keyframes animate-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: animate-fade-in 0.35s ease both;
}

/* ── Form elements ── */
.form-input, .form-select, .form-textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="date"],
select, textarea {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

/* ── Tables ── */
.table-inline th {
  background: #f8fafc;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 10px 12px;
}
.table-inline td { padding: 10px 12px; }
.table-inline tbody tr:hover td { background: #fffbeb; }

/* ── Recordings thumbnail gradient ── */
.recording-thumb {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 12px 12px 0 0;
}

/* ── Toast notifications ── */
.toast {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid rgba(226,232,240,0.8);
}

/* ── Nutri cards (booking) ── */
.nutri-card { border-radius: 16px !important; }
.nutri-card.sel {
  border-color: #f59e0b !important;
  background: linear-gradient(135deg, #fffbeb, #fff) !important;
  box-shadow: 0 4px 20px rgba(245,158,11,0.2) !important;
}

/* ── Dropdown panel ── */
.dropdown-panel {
  background: #fff;
  border: 1px solid rgba(226,232,240,0.8);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  min-width: 200px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 100;
  overflow: hidden;
}

/* ── Page layout background ── */
@media (min-width: 1024px) {
  .page-content { padding: 2rem 2.25rem; }
}

/* ── END PREMIUM UPGRADE ── */

/* ============================================================
   DASHBOARD PREMIUM — App-Quality Components
   ============================================================ */

/* ── Hero Banner ── */
.db-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1040 40%, #0f2027 70%, #0f172a 100%);
  padding: 1.5rem 1.5rem 0;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(245,158,11,0.12);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25), 0 2px 0 rgba(245,158,11,0.08) inset;
}
.db-hero-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.db-hero-blob-1 {
  width: 260px; height: 260px;
  top: -80px; right: -60px;
  background: radial-gradient(circle, rgba(245,158,11,0.22) 0%, transparent 65%);
}
.db-hero-blob-2 {
  width: 200px; height: 200px;
  bottom: -60px; left: -40px;
  background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 65%);
}
.db-hero-blob-3 {
  width: 150px; height: 150px;
  top: 20px; left: 35%;
  background: radial-gradient(circle, rgba(16,185,129,0.1) 0%, transparent 65%);
}
.db-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.25rem;
}
.db-hero-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.25), 0 4px 12px rgba(245,158,11,0.3);
  overflow: hidden;
}
.db-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.db-hero-text { flex: 1; min-width: 0; }
.db-hero-greeting {
  font-size: 1.15rem; font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #fde68a 55%, #f59e0b 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1.2; margin-bottom: 6px;
}
.db-hero-plan {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.72rem; font-weight: 700; color: #fcd34d;
  letter-spacing: 0.02em;
}
.db-hero-plan-dot { color: rgba(252,211,77,0.5); }
.db-hero-cta {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 14px rgba(245,158,11,0.45);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; color: #fff; text-decoration: none;
  font-size: 1rem;
  transition: all 0.18s ease;
}
.db-hero-cta span { font-size: 0.55rem; font-weight: 700; letter-spacing: 0.05em; }
.db-hero-cta:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(245,158,11,0.55); }

/* Stats bar inside hero */
.db-stats-bar {
  position: relative; z-index: 1;
  display: flex; align-items: center;
  background: rgba(255,255,255,0.05);
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 0 -1.5rem;
  padding: 0.9rem 1.5rem;
}
.db-stat { flex: 1; text-align: center; }
.db-stat-val { display: block; font-size: 1rem; font-weight: 800; color: #fff; line-height: 1; margin-bottom: 3px; }
.db-stat-lbl { display: block; font-size: 0.6rem; font-weight: 600; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.06em; }
.db-stat-div { width: 1px; height: 30px; background: rgba(255,255,255,0.1); flex-shrink: 0; }

/* ── Section label ── */
.db-section-label {
  font-size: 0.7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: #94a3b8; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 8px;
}
.db-section-label::after {
  content: ''; flex: 1; height: 1px; background: #e2e8f0;
}

/* ── Quick nav grid (app-icon style) ── */
.db-quicknav {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
  .db-quicknav { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.db-qn-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-decoration: none; cursor: pointer;
}
.db-qn-item:hover .db-qn-icon { transform: scale(1.08); box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.db-qn-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.qn-amber  { background: linear-gradient(145deg,#fbbf24,#d97706); }
.qn-red    { background: linear-gradient(145deg,#f87171,#dc2626); }
.qn-purple { background: linear-gradient(145deg,#a78bfa,#7c3aed); }
.qn-blue   { background: linear-gradient(145deg,#60a5fa,#2563eb); }
.qn-green  { background: linear-gradient(145deg,#34d399,#059669); }
.qn-teal   { background: linear-gradient(145deg,#2dd4bf,#0d9488); }
.db-qn-label {
  font-size: 0.65rem; font-weight: 700; color: #475569;
  text-align: center; line-height: 1.2;
}

/* ── Main grid ── */
.db-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .db-main-grid { grid-template-columns: 3fr 2fr; gap: 1.25rem; }
}

/* ── Premium cards ── */
.db-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
}
.db-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem 0.5rem;
}
.db-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; font-weight: 800; color: #0f172a;
}
.db-card-icon-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.db-link-sm {
  font-size: 0.75rem; font-weight: 700; color: #f59e0b;
  text-decoration: none;
  transition: color 0.15s;
}
.db-link-sm:hover { color: #d97706; }

/* ── Appointment card ── */
.db-card-appt { margin-bottom: 1rem; }
.db-appt-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg,#fffbeb,#fef3c7);
  border-top: 1px solid #fde68a; border-bottom: 1px solid #fde68a;
  gap: 12px;
}
.db-appt-left { display: flex; align-items: center; gap: 10px; }
.db-appt-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg,#f59e0b,#d97706);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem; flex-shrink: 0;
}
.db-appt-name { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.db-appt-role { font-size: 0.75rem; color: #6b7280; margin-top: 1px; }
.db-appt-countdown {
  font-size: 0.8rem; font-weight: 800;
  color: #d97706; white-space: nowrap;
  background: rgba(245,158,11,0.12);
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(245,158,11,0.25);
}
.db-appt-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem; color: #374151;
}
.db-appt-meta span { display: flex; align-items: center; gap: 5px; }
.db-appt-actions {
  display: flex; gap: 8px; padding: 0 1.25rem 1rem;
}
.db-btn-join {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg,#f59e0b,#d97706);
  color: #fff; font-weight: 700; font-size: 0.8125rem;
  padding: 9px 18px; border-radius: 10px; text-decoration: none;
  box-shadow: 0 3px 10px rgba(245,158,11,0.35);
  transition: all 0.18s ease;
}
.db-btn-join:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(245,158,11,0.45); }
.db-btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #374151; font-weight: 600; font-size: 0.8125rem;
  padding: 9px 16px; border-radius: 10px; text-decoration: none;
  border: 1.5px solid #e2e8f0;
  transition: all 0.18s ease;
}
.db-btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

/* Empty appointment state */
.db-empty-appt { padding: 2.5rem 1.25rem; text-align: center; }
.db-empty-icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: linear-gradient(135deg,#f1f5f9,#e2e8f0);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; color: #94a3b8; margin: 0 auto 14px;
}
.db-empty-title { font-size: 1rem; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.db-empty-sub { font-size: 0.8125rem; color: #64748b; max-width: 260px; margin: 0 auto; }

/* ── Feature tiles ── */
.db-feature-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.db-feature-tile {
  border-radius: 18px; padding: 1.1rem;
  text-decoration: none; position: relative; overflow: hidden;
  min-height: 110px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.db-feature-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.15); }
.db-ft-live {
  background: linear-gradient(135deg,#1a0533,#3b0764,#1e0752);
  border: 1px solid rgba(139,92,246,0.2);
}
.db-ft-rec {
  background: linear-gradient(135deg,#0c1a3a,#1d3461,#0f1e3c);
  border: 1px solid rgba(59,130,246,0.2);
}
.db-ft-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  background: rgba(255,255,255,0.12);
  margin-bottom: auto;
}
.db-ft-title { font-size: 0.9375rem; font-weight: 800; color: #fff; margin: 0.75rem 0 3px; }
.db-ft-sub   { font-size: 0.75rem; color: rgba(255,255,255,0.55); }
.db-ft-arrow {
  position: absolute; top: 1rem; right: 1rem;
  color: rgba(255,255,255,0.3); font-size: 0.75rem;
  transition: transform 0.18s;
}
.db-feature-tile:hover .db-ft-arrow { transform: translateX(3px); color: rgba(255,255,255,0.7); }

/* ── Activity list ── */
.db-activity-list { padding: 0 0.5rem 0.5rem; }
.db-activity-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.65rem 0.75rem; border-radius: 12px;
  transition: background 0.15s;
}
.db-activity-item:hover { background: #f8fafc; }
.db-activity-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.db-activity-info { flex: 1; min-width: 0; }
.db-activity-title { font-size: 0.8rem; font-weight: 600; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-activity-time  { font-size: 0.7rem; color: #94a3b8; margin-top: 1px; }
.db-activity-amount { font-size: 0.875rem; font-weight: 800; flex-shrink: 0; white-space: nowrap; }
.db-activity-empty { padding: 1.5rem 1.25rem; }

/* ── Health links ── */
.db-health-links { padding: 0 0.5rem 0.75rem; }
.db-hl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.7rem 0.75rem; border-radius: 10px;
  text-decoration: none; font-size: 0.8375rem;
  font-weight: 600; color: #334155;
  transition: background 0.15s;
}
.db-hl-item:hover { background: #f8fafc; }
.db-hl-item + .db-hl-item { border-top: 1px solid #f1f5f9; }

/* ── Sidebar improvements ── */
.sidebar-logo-img {
  width: 40px; height: 40px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,0.08);
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(245,158,11,0.2);
  animation: pulse-glow 3s ease-in-out infinite;
}
.sidebar-logo-text {
  font-size: 0.9375rem; font-weight: 800;
  background: linear-gradient(135deg,#fcd34d,#f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo-role {
  font-size: 0.65rem; color: rgba(255,255,255,0.4);
  font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; margin-top: 1px;
}

/* ── Top header premium ── */
.top-header {
  height: 60px; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 12px;
}
.header-title h1 {
  font-size: 1rem; font-weight: 800; color: #0f172a;
}
.header-icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc; border: 1px solid #e2e8f0;
  color: #64748b; cursor: pointer; transition: all 0.15s;
  font-size: 0.875rem;
}
.header-icon-btn:hover { background: #f1f5f9; color: #0f172a; }
.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 5px 10px 5px 5px;
  cursor: pointer; transition: all 0.15s;
}
.user-menu-btn:hover { background: #f1f5f9; }
.user-menu-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg,#f59e0b,#d97706);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #fff;
  overflow: hidden;
}
.user-menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu-name { font-size: 0.8125rem; font-weight: 700; color: #0f172a; }

/* ── Mobile bottom nav ── */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(226,232,240,0.6);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  z-index: 50; display: none;
}
@media (max-width: 1023px) { .mobile-bottom-nav { display: block; } }
.mobile-bottom-nav-inner {
  display: grid; height: 64px;
  padding: 0 4px;
}
.mobile-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; text-decoration: none;
  font-size: 0.58rem; font-weight: 700;
  color: #94a3b8; letter-spacing: 0.03em;
  text-transform: uppercase; padding: 0 4px;
  transition: color 0.15s;
}
.mobile-nav-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all 0.15s;
}
.mobile-nav-item.active { color: #d97706; }
.mobile-nav-item.active .mobile-nav-icon {
  background: linear-gradient(135deg,rgba(245,158,11,0.18),rgba(245,158,11,0.08));
  color: #d97706;
}
.mobile-nav-item:hover:not(.active) { color: #475569; }
.page-content { padding-bottom: 80px; }
@media (min-width: 1024px) { .page-content { padding-bottom: 2rem; } }

/* ── END DASHBOARD PREMIUM ── */

/* ============================================================
   END OF app.css
   ============================================================ */

/* ============================================================
   26. RESPONSIVE OVERHAUL — Mobile-first (2026 Premium)
   ============================================================ */

/* ── Tighter page padding on tiny screens ─────────────────── */
@media (max-width: 480px) {
  .page-content { padding: 0.875rem 0.875rem 100px; }
}

/* ── Card padding tightens on mobile ──────────────────────── */
@media (max-width: 480px) {
  .card    { padding: 1rem; border-radius: var(--radius-md); }
  .card-lg { padding: 1.125rem; }
  .card-sm { padding: 0.75rem; }
}
@media (min-width: 481px) and (max-width: 640px) {
  .card    { padding: 1.125rem; }
}

/* ── Stat cards ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .stat-card  { padding: 0.875rem 0.75rem; gap: 10px; }
  .stat-icon  { width: 38px; height: 38px; font-size: 0.9rem; }
  .stat-value { font-size: 1.25rem; }
  .stat-label { font-size: 0.6875rem; }
}

/* ── Touch targets — minimum 44px on mobile ───────────────── */
@media (max-width: 1023px) {
  .btn        { min-height: 44px; }
  .btn-sm     { min-height: 40px; }
  .btn-xs     { min-height: 36px; }
  .nav-link   { min-height: 44px; }
  .mobile-nav-item { min-height: 52px; }
}

/* ── Modal → bottom-sheet on mobile ──────────────────────── */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-panel,
  .modal-panel-sm,
  .modal-panel-lg,
  .modal-panel-xl {
    max-width: 100%;
    width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  /* Drag handle */
  .modal-panel::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--dark-200);
    border-radius: 99px;
    margin: 10px auto 0;
  }
  .modal-header  { padding: 1rem 1.25rem; }
  .modal-body    { padding: 1rem 1.25rem; }
  .modal-footer  { padding: 0.875rem 1.25rem; flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}

/* ── Tables always scroll horizontally ───────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .data-table { min-width: 520px; }
  .data-table td, .data-table th { padding: 9px 10px; }
}

/* ── Section headers stack on tiny screens ───────────────── */
@media (max-width: 480px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ── Welcome banner ───────────────────────────────────────── */
@media (max-width: 480px) {
  .welcome-banner   { padding: 1.125rem; }
  .welcome-greeting { font-size: 1rem; }
}

/* ── Mobile bottom nav tiny screens ──────────────────────── */
@media (max-width: 375px) {
  .mobile-nav-item { font-size: 0.55rem; padding: 6px 2px; }
  .mobile-nav-icon { width: 28px; height: 28px; font-size: 0.875rem; }
}

/* ── Scrollable horizontal tab bar ───────────────────────── */
.tabs-scroll {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  padding-bottom: 2px;
}
.tabs-scroll::-webkit-scrollbar { display: none; }

/* ── Input number — hide spinners ────────────────────────── */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Sidebar scrolls its nav on small heights ────────────── */
.sidebar-nav { overflow-y: auto; overscroll-behavior: contain; }

/* ── Print — hide chrome ──────────────────────────────────── */
@media print {
  .sidebar, .top-header, .mobile-bottom-nav,
  #cookieBanner, #cookieModal, #toast-container { display: none !important; }
  .main-area   { padding-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ============================================================
   27. PREMIUM CARD VARIANTS
   ============================================================ */

/* Glassmorphism card */
.card-glass-premium {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* Gradient tint cards */
.card-tint-amber  { background: linear-gradient(135deg,#fffbeb,#fef3c7); border-color:#fde68a; }
.card-tint-green  { background: linear-gradient(135deg,#f0fdf4,#dcfce7); border-color:#bbf7d0; }
.card-tint-blue   { background: linear-gradient(135deg,#eff6ff,#dbeafe); border-color:#bfdbfe; }
.card-tint-purple { background: linear-gradient(135deg,#faf5ff,#f3e8ff); border-color:#e9d5ff; }
.card-tint-red    { background: linear-gradient(135deg,#fff1f2,#ffe4e6); border-color:#fecdd3; }
.card-tint-teal   { background: linear-gradient(135deg,#f0fdfa,#ccfbf1); border-color:#99f6e4; }

/* Premium dark hero card */
.card-dark-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

/* Plan / pricing card */
.plan-card {
  position: relative;
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-light);
  padding: 1.5rem;
  background: #fff;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.plan-card:hover { box-shadow: var(--shadow-xl); transform: translateY(-3px); }
.plan-card.popular {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.15), var(--shadow-lg);
}
.plan-card-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  padding: 3px 16px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--brand-shadow);
}
.plan-price { font-size: 2.25rem; font-weight: 900; line-height: 1; color: var(--dark-900); }
.plan-period { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }
.plan-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-features li { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--dark-700); }
.plan-features li::before {
  content: '✓'; color: var(--success); font-weight: 800;
  font-size: 0.8rem; flex-shrink: 0;
  width: 18px; height: 18px; background: var(--success-bg);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   28. PREMIUM STAT / METRIC TILES
   ============================================================ */
.metric-tile {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}
.metric-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-tile-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; flex-shrink: 0;
}
.metric-tile-value { font-size: 1.75rem; font-weight: 900; line-height: 1; color: var(--dark-900); }
.metric-tile-label { font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); }
.metric-tile-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; font-weight: 700; margin-top: 2px;
}
.metric-tile-trend.up   { color: var(--success); }
.metric-tile-trend.down { color: var(--danger); }
/* Accent stripe on left */
.metric-tile-accent::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.metric-tile-accent.amber::before  { background: var(--brand-gradient); }
.metric-tile-accent.green::before  { background: linear-gradient(180deg,#10b981,#34d399); }
.metric-tile-accent.blue::before   { background: linear-gradient(180deg,#3b82f6,#60a5fa); }
.metric-tile-accent.purple::before { background: linear-gradient(180deg,#8b5cf6,#a78bfa); }
.metric-tile-accent.red::before    { background: linear-gradient(180deg,#ef4444,#f87171); }

/* ============================================================
   29. ACTIVITY / TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-500);
  flex-shrink: 0; margin-top: 5px;
  box-shadow: 0 0 0 3px rgba(232,160,32,0.2);
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-title   { font-size: 0.875rem; font-weight: 600; color: var(--dark-800); }
.timeline-time    { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   30. FORM GROUPS RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  /* Any 2-col form grid collapses to 1 col */
  .form-grid-2 { grid-template-columns: 1fr !important; }
  /* Inline label + input rows stack */
  .form-inline { flex-direction: column; align-items: flex-start; }
}

/* Input groups */
.input-group {
  display: flex; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-group:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}
.input-group-addon {
  padding: 0 12px; background: var(--bg-subtle);
  display: flex; align-items: center; font-size: 0.875rem;
  color: var(--text-muted); white-space: nowrap;
  border-right: 1.5px solid var(--border); flex-shrink: 0;
}
.input-group-addon-right {
  border-right: none; border-left: 1.5px solid var(--border);
}
.input-group input,
.input-group .form-input {
  border: none !important; border-radius: 0 !important;
  box-shadow: none !important; flex: 1; min-width: 0;
}

/* ============================================================
   31. RESPONSIVE QUICK ACTIONS GRID
   ============================================================ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .quick-actions-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .quick-action-tile  { padding: 0.75rem 0.5rem; }
  .quick-action-icon  { font-size: 1.25rem; }
  .quick-action-label { font-size: 0.6875rem; }
}
@media (max-width: 360px) {
  .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   32. PREMIUM PAGE HEADER
   ============================================================ */
.premium-page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.premium-page-title {
  font-size: 1.375rem; font-weight: 900; color: var(--dark-900);
  line-height: 1.2;
}
.premium-page-subtitle {
  font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px;
}
@media (max-width: 480px) {
  .premium-page-header { flex-direction: column; align-items: flex-start; }
  .premium-page-title  { font-size: 1.125rem; }
  .premium-page-header .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   33. PILL TABS (horizontal scrollable)
   ============================================================ */
.pill-tabs {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 99px;
  font-size: 0.8125rem; font-weight: 600;
  white-space: nowrap; cursor: pointer; border: none;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--bg-subtle); color: var(--dark-600);
  text-decoration: none;
}
.pill-tab:hover { background: var(--dark-100); color: var(--dark-800); }
.pill-tab.active {
  background: var(--brand-gradient); color: #fff;
  box-shadow: var(--brand-shadow);
}
.pill-tab-count {
  background: rgba(255,255,255,0.25); border-radius: 99px;
  padding: 1px 7px; font-size: 0.6875rem; font-weight: 800;
}
.pill-tab:not(.active) .pill-tab-count {
  background: var(--dark-200); color: var(--dark-600);
}

/* ============================================================
   34. NOTIFICATION / BADGE DOT ON ICON
   ============================================================ */
.icon-badge {
  position: relative; display: inline-flex;
}
.icon-badge::after {
  content: '';
  position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}

/* ============================================================
   35. RESPONSIVE TABLE — CARD-STACK ON MOBILE
   ============================================================ */
/* Use class .table-stack on <table> to activate card mode at 480px */
@media (max-width: 480px) {
  .table-stack,
  .table-stack thead { display: none; }
  .table-stack tbody,
  .table-stack tr,
  .table-stack td { display: block; }
  .table-stack tbody tr {
    background: #fff; border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 12px; margin-bottom: 8px;
    box-shadow: var(--shadow-xs);
  }
  .table-stack td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
  }
  .table-stack td:last-child { border-bottom: none; padding-bottom: 0; }
  .table-stack td::before {
    content: attr(data-label);
    font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    flex-shrink: 0; margin-right: 12px;
  }
}

/* ============================================================
   36. TRACKING / CODE EDITOR STYLES
   ============================================================ */
.code-textarea {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
  border-radius: var(--radius-md);
  resize: vertical;
  min-height: 120px;
}
.code-textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
  background: #0d1520;
}
.code-textarea::placeholder { color: #475569; }

/* ── Pixel integration card ── */
.pixel-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  padding: 14px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.pixel-card:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.1);
}
.pixel-card-logo {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.pixel-card-body { flex: 1; min-width: 0; }
.pixel-card-label {
  font-size: 0.8125rem; font-weight: 700; color: var(--dark-800);
  margin-bottom: 6px;
}
.pixel-card-input {
  width: 100%; background: var(--bg-subtle); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 0.8125rem;
  font-family: monospace; color: var(--text-primary); outline: none;
  transition: border-color var(--transition-fast);
}
.pixel-card-input:focus { border-color: var(--brand-500); background: #fff; }
.pixel-card-status {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.pixel-card-status.active { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.pixel-card-status.inactive { background: var(--dark-300); }

/* ============================================================
   37. SCROLLBAR HIDDEN UTILITY
   ============================================================ */
.scrollbar-hide { scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ============================================================
   38. MOBILE HEADER IMPROVEMENTS
   ============================================================ */
@media (max-width: 640px) {
  .top-header { padding: 0 0.875rem; gap: 8px; }
  .header-title h1 { font-size: 0.875rem; }
}

/* ============================================================
   39. FORM FLOATING LABEL (premium input)
   ============================================================ */
.float-label { position: relative; }
.float-label input, .float-label textarea {
  padding-top: 1.375rem; padding-bottom: 0.5rem;
}
.float-label label {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 0.875rem; color: var(--text-muted);
  pointer-events: none; transition: all 0.15s ease;
}
.float-label input:focus ~ label,
.float-label input:not(:placeholder-shown) ~ label,
.float-label textarea:focus ~ label,
.float-label textarea:not(:placeholder-shown) ~ label {
  top: 0.75rem; transform: none;
  font-size: 0.6875rem; font-weight: 600; color: var(--brand-600);
}

/* ============================================================
   40. UPGRADE BANNER (member pages)
   ============================================================ */
.upgrade-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius-xl); padding: 1.5rem;
  color: #fff; display: flex; align-items: center;
  gap: 16px; position: relative; overflow: hidden;
}
.upgrade-banner::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(232,160,32,0.12);
}
.upgrade-banner::after {
  content: '';
  position: absolute; bottom: -50px; left: 30%;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(232,160,32,0.07);
}
.upgrade-banner-content { position: relative; z-index: 1; flex: 1; min-width: 0; }
.upgrade-banner-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; color: #fff; flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(232,160,32,0.4);
  position: relative; z-index: 1;
}
@media (max-width: 480px) {
  .upgrade-banner { flex-direction: column; padding: 1.25rem; text-align: center; }
  .upgrade-banner-icon { margin: 0 auto; }
  .upgrade-banner .btn { width: 100%; margin-top: 4px; }
}

/* ============================================================
   41. COLLAPSIBLE / ACCORDION SECTIONS
   ============================================================ */
.collapsible-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 10px;
  transition: box-shadow var(--transition-fast);
}
.collapsible-card:hover { box-shadow: var(--shadow-md); }

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  transition: background var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.collapsible-header:hover { background: var(--bg-subtle); }
.collapsible-header.open  { background: var(--bg-subtle); }

.collapsible-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-800);
  flex: 1;
  min-width: 0;
}
.collapsible-title-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.collapsible-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--brand-100);
  color: var(--brand-700);
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.collapsible-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.collapsible-header.open .collapsible-chevron { transform: rotate(180deg); }

.collapsible-body {
  display: none;
  border-top: 1px solid var(--border-light);
  padding: 0;
  animation: collapseIn 0.2s ease;
}
.collapsible-body.open { display: block; }
.collapsible-body-inner { padding: 16px 18px; }

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

/* Divider between collapsible items */
.collapsible-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 18px;
}

/* Nested collapsible */
.collapsible-card .collapsible-card {
  border-radius: var(--radius-md);
  margin: 0 0 6px;
}

/* Color variants */
.collapsible-card.amber  { border-left: 3px solid var(--brand-500); }
.collapsible-card.green  { border-left: 3px solid #10b981; }
.collapsible-card.blue   { border-left: 3px solid #3b82f6; }
.collapsible-card.purple { border-left: 3px solid #8b5cf6; }
.collapsible-card.red    { border-left: 3px solid #ef4444; }

/* ============================================================
   42. ANIMATED STAT COUNTER
   ============================================================ */
.stat-counter { display: inline-block; }

/* ============================================================
   43. COLORFUL SECTION HEADERS
   ============================================================ */
.section-pill-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: 99px;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.section-pill-header.amber  { background: #fef3c7; color: #92400e; }
.section-pill-header.green  { background: #d1fae5; color: #065f46; }
.section-pill-header.blue   { background: #dbeafe; color: #1e40af; }
.section-pill-header.purple { background: #ede9fe; color: #5b21b6; }
.section-pill-header.red    { background: #fee2e2; color: #991b1b; }
.section-pill-header.teal   { background: #ccfbf1; color: #0f766e; }
.section-pill-header .icon-wrap {
  width: 24px; height: 24px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
}
.section-pill-header.amber  .icon-wrap { background: #f59e0b; color: #fff; }
.section-pill-header.green  .icon-wrap { background: #10b981; color: #fff; }
.section-pill-header.blue   .icon-wrap { background: #3b82f6; color: #fff; }
.section-pill-header.purple .icon-wrap { background: #8b5cf6; color: #fff; }
.section-pill-header.red    .icon-wrap { background: #ef4444; color: #fff; }
.section-pill-header.teal   .icon-wrap { background: #14b8a6; color: #fff; }

/* ============================================================
   44. PREMIUM WELCOME BANNER VARIANTS
   ============================================================ */
.welcome-banner-v2 {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
  color: #fff;
}
.welcome-banner-v2::before {
  content: '';
  position: absolute; top: -60px; right: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.welcome-banner-v2::after {
  content: '';
  position: absolute; bottom: -80px; left: 40%;
  width: 240px; height: 240px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.welcome-banner-v2-content { position: relative; z-index: 1; }
.welcome-banner-v2-name  { font-size: 1.25rem; font-weight: 800; }
.welcome-banner-v2-sub   { font-size: 0.875rem; opacity: 0.75; margin-top: 2px; }
.welcome-banner-v2-stats {
  display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap;
}
.welcome-banner-v2-stat  {
  display: flex; flex-direction: column;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 90px;
}
.welcome-banner-v2-stat-val  { font-size: 1.125rem; font-weight: 800; }
.welcome-banner-v2-stat-lbl  { font-size: 0.65rem; opacity: 0.7; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }

/* ============================================================
   45. MOBILE-FIRST LIST ITEMS (replace raw <li>)
   ============================================================ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-item-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.875rem; font-weight: 600; color: var(--dark-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.list-item-meta  { flex-shrink: 0; text-align: right; }
.list-item-value { font-size: 0.875rem; font-weight: 700; color: var(--dark-800); }
.list-item-time  { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   46. COLORFUL GRADIENT STAT CARDS (v2)
   ============================================================ */
.grad-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.grad-card::after {
  content: '';
  position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.grad-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; margin-bottom: 12px;
}
.grad-card-val   { font-size: 1.875rem; font-weight: 900; line-height: 1; }
.grad-card-label { font-size: 0.75rem; opacity: 0.8; margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.grad-card-trend { font-size: 0.75rem; opacity: 0.9; margin-top: 6px; }
.grad-card.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.grad-card.green  { background: linear-gradient(135deg, #10b981, #059669); }
.grad-card.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.grad-card.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.grad-card.pink   { background: linear-gradient(135deg, #ec4899, #db2777); }
.grad-card.teal   { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.grad-card.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.grad-card.orange { background: linear-gradient(135deg, #f97316, #ea580c); }

/* ============================================================
   47. RESPONSIVE GRID HELPERS
   ============================================================ */
.grid-auto-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-auto-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-auto-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 640px) {
  .grid-auto-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-auto-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
  .grid-auto-4, .grid-auto-3 { grid-template-columns: 1fr; }
  .grid-auto-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   48. SEARCH + FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar .search-box {
  flex: 1; min-width: 180px;
  position: relative;
}
.filter-bar .search-box input {
  padding-left: 36px;
  border-radius: 99px;
}
.filter-bar .search-box i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: var(--text-muted);
  font-size: 0.8rem; pointer-events: none;
}
@media (max-width: 480px) {
  .filter-bar { flex-direction: column; }
  .filter-bar > * { width: 100%; }
  .filter-bar select { width: 100%; }
}

/* ============================================================
   49. DATA LABELS FOR MOBILE TABLE CARDS
   ============================================================ */
@media (max-width: 600px) {
  .mobile-card-table thead { display: none; }
  .mobile-card-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: var(--shadow-xs);
  }
  .mobile-card-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    gap: 8px;
  }
  .mobile-card-table td:last-child { border-bottom: none; padding-bottom: 0; }
  .mobile-card-table td::before {
    content: attr(data-label);
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.05em; flex-shrink: 0;
    min-width: 90px;
  }
}

/* ============================================================
   50. FLOATING ACTION BUTTON (mobile)
   ============================================================ */
.fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(232,160,32,0.45);
  display: none;
  align-items: center; justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 40;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(232,160,32,0.55); }
@media (max-width: 1023px) { .fab { display: flex; } }
@media (min-width: 1024px) { .fab { display: none !important; } }

/* ============================================================
   51. SIDEBAR SECTION GROUPS (collapsible on desktop)
   ============================================================ */
.sidebar-section-group { margin-bottom: 4px; }
.sidebar-section-group-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 8px 16px 4px;
}

/* ============================================================
   52. EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem 1rem; text-align: center;
}
.empty-state-icon {
  width: 64px; height: 64px; border-radius: var(--radius-xl);
  background: var(--bg-subtle); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1rem;
}
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--dark-800); margin-bottom: 6px; }
.empty-state-sub   { font-size: 0.875rem; color: var(--text-muted); max-width: 300px; line-height: 1.5; }
.empty-state-action { margin-top: 1.25rem; }

/* ============================================================
   53. ROLE COLOR STRIPES
   ============================================================ */
.role-stripe-ADMIN        { border-left: 3px solid #4f46e5; }
.role-stripe-SUPER_ADMIN  { border-left: 3px solid #7c3aed; }
.role-stripe-MANAGER      { border-left: 3px solid #2563eb; }
.role-stripe-DIETICIAN    { border-left: 3px solid #059669; }
.role-stripe-NUTRITIONIST { border-left: 3px solid #0d9488; }
.role-stripe-TRAINER      { border-left: 3px solid #d97706; }
.role-stripe-PAID_USER    { border-left: 3px solid #10b981; }
.role-stripe-FREE_USER    { border-left: 3px solid #94a3b8; }

/* ============================================================
   END premium additions
   ============================================================ */

/* ============================================================
   54. GRAD-CARD INNER ELEMENTS (gc-*) & COLOR ALIASES
   ============================================================ */
/* Color aliases so both `class="grad-card amber"` and
   `class="grad-card grad-amber"` work */
.grad-card.grad-amber  { background: linear-gradient(135deg,#f59e0b,#d97706); }
.grad-card.grad-green  { background: linear-gradient(135deg,#10b981,#059669); }
.grad-card.grad-blue   { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.grad-card.grad-purple { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.grad-card.grad-pink   { background: linear-gradient(135deg,#ec4899,#db2777); }
.grad-card.grad-teal   { background: linear-gradient(135deg,#14b8a6,#0d9488); }
.grad-card.grad-indigo { background: linear-gradient(135deg,#6366f1,#4f46e5); }
.grad-card.grad-orange { background: linear-gradient(135deg,#f97316,#ea580c); }
.grad-card.grad-red    { background: linear-gradient(135deg,#ef4444,#dc2626); }

/* Inner layout helpers */
.gc-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff; flex-shrink: 0;
  margin-bottom: 10px;
}
.gc-body   { flex: 1; }
.gc-val    { font-size: 1.75rem; font-weight: 900; color: #fff; line-height: 1; }
.gc-lbl    { font-size: 0.75rem; color: rgba(255,255,255,0.8); font-weight: 600;
             text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.gc-sub    { font-size: 0.75rem; color: rgba(255,255,255,0.65); margin-top: 4px; }

/* ============================================================
   55. WELCOME BANNER V2 — STAT TILES & ORBS
   ============================================================ */
.welcome-banner-v2 {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg,#1a1f36 0%,#1e2a45 60%,#0f1828 100%);
  border-radius: 20px; padding: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(50px); pointer-events: none;
}
.orb-1 {
  width: 200px; height: 200px; top: -60px; left: -40px;
  background: rgba(245,158,11,0.2);
}
.orb-2 {
  width: 160px; height: 160px; bottom: -50px; right: 80px;
  background: rgba(139,92,246,0.18);
}
.wb-stat-tiles {
  display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1;
}
.wb-tile {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 10px 16px;
  text-align: center; min-width: 80px;
}
.wb-tile-val {
  font-size: 1.125rem; font-weight: 800; color: #fff; line-height: 1;
}
.wb-tile-lbl {
  font-size: 0.65rem; color: rgba(255,255,255,0.55); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px;
}
@media (max-width: 640px) {
  .welcome-banner-v2 { flex-direction: column; align-items: flex-start; }
  .wb-stat-tiles { width: 100%; }
  .wb-tile { flex: 1; min-width: 0; }
}

/* ============================================================
   56. SECTION PILL HEADER — HYPHENATED COLOUR ALIASES
   ============================================================ */
/* Allow both: class="section-pill-header amber"
          and: class="section-pill-header section-pill-amber" */
.section-pill-amber  { background: #fef3c7; color: #92400e; }
.section-pill-green  { background: #d1fae5; color: #065f46; }
.section-pill-blue   { background: #dbeafe; color: #1e40af; }
.section-pill-purple { background: #ede9fe; color: #5b21b6; }
.section-pill-red    { background: #fee2e2; color: #991b1b; }
.section-pill-teal   { background: #ccfbf1; color: #0f766e; }

/* ============================================================
   57. ROLE COLOUR STRIPES (short aliases)
   ============================================================ */
.role-stripe-teal   { border-left: 3px solid #0d9488; }
.role-stripe-green  { border-left: 3px solid #16a34a; }
.role-stripe-amber  { border-left: 3px solid #d97706; }
.role-stripe-blue   { border-left: 3px solid #2563eb; }
.role-stripe-purple { border-left: 3px solid #7c3aed; }
.role-stripe-red    { border-left: 3px solid #dc2626; }

/* ============================================================
   58. EMPTY STATE — desc alias
   ============================================================ */
.empty-state-desc { font-size: 0.875rem; color: var(--text-muted); max-width: 280px;
                    line-height: 1.5; margin: 0 auto; }

/* ============================================================
   END section 54-58
   ============================================================ */


/* ════════════════════════════════════════════════════════════════════
   59. RESPONSIVE OVERRIDES — global admin/member responsive layer
   ════════════════════════════════════════════════════════════════════
   Applies to every admin page in one shot:
     • Wide tables get horizontal-scroll wrappers (never overflow viewport)
     • Inputs / selects / textareas never exceed their container
     • Modals always fit the screen
     • Cards get tighter padding on small screens
     • Headers / tab strips wrap instead of overflowing
     • Wide flex bars on toolbars wrap with sensible gaps
   ════════════════════════════════════════════════════════════════════ */

/* Universal max-width safety — stops fixed-px widths from breaking small screens */
.card, .premium-card, .stat-card, .form-input, .form-select, textarea, select {
  max-width: 100%;
  box-sizing: border-box;
}

/* Tables that don't already sit in an overflow wrapper get one for free */
.data-table { width: 100%; }
.table-scroll, .data-table-scroll {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

/* Images never bigger than their container */
img { max-width: 100%; height: auto; }

/* ── Mobile / tablet  (≤820px) ───────────────────────────────────────── */
@media (max-width: 820px) {
  /* Page container — let it fill the viewport, less side padding */
  .container, main, .admin-main, .premium-page-header { padding-left: 12px; padding-right: 12px; }

  /* Cards & headers */
  .card { padding: 14px; border-radius: 14px; }
  .premium-card { padding: 14px; }
  .premium-page-header { flex-wrap: wrap; gap: 10px; }
  .premium-page-title { font-size: 1.1rem; }

  /* Tables — wrap in horizontal scroll, sticky first column for readability */
  .data-table, .premium-table, table.responsive-table {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .data-table thead, .premium-table thead { white-space: nowrap; }
  .data-table th, .data-table td,
  .premium-table th, .premium-table td { padding: 8px 10px; font-size: 0.82rem; }

  /* Form layouts — collapse 2/3/4-column grids to single column */
  .form-row, .form-grid, .grid, .premium-grid,
  [class*="grid-cols-2"], [class*="grid-cols-3"], [class*="grid-cols-4"] {
    grid-template-columns: 1fr !important;
  }
  /* …unless an explicit responsive variant is set (Tailwind sm:grid-cols-2 etc.) */

  /* Form inputs — bigger touch targets, true 16px font (prevents iOS zoom) */
  .form-input, .form-select, input[type="text"], input[type="email"],
  input[type="password"], input[type="number"], input[type="tel"],
  input[type="date"], input[type="search"], select, textarea {
    font-size: 16px !important;
    padding: 11px 13px;
    min-height: 44px;
  }
  textarea { min-height: 80px; }

  /* Buttons — touch-friendly */
  .btn, button.btn-primary, button.btn-secondary, button.btn-ghost {
    min-height: 42px; padding: 10px 16px;
  }
  .btn-sm { min-height: 34px; padding: 7px 12px; font-size: 0.84rem; }

  /* Tabs / pill rows — wrap instead of horizontal-scroll-on-edge */
  .pill-tabs, .wa-tabs, .nav-tabs, .filter-pills {
    flex-wrap: wrap; gap: 6px;
  }

  /* Modals — full-width with small margins, scrollable body */
  .modal, .premium-modal, [class*="modal-"] {
    width: 100% !important; max-width: calc(100vw - 24px) !important;
    margin: 12px;
  }
  .modal-content, .premium-modal-content { max-height: calc(100vh - 60px); overflow-y: auto; }

  /* Stat cards — let them grow to fill row */
  .stat-card, .premium-stat-card { width: 100%; }

  /* Toolbars that pack many controls — wrap with consistent gap */
  .toolbar, .actions-row, .bulk-actions, .filters-row, .premium-toolbar {
    flex-wrap: wrap; gap: 8px;
  }

  /* Sidebars — hide the desktop sidebar on mobile (mobile nav handles it) */
  /* (Mobile bottom nav is already in place in includes/layout_end.php) */
}

/* ── Small phones (≤480px) ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .premium-page-title { font-size: 1rem; }
  .premium-page-subtitle { font-size: 0.75rem; }
  .card, .premium-card { padding: 12px; }
  .data-table th, .data-table td { font-size: 0.78rem; padding: 6px 8px; }

  /* Generic h1..h3 inside admin pages */
  h1 { font-size: 1.2rem; }
  h2 { font-size: 1.05rem; }
  h3 { font-size: 0.95rem; }

  /* Pagination */
  .pagination, .page-nav { flex-wrap: wrap; justify-content: center; gap: 4px; }
}

/* ── Print friendliness (used for "Save as PDF" via browser) ────────── */
@media print {
  .mobile-bottom-nav, .sidebar, .premium-sidebar, .topbar, .toolbar, .btn { display: none !important; }
  body { background: #fff; }
  .card, .premium-card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
}
/* ──────────────────────────────────────────────────────────────────── */


/* ════════════════════════════════════════════════════════════════════
   60. PREMIUM QUICK ACTIONS · used on every dashboard's index page
   ════════════════════════════════════════════════════════════════════
   Markup:
     <div class="qa-grid">
       <a href="…" class="qa-tile qa-amber">
         <span class="qa-icon"><i class="fa-solid fa-users"></i></span>
         <span class="qa-text">
           <span class="qa-label">Manage Users</span>
           <span class="qa-sub">View, edit, bulk actions</span>
         </span>
         <span class="qa-arrow"><i class="fa-solid fa-arrow-right"></i></span>
       </a>
       … more tiles …
     </div>
   Variants: qa-amber, qa-green, qa-blue, qa-purple, qa-teal, qa-red,
             qa-pink, qa-indigo
   ════════════════════════════════════════════════════════════════════ */

.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.qa-tile {
  --qa-from: #fef3c7;
  --qa-to:   #fde68a;
  --qa-fg:   #d97706;
  --qa-shadow: 245,158,11;
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--qa-from) 0%, #fff 65%);
  border: 1px solid #fff;
  border-left: 4px solid var(--qa-fg);
  border-radius: 14px;
  text-decoration: none;
  color: #1f2937;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.03);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.2),
              box-shadow .18s, border-color .18s;
  min-height: 78px;
  overflow: hidden;
}
.qa-tile::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(var(--qa-shadow), .12), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
}
.qa-tile:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 28px rgba(var(--qa-shadow), .18),
              0 2px 6px rgba(0,0,0,.06);
  border-color: var(--qa-fg);
}
.qa-tile:hover::before { opacity: 1; }
.qa-tile:active { transform: translateY(-1px) scale(0.99); }

.qa-icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--qa-from), var(--qa-to));
  color: var(--qa-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(var(--qa-shadow), .25);
}
.qa-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.qa-label {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qa-sub {
  font-size: 0.72rem;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qa-arrow {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  color: var(--qa-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  opacity: .55;
  transition: transform .18s, opacity .18s, background .18s;
}
.qa-tile:hover .qa-arrow {
  transform: translateX(3px);
  opacity: 1;
  background: var(--qa-fg);
  color: #fff;
}
.qa-badge {
  position: absolute;
  top: 8px; right: 10px;
  background: var(--qa-fg);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Colour variants */
.qa-amber  { --qa-from:#fef3c7; --qa-to:#fde68a; --qa-fg:#d97706; --qa-shadow:245,158,11;  }
.qa-green  { --qa-from:#dcfce7; --qa-to:#bbf7d0; --qa-fg:#16a34a; --qa-shadow:34,197,94;   }
.qa-blue   { --qa-from:#dbeafe; --qa-to:#bfdbfe; --qa-fg:#2563eb; --qa-shadow:59,130,246;  }
.qa-purple { --qa-from:#ede9fe; --qa-to:#ddd6fe; --qa-fg:#7c3aed; --qa-shadow:139,92,246;  }
.qa-teal   { --qa-from:#ccfbf1; --qa-to:#99f6e4; --qa-fg:#0d9488; --qa-shadow:20,184,166;  }
.qa-red    { --qa-from:#fee2e2; --qa-to:#fecaca; --qa-fg:#dc2626; --qa-shadow:239,68,68;   }
.qa-pink   { --qa-from:#fce7f3; --qa-to:#fbcfe8; --qa-fg:#db2777; --qa-shadow:236,72,153;  }
.qa-indigo { --qa-from:#e0e7ff; --qa-to:#c7d2fe; --qa-fg:#4f46e5; --qa-shadow:99,102,241;  }
.qa-rose   { --qa-from:#ffe4e6; --qa-to:#fecdd3; --qa-fg:#e11d48; --qa-shadow:225,29,72;   }
.qa-cyan   { --qa-from:#cffafe; --qa-to:#a5f3fc; --qa-fg:#0891b2; --qa-shadow:8,145,178;   }
.qa-lime   { --qa-from:#ecfccb; --qa-to:#d9f99d; --qa-fg:#65a30d; --qa-shadow:132,204,22;  }
.qa-slate  { --qa-from:#f1f5f9; --qa-to:#e2e8f0; --qa-fg:#475569; --qa-shadow:100,116,139; }

/* Section heading just above the grid */
.qa-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.qa-section-title-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 4px 10px rgba(245,158,11,.25);
}
.qa-section-title small {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 4px;
}

@media (max-width: 820px) {
  .qa-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
  .qa-tile { padding: 12px 13px; min-height: 70px; }
  .qa-icon { width: 40px; height: 40px; font-size: 1.05rem; border-radius: 10px; }
  .qa-label { font-size: 0.86rem; }
  .qa-sub { font-size: 0.68rem; }
}
@media (max-width: 480px) {
  .qa-grid { grid-template-columns: 1fr; }
  .qa-tile { min-height: 64px; padding: 11px 12px; }
}


/* ════════════════════════════════════════════════════════════════════
   61. AI CHAT BUBBLE · Markdown rendering typography
   ════════════════════════════════════════════════════════════════════
   Assistant messages render Markdown via renderMd() / render_chat_md().
   These styles make the output look like a polished article instead of
   a wall of asterisks.
   ════════════════════════════════════════════════════════════════════ */

.chat-bubble.md-body {
  font-size: 0.92rem;
  line-height: 1.62;
  color: #1f2937;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Headings inside the bubble */
.chat-bubble.md-body h2,
.chat-bubble.md-body h3,
.chat-bubble.md-body h4 {
  margin: 14px 0 6px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
  line-height: 1.3;
}
.chat-bubble.md-body h2 { font-size: 1.05rem; }
.chat-bubble.md-body h3 { font-size: 0.98rem; }
.chat-bubble.md-body h4 { font-size: 0.92rem; color: #334155; }
.chat-bubble.md-body :first-child { margin-top: 0; }
.chat-bubble.md-body :last-child  { margin-bottom: 0; }

/* Strong / em / del */
.chat-bubble.md-body strong { font-weight: 700; color: #0f172a; }
.chat-bubble.md-body em     { font-style: italic; color: #374151; }
.chat-bubble.md-body del    { color: #94a3b8; }

/* Inline + block code */
.chat-bubble.md-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #f1f5f9;
  color: #be185d;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
}
.chat-bubble.md-body pre {
  background: #0f172a;
  color: #f1f5f9;
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 10px 0;
  -webkit-overflow-scrolling: touch;
}
.chat-bubble.md-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
  font-size: inherit;
}

/* Lists */
.chat-bubble.md-body ul,
.chat-bubble.md-body ol {
  margin: 8px 0;
  padding-left: 22px;
}
.chat-bubble.md-body ul { list-style: disc; }
.chat-bubble.md-body ol { list-style: decimal; }
.chat-bubble.md-body li {
  margin: 4px 0;
  padding-left: 4px;
}
.chat-bubble.md-body li::marker {
  color: #f59e0b;
  font-weight: 700;
}
.chat-bubble.md-body ul ul,
.chat-bubble.md-body ol ol,
.chat-bubble.md-body ul ol,
.chat-bubble.md-body ol ul { margin: 4px 0; }

/* Links */
.chat-bubble.md-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
.chat-bubble.md-body a:hover { color: #1d4ed8; }

/* Blockquote */
.chat-bubble.md-body blockquote {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  padding: 8px 12px;
  margin: 10px 0;
  border-radius: 0 8px 8px 0;
  color: #78350f;
  font-style: italic;
}

/* HR */
.chat-bubble.md-body hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}

/* Tables (if AI ever emits them) */
.chat-bubble.md-body table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.84rem;
  width: 100%;
}
.chat-bubble.md-body th,
.chat-bubble.md-body td {
  border: 1px solid #e5e7eb;
  padding: 5px 8px;
  text-align: left;
}
.chat-bubble.md-body th { background: #f8fafc; font-weight: 700; }

/* ── Mobile chat typography (≤480px) ── */
@media (max-width: 480px) {
  .chat-bubble.md-body { font-size: 0.95rem; line-height: 1.6; }
  .chat-bubble.md-body h2 { font-size: 1rem; }
  .chat-bubble.md-body h3 { font-size: 0.95rem; }
  .chat-bubble.md-body pre { font-size: 0.78rem; padding: 10px 12px; }
  .chat-bubble.md-body ul,
  .chat-bubble.md-body ol { padding-left: 18px; }
}


/* ════════════════════════════════════════════════════════════════
   ADMIN + GLOBAL RESPONSIVE FIXES — appended
   ════════════════════════════════════════════════════════════════ */

/* ── Bottom nav: prevent label overflow on small screens ──────── */
.mobile-nav-item {
  font-size: 0.52rem;
  padding: 0 2px;
  overflow: hidden;
}
@media (max-width: 360px) {
  .mobile-nav-item { font-size: 0.48rem; }
  .mobile-nav-icon { width: 28px; height: 28px; font-size: 0.9rem; }
}
/* Truncate long labels (e.g. "IMPORT / EXPORT", "ENGAGEMENT") */
.mobile-nav-item > span:not(.mobile-nav-icon) {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  text-align: center;
}

/* ── Admin dashboard grid fixes ───────────────────────────────── */

/* dashboard-grid-2: revenue chart + quick actions — stack on mobile */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 1024px) {
  .dashboard-grid-2 { grid-template-columns: 1.3fr 1fr; }
}

/* Recent appointments / payments — stack on mobile, side-by-side ≥768 */
.admin-activity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
  .admin-activity-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Hero banner wb-stat-tiles — 3 tiles side by side on all sizes ── */
.wb-stat-tiles {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  margin-top: 12px;
}
.wb-tile {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.15);
}
.wb-tile-val {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-tile-lbl {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.65);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 640px) {
  .wb-tile { padding: 12px 16px; }
  .wb-tile-val { font-size: 1.25rem; }
  .wb-tile-lbl { font-size: 0.7rem; }
}

/* ── Grad stat cards — 2-col mobile, 4-col desktop ──────────────── */
.grid-auto-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 900px) {
  .grid-auto-4 { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
.grad-card {
  border-radius: 16px;
  padding: 16px;
  min-height: 100px;
}
@media (max-width: 400px) {
  .grad-card { padding: 14px 12px; }
  .gc-val { font-size: 1.4rem !important; }
}

/* ── Quick actions: only override on very small screens ───────── */
@media (max-width: 479px) {
  .qa-grid { grid-template-columns: 1fr !important; }
}

/* ── collapsible-card list items wrapping ─────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.list-item .badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  padding: 2px 7px;
  white-space: nowrap;
}
@media (max-width: 400px) {
  .list-item { gap: 8px; padding: 8px 12px !important; }
  .list-item .badge { display: none; } /* hide badge on very small, show status via dot instead */
}

/* ── welcome-banner-v2 layout fix on mobile ──────────────────── */
.welcome-banner-v2 {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 768px) {
  .welcome-banner-v2 {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
  }
  .wb-stat-tiles {
    margin-top: 0;
    width: auto;
    flex-direction: column;
    min-width: 180px;
  }
  .wb-tile { text-align: left; padding: 10px 16px; }
}

/* ── Ensure page content doesn't get hidden under bottom nav ─── */
.page-content {
  padding-bottom: 84px;
}
@media (min-width: 1024px) {
  .page-content { padding-bottom: 2rem; }
}

/* ── Admin tables: horizontal scroll wrapper on mobile ─────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

/* ── Card padding tighter on mobile ─────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 14px 14px !important; border-radius: 14px !important; }
  .collapsible-header { padding: 12px 14px !important; }
  .collapsible-body   { padding-left: 14px !important; padding-right: 14px !important; }
}


/* ════════════════════════════════════════════════════════════════
   PREMIUM CARD READABILITY FIXES
   ════════════════════════════════════════════════════════════════ */

/* Grad cards — ensure all text is white with strong contrast */
.grad-card, .grad-card * {
  color: #fff;
}
.grad-card .gc-lbl,
.grad-card .gc-sub {
  color: rgba(255,255,255,0.88) !important;
}
.grad-card .gc-val {
  color: #fff !important;
  text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.gc-body { position:relative; z-index:1; }
.gc-icon {
  background: rgba(255,255,255,0.22) !important;
  color: #fff !important;
  border-radius: 12px;
}

/* Dashboard section heads — ensure readable */
.ds-section-title-text { color:#1e293b !important; }
.ds-section-subtitle   { color:#64748b !important; }

/* Measurement KPI grid on dashboard — ensure readable */
.ds-meas-kpi { color:#1e293b; }
.ds-meas-kpi-label { color:#94a3b8 !important; }
.ds-meas-kpi-val   { color:#1e293b !important; }

/* Collapsible section headers — premium look */
.ms-head:hover { background:#f8fafc; }
.ms-title { color:#1e293b !important; font-size:.9rem !important; }
.ms-sub   { color:#64748b !important; }

/* Quick Access tiles — ensure label readability */
.qa-label { color:#1e293b !important; font-weight:700 !important; }
.qa-sub   { color:#64748b !important; }

/* Welcome banner stat tiles — white text on dark bg */
.wb-tile      { background:rgba(255,255,255,0.14) !important; }
.wb-tile-val  { color:#fff !important; font-weight:900 !important; }
.wb-tile-lbl  { color:rgba(255,255,255,0.7) !important; }

/* DB hero stats bar */
.db-stat-val { color:#fff !important; font-weight:800 !important; }
.db-stat-lbl { color:rgba(255,255,255,0.65) !important; font-weight:600 !important; }

/* Nutritionist / admin grad cards */
.grad-teal   { background:linear-gradient(135deg,#14b8a6,#0d9488) !important; }
.grad-green  { background:linear-gradient(135deg,#22c55e,#16a34a) !important; }
.grad-amber  { background:linear-gradient(135deg,#f59e0b,#d97706) !important; }
.grad-purple { background:linear-gradient(135deg,#8b5cf6,#7c3aed) !important; }
.grad-blue   { background:linear-gradient(135deg,#3b82f6,#2563eb) !important; }
.grad-red    { background:linear-gradient(135deg,#ef4444,#dc2626) !important; }

/* Card white backgrounds — ensure body text is dark */
.card, .db-card { color:#1e293b; }
.card h3, .card h4 { color:#1e293b; }
.card p { color:#475569; }


/* ════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE FIXES — 360-390px
   ════════════════════════════════════════════════════════════════ */

/* Admin greeting — prevent emoji wrap */
.welcome-banner-v2 h1 {
  font-size: 1.25rem !important;
  line-height: 1.3;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
@media(max-width:400px) {
  .welcome-banner-v2 h1 { font-size:1.1rem !important; }
}

/* Quick Actions header — prevent title wrap */
.qa-section-title {
  flex-wrap: nowrap !important;
  align-items: center !important;
}
.qa-section-title small {
  white-space: nowrap;
  font-size: .68rem;
}
@media(max-width:400px) {
  .qa-section-title { font-size:.9rem !important; }
  .qa-section-title small { display:none; } /* hide subtitle on very small screens */
}

/* Progress stat cards — fix label truncation on small screens */
.db-pstat .l {
  font-size: .6rem !important;
  line-height: 1.2;
  white-space: normal !important;
  word-break: break-word;
}
.db-pstat .v {
  font-size: 1.4rem !important;
}
.db-pstat .ic {
  font-size: 1.2rem !important;
  opacity: .25 !important;
}
@media(max-width:380px) {
  .db-pstat { padding: 12px 10px !important; }
  .db-pstat .v { font-size: 1.25rem !important; }
  .db-pstat .l { font-size: .58rem !important; }
}

/* Progress charts section — ensure no overflow */
.db-chart-grid { overflow:hidden; }
.db-chart-wrap canvas { max-width:100%; }

/* Member hero stat bar — ensure 4 items fit on 360px */
.db-stats-bar {
  overflow-x: hidden !important;
}
.db-stat-val { font-size: .95rem !important; }
.db-stat-lbl { font-size: .58rem !important; }

/* Measurement KPI grid on dashboard — 2 col min at 360px */
.ds-meas-kpi-grid {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* Admin stat cards — readable label on small */
.gc-lbl  { font-size: .65rem !important; word-break: break-word; line-height: 1.2; }
.gc-sub  { font-size: .65rem !important; }
.gc-val  { font-size: 1.6rem !important; }

/* Bottom nav — prevent text overflow on narrow screens */
@media(max-width:380px) {
  .mobile-nav-item { font-size: .46rem !important; padding:0 1px !important; }
  .mobile-nav-icon { width:26px !important; height:26px !important; }
}

