/* =========================================================
   Multi-Tenant RAG Chatbot — Design System v2
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Space+Mono:wght@400;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --sidebar-w: 230px;
  --sidebar-w-collapsed: 66px;

  /* LIGHT MODE (Slate / Blue) derived from new palette */
  --bg-primary: #F8FAFC;
  --bg-secondary: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-input: #FFFFFF;

  --border-subtle: rgba(15, 23, 42, .08);
  --border-hover: rgba(15, 23, 42, .16);

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;

  /* Admin accent - Blue */
  --accent: #2563EB;
  /* Blue 600 */
  --accent-light: #3B82F6;
  /* Blue 500 (requested) */
  --accent-glow: rgba(59, 130, 246, .20);
  --accent-bg: rgba(59, 130, 246, .10);

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, .10);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, .10);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, .10);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, .10);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  --shadow-xs: 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .12);

  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;

  --ease-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --ease-smooth: 280ms cubic-bezier(.4, 0, .2, 1);
  --ease-bounce: 420ms cubic-bezier(.34, 1.56, .64, 1);
  --ease-sidebar: 260ms cubic-bezier(.4, 0, .2, 1);
}

/* ── Dark Theme Overrides ───────────────────────────────── */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  --bg-input: #0F172A;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);

  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --accent: #3B82F6;
  --accent-light: #60A5FA;
  --accent-glow: rgba(59, 130, 246, 0.30);
  --accent-bg: rgba(59, 130, 246, 0.15);

  --shadow-xs: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ── Superadmin theme ───────────────────────────────────── */
.superadmin-theme {
  --accent: #DC2626;
  --accent-light: #EF4444;
  --accent-glow: rgba(220, 38, 38, .20);
  --accent-bg: rgba(220, 38, 38, .08);

  --success: #15803D;
  --success-bg: rgba(21, 128, 61, .10);
  --warning: #B45309;
  --warning-bg: rgba(180, 83, 9, .10);
  --danger: #DC2626;
  --danger-bg: rgba(220, 38, 38, .10);
  --info: #1D4ED8;
  --info-bg: rgba(29, 78, 216, .10);
}



/* ── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(59, 130, 246, 0.04) 0px, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(16, 185, 129, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 300ms ease, color 300ms ease;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--ease-fast);
}

a:hover {
  color: var(--accent);
}

/* =========================================================
   LAYOUT
   ========================================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--ease-sidebar);
}

.app-wrapper.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-w-collapsed);
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Admin Sidebar — Premium deep-navy gradient (mirrors superadmin design language) */
  background: #3985ff;
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .20);
  transition: all var(--ease-sidebar);
}

[data-theme="dark"] .sidebar {
  /* Dark Mode - Deep navy gradient */
  background: linear-gradient(180deg, #0F172A 0%, #0B1121 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .25);
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

/* Superadmin sidebar bg */
.superadmin-theme .sidebar {
  background: linear-gradient(180deg, #150a0a 0%, #0d0606 55%, #060303 100%);
}

/* Fixed-width inner so text doesn't wrap when collapsing */
.sidebar-inner {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 20px 16px 18px;
  background: transparent;
  /* inherits dark sidebar */
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

/* White rounded-square icon tile (matches the reference image) */
.logo-icon-wrap {
  width: 44px;
  height: 44px;
  background: #FFFFFF;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  padding: 7px;
  transition: transform var(--ease-bounce);
}

.sidebar-logo:hover .logo-icon-wrap {
  transform: rotate(8deg) scale(1.08);
}

.logo-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-text {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* "Kashsphere" bold white + "AI" in green accent */
.logo-text h1 {
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  white-space: nowrap;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.logo-ai-badge {
  font-size: 10px;
  font-weight: 700;
  color: #10B981;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Role pill — green tinted, works on dark background */
.logo-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid rgba(16, 185, 129, 0.25);
  width: fit-content;
}

.logo-role-pill i {
  font-size: 9px;
  opacity: 0.9;
}

/* Frosted-glass collapse toggle */
.sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-left: auto;
  transition: all var(--ease-fast);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, .35);
}

.sidebar-toggle i {
  transition: transform var(--ease-sidebar);
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar.collapsed .sidebar-logo {
  gap: 0;
}


/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .4);
  padding: 14px 10px 5px;
  white-space: nowrap;
  transition: opacity var(--ease-smooth);
}

[data-theme="dark"] .nav-section-title {
  color: rgba(255, 255, 255, .28);
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: rgba(255, 255, 255, .8);
  /* Light text for blue sidebar */
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--ease-fast);
  border: 1px solid transparent;
}

[data-theme="dark"] .nav-item {
  color: rgba(255, 255, 255, .52);
}

.nav-item:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .88);
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .1);
}

