/* ==============================================================================
   DG-Analytics Enterprise Power BI Portal — Raai / DG Cars Design System
   Matches https://raai-beta.dgcars.cloud
   ============================================================================== */

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

:root {
  /* Brand Colors */
  --primary: #008b35;
  --primary-hover: #00752d;
  --primary-light: rgba(0, 139, 53, 0.12);
  --primary-glow: rgba(0, 139, 53, 0.25);
  
  --brand-teal: #2b8a8a;
  --brand-teal-light: rgba(43, 138, 138, 0.12);
  --brand-lime: #84cc16;

  /* Surfaces & Typography */
  --background: #f3f3f4;
  --foreground: #13161b;
  --card: #ffffff;
  --card-foreground: #13161b;

  --secondary: #f0f2f5;
  --secondary-foreground: #2b2e33;
  --muted: #eceff2;
  --muted-foreground: #606369;

  --border: #dfe1e5;
  --input: #dfe1e5;
  --ring: #008b35;

  /* Status Colors */
  --destructive: #e7000b;
  --destructive-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --success: #10b981;
  --success-bg: #dcfce7;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  /* Power BI Legacy Mapping */
  --pbi-gold: var(--primary);
  --pbi-gold-hover: var(--primary-hover);
  --pbi-gold-light: var(--primary-light);
  --pbi-text-primary: var(--foreground);
  --pbi-text-secondary: var(--muted-foreground);
  --pbi-text-muted: #8a8f98;
  --pbi-danger: var(--destructive);
  --pbi-success: var(--success);
  --pbi-info: var(--info);
  --pbi-hover-bg: #f0f2f5;

  /* Dark Sidebar Theme */
  --sidebar-width: 290px;
  --sidebar-collapsed-width: 64px;
  --sidebar-bg: #0b121a;
  --sidebar-fg: #c0c4cb;
  --sidebar-hover-bg: #151d28;
  --sidebar-active-bg: #14361d;
  --sidebar-active-fg: #f1f5fc;
  --sidebar-border: #202938;
  --sidebar-header-bg: #070d13;
  --sidebar-dock-bg: #070d13;

  /* Auth / Landing Mesh */
  --auth-bg-from: #06120f;
  --auth-bg-via: #0a201a;
  --auth-bg-to: #0d2b1f;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 6px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--foreground);
  background-color: var(--background);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================================================
   1. APP CONTAINER (Edge-to-Edge Right Canvas with Floating Left Rail)
   ============================================================================== */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: var(--background);
}

/* ==============================================================================
   2. LEFT NAVIGATION SIDEBAR (Floating Rounded Card with Tight Margins)
   ============================================================================== */
.pbi-sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - 4px);
  margin: 2px;
  background-color: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  color: var(--sidebar-fg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.pbi-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Circular Rail Divider Toggle Button */
.sidebar-rail-toggle {
  position: absolute;
  top: 16px;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.sidebar-rail-toggle:hover {
  background-color: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 139, 53, 0.3);
}

.sidebar-rail-toggle svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pbi-sidebar.collapsed .sidebar-rail-toggle svg {
  transform: rotate(180deg);
}

/* Sidebar Brand Header */
.sidebar-brand-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  border-bottom: 1px solid var(--sidebar-border);
  background-color: transparent;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  overflow: hidden;
  white-space: nowrap;
}

.pbi-logo-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  flex-shrink: 0;
}

.pbi-bar {
  width: 4px;
  background: linear-gradient(to top, var(--primary), #34d399);
  border-radius: 2px;
}
.pbi-bar.bar-1 { height: 8px; }
.pbi-bar.bar-2 { height: 14px; }
.pbi-bar.bar-3 { height: 20px; }

/* Sidebar Search Bar */
.sidebar-search-container {
  padding: 8px 10px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  height: 32px;
  background-color: #121a24;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  padding: 0 10px 0 30px;
  color: #ffffff;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.search-box input::placeholder {
  color: #64748b;
}

.search-box input:focus {
  border-color: var(--primary);
  background-color: #16202c;
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.8rem;
}

/* Scrollable Content */
.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 6px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
}

/* 3-Layer Navigation Tree */
.section-accordion {
  margin-bottom: 4px;
}

.section-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
  background-color: transparent;
  border-radius: var(--radius-sm);
  margin: 0;
}

.section-accordion-header:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-icon {
  font-size: 0.9rem;
  color: #64748b;
}

.section-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-edit-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.section-accordion-header:hover .section-edit-btn {
  opacity: 0.9;
}

.section-edit-btn:hover {
  opacity: 1 !important;
  color: #4ade80;
  background-color: rgba(52, 211, 153, 0.15);
  transform: scale(1.15);
}

.section-count-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  background-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border-radius: 9999px;
}

.sidebar-add-section-wrap {
  padding: 4px 2px 8px 2px;
  margin-top: 4px;
}

.btn-add-section-quick {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-add-section-quick:hover {
  background-color: rgba(0, 139, 53, 0.14);
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
  transform: translateY(-1px);
}

.section-reports-list {
  display: none;
  padding: 2px 0 4px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 10px;
  margin-top: 1px;
  margin-bottom: 2px;
}

.section-reports-list.open {
  display: block;
}

/* Accordion Rotating Chevron */
.accordion-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
  flex-shrink: 0;
  border-radius: 4px;
}

.accordion-chevron:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.accordion-chevron.open {
  transform: rotate(90deg);
  color: #34d399;
}

/* Layer 2: Report Accordion */
.report-accordion {
  margin-bottom: 1px;
}

.report-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  font-size: 0.82rem;
  color: var(--sidebar-fg);
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 1px 2px;
}

.report-accordion-header:hover {
  background-color: var(--sidebar-hover-bg);
  color: #ffffff;
}

.report-accordion-header.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  font-weight: 600;
}

.report-accordion-header.active .report-name {
  color: #ffffff;
}

.report-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Favourite star on report rows: shown on hover, always shown when starred */
.report-star-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0 4px;
  margin-left: 4px;
  font-size: 0.95rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.report-accordion-header:hover .report-star-btn,
.report-star-btn:focus-visible {
  opacity: 1;
}

.report-star-btn:hover {
  color: #fbbf24;
}

.report-star-btn.on {
  opacity: 1;
  color: #fbbf24;
}

