/* ============================================================
   DoctorParcha - Gen Z Mobile-First Design System
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --primary: #4361ee;
  --primary-dark: #3a0ca3;
  --primary-light: #7b9cff;
  --secondary: #7209b7;
  --accent: #f72585;
  --teal: #06d6a0;
  --cyan: #4cc9f0;
  --orange: #f8961e;
  --yellow: #fee440;
  --green: #06d6a0;
  --red: #ef233c;

  --bg: #f0f4ff;
  --bg-card: #ffffff;
  --bg-sidebar: #0d0f1e;
  --bg-dark: #111827;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --gradient-warm: linear-gradient(135deg, #f72585 0%, #f8961e 100%);
  --gradient-cool: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
  --gradient-green: linear-gradient(135deg, #06d6a0 0%, #118ab2 100%);

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(67,97,238,.1);
  --shadow-lg: 0 8px 32px rgba(67,97,238,.15);
  --shadow-xl: 0 20px 60px rgba(67,97,238,.2);

  --radius: .75rem;
  --radius-sm: .5rem;
  --radius-lg: 1.25rem;
  --radius-xl: 2rem;
  --radius-full: 9999px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: all .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .4s cubic-bezier(.4,0,.2,1);

  --sidebar-w: 260px;
  --topbar-h: 64px;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0d0f1e;
  --bg-card: #161b2e;
  --bg-sidebar: #060810;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #1e2a3a;
  --border-dark: #2d3a4e;

  /* ── Override Bootstrap 5 CSS variables so its components respect dark mode ── */
  --bs-body-color: #e2e8f0;
  --bs-body-color-rgb: 226,232,240;
  --bs-body-bg: #0d0f1e;
  --bs-card-bg: #161b2e;
  --bs-card-color: #e2e8f0;
  --bs-card-cap-color: #e2e8f0;
  --bs-card-border-color: #1e2a3a;
  --bs-border-color: #1e2a3a;
  --bs-border-color-translucent: rgba(255,255,255,.08);
  --bs-secondary-color: #94a3b8;
  --bs-tertiary-color: #64748b;
  --bs-tertiary-bg: #0d0f1e;
  --bs-secondary-bg: #161b2e;
  --bs-emphasis-color: #f1f5f9;
  --bs-link-color: #7b9cff;
  --bs-link-hover-color: #a5bfff;
  --bs-heading-color: #e2e8f0;
  --bs-table-color: #e2e8f0;
  --bs-table-striped-color: #e2e8f0;
  --bs-table-active-color: #e2e8f0;
  --bs-table-hover-color: #e2e8f0;
  --bs-table-border-color: #1e2a3a;
  --bs-table-striped-bg: rgba(255,255,255,.025);
  --bs-table-active-bg: rgba(255,255,255,.04);
  --bs-table-hover-bg: rgba(255,255,255,.02);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; font-size: 16px; color-scheme: light; }
[data-theme="dark"] html, html[data-theme="dark"] { color-scheme: dark; }