.superadmin-theme .nav-item.active {
  color: #FCA5A5;
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: #fff;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(255, 255, 255, .6);
}

.superadmin-theme .nav-item.active::before {
  background: #EF4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, .6);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: #fff;
  /* White icons for blue sidebar */
  transition: transform var(--ease-bounce);
}

[data-theme="dark"] .nav-icon {
  color: rgba(255, 255, 255, 0.75);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-label {
  flex: 1;
  transition: opacity var(--ease-smooth);
}

.nav-badge {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .2);
  color: #60A5FA;
  flex-shrink: 0;
  transition: opacity var(--ease-smooth);
}

.superadmin-theme .nav-badge {
  background: rgba(239, 68, 68, .2);
  color: #FCA5A5;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge {
  opacity: 0;
  pointer-events: none;
}

/* Tooltip on collapsed */
.nav-item::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a2535;
  color: rgba(255, 255, 255, .9);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 400;
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ── Footer ── */
.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, .15);
  /* White divider for blue sidebar */
  flex-shrink: 0;
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, .07);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: all 300ms cubic-bezier(.34, 1.56, .64, 1);
}

.user-badge:hover {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .14);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;

  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  box-shadow: 0 0 14px rgba(59, 130, 246, .45);
}

.superadmin-theme .user-avatar {
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  box-shadow: 0 0 12px rgba(239, 68, 68, .3);
}

.user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity var(--ease-smooth);
}

.user-info .name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .role {
  font-size: 9.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .38);
}

.user-info .signout {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, 0.527);
}

.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
}

.user-signout {
  color: rgba(255, 255, 255, .35);
  font-size: 14px;
  flex-shrink: 0;
  transition: color var(--ease-fast);
}

.user-badge:hover .user-signout {
  color: rgba(255, 255, 255, .7);
}

/* Sidebar footer actions */
.sidebar-footer-actions {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  transition: opacity var(--ease-smooth);
}

.sidebar.collapsed .sidebar-footer-actions {
  opacity: 0;
  pointer-events: none;
}

.footer-btn {
  flex: 1;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .03);
  color: rgba(255, 255, 255, .4);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--ease-fast);
}

.footer-btn:hover {
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .8);
}

.footer-btn.danger:hover {
  background: rgba(220, 38, 38, .15);
  color: #FCA5A5;
  border-color: rgba(220, 38, 38, .25);
}

/* Mobile backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  z-index: 199;
}

.sidebar-backdrop.active {
  display: block;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(248, 250, 252, 0.65);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  transition: all var(--ease-smooth);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-title h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Search */
.topbar-search {
  position: relative;
  max-width: 260px;
  width: 100%;
}

.topbar-search input {
  width: 100%;
  padding: 8px 14px 8px 34px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--ease-fast);
}

.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* Icon buttons */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all var(--ease-fast);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--bg-primary);
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--ease-fast);
}

.mobile-menu-btn:hover {
  background: var(--bg-card-hover);
}

/* =========================================================
   PAGE BODY
   ========================================================= */