/* Folder picker opened from the star */
.fav-menu {
  position: fixed;
  z-index: 2000;
  min-width: 200px;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.fav-menu-title {
  padding: 4px 8px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.fav-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 0.84rem;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.fav-menu-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-menu-item:hover {
  background: #f1f5f9;
}

.fav-menu-item.current {
  font-weight: 600;
}

.fav-menu-check {
  color: var(--primary);
}

.fav-menu-item.danger {
  color: #dc2626;
}

.fav-menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

/* Layer 3: Report Pages List */
.report-pages-list {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 3px 12px;
}

.report-pages-list.open {
  display: flex;
}

.page-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: #94a3b8;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  margin-right: 2px;
}

.page-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.page-item.active {
  background-color: rgba(0, 139, 53, 0.2);
  color: #4ade80;
  font-weight: 600;
}

.page-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #64748b;
  flex-shrink: 0;
}

.page-item.active .page-dot {
  background-color: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.8);
}

/* Non-scrollable Bottom Section (Docked) */
.sidebar-bottom-section {
  padding: 6px 8px 8px 8px;
  border-top: 1px solid var(--sidebar-border);
  background-color: transparent;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  transition: all 0.22s ease;
}

.sidebar-bottom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.sidebar-bottom-header:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.bottom-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bottom-header-title {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #94a3b8;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-bottom-collapse {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-bottom-header:hover .btn-bottom-collapse,
.btn-bottom-collapse:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.bottom-chevron-icon {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.2s ease;
  stroke: #94a3b8;
}

.sidebar-bottom-header:hover .bottom-chevron-icon {
  stroke: #34d399;
}

/* Collapsed state: pointing UPWARDS */
.sidebar-bottom-section.collapsed .bottom-chevron-icon {
  transform: rotate(180deg);
  stroke: #4ade80;
}

.sidebar-utility-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 250px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin 0.2s ease;
}

.sidebar-bottom-section.collapsed .sidebar-utility-nav {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* Hide header elements in collapsed sidebar rail mode */
.pbi-sidebar.collapsed .sidebar-bottom-header {
  display: none !important;
}

.sidebar-utility-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sidebar-utility-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.sidebar-utility-link.active {
  background-color: #14361d;
  color: #4ade80;
  font-weight: 600;
}

.utility-icon {
  width: 18px;
  height: 18px;
  stroke: #34d399;
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.sidebar-utility-link:hover .utility-icon {
  stroke: #4ade80;
  transform: scale(1.08);
}

.utility-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background-color: #008b35;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 139, 53, 0.3);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  overflow: hidden;
  flex: 1;
}

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

.btn-sidebar-signout {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  transition: color 0.15s ease;
  font-family: inherit;
}

.btn-sidebar-signout:hover {
  color: #94a3b8;
  text-decoration: underline;
}

/* Collapsed Sidebar Mode */
.pbi-sidebar.collapsed .sidebar-brand-header {
  justify-content: center;
  padding: 0;
}

.pbi-sidebar.collapsed .brand-text,
.pbi-sidebar.collapsed .sidebar-search-container,
.pbi-sidebar.collapsed .user-meta,
.pbi-sidebar.collapsed .utility-label,
.pbi-sidebar.collapsed .section-title-group span:not(.section-icon),
.pbi-sidebar.collapsed .section-count-badge,
.pbi-sidebar.collapsed .report-name,
.pbi-sidebar.collapsed .accordion-chevron,
.pbi-sidebar.collapsed .report-pages-list {
  display: none !important;
}

.pbi-sidebar.collapsed .sidebar-bottom-section {
  padding: 10px 6px;
  gap: 8px;
}

.pbi-sidebar.collapsed .sidebar-utility-link {
  justify-content: center;
  padding: 8px 0;
}

.pbi-sidebar.collapsed .sidebar-user-card {
  justify-content: center;
  padding: 4px;
  background: transparent;
  border: none;
}

.pbi-sidebar.collapsed .sidebar-user-card .btn-sidebar-signout {
  display: none !important;
}

/* ==============================================================================
   3. MAIN VIEWPORT & FULL EDGE-TO-EDGE REPORT STAGE
   ============================================================================== */
.main-viewport {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-color: #ffffff;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* Extreme Bottom-Right Floating Fullscreen Button */
.btn-fullscreen-floating {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 50;
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  padding: 0;
}

.btn-fullscreen-floating:hover {
  background-color: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 16px rgba(0, 139, 53, 0.25);
}

.btn-fullscreen-floating svg {
  transition: transform 0.2s ease;
}

.btn-fullscreen-floating:hover svg {
  transform: scale(1.1);
}

/* ==============================================================================
   4. EMBED STAGE & MOCK CANVAS (MAX VERTICAL & HORIZONTAL SPACE)
   ============================================================================== */
.embed-stage {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: #ffffff;
  border-radius: 0;
}

#embedContainer {
  width: 100%;
  height: 100%;
}

/* Skeleton Loading */
.skeleton-loader {
  position: absolute;
  inset: 0;
  background: var(--background);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}
.skeleton-loader.active {
  display: flex;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 139, 53, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* Error Banner */
.error-banner {
  display: none;
  margin: 20px;
  padding: 16px 20px;
  background-color: var(--destructive-bg);
  border: 1px solid #fca5a5;
  border-left: 4px solid var(--destructive);
  border-radius: var(--radius-md);
  color: #991b1b;
}
.error-banner h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.error-banner p {
  font-size: 0.85rem;
}
.error-banner pre {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

/* Interactive Mock Power BI Canvas */
.mock-canvas {
  width: 100%;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  background-color: var(--background);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mock-banner {
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--card);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary), var(--brand-teal));
}

.kpi-label {
  font-size: 0.76rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
}

.kpi-delta {
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kpi-delta.up { color: #16a34a; }
.kpi-delta.down { color: var(--destructive); }

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

@media (max-width: 992px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
}

.mock-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 180px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}

.bar-fill {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(180deg, #34d399 0%, var(--primary) 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
}

.bar-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.mock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mock-table th {
  text-align: left;
  padding: 10px 12px;
  background-color: var(--secondary);
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.mock-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.report-page-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  background-color: var(--secondary);
  color: var(--muted-foreground);
  border-radius: 9999px;
}

/* ==============================================================================
   5. ADMIN SETTINGS MODAL & HIG DIALOG
   ============================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  width: 90%;
  max-width: 920px;
  max-height: 88vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.25s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfc;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--foreground);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--foreground);
}

.tab-btn.active {
  color: var(--brand-teal);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--brand-teal);
  border-radius: 9999px;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
  background-color: #ffffff;
  color: var(--foreground);
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #00752d 100%);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 139, 53, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #00993a 0%, #006b29 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 139, 53, 0.35);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-danger {
  background-color: var(--destructive-bg);
  color: var(--destructive);
  border: 1px solid #fecaca;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background-color: var(--destructive);
  color: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 14px;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background-color: #fafbfc;
  border-bottom: 2px solid var(--border);
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* ==============================================================================
   6. SIGN-IN / AUTH OVERLAY (Raai Analytics Animated Canvas Theme)
   ============================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #0c1824 0%, #070e15 60%, #04080d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
  padding: 20px;
}

/* Ambient Radial Glows */
.login-overlay::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 139, 53, 0.22) 0%, rgba(16, 185, 129, 0.06) 50%, transparent 70%);
  filter: blur(80px);
  animation: blob-drift 18s ease-in-out infinite;
  pointer-events: none;
}