/* ── Select / Option dark-mode fix ─────────────────────────── */
/* Force select elements to always use theme colours (native popup inherits color-scheme) */
select,
.form-select {
  background-color: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
select option,
.form-select option {
  background-color: var(--bg-card);
  color: var(--text);
}
/* Dark-mode overrides (catches browsers that don't inherit color-scheme) */
[data-theme="dark"] select,
[data-theme="dark"] .form-select {
  background-color: #161b2e !important;
  color: #e2e8f0 !important;
  border-color: #1e2a3a !important;
}
[data-theme="dark"] select option,
[data-theme="dark"] .form-select option {
  background-color: #161b2e !important;
  color: #e2e8f0 !important;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

::selection { background: var(--primary); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: var(--radius-full); }

/* ── Typography ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); letter-spacing: -.02em; }
.display-1 { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 800; }
.display-2 { font-size: clamp(2rem, 5vw, 4rem); font-weight: 800; }
.text-gradient { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.text-gradient-warm { background: var(--gradient-warm); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ── Utility Classes ────────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,.4);
}

.glass-dark {
  background: rgba(13,15,30,.7);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,.08);
}

.card-hover {
  transition: var(--transition);
  cursor: pointer;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.bg-gradient { background: var(--gradient) !important; }
.bg-gradient-warm { background: var(--gradient-warm) !important; }
.bg-gradient-cool { background: var(--gradient-cool) !important; }
.bg-gradient-green { background: var(--gradient-green) !important; }

.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-weight: 600;
  border-radius: var(--radius-full);
  padding: .55rem 1.4rem;
  font-size: .875rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: none;
  cursor: pointer;
  /* Creates a local stacking context so z-index values only affect
     children of this button — prevents the ::after hover overlay
     from being composited on top of button text. */
  isolation: isolate;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
  /* Push overlay BEHIND all button content (text, icons, badges).
     Inside the isolation context this means: above the button's own
     background colour / gradient, but below every flex child. */
  z-index: -1;
}
.btn:hover::after { background: rgba(255,255,255,.12); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(67,97,238,.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(67,97,238,.5);
  transform: translateY(-1px);
  color: #fff;
}

.btn-accent {
  background: var(--gradient-warm);
  color: #fff;
  box-shadow: 0 4px 15px rgba(247,37,133,.3);
}
.btn-accent:hover { transform: translateY(-1px); color: #fff; }

.btn-teal {
  background: var(--gradient-green);
  color: #fff;
  box-shadow: 0 4px 15px rgba(6,214,160,.3);
}
.btn-teal:hover { transform: translateY(-1px); color: #fff; }

.btn-outline-primary {
  border: 1.5px solid var(--border);
  color: var(--primary);
  background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-ghost {
  background: rgba(67,97,238,.08);
  color: var(--primary);
}
.btn-ghost:hover { background: rgba(67,97,238,.15); color: var(--primary); }

.btn-xs { padding: .2rem .6rem;  font-size: .75rem; }
.btn-sm { padding: .35rem 1rem; font-size: .8rem; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2.5rem; font-size: 1.1rem; }

.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-lg { width: 48px; height: 48px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .925rem;
  color: var(--text);
  transition: var(--transition);
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.15);
  outline: none;
  background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-light); }

.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
  display: block;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.input-group-text {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

.form-floating .form-control { padding-top: 1.5rem; padding-bottom: .5rem; }
.form-floating label { color: var(--text-muted); font-size: .875rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  /* overflow:hidden removed — it clips Bootstrap dropdowns/popovers inside cards.
     Use .card-img-top or explicit overflow:hidden on children that need clipping. */
}
/* Clip only card images at the top corners, not the whole card */
.card > img:first-child,
.card-img-top { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

.card-body { padding: 1.5rem; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  opacity: .08;
  background: var(--primary);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-change { font-size: .8rem; font-weight: 600; margin-top: .5rem; }
.stat-card .stat-change.up { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }

/* ── Navbar (Public) ────────────────────────────────────────── */
.navbar-main {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(67,97,238,.08);
  padding: .75rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
}

.navbar-main.scrolled {
  box-shadow: 0 4px 30px rgba(0,0,0,.08);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.03em;
}

.navbar-nav .nav-link {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text) !important;
  padding: .5rem .875rem !important;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
  background: rgba(67,97,238,.08);
  color: var(--primary) !important;
}

/* ── Sidebar (Dashboard) ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo .brand {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.03em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 1rem 1.5rem .4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.5rem;
  color: rgba(255,255,255,.6) !important;
  font-weight: 500;
  font-size: .875rem;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  margin: .1rem .75rem;
  border-radius: var(--radius);
}

.sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.9) !important;
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(67,97,238,.3), rgba(114,9,183,.2));
  color: #fff !important;
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar-link .nav-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
  transition: var(--transition);
}

.sidebar-link.active .nav-icon,
.sidebar-link:hover .nav-icon {
  background: rgba(67,97,238,.3);
}

.sidebar-link .badge {
  margin-left: auto;
  font-size: .65rem;
  background: var(--accent);
  border-radius: var(--radius-full);
  padding: .15rem .5rem;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

.topbar-search {
  flex: 1;
  max-width: 380px;
}

.topbar-search .form-control {
  border-radius: var(--radius-full);
  padding-left: 2.5rem;
  background: var(--bg);
  font-size: .875rem;
}

.topbar-search-wrap { position: relative; }
.topbar-search-wrap .fa-search {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: .8rem;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.notification-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
}
.notification-btn:hover { background: rgba(67,97,238,.08); color: var(--primary); }
.notification-btn .badge-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ── Dashboard Layout ───────────────────────────────────────── */
.dashboard-layout { display: flex; min-height: 100vh; }
.dashboard-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
}
.dashboard-content { flex: 1; padding: 1.5rem; }

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  min-height: 92vh;
  background: var(--gradient);
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}
@media (max-width: 991.98px) {
  .hero {
    min-height: unset;
    align-items: flex-start;
    padding-top: 3rem;
    padding-bottom: 3.5rem;
  }
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 160%;
  background: radial-gradient(ellipse, rgba(255,255,255,.12) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 40%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(247,37,133,.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .3;
  animation: float 8s ease-in-out infinite;
}

.hero-blob-1 { width: 400px; height: 400px; background: #f72585; top: 10%; right: 10%; animation-delay: 0s; }
.hero-blob-2 { width: 300px; height: 300px; background: #4cc9f0; bottom: 10%; right: 30%; animation-delay: 3s; }
.hero-blob-3 { width: 250px; height: 250px; background: #fee440; top: 50%; left: 5%; animation-delay: 1.5s; }

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(20px,-30px) scale(1.05); }
  66% { transform: translate(-15px,20px) scale(.95); }
}

.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  padding: .4rem 1rem;
  border-radius: var(--radius-full);
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: .03em;
}

.hero-badge .pulse-dot {
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}

.hero h1 { color: #fff; margin-bottom: 1.5rem; }
.hero p { color: rgba(255,255,255,.85); font-size: 1.15rem; margin-bottom: 2rem; }

/* ── Hero search bar — unified pill, always white regardless of theme ── */
.hero-search-box {
  background: #ffffff;
  border-radius: 999px;
  padding: .45rem;
  display: flex;
  align-items: center;
  gap: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.22), 0 0 0 1px rgba(255,255,255,.25);
  overflow: hidden;
}

/* Inner wrappers */
.search-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.search-icon-wrap {
  padding: 0 .25rem 0 .85rem;
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-size: .95rem;
}
.search-action-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ── Mobile: stack into 2 rows ── */
@media (max-width: 575.98px) {
  .hero-search-box {
    border-radius: 1.25rem;
    flex-wrap: wrap;
    padding: .3rem;
  }
  .search-input-wrap {
    flex: 1 1 100%;
    border-bottom: 1.5px solid #e2e8f0;
    padding-bottom: .15rem;
  }
  .search-action-wrap {
    flex: 1 1 100%;
    padding: .2rem .2rem .2rem .4rem;
  }
  .search-action-wrap .form-select {
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
    font-size: .85rem;
    padding-left: .5rem;
  }
  .search-action-wrap .btn-search-pill {
    margin: .15rem;
    padding: .5rem 1.1rem;
    flex-shrink: 0;
  }
}

/* Input */
.hero-search-box .form-control {
  border: none !important;
  background: transparent !important;
  color: #1a1a2e !important;
  font-size: .95rem;
  font-weight: 500;
  padding: .65rem 1rem .65rem 2.6rem;
  flex: 1;
  min-width: 0;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  width: 100%;
}
.hero-search-box .form-control::placeholder {
  color: #94a3b8 !important;
  font-weight: 400;
}
.hero-search-box .form-control:focus {
  background: transparent !important;
  box-shadow: none !important;
  color: #1a1a2e !important;
}

/* Divider between input and select */
.hero-search-divider {
  width: 1px;
  height: 28px;
  background: #e2e8f0;
  flex-shrink: 0;
}

/* City select */
.hero-search-box .form-select {
  border: none !important;
  background: transparent !important;
  color: #1a1a2e !important;
  font-size: .88rem;
  font-weight: 600;
  padding: .65rem .9rem .65rem .75rem;
  flex-shrink: 0;
  width: auto;
  min-width: 110px;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: auto;
  cursor: pointer;
}
.hero-search-box .form-select:focus {
  background: transparent !important;
  box-shadow: none !important;
  color: #1a1a2e !important;
}

/* Search button — pill on right */
.btn-search-pill,
.hero-search-box .btn-search-pill {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .58rem 1.35rem;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s;
  margin: .18rem .18rem .18rem 0;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
}
.btn-search-pill:hover,
.hero-search-box .btn-search-pill:hover { background: var(--primary-dark); color: #fff; }

/* Dark-mode: keep white always */
[data-theme="dark"] .hero-search-box {
  background: #ffffff;
  box-shadow: 0 8px 40px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.15);
}
[data-theme="dark"] .hero-search-box .form-control,
[data-theme="dark"] .hero-search-box .form-select {
  background: transparent !important;
  color: #1a1a2e !important;
}
[data-theme="dark"] .hero-search-box .form-control::placeholder { color: #94a3b8 !important; }
[data-theme="dark"] .hero-search-box .form-select option { background: #fff; color: #1a1a2e; }

.hero-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 2.5rem; }
.hero-stat { color: rgba(255,255,255,.9); }
.hero-stat .value { font-size: 1.75rem; font-weight: 800; color: #fff; line-height: 1; }
.hero-stat .label { font-size: .8rem; opacity: .8; margin-top: .25rem; }

/* ── Specialty Cards ────────────────────────────────────────── */
.spec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}

.spec-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(67,97,238,.15);
}

.spec-card .spec-icon {
  width: 60px; height: 60px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(67,97,238,.1), rgba(114,9,183,.1));
  color: var(--primary);
  transition: var(--transition);
}

.spec-card:hover .spec-icon {
  background: var(--gradient);
  color: #fff;
  transform: scale(1.1) rotate(5deg);
}

.spec-card .spec-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.spec-card .spec-count { font-size: .75rem; color: var(--text-muted); }

/* ── Doctor Cards ───────────────────────────────────────────── */
.doctor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

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

.doctor-card-top {
  background: var(--gradient);
  height: 80px;
  position: relative;
}

.doctor-card-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 3px solid #fff;
  object-fit: cover;
  position: absolute;
  bottom: -40px;
  left: 1.5rem;
  box-shadow: var(--shadow);
}

.doctor-card-body { padding: 3rem 1.5rem 1.5rem; }

.doctor-name { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.doctor-spec { font-size: .8rem; color: var(--primary); font-weight: 600; margin-bottom: .5rem; }
.doctor-exp { font-size: .78rem; color: var(--text-muted); }

.doctor-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0; }
.doctor-tag {
  font-size: .7rem;
  background: rgba(67,97,238,.08);
  color: var(--primary);
  padding: .2rem .6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.doctor-fee { font-size: .875rem; color: var(--text-muted); }
.doctor-fee span { font-weight: 700; color: var(--text); font-size: 1rem; }

/* ── Appointment Card ───────────────────────────────────────── */
.appt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

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

.appt-avatar {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

.appt-info { flex: 1; min-width: 0; }
.appt-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-meta { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; margin-top: .2rem; }

/* ── Status Badges ──────────────────────────────────────────── */
.badge-status {
  font-size: .7rem;
  font-weight: 700;
  padding: .3rem .75rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge-pending { background: rgba(248,150,30,.12); color: #d67706; }
.badge-confirmed { background: rgba(67,97,238,.1); color: var(--primary); }
.badge-completed { background: rgba(6,214,160,.12); color: #059669; }
.badge-cancelled { background: rgba(239,35,60,.1); color: var(--red); }
.badge-in_progress { background: rgba(76,201,240,.12); color: #0891b2; }
.badge-checked_in { background: rgba(114,9,183,.1); color: var(--secondary); }

/* ── Queue Display ──────────────────────────────────────────── */
.token-display {
  background: var(--gradient);
  border-radius: var(--radius-xl);
  padding: 2rem;
  color: #fff;
  text-align: center;
}

.token-number { font-size: 5rem; font-weight: 900; line-height: 1; }
.token-label { font-size: .875rem; opacity: .85; margin-top: .5rem; letter-spacing: .1em; text-transform: uppercase; }

.queue-list { display: flex; flex-direction: column; gap: .5rem; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.queue-item.active {
  background: rgba(67,97,238,.05);
  border-color: var(--primary);
}
.queue-num {
  width: 36px; height: 36px;
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem;
  flex-shrink: 0;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-dp { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-dp thead th {
  background: var(--bg);
  padding: .875rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.table-dp tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text);
  vertical-align: middle;
}
.table-dp tbody tr:hover { background: rgba(67,97,238,.02); }
.table-dp tbody tr:last-child td { border-bottom: none; }

/* ── Prescription Pad ───────────────────────────────────────── */
.rx-pad {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rx-header {
  background: var(--gradient);
  padding: 1.5rem;
  color: #fff;
}

.rx-header .clinic-name { font-size: 1.25rem; font-weight: 800; }
.rx-header .doctor-name { font-size: .95rem; opacity: .9; margin-top: .25rem; }
.rx-header .doctor-details { font-size: .8rem; opacity: .8; margin-top: .1rem; }

.rx-symbol {
  font-size: 3rem;
  font-weight: 900;
  color: rgba(255,255,255,.2);
  position: absolute;
  right: 1.5rem;
  top: 1rem;
  font-style: italic;
}

.rx-body { padding: 1.5rem; }
.rx-medicine-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: .75rem;
  align-items: start;
  padding: .75rem 0;
  border-bottom: 1px dashed var(--border);
}

/* ── Dental Chart ───────────────────────────────────────────── */
.tooth-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.tooth-btn {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: .7rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text);
}
.tooth-btn:hover { border-color: var(--primary); background: rgba(67,97,238,.05); }
.tooth-btn.healthy { border-color: var(--green); background: rgba(6,214,160,.08); color: #059669; }
.tooth-btn.caries { border-color: var(--orange); background: rgba(248,150,30,.1); color: #d67706; }
.tooth-btn.extracted { border-color: var(--red); background: rgba(239,35,60,.08); color: var(--red); }
.tooth-btn.crowned { border-color: var(--primary); background: rgba(67,97,238,.08); color: var(--primary); }
.tooth-btn.filled { border-color: var(--secondary); background: rgba(114,9,183,.08); color: var(--secondary); }

/* ── Charts / Analytics ─────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.chart-card .chart-title { font-weight: 700; font-size: 1rem; margin-bottom: 1.5rem; }
.chart-card .chart-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; font-weight: 400; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  border: none;
  padding: .875rem 1.25rem;
  font-size: .875rem;
  font-weight: 500;
}
.alert-success { background: rgba(6,214,160,.1); color: #059669; }
.alert-danger { background: rgba(239,35,60,.1); color: var(--red); }
.alert-warning { background: rgba(248,150,30,.1); color: #d67706; }
.alert-info { background: rgba(67,97,238,.1); color: var(--primary); }

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius);
  object-fit: cover;
  display: inline-block;
  flex-shrink: 0;
}
.avatar-circle { border-radius: 50%; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 60px; height: 60px; }
.avatar-xl { width: 80px; height: 80px; }
.avatar-xxl { width: 120px; height: 120px; }

/* ── Progress / Timeline ────────────────────────────────────── */
.progress-dp {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-dp-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient);
  transition: width .6s ease;
}

.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .5rem;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: .25rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}
.timeline-item.success::before { background: var(--green); }
.timeline-item.warning::before { background: var(--orange); }
.timeline-item.danger::before { background: var(--red); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius-xl);
  border: none;
  box-shadow: var(--shadow-xl);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

/* ── Tabs ───────────────────────────────────────────────────── */
.nav-pills-dp { display: flex; gap: .35rem; background: var(--bg); border-radius: var(--radius-full); padding: .3rem; }
.nav-pills-dp .nav-link {
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .85rem;
  padding: .45rem 1.1rem;
  transition: var(--transition);
}
.nav-pills-dp .nav-link.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(67,97,238,.3);
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-title { font-size: 1.35rem; font-weight: 800; margin: 0; }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb-dp {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.breadcrumb-dp a { color: var(--text-muted); }
.breadcrumb-dp a:hover { color: var(--primary); }
.breadcrumb-dp .sep { opacity: .4; }

/* ── Skeleton Loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, rgba(67,97,238,.05) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ── Floating Action Button ─────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 8px 24px rgba(67,97,238,.4);
  cursor: pointer;
  z-index: 800;
  transition: var(--transition);
  border: none;
}
.fab:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 12px 30px rgba(67,97,238,.5); }

/* ── Mobile Bottom Nav ──────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 1000;
  backdrop-filter: blur(20px);
}

.mobile-bottom-nav .nav-items { display: flex; height: 100%; }
.mobile-bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .2rem; font-size: .6rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: var(--transition); text-decoration: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-bottom-nav .nav-item i { font-size: 1.25rem; }
.mobile-bottom-nav .nav-item.active { color: var(--primary); }
.mobile-bottom-nav .nav-item .nav-bubble {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: -.5rem;
  box-shadow: 0 4px 15px rgba(67,97,238,.4);
}

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

.animate-fadeInUp { animation: fadeInUp .5s ease forwards; }
.animate-fadeIn { animation: fadeIn .4s ease forwards; }
.animate-scaleIn { animation: scaleIn .3s ease forwards; }

/* Stagger children */
.stagger-children > * { opacity: 0; animation: fadeInUp .5s ease forwards; }
.stagger-children > *:nth-child(1) { animation-delay: .05s; }
.stagger-children > *:nth-child(2) { animation-delay: .1s; }
.stagger-children > *:nth-child(3) { animation-delay: .15s; }
.stagger-children > *:nth-child(4) { animation-delay: .2s; }
.stagger-children > *:nth-child(5) { animation-delay: .25s; }
.stagger-children > *:nth-child(6) { animation-delay: .3s; }
.stagger-children > *:nth-child(7) { animation-delay: .35s; }
.stagger-children > *:nth-child(8) { animation-delay: .4s; }

/* ── Sidebar mini mode (desktop) ────────────────────────────── */
/* Applied via body.sidebar-mini — toggled by hamburger on desktop.
   Collapses sidebar to 64px icon-only rail. */
body.sidebar-mini .sidebar {
  width: 64px;
}
body.sidebar-mini .sidebar-logo {
  padding: 1.25rem .5rem;
}
body.sidebar-mini .sidebar-logo > a {
  justify-content: center;
  gap: 0;
}
/* Mini icon: hidden in full mode, shown only when sidebar is collapsed */
.sidebar-logo .sidebar-mini-icon { display: none; }
body.sidebar-mini .sidebar-logo .sidebar-mini-icon { display: flex !important; }

/* Hide full logo area when sidebar is collapsed */
body.sidebar-mini .sidebar-logo a > span.brand,
body.sidebar-mini .sidebar-logo .sidebar-full-logo { display: none; }
body.sidebar-mini .sidebar-user-info {
  display: none;
}
body.sidebar-mini .sidebar-section-label {
  display: none;
}
body.sidebar-mini .sidebar-link {
  justify-content: center;
  padding: .65rem .5rem;
  margin: .1rem .4rem;
  gap: 0;
}
body.sidebar-mini .sidebar-link .nav-label,
body.sidebar-mini .sidebar-link .badge {
  display: none;
}
body.sidebar-mini .sidebar-footer .sidebar-link {
  justify-content: center;
  padding: .65rem .5rem;
  margin: 0 .4rem;
  gap: 0;
}
body.sidebar-mini .sidebar-footer .sidebar-link .nav-label {
  display: none;
}
/* Hide left-edge active indicator bar in mini mode (use background color instead) */
body.sidebar-mini .sidebar-link.active::before {
  display: none;
}
body.sidebar-mini .dashboard-main {
  margin-left: 64px;
}

/* Mobile overlay — show when sidebar is open */
.sidebar-overlay.active {
  display: block !important;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  /* On mobile: always show full sidebar (no mini mode) */
  body.sidebar-mini .sidebar            { width: var(--sidebar-w); }
  body.sidebar-mini .sidebar-logo       { padding: 1.5rem; }
  body.sidebar-mini .sidebar-logo > a   { justify-content: flex-start; gap: .5rem; }
  body.sidebar-mini .sidebar-user-info  { display: block; }
  body.sidebar-mini .sidebar-section-label { display: block; }
  body.sidebar-mini .sidebar-link {
    justify-content: flex-start;
    padding: .7rem 1.5rem;
    margin: .1rem .75rem;
    gap: .75rem;
  }
  body.sidebar-mini .sidebar-link .nav-label { display: revert; }
  body.sidebar-mini .sidebar-link .badge { display: revert; }
  body.sidebar-mini .sidebar-footer .sidebar-link {
    justify-content: flex-start;
    padding: .7rem 1.5rem;
    margin: 0;
    gap: .75rem;
  }
  body.sidebar-mini .sidebar-footer .sidebar-link .nav-label { display: revert; }
  body.sidebar-mini .dashboard-main { margin-left: 0; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,.5);
  }
  .dashboard-main { margin-left: 0; }
  .mobile-bottom-nav { display: block; }
  .dashboard-content { padding-bottom: 5rem; }
}

@media (max-width: 767.98px) {
  .hero { min-height: auto; /*padding: 5rem 0 4rem;*/ }
  .hero h1 { font-size: 2.2rem; }
  .hero-stats { gap: 1.25rem; }
  .hero-stat .value { font-size: 1.4rem; }
  .dashboard-content { padding: 1rem; padding-bottom: 5rem; }
  .topbar { padding: 0 1rem; }
  .topbar-search { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .rx-medicine-row { grid-template-columns: 1fr; }
  .tooth-grid { grid-template-columns: repeat(8, 1fr); gap: 2px; }
}

@media (max-width: 575.98px) {
  .card-body { padding: 1rem; }
  .stat-card { padding: 1rem; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .doctor-card-body { padding: 2.5rem 1rem 1rem; }
}

/* ── Dark Mode component overrides ──────────────────────────── */

/* Navbar */
[data-theme="dark"] .navbar-main {
  background: rgba(13,15,30,.92);
  border-color: rgba(255,255,255,.06);
}

/* Glass */
[data-theme="dark"] .glass {
  background: rgba(22,27,46,.7);
  border-color: rgba(255,255,255,.06);
}

/* Cards — explicit color so Bootstrap's --bs-body-color doesn't win */
[data-theme="dark"] .card,
[data-theme="dark"] .card-body { color: var(--text); }
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: rgba(255,255,255,.05);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background: rgba(255,255,255,.07);
  color: var(--text);
}
[data-theme="dark"] .form-control[readonly],
[data-theme="dark"] .form-control:disabled {
  background: rgba(255,255,255,.03);
  color: var(--text-muted);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-light); }
[data-theme="dark"] .form-label { color: var(--text-muted); }
[data-theme="dark"] .form-text { color: var(--text-muted); }
[data-theme="dark"] .form-check-label { color: var(--text); }

/* Input group */
[data-theme="dark"] .input-group-text {
  background: rgba(255,255,255,.06);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Modals */
[data-theme="dark"] .modal-content {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .modal-body { color: var(--text); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background: rgba(67,97,238,.1);
  color: var(--text);
}
[data-theme="dark"] .dropdown-divider { border-color: var(--border); }
[data-theme="dark"] .dropdown-header { color: var(--text-muted); }

/* Tables — Bootstrap + custom */
[data-theme="dark"] .table {
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background: rgba(255,255,255,.025);
  color: var(--text);
}
[data-theme="dark"] .table-dp thead th {
  background: rgba(255,255,255,.03);
  color: var(--text-muted);
  border-color: var(--border);
}
[data-theme="dark"] .table-dp tbody td { color: var(--text); border-color: var(--border); }
[data-theme="dark"] .table-dp tbody tr:hover { background: rgba(255,255,255,.025); }

/* List groups */
[data-theme="dark"] .list-group-item {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .list-group-item-action:hover,
[data-theme="dark"] .list-group-item-action:focus {
  background: rgba(67,97,238,.08);
  color: var(--text);
}
[data-theme="dark"] .list-group-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Nav tabs */
[data-theme="dark"] .nav-tabs { border-color: var(--border); }
[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--text-muted);
  border-color: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  background: var(--bg-card);
  border-color: var(--border) var(--border) var(--bg-card);
  color: var(--text);
}

/* Nav pills */
[data-theme="dark"] .nav-pills .nav-link { color: var(--text-muted); }
[data-theme="dark"] .nav-pills .nav-link.active {
  background: var(--primary);
  color: #fff;
}

/* Accordion */
[data-theme="dark"] .accordion-item {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .accordion-button {
  background: var(--bg-card);
  color: var(--text);
}
[data-theme="dark"] .accordion-button:not(.collapsed) {
  background: rgba(67,97,238,.08);
  color: var(--primary);
}
[data-theme="dark"] .accordion-button::after {
  filter: invert(1) grayscale(100%) brightness(200%);
}
[data-theme="dark"] .accordion-body { color: var(--text); }

/* Alerts */
[data-theme="dark"] .alert { border: 1px solid; }
[data-theme="dark"] .alert-success { background: rgba(6,214,160,.1); color: #4ade80; border-color: rgba(6,214,160,.2); }
[data-theme="dark"] .alert-danger  { background: rgba(239,35,60,.1);  color: #f87171; border-color: rgba(239,35,60,.2); }
[data-theme="dark"] .alert-warning { background: rgba(248,150,30,.1); color: #fbbf24; border-color: rgba(248,150,30,.2); }
[data-theme="dark"] .alert-info    { background: rgba(67,97,238,.1);  color: #7b9cff; border-color: rgba(67,97,238,.2); }

/* Popover / Tooltip */
[data-theme="dark"] .popover {
  background: var(--bg-card);
  border-color: var(--border);
}
[data-theme="dark"] .popover-header {
  background: rgba(255,255,255,.04);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .popover-body { color: var(--text); }
[data-theme="dark"] .tooltip-inner {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Progress */
[data-theme="dark"] .progress {
  background: rgba(255,255,255,.08);
}

/* Pagination */
[data-theme="dark"] .page-link {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .page-link:hover {
  background: rgba(67,97,238,.1);
  color: var(--primary);
}
[data-theme="dark"] .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}
[data-theme="dark"] .page-item.disabled .page-link {
  background: var(--bg-card);
  color: var(--text-light);
}

/* Badges — text badges that inherit context color */
[data-theme="dark"] .badge.bg-light { color: #1a1a2e !important; }
[data-theme="dark"] .badge.bg-secondary { background: rgba(255,255,255,.15) !important; }

/* Buttons — ensure btn-ghost text is legible on dark backgrounds */
[data-theme="dark"] .btn-ghost {
  background: rgba(255,255,255,.06);
  color: var(--primary-light);          /* #7b9cff — brighter blue for dark bg */
}
[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255,255,255,.11);
  color: var(--primary-light);
}
/* btn-primary / btn-accent / btn-teal already use hard-coded #fff — fine.
   btn-outline-primary on dark: keep border visible */
[data-theme="dark"] .btn-outline-primary {
  border-color: rgba(67,97,238,.4);
  color: var(--primary-light);
}
[data-theme="dark"] .btn-outline-primary:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── bg-opacity-15 ──────────────────────────────────────────────────────────
   Bootstrap ships bg-opacity-10/25/50/75/100 but NOT 15.
   Define it here so all badge/chip patterns using bg-opacity-15 work correctly
   (without it, --bs-bg-opacity is never set → background becomes fully opaque
   → colored text on same-colored background = invisible).                    */
.bg-opacity-15 { --bs-bg-opacity: 0.15; }

/* Headings — ensure all heading tags are visible */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .h1,
[data-theme="dark"] .h2,
[data-theme="dark"] .h3,
[data-theme="dark"] .h4,
[data-theme="dark"] .h5,
[data-theme="dark"] .h6 { color: var(--text); }

/* Topbar / Mobile nav */
[data-theme="dark"] .topbar { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .mobile-bottom-nav { background: var(--bg-card); border-color: var(--border); }

/* Misc utility overrides */
[data-theme="dark"] .text-dark { color: var(--text) !important; }
[data-theme="dark"] .bg-light  { background: rgba(255,255,255,.04) !important; }
[data-theme="dark"] .bg-white  { background: var(--bg-card) !important; }
[data-theme="dark"] .border    { border-color: var(--border) !important; }
[data-theme="dark"] .border-top    { border-color: var(--border) !important; }
[data-theme="dark"] .border-bottom { border-color: var(--border) !important; }
[data-theme="dark"] hr { border-color: var(--border); opacity: 1; }

/* ── PWA / Mobile Specific ──────────────────────────────────── */
@media (display-mode: standalone) {
  .navbar-main { padding-top: env(safe-area-inset-top, 0); }
  .mobile-bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0); height: calc(64px + env(safe-area-inset-bottom, 0)); }
}