.page-body {
  padding: 26px 32px 48px;
  flex: 1;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb .sep {
  opacity: .4;
}

.breadcrumb .cur {
  color: var(--text-primary);
  font-weight: 600;
}

/* =========================================================
   STAT CARDS
   ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all 350ms cubic-bezier(.34, 1.56, .64, 1);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  /* Sophisticated lift */
  border-color: rgba(59, 130, 246, 0.35);
  /* Subtle blue edge */
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-card.accent .stat-icon {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.stat-card.success .stat-icon {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card.warning .stat-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card.info .stat-icon {
  background: var(--info-bg);
  color: var(--info);
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.stat-trend.up {
  background: var(--success-bg);
  color: var(--success);
}

.stat-trend.down {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-trend.neutral {
  background: var(--info-bg);
  color: var(--info);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 3px;
  font-family: var(--font-mono);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-bar {
  width: 100%;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 999px;
  margin-top: 14px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 900ms cubic-bezier(.4, 0, .2, 1);
}

.stat-card.accent .stat-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.stat-card.success .stat-bar-fill {
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.stat-card.warning .stat-bar-fill {
  background: linear-gradient(90deg, var(--warning), #f59e0b);
}

.stat-card.info .stat-bar-fill {
  background: linear-gradient(90deg, var(--info), #60a5fa);
}

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: all var(--ease-smooth);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
}

.card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Two col layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  margin-bottom: 18px;
}

/* =========================================================
   TABLE
   ========================================================= */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.table-search {
  position: relative;
  flex: 1;
  max-width: 260px;
}

.table-search input {
  width: 100%;
  padding: 8px 14px 8px 34px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--ease-fast);
}

.table-search input:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.table-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Custom Scrollbar for premium feel */
.table-container::-webkit-scrollbar {
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-light);
}

[data-theme="dark"] .table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  /* Blue accent text for Light Mode headers */
  background: var(--bg-secondary);
  /* Distinct slate/blueish background */
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text-primary);
}

.data-table td {
  padding: 13px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: background var(--ease-fast);
}

.data-table tr:hover td {
  background: var(--accent-bg);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.row-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6 0%, #1E3A8A 100%);
  box-shadow: 0 0 10px rgba(59, 130, 246, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.superadmin-theme .row-avatar {
  background: linear-gradient(135deg, #3b0e0e 0%, #1a0505 100%);
}

.row-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-name-cell strong {
  font-size: 13.5px;
  font-weight: 600;
}

.row-name-cell .sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  margin-top: 2px;
  border-top: 1px solid var(--border-subtle);
}

.table-foot-info {
  font-size: 11.5px;
  color: var(--text-muted);
}

.table-pager {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pager-info {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 5px 10px;
}

/* =========================================================
   QUICK ACTIONS
   ========================================================= */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.qa-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--ease-fast);
  text-align: left;
  text-decoration: none;
}

.qa-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateX(3px);
  color: var(--text-primary);
}

.qa-btn.primary:hover {
  background: var(--accent-bg);
  border-color: rgba(var(--accent-rgb, 15, 118, 110), .25);
  color: var(--accent);
}

.qa-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.qa-btn.primary .qa-icon {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.qa-btn:not(.primary) .qa-icon {
  background: var(--bg-primary);
  color: var(--text-muted);
}

.qa-text {
  flex: 1;
}

.qa-text .qa-label {
  font-size: 13px;
  font-weight: 600;
}

.qa-text .qa-desc {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* =========================================================
   ACTIVITY FEED
   ========================================================= */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-icon.create {
  background: var(--success-bg);
  color: var(--success);
}

.activity-icon.delete {
  background: var(--danger-bg);
  color: var(--danger);
}

.activity-icon.update {
  background: var(--info-bg);
  color: var(--info);
}

.activity-icon.login {
  background: var(--warning-bg);
  color: var(--warning);
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-body p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.activity-body .activity-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
}

/* =========================================================
   HEALTH STRIP
   ========================================================= */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.health-item-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.health-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.warn {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.health-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  cursor: pointer;
  transition: all var(--ease-fast);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
  position: relative;
  overflow: hidden;
  transition: all var(--ease-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
  color: #fff;
  filter: brightness(1.15);
}

.btn-primary:active {
  transform: scale(.97);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(185, 28, 28, .15);
}

.btn-danger:hover {
  background: rgba(185, 28, 28, .18);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  justify-content: center;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: .03em;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-accent {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.badge-neutral {
  background: var(--border-subtle);
  color: var(--text-muted);
}

/* =========================================================
   FORMS
   ========================================================= */
.form-group {
  margin-bottom: 17px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font-body);
  transition: all var(--ease-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--ease-smooth);
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 510px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
  animation: modalIn 260ms cubic-bezier(.34, 1.2, .64, 1) forwards;
}

@keyframes modalIn {
  from {
    transform: translateY(20px) scale(.97);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--ease-fast);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, .2);
}

.modal-footer {
  display: flex;
  gap: 9px;
  margin-top: 6px;
}

.modal-footer .btn {
  flex: 1;
  justify-content: center;
}

/* =========================================================
   PASSWORD REVEAL
   ========================================================= */
.password-reveal {
  background: rgba(180, 83, 9, .05);
  border: 1px solid rgba(180, 83, 9, .2);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  margin: 10px 0;
}

.pw-label {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--warning);
  margin-bottom: 5px;
}

.pw-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  word-break: break-all;
  user-select: all;
}

/* =========================================================
   UPLOAD ZONE
   ========================================================= */
.upload-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-md);
  padding: 44px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease-smooth);
  position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent-light);
  background: var(--accent-bg);
}