.login-overlay::after {
  content: '';
  position: absolute;
  bottom: -100px;
  right: 15%;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.18) 0%, rgba(59, 130, 246, 0.05) 50%, transparent 70%);
  filter: blur(90px);
  animation: blob-drift 18s ease-in-out infinite 6s;
  pointer-events: none;
}

/* -------------------------------------------------------------
   ANALYTICS BACKDROP & MOVING TELEMETRY SYSTEM
   ------------------------------------------------------------- */
.analytics-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

/* Ambient Analytics Matrix Grid */
.analytics-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 85%);
  animation: grid-drift 60s linear infinite;
}

@keyframes grid-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(56px); }
}

/* SVG Trend Canvas */
.analytics-svg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}

.analytics-trend-line.line-primary {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: draw-and-undulate 16s ease-in-out infinite alternate;
}

.analytics-trend-line.line-secondary {
  animation: float-curve 12s ease-in-out infinite alternate;
}

@keyframes draw-and-undulate {
  0% { stroke-dashoffset: 2000; transform: translateY(0); }
  40% { stroke-dashoffset: 0; transform: translateY(0); }
  70% { stroke-dashoffset: 0; transform: translateY(-15px) scaleY(1.03); }
  100% { stroke-dashoffset: 0; transform: translateY(10px) scaleY(0.97); }
}

@keyframes float-curve {
  0% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-18px) scaleY(1.05); }
  100% { transform: translateY(12px) scaleY(0.95); }
}

/* -------------------------------------------------------------
   FLOATING METRIC CARDS & TELEMETRY CHIPS (8 KPI Grid)
   ------------------------------------------------------------- */
.floating-metric-chip {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(11, 20, 30, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 8px 15px;
  border-radius: 9999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 139, 53, 0.14);
  color: #ffffff;
  z-index: 2;
  transition: transform 0.3s ease;
  min-width: 170px;
}

/* Left Column KPI Chips */
.chip-kpi-1 { top: 9%; left: 4%; animation: float-slow 7s ease-in-out infinite; }
.chip-kpi-2 { top: 31%; left: 2.5%; animation: float-slow 8.2s ease-in-out infinite 1s; }
.chip-kpi-3 { top: 53%; left: 4%; animation: float-slow 7.8s ease-in-out infinite 2s; }
.chip-kpi-4 { top: 75%; left: 2.8%; animation: float-slow 9s ease-in-out infinite 1.4s; }

/* Right Column KPI Chips */
.chip-kpi-5 { top: 9%; right: 4%; animation: float-slow 7.4s ease-in-out infinite 0.5s; }
.chip-kpi-6 { top: 31%; right: 2.5%; animation: float-slow 8.6s ease-in-out infinite 2.2s; }
.chip-kpi-7 { top: 53%; right: 4%; animation: float-slow 7.9s ease-in-out infinite 1.2s; }
.chip-kpi-8 { top: 75%; right: 2.8%; animation: float-slow 8.5s ease-in-out infinite 0.8s; }

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(0.4deg); }
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.metric-delta {
  font-size: 0.74rem;
  font-weight: 700;
}

.metric-delta.up {
  color: #34d399;
}

.metric-delta.down {
  color: #fbbf24;
}

.metric-delta.cyan {
  color: #38bdf8;
}

/* Mini Dynamic Bar Chart inside Chips */
.mini-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  padding: 2px 2px;
  flex-shrink: 0;
}

.mini-bar {
  width: 4px;
  background: linear-gradient(to top, #008b35, #34d399);
  border-radius: 2px;
  animation: bar-dance 1.4s ease-in-out infinite alternate;
}

.mini-bar.b1 { height: 40%; animation-delay: 0.1s; }
.mini-bar.b2 { height: 75%; animation-delay: 0.4s; }
.mini-bar.b3 { height: 55%; animation-delay: 0.2s; }
.mini-bar.b4 { height: 95%; animation-delay: 0.6s; }
.mini-bar.b5 { height: 80%; animation-delay: 0.3s; background: linear-gradient(to top, #06b6d4, #38bdf8); }

@keyframes bar-dance {
  0% { transform: scaleY(0.35); }
  100% { transform: scaleY(1.15); }
}

/* Mini Dynamic Pie / Donut Chart inside Chips */
.mini-pie-chart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mini-pie-chart svg {
  transform: rotate(-90deg);
}

.mini-pie-slice {
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}

.mini-pie-slice.cyan {
  stroke: #06b6d4;
}

.mini-pie-slice.amber {
  stroke: #f59e0b;
}

.mini-pie-slice.full {
  stroke: #10b981;
  animation: donut-pulse 2.2s ease-in-out infinite alternate;
}

@keyframes donut-pulse {
  0% { stroke-width: 3.5; opacity: 0.85; }
  100% { stroke-width: 4.2; opacity: 1; filter: drop-shadow(0 0 3px #10b981); }
}

/* Mini Sparkline inside Chips */
.mini-sparkline {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 20px;
  flex-shrink: 0;
}

.sparkline-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
  animation: sparkline-glow 2.5s ease-in-out infinite alternate;
}

@keyframes sparkline-glow {
  0% { filter: drop-shadow(0 0 0px rgba(16, 185, 129, 0)); opacity: 0.8; }
  100% { filter: drop-shadow(0 0 3px rgba(16, 185, 129, 0.8)); opacity: 1; }
}

/* Floating Directional Arrows */
.floating-arrow {
  position: absolute;
  color: rgba(52, 211, 153, 0.4);
  font-size: 1.1rem;
  font-weight: 700;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.4));
  animation: drift-up 9s linear infinite;
}

.arrow-1 { left: 22%; bottom: 8%; font-size: 1rem; animation-duration: 8s; animation-delay: 0s; }
.arrow-2 { left: 35%; bottom: 5%; font-size: 1.3rem; animation-duration: 11s; animation-delay: 2s; color: rgba(6, 182, 212, 0.4); }
.arrow-3 { right: 28%; bottom: 6%; font-size: 0.9rem; animation-duration: 9.5s; animation-delay: 4s; }
.arrow-4 { right: 38%; bottom: 10%; font-size: 1.2rem; animation-duration: 10.5s; animation-delay: 1s; color: rgba(59, 130, 246, 0.35); }
.arrow-5 { left: 48%; bottom: 4%; font-size: 1.4rem; animation-duration: 13s; animation-delay: 3s; }

@keyframes drift-up {
  0% { transform: translateY(0) scale(0.85); opacity: 0; }
  20% { opacity: 0.7; }
  80% { opacity: 0.7; }
  100% { transform: translateY(-480px) scale(1.15); opacity: 0; }
}

/* -------------------------------------------------------------
   ANIMATED DG-ANALYTICS BRAND LOGO
   ------------------------------------------------------------- */
.pbi-logo-container-animated {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  background: radial-gradient(circle, rgba(0, 139, 53, 0.3) 0%, rgba(11, 19, 28, 0.8) 70%);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 139, 53, 0.25), inset 0 0 12px rgba(52, 211, 153, 0.15);
  margin-bottom: 6px;
  transition: transform 0.3s ease;
}

.pbi-logo-container-animated:hover {
  transform: scale(1.06) rotate(1deg);
}

.pbi-logo-aura {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.4) 0%, transparent 70%);
  filter: blur(8px);
  animation: aura-breathe 4s ease-in-out infinite;
  z-index: 0;
}

@keyframes aura-breathe {
  0%, 100% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

.pbi-logo-bars-animated {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 28px;
}

.pbi-bar-anim {
  width: 5px;
  background: linear-gradient(to top, #008b35, #34d399, #6ee7b7);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
  animation: logo-bar-wave 1.6s ease-in-out infinite alternate;
}

.pbi-bar-anim.bar-1 { height: 12px; animation-delay: 0.1s; }
.pbi-bar-anim.bar-2 { height: 20px; animation-delay: 0.3s; }
.pbi-bar-anim.bar-3 { height: 28px; animation-delay: 0.5s; }
.pbi-bar-anim.bar-4 { height: 16px; animation-delay: 0.2s; background: linear-gradient(to top, #06b6d4, #38bdf8); }

@keyframes logo-bar-wave {
  0% { transform: scaleY(0.65); }
  100% { transform: scaleY(1.15); }
}

/* -------------------------------------------------------------
   GLASSMORPHIC LOGIN CARD (Raai Aesthetic)
   ------------------------------------------------------------- */
.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(11, 19, 28, 0.84);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 1.75rem;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 139, 53, 0.08);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 10;
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.login-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 30%, #6ee7b7 75%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.62);
  max-width: 290px;
  line-height: 1.35;
}

/* Microsoft single sign-on */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: #ffffff;
  color: #5e5e5e;
  border: 1px solid #8c8c8c;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-microsoft:hover {
  background: #f3f3f3;
}

.login-card .form-label {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  font-size: 0.82rem;
}

.login-card .form-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.login-card .form-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.login-card .form-input:focus {
  border-color: #34d399;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.login-card .btn-primary {
  background: linear-gradient(135deg, #008b35 0%, #059669 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  border: 1px solid rgba(52, 211, 153, 0.3);
  box-shadow: 0 4px 16px rgba(0, 139, 53, 0.35);
  transition: all 0.22s ease;
}

.login-card .btn-primary:hover {
  background: linear-gradient(135deg, #00a340 0%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 139, 53, 0.5);
}

.login-card .btn-primary svg {
  transition: transform 0.2s ease;
}

.login-card .btn-primary:hover svg {
  transform: translateX(3px);
}

@keyframes blob-drift {
  0%, 100% { transform: translate(0) scale(1); }
  33% { transform: translate(35px, -45px) scale(1.1); }
  66% { transform: translate(-30px, 30px) scale(0.92); }
}

/* ==============================================================================
   5. MODAL DIALOGS & ADMIN GOVERNANCE STYLES (Raai / DG Cars Theme)
   ============================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 18, 26, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
}

.modal-backdrop.open,
.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background-color: #ffffff;
  color: var(--foreground);
  width: 100%;
  max-width: 960px;
  max-height: 88vh;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
  0% { transform: scale(0.95) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.modal-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: #fee2e2;
  color: #e7000b;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 0.88rem;
  color: #334155;
}

/* Tabs Header in Admin Modal */
.tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 2px;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--foreground);
  background-color: #f1f5f9;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: rgba(0, 139, 53, 0.06);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Form Controls Inside Modals */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.form-input,
.form-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  color: var(--foreground);
  background-color: #ffffff;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Tables inside Modals */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.84rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-table thead {
  background-color: #f8fafc;
}

.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

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

.admin-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Action Buttons */
.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.btn-danger {
  background-color: #fee2e2;
  color: #e7000b;
  border: 1px solid #fca5a5;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background-color: #e7000b;
  color: #ffffff;
}

/* Capsules & Badges */
.hig-capsule {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.hig-capsule--green {
  background-color: #dcfce7;
  color: #166534;
}

.hig-capsule--amber {
  background-color: #fef3c7;
  color: #92400e;
}

.hig-capsule--gray {
  background-color: #f1f5f9;
  color: #475569;
}

.hig-capsule--blue {
  background-color: #dbeafe;
  color: #1e40af;
}

/* ==============================================================================
   6. SECONDARY ADMIN SUB-SIDEBAR & EMBEDDED ADMIN STAGE (Raai Dual Sidebar)
   ============================================================================== */
.admin-sub-sidebar {
  width: 245px;
  height: calc(100vh - 4px);
  margin: 2px 2px 2px 0;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  z-index: 45;
  flex-shrink: 0;
  overflow: hidden;
  animation: sidebar-slide-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sidebar-slide-in {
  0% { opacity: 0; transform: translateX(-10px); }
  100% { opacity: 1; transform: translateX(0); }
}

.admin-sub-header {
  height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfc;
  flex-shrink: 0;
}

.admin-sub-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sub-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.admin-sub-badge {
  background-color: #2563eb;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.btn-sub-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #64748b;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-sub-close:hover {
  background-color: #fee2e2;
  color: #e7000b;
}

.admin-sub-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.admin-nav-group {
  margin-bottom: 16px;
}

.admin-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  padding: 0 8px;
  text-transform: uppercase;
}

.admin-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sub-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
  font-family: inherit;
}

.admin-sub-link:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.admin-sub-link.active {
  background-color: #e6f4ea;
  color: #008b35;
  font-weight: 600;
}

.admin-sub-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  flex-shrink: 0;
}