.upload-zone-icon {
  font-size: 44px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 14px;
  transition: all var(--ease-smooth);
}

.upload-zone:hover .upload-zone-icon {
  color: var(--accent-light);
  transform: translateY(-4px);
}

.upload-zone h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
}

.upload-zone p {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* =========================================================
   EMBED CODE
   ========================================================= */
.embed-code-block {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #7DD3FC;
  word-break: break-all;
  position: relative;
}

/* =========================================================
   TOAST
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 17px;
  min-width: 290px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 280ms cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  font-size: 17px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.info .toast-icon {
  color: var(--info);
}

.toast-msg {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

@keyframes toastIn {
  from {
    transform: translateX(100%) scale(.95);
    opacity: 0;
  }

  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F2027 0%, #1a3a4a 50%, #0a1520 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(20, 184, 166, .12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(220, 38, 38, .08) 0%, transparent 60%);
  pointer-events: none;
}

.login-box {
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .35);
}

.login-logo {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #14B8A6, #0F766E);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 22px;
  box-shadow: 0 0 28px rgba(20, 184, 166, .3);
}

.login-box h2 {
  text-align: center;
  font-size: 23px;
  font-weight: 700;
  margin-bottom: 5px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 28px;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
  text-align: center;
  padding: 52px 28px;
}

.empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
  color: var(--text-muted);
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 7px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  max-width: 250px;
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   MISC
   ========================================================= */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--ease-fast);
}

.copy-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.progress-bar-track {
  width: 100%;
  height: 5px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
  transition: width var(--ease-smooth);
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUp 480ms ease-out forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in:nth-child(1) {
  animation-delay: 40ms;
}

.fade-in:nth-child(2) {
  animation-delay: 90ms;
}

.fade-in:nth-child(3) {
  animation-delay: 140ms;
}

.fade-in:nth-child(4) {
  animation-delay: 190ms;
}

.fade-in:nth-child(5) {
  animation-delay: 240ms;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

.animated-progress-container {
  width: 64px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  margin-top: 5px;
}

.animated-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--warning), #fbbf24, var(--warning));
  background-size: 200% 100%;
  animation: apb 1.4s linear infinite;
  width: 100%;
}

@keyframes apb {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}



/* Smooth transitions on every major element */
.card,
.stat-card,
.topbar,
.icon-btn,
.btn-secondary,
.btn-ghost,
.form-control,
.topbar-search input,
.modal-box,
.toast,
.qa-btn,
.data-table th,
.data-table td,
.upload-zone,
.skeleton,
.copy-btn {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 280ms;
  transition-timing-function: ease;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1280px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .topbar-search {
    display: none;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    z-index: 300;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .topbar {
    padding: 0 16px;
  }

  .page-body {
    padding: 18px 16px 40px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ADMIN PANEL STYLES — Kashsphere AI
   ========================================================= */

/* ── Dark Mode Tokens (Deep Navy palette) ── */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  /* deep navy */
  --bg-secondary: #1E293B;
  /* secondary nav/header */
  --bg-card: #111827;
  /* card surface */
  --bg-card-hover: #1F2937;
  /* hover / raised card */
  --bg-input: #111827;
  /* inputs */

  --border-subtle: rgba(255, 255, 255, .08);
  --border-hover: rgba(255, 255, 255, .16);

  --text-primary: #E5E7EB;
  /* off-white requested */
  --text-secondary: #9CA3AF;
  /* gray-400 */
  --text-muted: #6B7280;
  /* gray-500 */

  /* Blue accent */
  --accent-glow: rgba(59, 130, 246, .25);
  --accent-bg: rgba(59, 130, 246, .12);

  --success-bg: rgba(16, 185, 129, .15);
  --warning-bg: rgba(245, 158, 11, .15);
  --danger-bg: rgba(239, 68, 68, .15);
  --info-bg: rgba(59, 130, 246, .15);

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .5);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .6);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .7);
}