.admin-sub-link.active .admin-sub-icon {
  stroke: #008b35;
}

.admin-sub-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background-color: #fafbfc;
  flex-shrink: 0;
}

.btn-return-reports {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-return-reports:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* ADMIN MAIN VIEWPORT STAGE */
.admin-stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
  overflow: hidden;
}

.admin-stage-header {
  padding: 16px 24px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: #e6f4ea;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 139, 53, 0.2);
  flex-shrink: 0;
}

.admin-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.admin-capsule-badge {
  background-color: #2563eb;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.admin-header-subtitle {
  font-size: 0.83rem;
  color: #64748b;
  margin-top: 2px;
}

.admin-stage-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px 24px;
}

.subpage-pane {
  display: none;
}

.subpage-pane.active {
  display: block;
}

.subpage-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.subpage-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.subpage-count {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  margin-left: 4px;
}

.subpage-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 2px;
}

.admin-table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 260px;
}

.admin-table-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.82rem;
  width: 100%;
  color: #0f172a;
  font-family: inherit;
}

.admin-card-form {
  background: #ffffff;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.admin-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #008b35;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Responsive Rules for Auth Canvas */
@media (max-width: 1350px) {
  .floating-chart-card {
    display: none;
  }
}

@media (max-width: 1100px) {
  .chip-kpi-2, .chip-kpi-4, .chip-kpi-6, .chip-kpi-7 {
    display: none;
  }
  .floating-metric-chip {
    min-width: 140px;
    padding: 6px 12px;
  }
}

@media (max-width: 820px) {
  .floating-metric-chip,
  .floating-chart-card,
  .floating-arrow {
    display: none;
  }
  .login-card {
    padding: 28px 22px;
    border-radius: 1.25rem;
  }
}

/* ==============================================================================
   2-PART LEFT NAVIGATION BAR & DIRECT DAX CUSTOM VIEWS
   ============================================================================== */

.sidebar-category-block {
  margin-bottom: 8px;
  transition: all 0.22s ease;
}

.sidebar-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin-bottom: 3px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.sidebar-category-header:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-category-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-category-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.sidebar-category-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #94a3b8;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-category-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-category-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 5px;
  background: rgba(0, 139, 53, 0.2);
  color: #4ade80;
  border-radius: 4px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(74, 222, 128, 0.3);
  white-space: nowrap;
}

#blockPbiReports .sidebar-category-tag {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

.btn-category-collapse {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-category-header:hover .btn-category-collapse {
  color: #ffffff;
}

.category-chevron-icon {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.2s ease;
  stroke: #94a3b8;
}

.sidebar-category-header:hover .category-chevron-icon {
  stroke: #34d399;
}

.category-chevron-icon.open-up {
  transform: rotate(180deg);
  stroke: #4ade80;
}

.sidebar-category-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  margin: 8px 4px 8px 4px;
}

.sidebar-custom-views-list,
.sidebar-pbi-sections-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 2500px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

#blockCustomViews {
  flex-shrink: 0;
}

#blockPbiReports {
  display: flex;
  flex-direction: column;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stacks Power BI Reports on top of Tools & Dictionary when collapsed */
#blockPbiReports.collapsed {
  margin-top: auto !important;
  margin-bottom: 2px !important;
}

#blockPbiReports.collapsed .sidebar-category-header {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
}

.sidebar-category-block.collapsed .sidebar-custom-views-list,
.sidebar-category-block.collapsed .sidebar-pbi-sections-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.sidebar-custom-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  margin: 1px 2px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-fg);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  background-color: transparent;
  border: 1px solid transparent;
}

.sidebar-custom-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-custom-item.active {
  background-color: #14361d;
  color: #ffffff;
  border: 1px solid rgba(74, 222, 128, 0.35);
  box-shadow: 0 2px 8px rgba(0, 139, 53, 0.2);
  font-weight: 600;
}

.sidebar-custom-item.active .custom-item-icon {
  color: #4ade80;
}

.custom-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex-shrink: 0;
}

.custom-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-item-tag {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sidebar-custom-item.active .custom-item-tag {
  background: rgba(74, 222, 128, 0.2);
  color: #86efac;
}

/* Dashboards not released yet */
.sidebar-custom-item.coming-soon {
  cursor: not-allowed;
  opacity: 0.5;
}

.sidebar-custom-item.coming-soon:hover {
  background-color: transparent;
  color: var(--sidebar-fg);
  transform: none;
}

.sidebar-empty-hint {
  padding: 10px 8px;
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  font-style: italic;
}

/* Collapsed mode adjustments */
.pbi-sidebar.collapsed .sidebar-category-header,
.pbi-sidebar.collapsed .sidebar-category-divider,
.pbi-sidebar.collapsed .custom-item-name,
.pbi-sidebar.collapsed .custom-item-tag {
  display: none !important;
}

.pbi-sidebar.collapsed .sidebar-custom-item {
  justify-content: center;
  padding: 8px 0;
}

.pbi-sidebar.collapsed .custom-item-left {
  justify-content: center;
}

/* ==============================================================================
   CUSTOM VIEWS STAGE (DIRECT DAX VIEWPORT)
   ============================================================================== */

.custom-views-stage {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  overflow-y: auto;
  position: relative;
}

.custom-views-scroll-wrap {
  padding: 24px 30px 48px 30px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.custom-view-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.custom-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.custom-view-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.custom-view-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  background: rgba(0, 139, 53, 0.12);
  color: #008b35;
  border: 1px solid rgba(0, 139, 53, 0.25);
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.custom-view-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--foreground);
  letter-spacing: -0.02em;
}

.custom-view-desc {
  font-size: 0.88rem;
  color: var(--muted-foreground);
}

.custom-view-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dax-latency-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-dax-run {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0, 139, 53, 0.25);
}

.btn-dax-run:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 139, 53, 0.35);
}

/* DAX Code Preview Card */
.dax-code-card {
  background: #0b121a;
  border: 1px solid #202938;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.dax-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1a2332;
}

.dax-code-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dax-endpoint-label {
  font-size: 0.72rem;
  font-family: monospace;
  color: #34d399;
}

.dax-code-block {
  margin: 0;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* KPI Cards Grid */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.kpi-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card-icon {
  font-size: 1.15rem;
}

.kpi-card-value {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--foreground);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.kpi-card-sub {
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

/* Custom Card Panel & Tables */
.custom-card-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
}

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

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--foreground);
}

.panel-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-radius: 9999px;
}

.dax-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.dax-data-table th {
  text-align: left;
  padding: 10px 14px;
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.dax-data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.dax-data-table tbody tr:hover {
  background-color: #f8fafc;
}

.source-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(0, 139, 53, 0.1);
  color: #008b35;
  border-radius: 4px;
}

.badge-units {
  display: inline-flex;
  padding: 2px 8px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 4px;
  font-weight: 700;
}

/* DAX Query Studio */
.query-presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.presets-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-preset {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.dax-studio-editor-box {
  background: #0b121a;
  border: 1px solid #202938;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.dax-textarea {
  width: 100%;
  height: 160px;
  background: transparent;
  border: none;
  padding: 14px 16px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.88rem;
  color: #f1f5f9;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}

/* =============================================================
   DAX EXPLORER
============================================================= */
.dax-explorer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.dax-explorer-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}

.dax-model-select {
  flex: 1 1 260px;
  max-width: 440px;
  width: auto;
}

.dax-explorer-toolbar .dax-latency-badge {
  margin-left: auto;
}

.btn-dax-run:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.dax-explorer-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.dax-explorer-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: calc(100vh - 260px);
  min-height: 320px;
}

.dax-meta-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dax-meta-section + .dax-meta-section {
  margin-top: 12px;
}

.dax-meta-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
}

.dax-meta-group {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
}

.dax-meta-group:hover {
  background: #f8fafc;
}

.dax-meta-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 5px 6px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.dax-meta-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dax-meta-chevron {
  flex: 0 0 10px;
  font-size: 0.7rem;
  color: #94a3b8;
  transition: transform 0.15s ease;
}

.dax-meta-group.open .dax-meta-chevron {
  transform: rotate(90deg);
}

.dax-meta-all {
  padding: 2px 6px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  white-space: nowrap;
}

.dax-meta-all:hover {
  text-decoration: underline;
}

.dax-meta-group .dax-meta-count {
  margin-right: 6px;
}

.dax-meta-count {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.dax-meta-table {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
}

.dax-meta-table .dax-meta-count {
  font-weight: 600;
}

.dax-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #1e293b;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.dax-meta-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dax-meta-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.dax-meta-item.is-hidden {
  color: #94a3b8;
}

.dax-meta-icon {
  flex: 0 0 16px;
  font-size: 0.8rem;
  color: var(--primary);
  text-align: center;
}

.dax-meta-note,
.dax-meta-empty {
  padding: 8px;
  font-size: 0.8rem;
  color: #64748b;
}

.dax-meta-empty {
  padding: 24px 12px;
  text-align: center;
}

.dax-explorer-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dax-explorer .dax-textarea {
  height: 200px;
}

.dax-output-panel {
  margin: 0;
}

.dax-output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dax-output-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.dax-output-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dax-output-wrap {
  max-height: 480px;
  overflow: auto;
}

.dax-output-wrap .dax-data-table th {
  position: sticky;
  top: 0;
  text-transform: none;
  white-space: nowrap;
}

.dax-output-wrap .dax-data-table td {
  padding: 8px 14px;
  white-space: nowrap;
}

.dax-data-table td.is-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dax-null {
  color: #94a3b8;
  font-style: italic;
}

.dax-error {
  margin: 12px;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .dax-explorer-body {
    grid-template-columns: 1fr;
  }
  .dax-explorer-sidebar {
    max-height: 320px;
  }
}

/* =============================================================
   USAGE & ACTIVITY (admin)
============================================================= */
.usage-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.usage-kpi {
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.usage-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.usage-kpi-value {
  margin-top: 4px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-kpi-sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: #64748b;
}

.usage-user-row {
  cursor: pointer;
}

.usage-chevron {
  display: inline-block;
  font-size: 0.7rem;
  color: #94a3b8;
  transition: transform 0.15s ease;
}

.usage-user-row.is-open .usage-chevron {
  transform: rotate(90deg);
}

.usage-user-row.is-open td {
  background: #f8fafc;
}

.usage-detail-row > td {
  padding: 4px 12px 14px 32px;
  background: #f8fafc;
}

.usage-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.usage-detail-table th {
  padding: 6px 8px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  border-bottom: 1px solid var(--border);
}

.usage-detail-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: top;
}

@media (max-width: 900px) {
  .usage-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Glossary "Formula / Logic": plain-English definitions, so normal text in a soft box */
.glossary-logic {
  padding: 6px 10px;
  background: #f8fafc;
  border-left: 3px solid var(--primary-light);
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #0f172a;
  overflow-wrap: anywhere;
}

/* =============================================================
   DATA DICTIONARY (tabs reuse the leaderboard's .lb-metric-tab)
============================================================= */
.dd-sync-status {
  margin-top: 4px;
  font-size: 0.78rem;
  color: #64748b;
}

.dd-tabbed .lb-metric-tab {
  max-width: 200px;
}

.dd-tab-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.dd-tab-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.dd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

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

.dd-filter {
  width: auto;
  max-width: 260px;
}

.dd-count {
  margin-left: auto;
}

.dd-table-wrap {
  overflow-x: auto;
}

.dd-table td {
  vertical-align: top;
  padding: 10px 12px;
}

.dd-table th {
  white-space: nowrap;
}

.dd-col-name {
  min-width: 180px;
}

.dd-col-name strong {
  color: #0f172a;
}

.dd-col-dax {
  min-width: 320px;
  width: 40%;
}

.dd-desc {
  margin-top: 3px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #64748b;
}

.dd-model-name {
  font-size: 0.84rem;
  color: #1e293b;
}

.dd-muted {
  font-size: 0.74rem;
  color: #94a3b8;
}

.dd-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dd-code {
  margin: 0;
  padding: 8px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}

.dd-code.is-clamped {
  max-height: 5.9em;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.dd-code.is-clamped::after {
  content: 'Show all ▾';
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 10px 10px 4px;
  text-align: right;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: linear-gradient(to bottom, rgba(241, 245, 249, 0), #f1f5f9 60%);
}

.dd-code.is-clamped.is-open {
  max-height: none;
  padding-bottom: 22px;
}

.dd-code.is-clamped.is-open::after {
  content: 'Show less ▴';
  background: none;
}

.dd-chip {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 9999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

td > .dd-chip:first-child {
  margin-left: 0;
}

.dd-chip--muted {
  background: #f1f5f9;
  color: #64748b;
}

.dd-category-input {
  width: 150px;
  padding: 4px 8px;
  font-size: 0.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dd-category-input.is-saved {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.dd-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dd-link:hover {
  text-decoration: underline;
}

.dd-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 9999px;
  background: var(--primary-light);
  color: #0f172a;
  font-size: 0.8rem;
}

.dd-filter-chip button {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: #334155;
  font-size: 0.65rem;
  line-height: 18px;
  cursor: pointer;
}

.dd-filter-chip button:hover {
  background: rgba(0, 0, 0, 0.16);
}

.dd-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: #64748b;
}

.dd-pager .btn-secondary {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.dd-pager .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dd-empty {
  padding: 36px 16px;
  text-align: center;
  font-size: 0.86rem;
  color: #64748b;
}

@media (max-width: 820px) {
  .dd-tab-panel {
    padding: 14px;
  }
  .dd-search,
  .dd-filter {
    max-width: none;
    flex: 1 1 100%;
  }
  .dd-count {
    margin-left: 0;
  }
}

/* =============================================================
   COMPANY LEADERBOARD (DIRECT DAX) STYLES
============================================================= */

/* Controls Bar */
.lb-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lb-timeframe-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lb-control-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.lb-filter-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--foreground);
  cursor: pointer;
  transition: var(--transition);
}

.lb-filter-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.lb-filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 139, 53, 0.25);
}

.lb-search-sort-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  width: 240px;
  transition: var(--transition);
}