/* =========================================================
   DARK MODE — COMPONENT OVERRIDES (Deep Navy)
   ========================================================= */

/* Topbar */
[data-theme="dark"] .topbar {
  background: rgba(15, 23, 42, .95);
  /* #0F172A */
  border-bottom-color: rgba(255, 255, 255, .08);
}

/* Cards */
[data-theme="dark"] .card {
  border-color: rgba(255, 255, 255, .08);
}

[data-theme="dark"] .card:hover {
  border-color: rgba(59, 130, 246, .30);
}

/* Table */
[data-theme="dark"] .table-container {
  border-color: rgba(59, 130, 246, 0.15);
  /* Subtle accented blue border */
}

[data-theme="dark"] .data-table th {
  background: #1E293B;
  /* Secondary Navy */
  border-bottom-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-light);
  /* Accent Blue text for column names */
  font-weight: 700;
  letter-spacing: 0.05em;
}

[data-theme="dark"] .data-table td {
  border-bottom-color: rgba(59, 130, 246, 0.08);
  /* Faint blue row divider */
}

[data-theme="dark"] .data-table tr:hover td {
  background: rgba(59, 130, 246, .08);
}

/* Inputs / Forms */
[data-theme="dark"] .form-control {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .10);
  color: #E5E7EB;
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--accent-light);
  background: #111827;
  /* Card bg */
}

[data-theme="dark"] .topbar-search input {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
  color: #E5E7EB;
}

[data-theme="dark"] .topbar-search input:focus {
  background: #111827;
}

[data-theme="dark"] .table-search input {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
}

/* Buttons */
[data-theme="dark"] .icon-btn {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
  color: #9CA3AF;
}

[data-theme="dark"] .icon-btn:hover {
  background: #334155;
  /* lighter slate */
  border-color: rgba(59, 130, 246, .25);
  color: #E5E7EB;
}

[data-theme="dark"] .btn-secondary {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .10);
  color: #E5E7EB;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #334155;
}

[data-theme="dark"] .btn-ghost {
  color: #9CA3AF;
}

[data-theme="dark"] .btn-ghost:hover {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
}

[data-theme="dark"] .mobile-menu-btn {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
  color: #E5E7EB;
}

/* Modal */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, .80);
}

[data-theme="dark"] .modal-box {
  background: #111827;
  border-color: rgba(255, 255, 255, .10);
}

[data-theme="dark"] .modal-close {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .10);
  color: #9CA3AF;
}

/* Toast */
[data-theme="dark"] .toast {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .10);
}

/* Upload zone */
[data-theme="dark"] .upload-zone {
  border-color: rgba(59, 130, 246, .20);
}

[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.dragover {
  background: rgba(59, 130, 246, .08);
}

/* Stat cards */
[data-theme="dark"] .stat-card {
  background: #111827;
  border-color: rgba(255, 255, 255, .08);
}

/* QA Buttons */
[data-theme="dark"] .qa-btn {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
  color: #E5E7EB;
}

[data-theme="dark"] .qa-btn:hover {
  background: #334155;
  border-color: rgba(59, 130, 246, .20);
}

[data-theme="dark"] .qa-btn:not(.primary) .qa-icon {
  background: #0F172A;
}

/* Empty state */
[data-theme="dark"] .empty-icon {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
}

/* Skeleton shimmer */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1E293B 25%, #334155 50%, #1E293B 75%);
  background-size: 200% 100%;
}

/* Copy btn */
[data-theme="dark"] .copy-btn {
  background: #1E293B;
  border-color: rgba(255, 255, 255, .08);
  color: #9CA3AF;
}

[data-theme="dark"] .copy-btn:hover {
  background: #334155;
}

/* Progress bar track */
[data-theme="dark"] .progress-bar-track {
  background: rgba(255, 255, 255, .10);
}

/* Breadcrumb */
[data-theme="dark"] .breadcrumb a {
  color: #9CA3AF;
}

[data-theme="dark"] .breadcrumb a:hover {
  color: #E5E7EB;
}

/* Theme toggle — subtle amber sun icon in dark mode */
[data-theme="dark"] #themeToggle {
  color: #eab308;
  /* Yellow 500 */
  border-color: rgba(234, 179, 8, .25);
}

[data-theme="dark"] #themeToggle:hover {
  background: rgba(234, 179, 8, .10);
}