.lb-search-wrap:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 139, 53, 0.12);
}

.lb-search-wrap svg {
  color: var(--muted-foreground);
}

.lb-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.84rem;
  color: var(--foreground);
  width: 100%;
}

.lb-btn-toggle-dax {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: var(--transition);
}

.lb-btn-toggle-dax:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Podium Showcase Grid */
.lb-podium-section {
  margin: 6px 0 12px 0;
}

.lb-podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 18px;
  align-items: flex-end;
}

@media (max-width: 900px) {
  .lb-podium-grid {
    grid-template-columns: 1fr;
  }
}

.lb-podium-card {
  position: relative;
  background: #ffffff;
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
  overflow: hidden;
}

.lb-podium-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

/* Gold - Rank 1 */
.lb-podium-card.podium-gold {
  background: linear-gradient(180deg, #fffdf0 0%, #ffffff 60%);
  border: 2px solid #fbbf24;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.2);
  padding: 28px 20px;
}

.lb-podium-card.podium-gold:hover {
  box-shadow: 0 16px 36px rgba(251, 191, 36, 0.32);
}

.lb-podium-card.podium-gold .lb-podium-badge {
  background: #fbbf24;
  color: #78350f;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

/* Silver - Rank 2 */
.lb-podium-card.podium-silver {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 60%);
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 4px 16px rgba(148, 163, 184, 0.15);
}

.lb-podium-card.podium-silver .lb-podium-badge {
  background: #94a3b8;
  color: #ffffff;
}

/* Bronze - Rank 3 */
.lb-podium-card.podium-bronze {
  background: linear-gradient(180deg, #fffbf5 0%, #ffffff 60%);
  border: 1.5px solid #fdba74;
  box-shadow: 0 4px 16px rgba(253, 186, 116, 0.2);
}

.lb-podium-card.podium-bronze .lb-podium-badge {
  background: #f97316;
  color: #ffffff;
}

.lb-podium-badge-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lb-podium-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 9999px;
}

.lb-podium-rank-pill {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted-foreground);
}

.lb-podium-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.lb-podium-company {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--foreground);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-podium-city {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 16px;
}

.lb-podium-main-stat {
  padding: 12px 10px;
  background: rgba(0, 139, 53, 0.06);
  border: 1px dashed rgba(0, 139, 53, 0.25);
  border-radius: 10px;
  margin-bottom: 14px;
}

.lb-podium-stat-val {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  font-family: 'Outfit', sans-serif;
}

.lb-podium-stat-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.lb-podium-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.lb-podium-mini-col {
  text-align: center;
}

.lb-mini-val {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--foreground);
}

.lb-mini-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

/* Leaderboard Table Specific Styles */
.lb-table th {
  user-select: none;
  white-space: nowrap;
}

/* Compact rows so the top 10 fits on one screen */
.lb-table th,
.lb-table td {
  padding: 8px 14px;
  vertical-align: middle;
}

.lb-table .lb-th-rank,
.lb-table .lb-td-rank {
  width: 110px;
  text-align: center;
}

.lb-table .lb-th-metric {
  width: 30%;
}

.lb-table .lb-th-size,
.lb-table .lb-td-size {
  width: 170px;
}

.lb-table .lb-rank-cell {
  flex-direction: row;
  gap: 6px;
}

.lb-metric-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-metric-cell-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.lb-table th:hover {
  color: var(--primary);
}

.lb-table-row:hover {
  background: #f8fafc !important;
}

.lb-table-row.top-tier-row {
  background: #fcfdfc;
}

.lb-rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.lb-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.lb-rank-badge.rank-1 {
  background: rgba(251, 191, 36, 0.2);
  color: #b45309;
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.lb-rank-badge.rank-2 {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.lb-rank-badge.rank-3 {
  background: rgba(249, 115, 22, 0.18);
  color: #c2410c;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.lb-company-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-company-name {
  font-weight: 700;
  color: var(--foreground);
  font-size: 0.9rem;
}

.lb-company-group {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.lb-city-badge {
  display: inline-block;
  padding: 3px 9px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
}

.lb-bookings-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

/* Last-week comparison (value + position change) */
.lb-prev-val {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: #64748b;
}

.lb-rank-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.lb-rank-move {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 1px 6px;
  border-radius: 9999px;
  white-space: nowrap;
  background: #f1f5f9;
  color: #64748b;
}

.lb-prev-val.up,
.lb-rank-move.up {
  color: #15803d;
}

.lb-prev-val.down,
.lb-rank-move.down {
  color: #dc2626;
}

.lb-rank-move.up {
  background: #dcfce7;
}

.lb-rank-move.down {
  background: #fee2e2;
}

.lb-rank-move.new {
  background: #dbeafe;
  color: #1d4ed8;
}

.lb-bookings-val {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--foreground);
  font-family: 'Outfit', sans-serif;
}

.lb-progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.lb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #008b35);
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lb-rate-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.lb-rate-pill.rate-good {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.lb-rate-pill.rate-warn {
  background: rgba(234, 179, 8, 0.12);
  color: #a16207;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.lb-rate-pill.rate-bad {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.lb-drivers-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

/* Parameter Tabs Card & Navigation */
/* When the leaderboard data was captured */
.lb-updated-at {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Leaderboard parameter tabs: browser-style tabs sitting on the leaderboard panel */
.lb-tabbed {
  display: flex;
  flex-direction: column;
}

.lb-metric-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 12px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.lb-metric-tab {
  flex: 1 1 0;
  min-width: 0;
  max-width: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  background: #eef2f6;
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--muted-foreground);
}

.lb-metric-tab:hover {
  background: #e2e8f0;
}

.lb-metric-tab.active {
  background: #ffffff;
  border-bottom-color: #ffffff;
  padding-top: 12px;
  box-shadow: inset 0 3px 0 var(--primary);
  color: var(--foreground);
}

.lb-tab-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* The table card already sits inside the tab panel, so drop its own frame */
.lb-tab-panel .custom-card-panel {
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Table is the main focus; top-3 cards stack in a narrow column on the right */
.lb-tab-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 20px;
}

.lb-tab-panel > .custom-card-panel {
  order: 1;
}

.lb-tab-panel > .lb-podium-section {
  order: 2;
  margin: 0;
}

.lb-podium-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-podium-card.lb-podium-compact {
  padding: 12px 14px;
  text-align: left;
}

.lb-podium-card.lb-podium-compact:hover {
  transform: none;
}

.lb-podium-compact .lb-podium-badge-wrap {
  margin-bottom: 8px;
}

.lb-podium-compact-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.lb-podium-compact-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.lb-podium-compact-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lb-podium-compact .lb-podium-company {
  font-size: 0.95rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-podium-compact-size {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.lb-podium-compact .lb-podium-main-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin: 0;
}

.lb-podium-compact .lb-podium-stat-val {
  font-size: 1.3rem;
}

/* Parameters not yet available in the dataset */
.lb-metric-tab.is-soon {
  cursor: not-allowed;
  opacity: 0.6;
}

.lb-metric-tab.is-soon:hover {
  background: #eef2f6;
}

.lb-tab-soon {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
}

.lb-tab-panel #lbTableWrap {
  overflow-x: auto;
}

@media (max-width: 1400px) {
  .lb-tab-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .lb-tab-panel > .lb-podium-section {
    order: 0;
  }

  .lb-podium-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .lb-podium-stack {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .lb-metric-tabs {
    overflow-x: auto;
    padding: 0 4px;
  }

  .lb-metric-tab {
    flex: 0 0 auto;
    max-width: none;
  }

  .lb-tab-panel {
    padding: 16px;
  }
}

.lb-metric-tab .lb-tab-icon {
  font-size: 1.15rem;
}

.lb-metric-tab .lb-tab-title {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--foreground);
}

.lb-metric-tab.active .lb-tab-title {
  color: var(--primary);
  font-weight: 800;
}

/* Active Metric Table Column Highlighting */
th.active-metric-th {
  background: rgba(0, 139, 53, 0.08) !important;
  color: var(--primary) !important;
  font-weight: 800 !important;
  border-bottom: 2px solid var(--primary) !important;
}

td.active-metric-td {
  background: rgba(0, 139, 53, 0.025);
}

.highlight-val {
  font-weight: 900 !important;
  color: var(--primary) !important;
  font-size: 1.05rem !important;
}

.highlight-pill {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
}

.highlight-badge {
  background: #f0fdf4 !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
}

.lb-progress-fill.rev-fill {
  background: linear-gradient(90deg, #34d399, #059669);
}

.lb-progress-fill.total-fill {
  background: linear-gradient(90deg, #94a3b8, #475569);
}

.lb-progress-fill.rate-fill {
  background: linear-gradient(90deg, #38bdf8, #0284c7);
}

.lb-progress-fill.driver-fill {
  background: linear-gradient(90deg, #818cf8, #4f46e5);
}




/* ==========================================
   Reports synced from Power BI + per-user report access
   ========================================== */
.report-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  color: #475569;
}

.report-sync-bar .btn-secondary {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 0.8rem;
}

.admin-group-row td {
  background: #f1f5f9;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.admin-group-count {
  margin-left: 6px;
  font-weight: 600;
  color: #64748b;
}

.access-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.access-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.access-count.none {
  color: #94a3b8;
  font-weight: 500;
}

.access-manage-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.modal-dialog.report-access-dialog {
  max-width: 560px;
  height: 80vh;
}

.report-access-dialog .modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  overflow: hidden;
  flex: 1;
}

.report-access-summary {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.report-access-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.access-group + .access-group {
  border-top: 1px solid var(--border);
}

.access-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.access-group-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.access-chevron {
  display: inline-block;
  color: #64748b;
  transition: transform 0.15s ease;
}

.access-group.open .access-chevron {
  transform: rotate(90deg);
}

.access-group-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-group-count {
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
}

.access-group-items {
  display: none;
  padding: 4px 12px 8px 34px;
}

.access-group.open .access-group-items {
  display: block;
}

.access-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.83rem;
  color: #334155;
  cursor: pointer;
}

.access-empty {
  padding: 24px;
  text-align: center;
  font-size: 0.83rem;
  color: #94a3b8;
}

.report-access-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

/* Portal version under the user's name in the sidebar */
.app-version {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

/* =============================================================
   USAGE GUIDE
============================================================= */
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.guide-toc a {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.guide-toc a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.guide-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-card {
  padding: 18px 22px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 16px;
}

.guide-card h4 {
  margin-bottom: 8px;
  font-size: 0.98rem;
  color: var(--foreground);
}

.guide-card p,
.guide-card li {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #334155;
}

.guide-card ul,
.guide-card ol {
  margin: 6px 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-card ol + ul {
  margin-top: 10px;
}

.guide-tip {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  background: var(--primary-light);
}

/* Tools & Dictionary is no longer collapsible: its header is just a label */
.sidebar-bottom-header {
  cursor: default;
}

.sidebar-bottom-header:hover {
  background-color: transparent;
}

/* Usage Guide screenshots (captured at 2x; click to open full size) */
.guide-figure {
  margin: 14px 0 4px;
}

.guide-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.guide-figure a {
  display: inline-block;
  max-width: 100%;
}

.guide-figure figcaption {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #64748b;
}

.guide-figure--narrow img {
  max-width: 290px;
}

.guide-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.guide-steps .guide-figure {
  flex: 0 1 auto;
  max-width: 100%;
}

.guide-steps--wide .guide-figure {
  flex: 1 1 420px;
}
