
/* =LOUDXPLORER.CSS - Unified Stylesheet
   Merged from layout.css + main.css
   =============================================== */

/* ===========================
   CSS Variables & Root
=========================== */
:root {
  --font-family: 'Inter', system-ui, sans-serif;
  --color-bg: #0b0e12;
  --color-bg-alt: #12161d;
  --color-surface: #161b23;
  --color-text: #f5f5f5;
  --color-text-muted: #a5a5a5;
  --color-accent: #3b82f6;
  --color-border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --transition: all 0.3s ease;
  --bg-dark: #0f141a;
  --bg-panel: #1a2028;
  --text-light: #e6e8eb;
  --border: #2a3038;
  --accent: #5ec2b7;
  --accent-hover: #4aa89f;
  --primary: #2563eb;
  --secondary: #3b82f6;
}

/* ===========================
   Global Reset & Base Styles
=========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ===========================
   Layout Structure
=========================== */
header {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  background: linear-gradient(to bottom, #0f141a, #10161c);
  border-bottom: none;
  box-shadow: none;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

main.loaded {
  opacity: 1;
}

main.loaded #center {
  transform: translateY(0);
  opacity: 1;
}

/* ===========================
   Top Header / Navbar
=========================== */
.top-header {
  background: linear-gradient(135deg, #1e63f0 0%, #1550c3 70%, #0e3fa1 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  height: 48px;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  color: #e2e8f0;
  overflow: visible;
}

.top-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top left,
    rgba(255, 255, 255, 0.08),
    transparent 70%
  );
  background-size: 200% 100%;
  animation: cloud-shimmer 20s linear infinite;
  pointer-events: none;
}

@keyframes cloud-shimmer {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 0%;
  }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-logo {
  height: 18px;
  width: auto;
  margin-top: -4px;
  transform: scale(1.4);
  transform-origin: left center;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
  transition: transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.navbar-logo:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.app-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  margin-left: 10px;
  opacity: 0.9;
  transition: opacity 0.1s ease;
}

/* Provider Menu */
.provider-menu {
  position: relative;
}

#providerToggle {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: background 0.2s;
  position: relative;
  z-index: 99999;
}

#providerToggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

#providerMenu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  list-style: none;
  z-index: 10000;
  min-width: 160px;
  margin-top: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#providerMenu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

#providerMenu li {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

#providerMenu li:hover {
  background: rgba(96, 165, 250, 0.2);
}

/* ===========================
   Navigation Sidebar
=========================== */
#nav {
  flex: 0 0 240px;
  background: linear-gradient(to bottom, #111418, #10161c);
  padding: 1rem;
  border-radius: 12px;
  color: #e6e8eb;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.45),
    inset -1px 0 0 rgba(255, 255, 255, 0.05);
  scrollbar-gutter: stable;
}

#nav h3 {
  color: #d9e2ec;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

/* Add this to your new CSS file */
@media (max-width: 639px) {
  #nav {
    display: none !important;
  }
}

@media (min-width: 640px) {
  #nav {
    display: flex !important;
    flex-direction: column;
  }
}

/* ===========================
   Center Panel
=========================== */
#center {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, #10161c, #0f141a);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

/* ===========================
   Top Bar (Breadcrumb Area)
=========================== */
#top-bar {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #1e3a8a 0%, #0f172a 85%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.25);
}

#top-bar > div {
  min-width: 0;
}

/* Home Badge */
.home-card {
  text-decoration: none;
}

.home-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #0078ff, #00b4ff);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 22px;
  transition: all 0.2s;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.home-badge:hover {
  background: rgba(96, 165, 250, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 136, 255, 0.35);
}

.home-badge .emoji {
  font-size: 1.2rem;
}

.home-badge .label {
  color: #93c5fd;
  font-weight: 500;
}

.home-badge .count {
  background: rgba(255, 255, 255, 0.25);
  color: #0f172a;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Breadcrumb */
#breadcrumb-container {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#breadcrumb,
.breadcrumb,
.breadcrumbs,
.breadcrumb-display {
  background: linear-gradient(145deg, #1b2533, #141a22);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-display {
  display: flex;
}

.breadcrumb-display span {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.breadcrumb-display span:hover {
  background: rgba(255, 255, 255, 0.1);
}

.breadcrumb-display span.current,
#breadcrumb .current,
#breadcrumb [aria-current='page'],
#breadcrumb span:last-child {
  color: #f8fafc;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
  cursor: default;
  text-decoration: none;
}

.breadcrumb-display .sep,
#breadcrumb .sep,
#breadcrumb .separator {
  cursor: default;
  padding: 0;
  color: #94a3b8;
  opacity: 0.9;
}

#breadcrumb a,
.breadcrumb a,
#breadcrumb span:not(.current):not([aria-current='page']):not(:last-child) {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
}

#breadcrumb a:hover,
.breadcrumb a:hover,
#breadcrumb span:hover {
  color: #93c5fd;
  text-decoration: underline;
}

#provider-select {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
}

/* Search & Controls */
#search {
  flex-shrink: 1;
  width: 200px;
  max-width: 25vw;
  min-width: 140px;
  padding: 6px 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #e2e8f0;
}

#search:focus {
  outline: none;
  border-color: #60a5fa;
}

#mode-toggle {
  padding: 6px 12px;
  background: #60a5fa;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

#mode-toggle:hover {
  background: #3b82f6;
}

#mode-toggle[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-btn {
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ===========================
   Explorer Wrapper (Scrollable Content)
=========================== */
#explorer-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 2rem;
  scrollbar-gutter: stable;
}

#explorer {
  min-height: 400px;
}

#explorer h3 {
  position: relative;
  top: auto;
  z-index: auto;
}

/* ===========================
   Welcome / Dashboard
=========================== */
.welcome-container {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
}

.welcome-container h2 {
  color: #93c5fd;
  margin-bottom: 24px;
}

#mainDashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 80vh;
  margin-top: 40px;
}

#dashboardRow {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 80px;
  width: 100%;
}

/* Provider Chart */
#providerChartContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 16px;
  padding: 16px;
  width: min(90%, 560px);
  height: 380px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#providerChartContainer:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
}

#providerChartContainer h3 {
  color: #93c5fd;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

#providerChart {
  min-width: 340px;
  min-height: 340px;
}

.chart-container canvas {
  background-color: #0f172a;
  border-radius: 8px;
  padding: 10px;
}

.chartjs-legend,
.chart-label {
  color: #e2e8f0;
  font-weight: 500;
  font-size: 0.9rem;
}

.chartjs-tooltip {
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.helper-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
  table-layout: fixed;
  margin-top: 10px;
  margin-bottom: 10px;
  border-spacing: 0;
}

.helper-table th, .helper-table td {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.helper-table th {
  background-color: #1e293b;
  color: #93c5fd;
  text-align: left;
}

.helper-table td {
  border-bottom: 1px solid #334155;
  vertical-align: middle;
}

.helper-table tr:nth-child(even) {
  background-color: #16223a;
}
.helper-table tr:hover {
  background-color: #1e3a5f;
  transition: background 0.15s ease-in-out;
}


.helper-table a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 500;
}

.helper-table a:hover {
  text-decoration: underline;
}

.helper-table td:first-child {
  font-weight: 600;
  width: 140px;
}

.helper-table td:nth-child(2),
.helper-table td:nth-child(3) {
  width: 180px;
}

.helper-table td:last-child {
  width: auto;
}

/* Entire analysis container */

#analysisSection {
  width: min(95%, 900px);
  background: #0b1120;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.65);
  color: #e2e8f0;
  margin: 40px auto;
  max-width: 1200px;
  max-height: 85vh;       /* prevents overflow beyond screen */
  overflow-y: auto;       /* makes content scrollable */
  overflow-x: hidden;
  padding-bottom: 10px;
  padding: 20px 30px;
}

/* Optional: makes the scrollbar look good on dark backgrounds */
#analysisSection::-webkit-scrollbar {
  width: 8px;
}

#analysisSection::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
}

#analysisSection::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Header + Close button in one unified top bar */
.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  padding: 14px 20px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.analysis-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f9fafb;
  letter-spacing: 0.4px;
}

#closeAnalysisBtn {
  background: #dc2626;
  color: #f9fafb;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
#closeAnalysisBtn:hover {
  background: #ef4444;
  transform: scale(1.05);
}

/* Inner text area (executive summary block) */
#analysisSummary pre {
  background: #111827;
  color: #f3f4f6;
  padding: 25px;
  border-radius: 0 0 12px 12px;
  border-left: 4px solid #3b82f6;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: "Fira Code", monospace;
  line-height: 1.6;
}

/* Headings inside the preformatted text */
#analysisSummary pre h3,
#analysisSummary pre h4 {
  color: #93c5fd;
  margin-top: 16px;
}

/* Emphasis and highlights */
#analysisSummary pre strong {
  color: #38bdf8;
}
#analysisSummary pre em {
  color: #facc15;
}

/* Insights and anomalies sections */
#insightsList, #anomaliesList {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 15px 20px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
}
#insightsList li::before { content: "✅ "; }
#anomaliesList li::before { content: "❌ "; }

h4 {
  color: #93c5fd;
  margin: 0 20px 5px 20px;
  border-bottom: 1px solid #334155;
  padding-bottom: 5px;
  font-size: 1rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Markdown-rendered report */
.markdown-body {
  background: #111827;
  color: #e2e8f0;
  padding: 25px 30px;
  border-radius: 0 0 12px 12px;
  border-left: 4px solid #3b82f6;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
  font-family: 'Inter', 'Fira Code', monospace;
  line-height: 1.6;
}

.markdown-body h3 {
  color: #60a5fa;
  margin-top: 20px;
  border-bottom: 1px solid #1e3a8a;
  padding-bottom: 6px;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.8px;
}

.markdown-body h4 {
  color: #a5b4fc;
  margin-top: 14px;
}

.markdown-body strong {
  color: #facc15;
}

.markdown-body em {
  color: #f87171;
}

.markdown-body ul {
  margin: 10px 0 10px 20px;
}

.markdown-body li {
  margin-bottom: 6px;
}

/* Keep the dark container around everything */
#analysisSection {
  background: #0b1120;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.65);
  padding: 0;
  margin: 40px auto;
  max-width: 1200px;
  color: #e2e8f0;
}

.close-btn {
  background: #dc2626;
  color: #f9fafb;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.close-btn:hover {
  background: #ef4444;
  transform: scale(1.05);
}

#complianceDashboard {
  background: #0b1120;
  color: #e2e8f0;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  padding: 20px;
  margin: 40px auto;
  max-width: 1200px;
  overflow-y: auto;
  animation: fadeIn 0.4s ease-in-out;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  padding: 10px 20px;
  border-radius: 12px 12px 0 0;
  margin-bottom: 20px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: #111827;
  border-radius: 10px;
  padding: 20px;
}

.summary-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.summary-cards .card {
  background: #1e293b;
  padding: 15px 25px;
  border-radius: 10px;
  text-align: center;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
}

.controls-table {
  background: #111827;
  border-radius: 10px;
  padding: 15px;
}

.controls-table table {
  width: 100%;
  border-collapse: collapse;
}

.controls-table th, .controls-table td {
  border-bottom: 1px solid #334155;
  padding: 10px;
}

.status-dot {
  height: 10px;
  width: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-compliant { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-partial { background: #facc15; box-shadow: 0 0 6px #facc15; }
.status-noncompliant { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

#narrativeOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9998;
  backdrop-filter: blur(3px);
  justify-content: flex-end;
  align-items: flex-start;
  padding: 40px;
  animation: fadeIn 0.3s ease-in-out;
}

.narrative-box {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  padding: 20px 25px;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: slideIn 0.4s ease-in-out;
  border-left: 4px solid #3b82f6;
}

.narrative-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid #334155;
  padding-bottom: 6px;
}

.narrative-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #93c5fd;
}

#closeNarrativeBtn {
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}
#closeNarrativeBtn:hover {
  transform: scale(1.2);
  color: #f87171;
}

#narrativeContent {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 10px;
}

#narrativeContent strong {
  color: #38bdf8;
}
#narrativeContent em {
  color: #facc15;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


.analysis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(6px);
  z-index: 4000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 30px;
}

.overlay-content {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  width: 90%;
  height: 85%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.overlay-body {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.narrative-panel, .dashboard-panel {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scrollable-panel {
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.close-overlay {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.close-overlay:hover {
  background: #dc2626;
}

@media (max-width: 900px) {
  .overlay-body {
    flex-direction: column;
  }
}

.analysis-overlay {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.97);
  backdrop-filter: blur(6px);
  z-index: 4000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 30px;
  animation: fadeIn 0.3s ease;
}

.overlay-content {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  width: 90%;
  height: 85%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.overlay-body {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.narrative-panel,
.dashboard-panel {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scrollable-panel {
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.close-overlay {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.close-overlay:hover {
  background: #dc2626;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .overlay-body {
    flex-direction: column;
  }
}
#complianceDashboard {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  width: 70%;
  max-width: 1200px;
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2rem;
  display: none;
  animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.chart-grid {
  display: flex;
  justify-content: space-around;
  gap: 2rem;
  margin-top: 2rem;
}

.chart-card {
  flex: 1;
  background: rgba(255,255,255,0.03);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  min-height: 350px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.4);
}
.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
}

/* Overlay behind the modal */
.compliance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding-top: 5vh;
  z-index: 9999;
}

.compliance-modal {
  background: #0b1624;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2.5rem 3rem;
  width: 90%;
  max-width: 1400px;
  min-height: 70vh;  /* gives room for charts */
  animation: fadeInUp 0.4s ease-out;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}


@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chart-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: flex-start;
  gap: 2rem;
  margin-top: 2rem;
}

.chart-card {
  flex: 1 1 45%;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  min-height: 420px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
 }

.summary-cards {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.compliance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.compliance-modal {
  background: #0b1624;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2.5rem 3rem;
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  color: white;
  animation: slideDown 0.4s ease-out;
  overflow-y: auto;
}

/* Header */
.compliance-modal .dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Summary cards */
.summary-cards {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Chart layout */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  flex: 1;
  align-items: stretch;
}

.chart-card {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 450px;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chart-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.chart-box {
  background: #1e293b;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;            /* ✅ This anchors the chart height */
  min-width: 400px;
  overflow: hidden;
}

.chart-box canvas {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

.compliance-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 4rem 0;
  justify-content: center;
  align-items: flex-start;
}

.dashboard-modal {
  margin: auto;
  background: #0f172a;
  color: #f9fafb;
  border-radius: 18px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2rem 2.5rem;
  width: 90%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-header {
  text-align: left;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f1f5f9;
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 0.75rem;
}

.summary-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1rem;
}

.summary-cards .card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  box-shadow: 0 0 15px rgba(0, 150, 255, 0.15);
  color: #e2e8f0;
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 160px;
  transition: all 0.25s ease;
  font-weight: 600;
}

.summary-cards .card:hover {
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
  transform: translateY(-2px);
}

.summary-cards .card i {
  font-size: 1rem;
}

.card.success { border-left: 4px solid #22c55e; }
.card.warning { border-left: 4px solid #facc15; }
.card.danger  { border-left: 4px solid #ef4444; }
.card.total   { border-left: 4px solid #3b82f6; }

.chart-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.chart-box {
  background: #1e293b;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 420px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.chart-box h3 {
  margin-bottom: 0.5rem;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 1.1rem;
}

.chart-box canvas {
  width: 90% !important;
  height: 90% !important;
  object-fit: contain;
}

.close-btn {
  align-self: center;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #ef4444;
}
.dashboard-modal {
  position: relative;
  overflow: hidden;
}

.dashboard-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(56,189,248,0.2), rgba(59,130,246,0.2), rgba(16,185,129,0.2));
  filter: blur(25px);
  z-index: 0;
  opacity: 0.3;
}

.dashboard-modal > * {
  position: relative;
  z-index: 1;
}

/* === Executive Narrative Modal Redesign === */
.narrative-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
}

.narrative-modal.hidden {
  display: none;
}

.narrative-dialog {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  width: min(95%, 1200px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.narrative-header {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.narrative-close {
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.narrative-close:hover {
  background: #b91c1c;
}

.narrative-body {
  padding: 20px 40px 30px 40px;
  overflow-y: auto;
  color: #e2e8f0;
  line-height: 1.7;
  font-size: 1rem;
}

.narrative-content {
  max-width: 1100px;
  margin: 0 auto;
}

/* --- Text and Sections --- */
.narrative-body h1, .narrative-body h2, .narrative-body h3 {
  color: #60a5fa;
  border-bottom: 1px solid rgba(96, 165, 250, 0.3);
  padding-bottom: 4px;
  margin-top: 20px;
  margin-bottom: 12px;
}

.narrative-body strong {
  color: #facc15;
  font-weight: 600;
}

.narrative-body p {
  margin: 10px 0;
}

.narrative-body ul {
  margin: 10px 0 10px 24px;
  padding-left: 16px;
}

.narrative-body li {
  margin-bottom: 6px;
}

/* --- Loader Spinner --- */
.narrative-content .loader {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  margin: 40px auto 10px auto;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.tip {
  color: #fbbf24;
  font-style: italic;
  margin-top: 12px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.button-group a {
  padding: 8px 12px;
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  transition: all 0.2s;
  text-align: center;
}

.button-group a:hover {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-2px);
}

details {
  margin-top: 12px;
}

details summary {
  cursor: pointer;
  color: #60a5fa;
  font-weight: 500;
}

details pre {
  background: #0f172a;
  padding: 12px;
  border-radius: 6px;
  margin-top: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: #cbd5e1;
}

/* Upload Section */
#uploadSection {
  margin-top: 20px !important; /* used to be 60px */
  background: rgba(15, 23, 42, 0.85);
  border-radius: 16px;
  padding: 30px 40px;
  width: min(90%, 560px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#uploadSection:hover {
  transform: scale(1.02);
  box-shadow: 0 0 25px rgba(96, 165, 250, 0.6);
}

#uploadSection h3 {
  color: #93c5fd;
  margin-bottom: 10px;
}

#uploadSection > p {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.file-input-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 12px;
}

.file-input-row label {
  color: #a1a1aa;
}

.file-input-row input[type='file'],
#uploadForm input[type='file'] {
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 8px;
  width: 230px;
  font-size: 0.9rem;
}

#uploadForm input[type='file']::-webkit-file-upload-button,
.file-input-row input[type='file']::file-selector-button {
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

#uploadSection button {
  margin-top: 16px;
  padding: 10px 24px;
  background: #60a5fa;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

#uploadSection button:hover {
  background: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.upload-tip {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 12px;
}

/* ===========================
   Provider Cards
=========================== */
.provider-card {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 10px 0;
  padding: 12px 0;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
  color: #f9fafb;
  background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.provider-card:hover {
  background: linear-gradient(145deg, #0057ff, #00a1d6);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.provider-card:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.provider-card[data-provider='azure'] {
  --brand: #0078d7;
}
.provider-card[data-provider='aws'] {
  --brand: #ff9900;
}
.provider-card[data-provider='gcloud'] {
  --brand: #4285f4;
}
.provider-card[data-provider='oci'] {
  --brand: #f80000;
}
.provider-card[data-provider='alibaba'] {
  --brand: #ff6a00;
}
.provider-card[data-provider='ibmcloud'] {
  --brand: #1194d9;
}
.provider-card[data-provider='ovhai'] {
  --brand: #00a1d6;
}

.provider-card:hover {
  color: var(--brand);
  text-shadow: 0 0 8px var(--brand);
  box-shadow: 0 0 14px var(--brand), inset 0 0 8px var(--brand);
}

.provider-card i {
  font-size: 1.5rem;
  width: 24px;
  text-align: center;
}

.icon-azure {
  color: #0078d7;
}
.icon-aws {
  color: #f90;
}
.icon-gcloud {
  color: #4285f4;
}
.icon-oci {
  color: #f80000;
}
.icon-aliyun {
  color: #ff6a00;
}
.icon-ibmcloud {
  color: #1194d9;
}
.icon-ovhai {
  color: #00a1d6;
}

/* ===========================
   Command & Drill Cards
=========================== */
.command-card,
.drill-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin: 8px 0;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.command-card:hover,
.drill-card:hover {
  background: #334155;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px) scale(1.01);
}

.command-card.active {
  background: linear-gradient(145deg, #2563eb, #1e3a8a);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}

.command-card.active strong {
  color: #fff;
}

.command-card small {
  color: #94a3b8;
}

.command-card strong {
  font-weight: 600;
}

.command-card[data-provider='aws'] strong {
  color: #facc15;
}
.command-card[data-provider='az'] strong {
  color: #60a5fa;
}
.command-card[data-provider='oci'] strong {
  color: #fb7185;
}
.command-card[data-provider='gcp'] strong {
  color: #34d399;
}

.drill-card h4 {
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93c5fd;
}

.drill-card.group {
  border-left: 4px solid #94a3b8;
}

.drill-card.leaf {
  border-left: 4px solid #2563eb;
}

.drill-card .meta {
  font-size: 12px;
  opacity: 0.7;
}

/* ===========================
   Control Cards & Grid
=========================== */
.controls-grid,
.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem 0;
  overflow: visible;
  max-height: none;
  height: auto;
  grid-auto-rows: minmax(auto, 1fr);
}

.control-card {
  background: #1e2433;
  color: #f1f5f9;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  position: relative;
  min-height: 140px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  perspective: 1000px;
}

.control-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  border-color: rgba(147, 197, 253, 0.3);
}

.control-card h4,
.control-card h5 {
  margin-top: 0;
  font-weight: 600;
  color: #93c5fd;
  font-size: 1rem;
}

.control-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.control-card p,
.control-card span,
.control-card div {
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
  color: #e2e8f0;
}

.control-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, #0091ff, #00ffff);
  box-shadow: 0 0 6px rgba(0, 145, 255, 0.4);
  opacity: 0.9;
}

/* Card Flip Animation */
.control-card-inner {
  position: relative;
  width: 100%;
  min-height: 180px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.control-card.flipped .control-card-inner {
  transform: rotateY(180deg);
}

.control-card-front,
.control-card-back {
  position: absolute;
  width: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  padding: 16px;
  background: rgba(25, 28, 36, 0.85);
  border: 1px solid rgba(0, 145, 255, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 145, 255, 0.08);
  color: #ffffff;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.control-card-front:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 145, 255, 0.6);
  box-shadow: 0 0 20px rgba(0, 145, 255, 0.25);
}

.control-card-back {
  transform: rotateY(180deg);
  white-space: normal;
  max-height: 250px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
}

.control-card-back:hover {
  overflow-y: auto;
}

.control-card .confidence-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
}

/* Control Navigation */
.control-nav-group {
  margin: 12px 0;
}

.control-nav-header {
  padding: 12px;
  background: rgba(96, 165, 250, 0.15);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: #93c5fd;
  transition: background 0.2s;
}

.control-nav-header:hover {
  background: rgba(96, 165, 250, 0.25);
}

.control-nav-list {
  display: none;
  padding-left: 12px;
}

.control-nav-card,
.control-item {
  padding: 8px 12px;
  margin: 4px 0;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: #cbd5e1;
}

.control-nav-card:hover,
.control-item:hover {
  background: rgba(51, 65, 85, 0.8);
  border-left: 3px solid #60a5fa;
  padding-left: 15px;
}

.control-item {
  background: var(--bg-secondary, #1e293b);
  color: var(--text-primary, #e2e8f0);
}

/* Sidebar Control Styling */
#controls,
.sidebar {
  background-color: #1b2430;
  border-right: 1px solid #2d3748;
  color: #d1d5db;
}

#controls h2,
.sidebar h2 {
  color: #a5b4fc;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 4px;
}

#controls button,
.sidebar button {
  background-color: #27303f;
  color: #e5e7eb;
  border: none;
  border-radius: 6px;
  margin: 4px 0;
  padding: 8px 10px;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

#controls button:hover,
.sidebar button:hover {
  background-color: #334155;
  color: #93c5fd;
}

#controls button.active,
.sidebar button.active {
  background-color: #3b4252;
  border-left: 3px solid #60a5fa;
  color: #e0e7ff;
  font-weight: 600;
}

/* ===========================
   Details Panel
=========================== */
#details {
  display: none;
  background: #0f172a;
  color: #e6e8eb;
  padding: 20px;
  margin: 16px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

#details h2 {
  color: #93c5fd;
  margin-bottom: 8px;
}

#op-title {
  color: #f1f5f9;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 4px;
}

#op-help {
  color: #94a3b8;
  font-style: italic;
  margin-bottom: 10px;
}

#details button {
  margin: 8px 8px 8px 0;
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#details button:hover {
  background: #1d4ed8;
}

/* Form Fields */
#form-container {
  margin: 16px 0;
}

.form-field {
  margin-bottom: 12px;
}

.form-field label {
  display: block;
  color: #cbd5e1;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.form-field input {
  width: 100%;
  padding: 8px 10px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}

.form-field input:focus,
#form-container input[type='text']:focus {
  outline: none;
  border-color: #3a8cff;
}

/* JSON & CLI Display */
#json-display,
#cli-display {
  background: #1e293b;
  color: #e6e8eb;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid #334155;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.45;
}

.json-detail-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #eee;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  overflow-x: auto;
}

.json-detail-card .json-key {
  color: #4ec9b0;
}
.json-detail-card .json-string {
  color: #ce9178;
}
.json-detail-card .json-number {
  color: #b5cea8;
}
.json-detail-card .json-boolean {
  color: #569cd6;
}
.json-detail-card .json-null {
  color: #808080;
}

/* JSON View Scrollbar */
.json-view::-webkit-scrollbar {
  height: 8px;
}

.json-view::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.4);
  border-radius: 10px;
}

.json-view::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148, 163, 184, 0.6);
}

/* JSON Dark Mode Fix */
pre,
pre code,
.json-view,
code[class*='language-'],
div[class*='json'],
pre[class*='json'] {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.added-json pre,
.added-json code {
  background: linear-gradient(145deg, #162b1e, #0d2015);
  border-left: 4px solid #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
}

.removed-json pre,
.removed-json code {
  background: linear-gradient(145deg, #2b1a1a, #1e1010);
  border-left: 4px solid #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.string {
  color: #86efac;
}
.number {
  color: #93c5fd;
}
.boolean {
  color: #fca5a5;
}
.null {
  color: #a5b4fc;
  font-style: italic;
}
.key {
  color: #60a5fa;
}

.meta {
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ===========================
   Diff & Comparison Styles
=========================== */
#diffBreadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 16px 0;
  font-size: 14px;
}

#diffBreadcrumbs span {
  cursor: pointer;
  color: #2563eb;
}

#diffBreadcrumbs span:hover {
  text-decoration: underline;
}

#diffBreadcrumbs .sep {
  color: #9ca3af;
}

.diff-section {
  margin: 24px 0;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.diff-card {
  background: rgba(30, 41, 59, 0.8);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.diff-card:hover {
  background: rgba(51, 65, 85, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.diff-path {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.pill.green {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.pill.orange {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.pill.red {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.backbar {
  margin-bottom: 16px;
}

.backbar button {
  padding: 8px 16px;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.backbar button:hover {
  background: #475569;
}

/* Inventory Cards */
.resource-card,
.inventory-item,
.diff-tile {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-card:hover,
.inventory-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.section-header,
.diff-section h4 {
  background: #0f172a;
  color: #38bdf8;
  border-left: 4px solid #38bdf8;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 600;
}

.badge-added,
.status-added {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid #4ade80;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

.badge-removed,
.status-removed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid #f87171;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

.badge-changed,
.status-changed {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

/* ===========================
   Executive Summary
=========================== */
#analysisSection {
  display: none;
  position: relative;
  background: rgba(30, 41, 59, 0.95);
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin: 16px;
  color: #e2e8f0;
}

#closeAnalysisBtn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

#closeAnalysisBtn:hover {
  background: #dc2626;
}

.summary-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  animation: summaryFadeUp 0.8s ease-out forwards;
}

.summary-card,
.summary-tile {
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  transform: translateY(15px);
  animation: summaryCardRise 0.6s ease-out forwards;
}

.summary-card:nth-child(1) {
  animation-delay: 0.15s;
}
.summary-card:nth-child(2) {
  animation-delay: 0.25s;
}
.summary-card:nth-child(3) {
  animation-delay: 0.35s;
}
.summary-card:nth-child(4) {
  animation-delay: 0.45s;
}

.summary-card:hover,
.summary-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

.summary-card label,
.summary-tile label {
  color: #93c5fd;
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 4px;
}

.summary-card span,
.summary-tile .value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.summary-tile .value.added {
  color: #22c55e;
}
.summary-tile .value.removed {
  color: #ef4444;
}
.summary-tile .value.changed {
  color: #fbbf24;
}
.summary-tile .value.delta {
  color: #38bdf8;
}

.summary-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  animation-delay: 0.6s;
}

.summary-section h3 {
  color: #60a5fa;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.summary-section ul {
  list-style: disc;
  margin-left: 20px;
}

.summary-section ul li {
  color: #cbd5e1;
  line-height: 1.5;
  font-size: 0.9rem;
}

.summary-section ul li::marker {
  color: #38bdf8;
}

.summary-section::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(96, 165, 250, 0.3),
    transparent
  );
  margin: 12px 0;
  opacity: 0;
  animation: dividerFade 1.2s ease 0.8s forwards;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-stat:last-child {
  border-bottom: none;
}

.summary-stat .label {
  color: #cbd5e1;
}

.summary-stat .value {
  font-weight: 600;
  font-size: 1.1rem;
}

.value.added {
  color: #34d399;
}
.value.removed {
  color: #f87171;
}
.value.changed {
  color: #fbbf24;
}
.value.delta {
  color: #60a5fa;
}

.insights-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  padding: 14px 18px;
  margin-bottom: 10px;
}

.insights-list,
.anomalies-list {
  margin-top: 12px;
  padding-left: 16px;
  font-size: 0.9rem;
}

.insights-list li,
.anomalies-list li {
  color: #a5b4fc;
  margin-bottom: 4px;
  list-style: disc;
}

.insights-list li span,
.anomalies-list li span {
  color: #cbd5e1;
}

.summary-close {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.summary-close:hover {
  background: #dc2626;
}

@keyframes summaryFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes summaryCardRise {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dividerFade {
  from {
    opacity: 0;
    width: 0;
  }
  to {
    opacity: 1;
    width: 100%;
  }
}

/* AI Summary Fix */
.ai-summary,
.ai-summary p,
.ai-summary span {
  color: #e6e8eb;
  background-color: #16223b;
}

/* ===========================
   AI Cards
=========================== */
.ai-card {
  background: var(--card-bg, #1e1e1e);
  color: var(--card-fg, #e8e8e8);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.ai-relation {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: #38bdf8;
}

.ai-control {
  font-weight: 600;
  font-size: 0.9rem;
  color: #a5b4fc;
}

.ai-body p {
  margin: 0.4rem 0;
  line-height: 1.45;
  font-size: 0.9rem;
}

.ai-body strong {
  color: #f9fafb;
}

.ai-body code {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.85rem;
  color: #fcd34d;
}

.ai-intent {
  color: #34d399;
}
.ai-evidence {
  color: #fbbf24;
}
.ai-action {
  font-style: italic;
  color: #93c5fd;
  margin-top: 0.6rem;
}

.ai-footer {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: right;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ai-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.ai-confidence {
  font-size: 0.75rem;
  color: #94a3b8;
}

.ai-block {
  margin-top: 8px;
  padding: 10px;
  background: rgba(0, 123, 255, 0.05);
  border-left: 3px solid #0078d4;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #111;
}

.ai-block p {
  margin: 6px 0;
  line-height: 1.4;
}

.ai-block .confidence {
  font-size: 0.8rem;
  color: #555;
}

.control-card.flipped .ai-block {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   Modals
=========================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #1e293b;
  margin: 10% auto;
  padding: 0;
  border-radius: 12px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #cbd5e1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  color: #93c5fd;
  margin: 0;
}

.close-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: #cbd5e1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ef4444;
}

.modal-body {
  padding: 20px;
  color: #cbd5e1;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ===========================
   Provider Modal
=========================== */
.provider-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.provider-modal[hidden] {
  display: none;
}

.provider-modal__dialog {
  background: #0f172a;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  transform: scale(0.97);
  animation: modalIn 0.2s ease forwards;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.provider-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #0f172a, #1e293b);
}

.provider-modal__header h3 {
  color: #60a5fa;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

#provider-modal-close,
.provider-modal__close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

#provider-modal-close:hover,
.provider-modal__close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.provider-modal__body {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}

.provider-modal__stats {
  display: flex;
  gap: 40px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
}

.provider-modal__stats .stat {
  background: rgba(15, 23, 42, 0.8);
  padding: 16px 24px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid rgba(96, 165, 250, 0.3);
  min-width: 120px;
  flex: 1;
}

.provider-modal__stats .stat strong {
  display: block;
  color: #38bdf8;
  font-size: 0.9rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.provider-modal__stats .stat div {
  font-size: 1.25rem;
  font-weight: bold;
  color: #f9fafb;
}

.provider-modal__content {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
}

.provider-modal__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  min-height: 200px;
  max-height: 60vh;
}

.provider-modal__panel h4 {
  color: #93c5fd;
  margin: 0 0 12px;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.cmd-list,
.control-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cmd-list li {
  padding: 8px 12px;
  margin: 0;
  background: #0f172a;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: monospace;
  font-size: 0.9rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-list li:hover {
  background: rgba(51, 65, 85, 0.8);
}

.cmd-list li code {
  color: #e2e8f0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  padding: 4px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-left: 10px;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: rgba(56, 189, 248, 0.3);
}

.control-list li {
  padding: 6px 10px;
  margin: 4px 0;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 0.9rem;
  cursor: help;
  transition: all 0.2s;
}

.control-list li:hover {
  background: rgba(96, 165, 250, 0.2);
  border-left: 3px solid #60a5fa;
  padding-left: 13px;
}

.narrative {
  color: #cbd5e1;
  line-height: 1.6;
  padding: 12px;
  background: #0f172a;
  border-radius: 6px;
  border-left: 3px solid #60a5fa;
  font-size: 0.9rem;
  overflow-y: auto;
}

blockquote {
  border-left: 3px solid #3b82f6;
  padding-left: 10px;
  margin: 8px 0;
  font-style: italic;
  color: #9ca3af;
}

/* ===========================
   Chat Drawer (Security Assistant)
=========================== */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, sans-serif;
  transition: bottom 0.35s ease, right 0.35s ease;
}

#chat-handle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background 0.3s ease,
    transform 0.4s cubic-bezier(0.25, 1.25, 0.5, 1), box-shadow 0.25s ease;
}

#chat-handle:hover {
  background: #005fa3;
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#chat-handle:active {
  transform: scale(0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

#chat-container.chat-open #chat-handle {
  right: 380px;
  transform: scale(0.9);
  transition: transform 0.4s ease, right 0.4s cubic-bezier(0.25, 1.25, 0.5, 1);
}

#chat-box {
  width: 340px;
  height: 420px;
  background: #fff;
  border-radius: 12px 12px 0 12px;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.25, 1.25, 0.5, 1);
  position: fixed;
  bottom: 20px;
  right: 20px;
}

#chat-box.open {
  transform: translateY(0);
  display: flex;
}

#chat-box.maximized {
  position: fixed;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 100%;
  border-radius: 10px;
  background: #0b1120; /* match your Cloud Explorer dark theme */
  color: #e2e8f0;
  z-index: 3000;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease-in-out;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0078d4;
  color: #fff;
  padding: 8px 12px;
  font-weight: 500;
}

.chat-controls {
  display: flex;
  gap: 6px;
}

.chat-controls button,
.chat-header button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.chat-controls button:hover,
.chat-header button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #0f172a;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.chat-input {
  display: flex;
  border-top: 1px solid #ddd;
  background: #fafafa;
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  background: #fafafa;
}

.chat-input button {
  background: #0078d4;
  border: none;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.chat-input button:hover {
  background: #005fa3;
}

.chat-msg {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.25s ease;
}

.chat-msg.user {
  background: #0078d4;
  color: #fff;
  margin-left: auto;
  text-align: right;
  border-bottom-right-radius: 2px;
}

.chat-msg.bot {
  background: #f3f4f6;
  color: #111;
  margin-right: auto;
  border-bottom-left-radius: 2px;
}

.bot-bubble {
  display: inline-block;
  text-align: left;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 14px;
  padding: 8px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #777;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.wink {
  display: inline-block;
  animation: winkAnim 1.4s ease-in-out 1.5s 2;
}

@keyframes winkAnim {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(15deg);
  }
}

/* Chat Developer Mode */
#chat-messages.dev-mode {
  background: #111827;
  color: #e5e7eb;
  font-family: 'Fira Code', 'Menlo', monospace;
  padding: 12px;
  border-top: 1px solid #1f2937;
}

#chat-messages.dev-mode pre,
#chat-messages.dev-mode code {
  background: #1e293b;
  color: #93c5fd;
  display: block;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-x: auto;
}

#chat-messages.dev-mode strong {
  color: #facc15;
}

#chat-messages.dev-mode .chat-msg {
  border-left: 3px solid #fbbf24;
  padding-left: 12px;
}

#chat-messages.dev-mode .chat-msg.bot {
  border-left: 3px solid #3b82f6;
  padding-left: 10px;
}

#chat-messages.dev-mode .chat-msg.user {
  border-left: 3px solid #10b981;
  padding-left: 10px;
}

/* Chat Authentication Modal */
#chat-auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  pointer-events: auto;
}

#chat-auth-modal.hidden {
  display: none;
}

.auth-content {
  position: relative;
  pointer-events: auto;
  background: #141a24;
  color: #e0e6ef;
  width: 320px;
  padding: 28px 36px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: fadeIn 0.25s ease;
}

.auth-content h3 {
  font-weight: 600;
  font-size: 1.1rem;
  color: #f8f9fa;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-content p {
  color: #cbd5e1;
  margin-bottom: 16px;
}

.auth-content input {
  width: 100%;
  padding: 10px;
  margin: 12px 0 16px 0;
  border-radius: 6px;
  border: 1px solid #2a2f38;
  background: #1e2532;
  color: #f8f9fa;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-content input:focus {
  border-color: #3a8cff;
}

.auth-buttons,
.auth-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-content button,
#chat-auth-cancel,
#chat-auth-submit {
  background: linear-gradient(90deg, #0078d4, #0094ff);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.3s ease;
}

#chat-auth-cancel {
  background: #374151;
  color: #d1d5db;
}

#chat-auth-cancel:hover {
  background: #475569;
  filter: brightness(1.1);
}

#chat-auth-submit {
  background: #2563eb;
}

#chat-auth-submit:hover {
  background: linear-gradient(90deg, #0094ff, #0078d4);
  transform: scale(1.04);
}

/* ===========================
   Buttons
=========================== */
button,
.helper-buttons a {
  margin: 6px 4px 0 0;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

button:hover,
.helper-buttons a:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

button:active {
  transform: translateY(0);
  background: #1e40af;
}

/* ===========================
   Toast Notifications
=========================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  min-width: 200px;
  margin-bottom: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  animation: fadeInOut 4s forwards;
}

.toast.info {
  background: #2563eb;
}

.toast.success {
  background: #16a34a;
}

.toast.warning {
  background: #f59e0b;
}

.toast.error {
  background: #dc2626;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  10%,
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.copy-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(56, 189, 248, 0.15);
  color: #e2e8f0;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(94, 194, 183, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10000;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Banner Messages
=========================== */
.banner {
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  border-left: 4px solid;
}

.banner.info {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  color: #93c5fd;
}

.banner.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #fca5a5;
}

.banner.warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #fde047;
}

.banner.success {
  background: rgba(52, 211, 153, 0.1);
  border-color: #34d399;
  color: #6ee7b7;
}

.banner .top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 8px;
}

.banner .icon {
  font-size: 1.2rem;
}

.banner .footer {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 8px;
}

/* ===========================
   Spinner / Loading
=========================== */
#spinner {
  display: none;
  text-align: center;
  margin: 20px;
}

.loader {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#global-spinner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #cbd5e1;
  font-family: sans-serif;
}

/* ===========================
   Helper Sections
=========================== */
.helper-section {
  margin-top: 50px;
  padding: 20px;
  background-color: #f9fafc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background-color 0.3s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.helper-section h3 {
  font-weight: 600;
  font-size: 1.3rem;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.helper-section p {
  margin: 0 0 15px;
  color: #4b5563;
}

.helper-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.helper-buttons a {
  display: inline-block;
  padding: 8px 14px;
  background-color: #2563eb;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.helper-buttons a:hover {
  background-color: #1d4ed8;
  transform: translateY(-2px);
}

.helper-buttons a:active {
  transform: translateY(0);
  background-color: #1e40af;
}

.helper-section details {
  margin-top: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.helper-section summary {
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  transition: color 0.2s ease;
}

.helper-section summary:hover {
  color: #2563eb;
}

.helper-section pre {
  background-color: #111;
  color: #f5f5f5;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 10px;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ===========================
   Section Dividers
=========================== */
.section-separator,
.section-divider,
hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

/* ===========================
   Footer
=========================== */
.app-footer {
  text-align: center;
  padding: 1rem 0;
  background: #0f172a;
  color: #9ca3af;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ===========================
   Utility Classes
=========================== */
.hidden {
  display: none !important;
}

.muted {
  color: #64748b;
  font-style: italic;
}

.error {
  color: #ef4444;
}

/* ===========================
   Scrollbar Styling
=========================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

#explorer-wrapper,
.controls-grid,
.control-grid {
  scrollbar-gutter: stable;
}

/* ===========================
   Typography
=========================== */
h1,
h2,
h3 {
  color: #ffffff;
  text-shadow: 0 0 6px rgba(0, 145, 255, 0.4);
}

/* ===========================
   Dark Mode Overrides
=========================== */
.dark-mode .helper-section {
  background-color: #111827;
  color: #e5e7eb;
}

.dark-mode .helper-section h3 {
  color: #60a5fa;
}

.dark-mode .helper-section p {
  color: #9ca3af;
}

.dark-mode .helper-section details {
  border-top: 1px solid #374151;
}

.dark-mode .helper-section summary {
  color: #d1d5db;
}

.dark-mode .home-badge {
  background: linear-gradient(135deg, #0b2340, #163c60);
  color: #e0e6ed;
}

.dark-mode .home-badge .count {
  background: rgba(255, 255, 255, 0.15);
}

.dark-mode .chat-msg.bot {
  background: #2a2a2a;
  color: #e5e7eb;
}

.dark-mode #chat-box {
  background: #1e293b;
  color: #e5e7eb;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}

.dark-mode #chat-box.maximized {
  background: #111827;
  color: #e5e7eb;
}

.dark-mode #chat-box.maximized .chat-input {
  background: #1e293b;
  border-color: #374151;
}

.dark-mode #chat-handle {
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.dark-mode #chat-handle:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.dark-mode .logout-btn {
  border-color: #60a5fa;
  color: #60a5fa;
}

.dark-mode .logout-btn:hover {
  background-color: #60a5fa;
  color: #0f172a;
}

.dark-mode #compareResult {
  background: #1e293b;
  color: #e5e7eb;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.dark-mode #compareResult h3 {
  color: #60a5fa;
}

.dark-mode .visitor-tile {
  background: linear-gradient(135deg, #1e293b, #111827);
  border: 1px solid #334155;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode .visitor-tile h4 {
  color: #9ca3af;
}

.dark-mode .visitor-tile .visitor-count {
  color: #60a5fa;
}

.dark-mode .visitor-tile .subtext {
  color: #94a3b8;
}

/* ===========================
   Responsive Design
=========================== */
@media (max-width: 768px) {
  body {
    font-size: 15px;
    overflow-x: hidden;
  }

  #top-bar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  #dashboardRow {
    flex-direction: column;
    gap: 40px;
  }

  #providerChartContainer,
  #uploadSection,
  #infoCards {
    width: 90% !important;
    max-width: none !important;
    margin: 0 auto;
  }

  #chat-box {
    width: 100%;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .provider-modal__content {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .diff-grid {
    grid-template-columns: 1fr;
  }

  .top-header {
    flex-direction: row;
  }

  .app-title {
    display: block;
    margin-top: 5px;
  }

  input[type='text'] {
    width: 100%;
  }

  button,
  a.logout-btn {
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .provider-menu button {
    font-size: 1.6rem;
  }

  #providerMenu {
    width: 160px;
  }

  #search {
    width: 100%;
    max-width: 100%;
  }

  #breadcrumb {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ===========================
   Visitor Tile Styling
=========================== */
.visitor-tile {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  min-width: 120px;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.visitor-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.visitor-tile h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.visitor-tile .visitor-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
  margin-top: 4px;
}

.visitor-tile .subtext {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

/* ===========================
   Card & Container Layouts
=========================== */
.card-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin: 40px auto;
  max-width: 1100px;
}

.card-row.single {
  justify-content: center;
}

.card-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
  margin: 40px auto;
  max-width: 1400px;
  padding: 0 20px;
}

.card {
  margin: 8px;
  display: inline-block;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ===========================
   Compare Result
=========================== */
#compareResult {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 500px;
  margin: 40px auto;
  text-align: center;
}

#compareResult h3 {
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1e3a8a;
}

.compare-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.compare-inputs input[type='file'] {
  flex: 1 1 45%;
  max-width: 260px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: #111827;
}

.compare-inputs input[type='file']::file-selector-button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  margin-right: 8px;
  cursor: pointer;
}

#compareResult button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s;
}

#compareResult button:hover {
  background: #1e40af;
  transform: translateY(-2px);
}

/* ===========================
   Filter Toggle
=========================== */
.filter-toggle {
  margin-bottom: 12px;
  background: #1d4ed8;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.filter-toggle:hover {
  background: #2563eb;
}

/* ===========================
   Matched Controls Panel
=========================== */
#matches-panel {
  overflow: visible;
  max-height: none;
  height: auto;
}

#matches-panel h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.matched-controls {
  background: transparent;
  padding-inline: 1rem;
}

/* ===========================
   Command & Parameter Boxes
=========================== */
.command-box,
.cli-command-box,
.parameter-box {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.command-box pre,
.cli-command-box pre,
.parameter-box pre {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin-top: 8px;
}

.command-box h3,
.cli-command-box h3,
.parameter-box h3 {
  color: #1e3a8a;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.command-box p,
.cli-command-box p,
.parameter-box p {
  color: #334155;
  font-size: 0.95rem;
  font-weight: 400;
  opacity: 1;
}

.command-header,
.command-header h2,
.command-header h3 {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.command-desc {
  color: #cbd5e1;
  font-style: italic;
}

.command-params,
.param-box,
.command-container {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.parameter-box label,
.parameter-box span {
  color: #1e293b;
  font-weight: 500;
}

.parameter-box input,
.parameter-box .input-field {
  background: #f8fafc;
  color: #111827;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

/* ===========================
   API Groups & Mapping Cards
=========================== */
.api-group,
.mapping-card {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-left: 6px solid rgba(59, 130, 246, 0.6);
  background: linear-gradient(180deg, #ffffff, #f9fafb);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.api-group:hover,
.mapping-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.api-group small,
.mapping-card small {
  color: #475569;
  font-style: italic;
  font-size: 0.9rem;
}

.section-header,
.command-title {
  color: var(--primary, #2563eb);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(37, 99, 235, 0.15);
}

/* ===========================
   Intent & Evidence Boxes
=========================== */
.intent-text,
.evidence-text {
  background: #f8fafc;
  border-left: 4px solid var(--primary, #2563eb);
  color: #111827;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
}

/* ===========================
   Typewriter Effect
=========================== */
#typewriter {
  font-size: 1.1rem;
  font-weight: 500;
  white-space: pre-wrap;
  display: inline-block;
  border-right: 2px solid #3949ab;
  animation: blink-caret 0.8s step-end infinite;
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: #3949ab;
  }
}

/* ===========================
   Provider Label
=========================== */
.provider-label {
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 14px;
  opacity: 0.9;
  text-transform: uppercase;
}

/* ===========================
   Container Overflow Fix
=========================== */
.container {
  overflow-x: hidden;
}

/* ===========================
   Additional Classes
=========================== */
.tile {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
}

.btn {
  display: inline-block;
  text-align: center;
  padding: 8px 10px;
  border-radius: 4px;
  color: white;
  text-decoration: none;
  font-size: 14px;
}

/* ===========================
   Navbar & Gradient Borders
=========================== */
.navbar {
  background: linear-gradient(90deg, #0057ff 0%, #00aaff 100%);
}

.section-divider {
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(0, 145, 255, 1) 0%,
    rgba(0, 255, 255, 0.6) 100%
  );
  box-shadow: 0 0 6px rgba(0, 145, 255, 0.7);
}

#main-header {
  border-bottom: 2px solid transparent;
  background-image: linear-gradient(
    90deg,
    rgba(0, 145, 255, 1),
    rgba(0, 255, 255, 0.7)
  );
  background-clip: padding-box;
  box-shadow: 0 0 10px rgba(0, 145, 255, 0.4);
}

/* ===========================
   Final Layout Fixes
=========================== */
.command-card,
.command-row,
.command-list-item {
  background-color: #1f2937;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.command-card:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Ensure no double borders */
header {
  border-bottom: none;
  box-shadow: none;
}

.header,
.top-bar {
  border-bottom: none;
  box-shadow: none;
}
 /* ===============================================
   CLOUDXPLORER.CSS - Unified Stylesheet
   Merged from layout.css + main.css
   =============================================== */

/* ===========================
   CSS Variables & Root
=========================== */
:root {
  --font-family: 'Inter', system-ui, sans-serif;
  --color-bg: #0b0e12;
  --color-bg-alt: #12161d;
  --color-surface: #161b23;
  --color-text: #f5f5f5;
  --color-text-muted: #a5a5a5;
  --color-accent: #3b82f6;
  --color-border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --transition: all 0.3s ease;
  --bg-dark: #0f141a;
  --bg-panel: #1a2028;
  --text-light: #e6e8eb;
  --border: #2a3038;
  --accent: #5ec2b7;
  --accent-hover: #4aa89f;
  --primary: #2563eb;
  --secondary: #3b82f6;
}

/* ===========================
   Global Reset & Base Styles
=========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ===========================
   Layout Structure
=========================== */
header {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  background: linear-gradient(to bottom, #0f141a, #10161c);
  border-bottom: none;
  box-shadow: none;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

main.loaded {
  opacity: 1;
}

main.loaded #center {
  transform: translateY(0);
  opacity: 1;
}

/* ===========================
   Top Header / Navbar
=========================== */
.top-header {
  background: linear-gradient(135deg, #1e63f0 0%, #1550c3 70%, #0e3fa1 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  height: 48px;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  color: #e2e8f0;
  overflow: visible;
}

.top-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top left,
    rgba(255, 255, 255, 0.08),
    transparent 70%
  );
  background-size: 200% 100%;
  animation: cloud-shimmer 20s linear infinite;
  pointer-events: none;
}

@keyframes cloud-shimmer {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 0%;
  }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-logo {
  height: 18px;
  width: auto;
  margin-top: -4px;
  transform: scale(1.4);
  transform-origin: left center;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
  transition: transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.navbar-logo:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.app-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  margin-left: 10px;
  opacity: 0.9;
  transition: opacity 0.1s ease;
}

/* Provider Menu */
.provider-menu {
  position: relative;
}

#providerToggle {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: background 0.2s;
  position: relative;
  z-index: 99999;
}

#providerToggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

#providerMenu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  list-style: none;
  z-index: 10000;
  min-width: 160px;
  margin-top: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#providerMenu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

#providerMenu li {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

#providerMenu li:hover {
  background: rgba(96, 165, 250, 0.2);
}

/* ===========================
   Navigation Sidebar
=========================== */
#nav {
  flex: 0 0 240px;
  background: linear-gradient(to bottom, #111418, #10161c);
  padding: 1rem;
  border-radius: 12px;
  color: #e6e8eb;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.45),
    inset -1px 0 0 rgba(255, 255, 255, 0.05);
  scrollbar-gutter: stable;
}

#nav h3 {
  color: #d9e2ec;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

/* Add this to your new CSS file */
@media (max-width: 639px) {
  #nav {
    display: none !important;
  }
}

@media (min-width: 640px) {
  #nav {
    display: flex !important;
    flex-direction: column;
  }
}

/* ===========================
   Center Panel
=========================== */
#center {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, #10161c, #0f141a);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

/* ===========================
   Top Bar (Breadcrumb Area)
=========================== */
#top-bar {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #1e3a8a 0%, #0f172a 85%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.25);
}

#top-bar > div {
  min-width: 0;
}

/* Home Badge */
.home-card {
  text-decoration: none;
}

.home-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #0078ff, #00b4ff);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 22px;
  transition: all 0.2s;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.home-badge:hover {
  background: rgba(96, 165, 250, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 136, 255, 0.35);
}

.home-badge .emoji {
  font-size: 1.2rem;
}

.home-badge .label {
  color: #93c5fd;
  font-weight: 500;
}

.home-badge .count {
  background: rgba(255, 255, 255, 0.25);
  color: #0f172a;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Breadcrumb */
#breadcrumb-container {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#breadcrumb,
.breadcrumb,
.breadcrumbs,
.breadcrumb-display {
  background: linear-gradient(145deg, #1b2533, #141a22);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-display {
  display: flex;
}

.breadcrumb-display span {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.breadcrumb-display span:hover {
  background: rgba(255, 255, 255, 0.1);
}

.breadcrumb-display span.current,
#breadcrumb .current,
#breadcrumb [aria-current='page'],
#breadcrumb span:last-child {
  color: #f8fafc;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
  cursor: default;
  text-decoration: none;
}

.breadcrumb-display .sep,
#breadcrumb .sep,
#breadcrumb .separator {
  cursor: default;
  padding: 0;
  color: #94a3b8;
  opacity: 0.9;
}

#breadcrumb a,
.breadcrumb a,
#breadcrumb span:not(.current):not([aria-current='page']):not(:last-child) {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
}

#breadcrumb a:hover,
.breadcrumb a:hover,
#breadcrumb span:hover {
  color: #93c5fd;
  text-decoration: underline;
}

#provider-select {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
}

/* Search & Controls */
#search {
  flex-shrink: 1;
  width: 200px;
  max-width: 25vw;
  min-width: 140px;
  padding: 6px 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #e2e8f0;
}

#search:focus {
  outline: none;
  border-color: #60a5fa;
}

#mode-toggle {
  padding: 6px 12px;
  background: #60a5fa;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

#mode-toggle:hover {
  background: #3b82f6;
}

#mode-toggle[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.logout-btn {
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ===========================
   Explorer Wrapper (Scrollable Content)
=========================== */
#explorer-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 2rem;
  scrollbar-gutter: stable;
}

#explorer {
  min-height: 400px;
}

#explorer h3 {
  position: relative;
  top: auto;
  z-index: auto;
}

/* ===========================
   Welcome / Dashboard
=========================== */
.welcome-container {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
}

.welcome-container h2 {
  color: #93c5fd;
  margin-bottom: 24px;
}

#mainDashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 80vh;
  margin-top: 40px;
}

#dashboardRow {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 80px;
  width: 100%;
}

/* Provider Chart */
#providerChartContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 16px;
  padding: 16px;
  width: min(90%, 560px);
  height: 380px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#providerChartContainer:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
}

#providerChartContainer h3 {
  color: #93c5fd;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

#providerChart {
  min-width: 340px;
  min-height: 340px;
}

.chart-container canvas {
  background-color: #0f172a;
  border-radius: 8px;
  padding: 10px;
}

.chartjs-legend,
.chart-label {
  color: #e2e8f0;
  font-weight: 500;
  font-size: 0.9rem;
}

.chartjs-tooltip {
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Info Cards */
#infoCards {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 520px;
}

.info-card {
  background: rgba(30, 41, 59, 0.8);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.info-card h3 {
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  margin-bottom: 12px;
}

.info-card ul {
  list-style: none;
  padding-left: 0;
  line-height: 1.6;
}

.info-card ul li {
  padding: 6px 0;
  color: #cbd5e1;
}

.info-card ul li:before {
  content: '▸ ';
  color: #60a5fa;
  font-weight: bold;
}

.info-card p {
  color: #334155;
  font-size: 0.95rem;
  font-weight: 400;
  opacity: 1;
}

/* Tighter spacing between the Helper Scripts table and Upload section */
.info-card.wide-card {
  margin-bottom: 20px !important; /* reduce if it was large */
}

.tip {
  color: #fbbf24;
  font-style: italic;
  margin-top: 12px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.button-group a {
  padding: 8px 12px;
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  transition: all 0.2s;
  text-align: center;
}

.button-group a:hover {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-2px);
}

details {
  margin-top: 12px;
}

details summary {
  cursor: pointer;
  color: #60a5fa;
  font-weight: 500;
}

details pre {
  background: #0f172a;
  padding: 12px;
  border-radius: 6px;
  margin-top: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: #cbd5e1;
}

/* Upload Section */
#uploadSection {
  margin-top: 60px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 16px;
  padding: 30px 40px;
  width: min(90%, 560px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#uploadSection:hover {
  transform: scale(1.02);
  box-shadow: 0 0 25px rgba(96, 165, 250, 0.6);
}

#uploadSection h3 {
  color: #93c5fd;
  margin-bottom: 10px;
}

#uploadSection > p {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.file-input-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 12px;
}

.file-input-row label {
  color: #a1a1aa;
}

.file-input-row input[type='file'],
#uploadForm input[type='file'] {
  color: #e2e8f0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 8px;
  width: 230px;
  font-size: 0.9rem;
}

#uploadForm input[type='file']::-webkit-file-upload-button,
.file-input-row input[type='file']::file-selector-button {
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

#uploadSection button {
  margin-top: 16px;
  padding: 10px 24px;
  background: #60a5fa;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

#uploadSection button:hover {
  background: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.upload-tip {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 12px;
}

/* ===========================
   Provider Cards
=========================== */
.provider-card {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 10px 0;
  padding: 12px 0;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
  color: #f9fafb;
  background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.provider-card:hover {
  background: linear-gradient(145deg, #0057ff, #00a1d6);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.provider-card:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.provider-card[data-provider='azure'] {
  --brand: #0078d7;
}
.provider-card[data-provider='aws'] {
  --brand: #ff9900;
}
.provider-card[data-provider='gcloud'] {
  --brand: #4285f4;
}
.provider-card[data-provider='oci'] {
  --brand: #f80000;
}
.provider-card[data-provider='alibaba'] {
  --brand: #ff6a00;
}
.provider-card[data-provider='ibmcloud'] {
  --brand: #1194d9;
}
.provider-card[data-provider='ovhai'] {
  --brand: #00a1d6;
}

.provider-card:hover {
  color: var(--brand);
  text-shadow: 0 0 8px var(--brand);
  box-shadow: 0 0 14px var(--brand), inset 0 0 8px var(--brand);
}

.provider-card i {
  font-size: 1.5rem;
  width: 24px;
  text-align: center;
}

.icon-azure {
  color: #0078d7;
}
.icon-aws {
  color: #f90;
}
.icon-gcloud {
  color: #4285f4;
}
.icon-oci {
  color: #f80000;
}
.icon-aliyun {
  color: #ff6a00;
}
.icon-ibmcloud {
  color: #1194d9;
}
.icon-ovhai {
  color: #00a1d6;
}

/* ===========================
   Command & Drill Cards
=========================== */
.command-card,
.drill-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin: 8px 0;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.command-card:hover,
.drill-card:hover {
  background: #334155;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px) scale(1.01);
}

.command-card.active {
  background: linear-gradient(145deg, #2563eb, #1e3a8a);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}

.command-card.active strong {
  color: #fff;
}

.command-card small {
  color: #94a3b8;
}

.command-card strong {
  font-weight: 600;
}

.command-card[data-provider='aws'] strong {
  color: #facc15;
}
.command-card[data-provider='az'] strong {
  color: #60a5fa;
}
.command-card[data-provider='oci'] strong {
  color: #fb7185;
}
.command-card[data-provider='gcp'] strong {
  color: #34d399;
}

.drill-card h4 {
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93c5fd;
}

.drill-card.group {
  border-left: 4px solid #94a3b8;
}

.drill-card.leaf {
  border-left: 4px solid #2563eb;
}

.drill-card .meta {
  font-size: 12px;
  opacity: 0.7;
}

/* ===========================
   Control Cards & Grid
=========================== */
.controls-grid,
.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem 0;
  overflow: visible;
  max-height: none;
  height: auto;
  grid-auto-rows: minmax(auto, 1fr);
}

.control-card {
  background: #1e2433;
  color: #f1f5f9;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  position: relative;
  min-height: 140px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  perspective: 1000px;
}

.control-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  border-color: rgba(147, 197, 253, 0.3);
}

.control-card h4,
.control-card h5 {
  margin-top: 0;
  font-weight: 600;
  color: #93c5fd;
  font-size: 1rem;
}

.control-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.control-card p,
.control-card span,
.control-card div {
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
  color: #e2e8f0;
}

.control-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, #0091ff, #00ffff);
  box-shadow: 0 0 6px rgba(0, 145, 255, 0.4);
  opacity: 0.9;
}

/* Card Flip Animation */
.control-card-inner {
  position: relative;
  width: 100%;
  min-height: 180px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.control-card.flipped .control-card-inner {
  transform: rotateY(180deg);
}

.control-card-front,
.control-card-back {
  position: absolute;
  width: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  padding: 16px;
  background: rgba(25, 28, 36, 0.85);
  border: 1px solid rgba(0, 145, 255, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 145, 255, 0.08);
  color: #ffffff;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.control-card-front:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 145, 255, 0.6);
  box-shadow: 0 0 20px rgba(0, 145, 255, 0.25);
}

.control-card-back {
  transform: rotateY(180deg);
  white-space: normal;
  max-height: 250px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
}

.control-card-back:hover {
  overflow-y: auto;
}

.control-card .confidence-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
}

/* Control Navigation */
.control-nav-group {
  margin: 12px 0;
}

.control-nav-header {
  padding: 12px;
  background: rgba(96, 165, 250, 0.15);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: #93c5fd;
  transition: background 0.2s;
}

.control-nav-header:hover {
  background: rgba(96, 165, 250, 0.25);
}

.control-nav-list {
  display: none;
  padding-left: 12px;
}

.control-nav-card,
.control-item {
  padding: 8px 12px;
  margin: 4px 0;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: #cbd5e1;
}

.control-nav-card:hover,
.control-item:hover {
  background: rgba(51, 65, 85, 0.8);
  border-left: 3px solid #60a5fa;
  padding-left: 15px;
}

.control-item {
  background: var(--bg-secondary, #1e293b);
  color: var(--text-primary, #e2e8f0);
}

/* Sidebar Control Styling */
#controls,
.sidebar {
  background-color: #1b2430;
  border-right: 1px solid #2d3748;
  color: #d1d5db;
}

#controls h2,
.sidebar h2 {
  color: #a5b4fc;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 4px;
}

#controls button,
.sidebar button {
  background-color: #27303f;
  color: #e5e7eb;
  border: none;
  border-radius: 6px;
  margin: 4px 0;
  padding: 8px 10px;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

#controls button:hover,
.sidebar button:hover {
  background-color: #334155;
  color: #93c5fd;
}

#controls button.active,
.sidebar button.active {
  background-color: #3b4252;
  border-left: 3px solid #60a5fa;
  color: #e0e7ff;
  font-weight: 600;
}

/* ===========================
   Details Panel
=========================== */
#details {
  display: none;
  background: #0f172a;
  color: #e6e8eb;
  padding: 20px;
  margin: 16px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

#details h2 {
  color: #93c5fd;
  margin-bottom: 8px;
}

#op-title {
  color: #f1f5f9;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 4px;
}

#op-help {
  color: #94a3b8;
  font-style: italic;
  margin-bottom: 10px;
}

#details button {
  margin: 8px 8px 8px 0;
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#details button:hover {
  background: #1d4ed8;
}

/* Form Fields */
#form-container {
  margin: 16px 0;
}

.form-field {
  margin-bottom: 12px;
}

.form-field label {
  display: block;
  color: #cbd5e1;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.form-field input {
  width: 100%;
  padding: 8px 10px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}

.form-field input:focus,
#form-container input[type='text']:focus {
  outline: none;
  border-color: #3a8cff;
}

/* JSON & CLI Display */
#json-display,
#cli-display {
  background: #1e293b;
  color: #e6e8eb;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid #334155;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.45;
}

.json-detail-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #eee;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  overflow-x: auto;
}

.json-detail-card .json-key {
  color: #4ec9b0;
}
.json-detail-card .json-string {
  color: #ce9178;
}
.json-detail-card .json-number {
  color: #b5cea8;
}
.json-detail-card .json-boolean {
  color: #569cd6;
}
.json-detail-card .json-null {
  color: #808080;
}

/* JSON View Scrollbar */
.json-view::-webkit-scrollbar {
  height: 8px;
}

.json-view::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.4);
  border-radius: 10px;
}

.json-view::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148, 163, 184, 0.6);
}

/* JSON Dark Mode Fix */
pre,
pre code,
.json-view,
code[class*='language-'],
div[class*='json'],
pre[class*='json'] {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.added-json pre,
.added-json code {
  background: linear-gradient(145deg, #162b1e, #0d2015);
  border-left: 4px solid #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
}

.removed-json pre,
.removed-json code {
  background: linear-gradient(145deg, #2b1a1a, #1e1010);
  border-left: 4px solid #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.string {
  color: #86efac;
}
.number {
  color: #93c5fd;
}
.boolean {
  color: #fca5a5;
}
.null {
  color: #a5b4fc;
  font-style: italic;
}
.key {
  color: #60a5fa;
}

.meta {
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ===========================
   Diff & Comparison Styles
=========================== */
#diffBreadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 16px 0;
  font-size: 14px;
}

#diffBreadcrumbs span {
  cursor: pointer;
  color: #2563eb;
}

#diffBreadcrumbs span:hover {
  text-decoration: underline;
}

#diffBreadcrumbs .sep {
  color: #9ca3af;
}

.diff-section {
  margin: 24px 0;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.diff-card {
  background: rgba(30, 41, 59, 0.8);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.diff-card:hover {
  background: rgba(51, 65, 85, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.diff-path {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.pill.green {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.pill.orange {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.pill.red {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.backbar {
  margin-bottom: 16px;
}

.backbar button {
  padding: 8px 16px;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.backbar button:hover {
  background: #475569;
}

/* Inventory Cards */
.resource-card,
.inventory-item,
.diff-tile {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-card:hover,
.inventory-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.section-header,
.diff-section h4 {
  background: #0f172a;
  color: #38bdf8;
  border-left: 4px solid #38bdf8;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 600;
}

.badge-added,
.status-added {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid #4ade80;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

.badge-removed,
.status-removed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid #f87171;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

.badge-changed,
.status-changed {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
}

/* ===========================
   Executive Summary
=========================== */
#analysisSection {
  display: none;
  position: relative;
  background: rgba(30, 41, 59, 0.95);
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin: 16px;
  color: #e2e8f0;
}

#closeAnalysisBtn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

#closeAnalysisBtn:hover {
  background: #dc2626;
}

.summary-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  animation: summaryFadeUp 0.8s ease-out forwards;
}

.summary-card,
.summary-tile {
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  transform: translateY(15px);
  animation: summaryCardRise 0.6s ease-out forwards;
}

.summary-card:nth-child(1) {
  animation-delay: 0.15s;
}
.summary-card:nth-child(2) {
  animation-delay: 0.25s;
}
.summary-card:nth-child(3) {
  animation-delay: 0.35s;
}
.summary-card:nth-child(4) {
  animation-delay: 0.45s;
}

.summary-card:hover,
.summary-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

.summary-card label,
.summary-tile label {
  color: #93c5fd;
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 4px;
}

.summary-card span,
.summary-tile .value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.summary-tile .value.added {
  color: #22c55e;
}
.summary-tile .value.removed {
  color: #ef4444;
}
.summary-tile .value.changed {
  color: #fbbf24;
}
.summary-tile .value.delta {
  color: #38bdf8;
}

.summary-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  animation-delay: 0.6s;
}

.summary-section h3 {
  color: #60a5fa;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.summary-section ul {
  list-style: disc;
  margin-left: 20px;
}

.summary-section ul li {
  color: #cbd5e1;
  line-height: 1.5;
  font-size: 0.9rem;
}

.summary-section ul li::marker {
  color: #38bdf8;
}

.summary-section::after {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(96, 165, 250, 0.3),
    transparent
  );
  margin: 12px 0;
  opacity: 0;
  animation: dividerFade 1.2s ease 0.8s forwards;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-stat:last-child {
  border-bottom: none;
}

.summary-stat .label {
  color: #cbd5e1;
}

.summary-stat .value {
  font-weight: 600;
  font-size: 1.1rem;
}

.value.added {
  color: #34d399;
}
.value.removed {
  color: #f87171;
}
.value.changed {
  color: #fbbf24;
}
.value.delta {
  color: #60a5fa;
}

.insights-card {
  background: linear-gradient(145deg, #1e293b, #111827);
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  padding: 14px 18px;
  margin-bottom: 10px;
}

.insights-list,
.anomalies-list {
  margin-top: 12px;
  padding-left: 16px;
  font-size: 0.9rem;
}

.insights-list li,
.anomalies-list li {
  color: #a5b4fc;
  margin-bottom: 4px;
  list-style: disc;
}

.insights-list li span,
.anomalies-list li span {
  color: #cbd5e1;
}

.summary-close {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.summary-close:hover {
  background: #dc2626;
}

@keyframes summaryFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes summaryCardRise {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dividerFade {
  from {
    opacity: 0;
    width: 0;
  }
  to {
    opacity: 1;
    width: 100%;
  }
}

/* AI Summary Fix */
.ai-summary,
.ai-summary p,
.ai-summary span {
  color: #e6e8eb;
  background-color: #16223b;
}

/* ===========================
   AI Cards
=========================== */
.ai-card {
  background: var(--card-bg, #1e1e1e);
  color: var(--card-fg, #e8e8e8);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.ai-relation {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: #38bdf8;
}

.ai-control {
  font-weight: 600;
  font-size: 0.9rem;
  color: #a5b4fc;
}

.ai-body p {
  margin: 0.4rem 0;
  line-height: 1.45;
  font-size: 0.9rem;
}

.ai-body strong {
  color: #f9fafb;
}

.ai-body code {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.85rem;
  color: #fcd34d;
}

.ai-intent {
  color: #34d399;
}
.ai-evidence {
  color: #fbbf24;
}
.ai-action {
  font-style: italic;
  color: #93c5fd;
  margin-top: 0.6rem;
}

.ai-footer {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: right;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-progress {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ai-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.ai-confidence {
  font-size: 0.75rem;
  color: #94a3b8;
}

.ai-block {
  margin-top: 8px;
  padding: 10px;
  background: rgba(0, 123, 255, 0.05);
  border-left: 3px solid #0078d4;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #111;
}

.ai-block p {
  margin: 6px 0;
  line-height: 1.4;
}

.ai-block .confidence {
  font-size: 0.8rem;
  color: #555;
}

.control-card.flipped .ai-block {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   Modals
=========================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #1e293b;
  margin: 10% auto;
  padding: 0;
  border-radius: 12px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #cbd5e1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  color: #93c5fd;
  margin: 0;
}

.close-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: #cbd5e1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ef4444;
}

.modal-body {
  padding: 20px;
  color: #cbd5e1;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ===========================
   Provider Modal
=========================== */
.provider-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.provider-modal[hidden] {
  display: none;
}

.provider-modal__dialog {
  background: #0f172a;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  transform: scale(0.97);
  animation: modalIn 0.2s ease forwards;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.provider-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #0f172a, #1e293b);
}

.provider-modal__header h3 {
  color: #60a5fa;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

#provider-modal-close,
.provider-modal__close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

#provider-modal-close:hover,
.provider-modal__close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.provider-modal__body {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}

.provider-modal__stats {
  display: flex;
  gap: 40px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
}

.provider-modal__stats .stat {
  background: rgba(15, 23, 42, 0.8);
  padding: 16px 24px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid rgba(96, 165, 250, 0.3);
  min-width: 120px;
  flex: 1;
}

.provider-modal__stats .stat strong {
  display: block;
  color: #38bdf8;
  font-size: 0.9rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.provider-modal__stats .stat div {
  font-size: 1.25rem;
  font-weight: bold;
  color: #f9fafb;
}

.provider-modal__content {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
}

.provider-modal__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  min-height: 200px;
  max-height: 60vh;
}

.provider-modal__panel h4 {
  color: #93c5fd;
  margin: 0 0 12px;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.cmd-list,
.control-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cmd-list li {
  padding: 8px 12px;
  margin: 0;
  background: #0f172a;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: monospace;
  font-size: 0.9rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-list li:hover {
  background: rgba(51, 65, 85, 0.8);
}

.cmd-list li code {
  color: #e2e8f0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  padding: 4px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-left: 10px;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: rgba(56, 189, 248, 0.3);
}

.control-list li {
  padding: 6px 10px;
  margin: 4px 0;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 0.9rem;
  cursor: help;
  transition: all 0.2s;
}

.control-list li:hover {
  background: rgba(96, 165, 250, 0.2);
  border-left: 3px solid #60a5fa;
  padding-left: 13px;
}

.narrative {
  color: #cbd5e1;
  line-height: 1.6;
  padding: 12px;
  background: #0f172a;
  border-radius: 6px;
  border-left: 3px solid #60a5fa;
  font-size: 0.9rem;
  overflow-y: auto;
}

blockquote {
  border-left: 3px solid #3b82f6;
  padding-left: 10px;
  margin: 8px 0;
  font-style: italic;
  color: #9ca3af;
}

/* ===========================
   Chat Drawer (Security Assistant)
=========================== */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, sans-serif;
  transition: bottom 0.35s ease, right 0.35s ease;
}

#chat-handle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background 0.3s ease,
    transform 0.4s cubic-bezier(0.25, 1.25, 0.5, 1), box-shadow 0.25s ease;
}

#chat-handle:hover {
  background: #005fa3;
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

#chat-handle:active {
  transform: scale(0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

#chat-container.chat-open #chat-handle {
  right: 380px;
  transform: scale(0.9);
  transition: transform 0.4s ease, right 0.4s cubic-bezier(0.25, 1.25, 0.5, 1);
}

#chat-box {
  width: 340px;
  height: 420px;
  background: #fff;
  border-radius: 12px 12px 0 12px;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.25, 1.25, 0.5, 1);
  position: fixed;
  bottom: 20px;
  right: 20px;
}

#chat-box.open {
  transform: translateY(0);
  display: flex;
}

#chat-box.maximized {
  position: fixed;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  border-radius: 12px;
  background: #fff;
  z-index: 2000;
  transform: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0078d4;
  color: #fff;
  padding: 8px 12px;
  font-weight: 500;
}

.chat-controls {
  display: flex;
  gap: 6px;
}

.chat-controls button,
.chat-header button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.chat-controls button:hover,
.chat-header button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #0f172a;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.chat-input {
  display: flex;
  border-top: 1px solid #ddd;
  background: #fafafa;
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  background: #fafafa;
}

.chat-input button {
  background: #0078d4;
  border: none;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.chat-input button:hover {
  background: #005fa3;
}

.chat-msg {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.25s ease;
}

.chat-msg.user {
  background: #0078d4;
  color: #fff;
  margin-left: auto;
  text-align: right;
  border-bottom-right-radius: 2px;
}

.chat-msg.bot {
  background: #f3f4f6;
  color: #111;
  margin-right: auto;
  border-bottom-left-radius: 2px;
}

.bot-bubble {
  display: inline-block;
  text-align: left;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 14px;
  padding: 8px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #777;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.wink {
  display: inline-block;
  animation: winkAnim 1.4s ease-in-out 1.5s 2;
}

@keyframes winkAnim {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(15deg);
  }
}

/* Chat Developer Mode */
#chat-messages.dev-mode {
  background: #111827;
  color: #e5e7eb;
  font-family: 'Fira Code', 'Menlo', monospace;
  padding: 12px;
  border-top: 1px solid #1f2937;
}

#chat-messages.dev-mode pre,
#chat-messages.dev-mode code {
  background: #1e293b;
  color: #93c5fd;
  display: block;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-x: auto;
}

#chat-messages.dev-mode strong {
  color: #facc15;
}

#chat-messages.dev-mode .chat-msg {
  border-left: 3px solid #fbbf24;
  padding-left: 12px;
}

#chat-messages.dev-mode .chat-msg.bot {
  border-left: 3px solid #3b82f6;
  padding-left: 10px;
}

#chat-messages.dev-mode .chat-msg.user {
  border-left: 3px solid #10b981;
  padding-left: 10px;
}

/* Chat Authentication Modal */
#chat-auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  pointer-events: auto;
}

#chat-auth-modal.hidden {
  display: none;
}

.auth-content {
  position: relative;
  pointer-events: auto;
  background: #141a24;
  color: #e0e6ef;
  width: 320px;
  padding: 28px 36px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: fadeIn 0.25s ease;
}

.auth-content h3 {
  font-weight: 600;
  font-size: 1.1rem;
  color: #f8f9fa;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-content p {
  color: #cbd5e1;
  margin-bottom: 16px;
}

.auth-content input {
  width: 100%;
  padding: 10px;
  margin: 12px 0 16px 0;
  border-radius: 6px;
  border: 1px solid #2a2f38;
  background: #1e2532;
  color: #f8f9fa;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-content input:focus {
  border-color: #3a8cff;
}

.auth-buttons,
.auth-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-content button,
#chat-auth-cancel,
#chat-auth-submit {
  background: linear-gradient(90deg, #0078d4, #0094ff);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.3s ease;
}

#chat-auth-cancel {
  background: #374151;
  color: #d1d5db;
}

#chat-auth-cancel:hover {
  background: #475569;
  filter: brightness(1.1);
}

#chat-auth-submit {
  background: #2563eb;
}

#chat-auth-submit:hover {
  background: linear-gradient(90deg, #0094ff, #0078d4);
  transform: scale(1.04);
}

/* ===========================
   Buttons
=========================== */
button,
.helper-buttons a {
  margin: 6px 4px 0 0;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

button:hover,
.helper-buttons a:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

button:active {
  transform: translateY(0);
  background: #1e40af;
}

/* ===========================
   Toast Notifications
=========================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  min-width: 200px;
  margin-bottom: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  animation: fadeInOut 4s forwards;
}

.toast.info {
  background: #2563eb;
}

.toast.success {
  background: #16a34a;
}

.toast.warning {
  background: #f59e0b;
}

.toast.error {
  background: #dc2626;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  10%,
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.copy-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(56, 189, 248, 0.15);
  color: #e2e8f0;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(94, 194, 183, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10000;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Banner Messages
=========================== */
.banner {
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  border-left: 4px solid;
}

.banner.info {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  color: #93c5fd;
}

.banner.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #fca5a5;
}

.banner.warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #fde047;
}

.banner.success {
  background: rgba(52, 211, 153, 0.1);
  border-color: #34d399;
  color: #6ee7b7;
}

.banner .top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 8px;
}

.banner .icon {
  font-size: 1.2rem;
}

.banner .footer {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 8px;
}

/* ===========================
   Spinner / Loading
=========================== */
#spinner {
  display: none;
  text-align: center;
  margin: 20px;
}

.loader {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#global-spinner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #cbd5e1;
  font-family: sans-serif;
}

/* ===========================
   Helper Sections
=========================== */
.helper-section {
  margin-top: 50px;
  padding: 20px;
  background-color: #f9fafc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background-color 0.3s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.helper-section h3 {
  font-weight: 600;
  font-size: 1.3rem;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.helper-section p {
  margin: 0 0 15px;
  color: #4b5563;
}

.helper-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.helper-buttons a {
  display: inline-block;
  padding: 8px 14px;
  background-color: #2563eb;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.helper-buttons a:hover {
  background-color: #1d4ed8;
  transform: translateY(-2px);
}

.helper-buttons a:active {
  transform: translateY(0);
  background-color: #1e40af;
}

.helper-section details {
  margin-top: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.helper-section summary {
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  transition: color 0.2s ease;
}

.helper-section summary:hover {
  color: #2563eb;
}

.helper-section pre {
  background-color: #111;
  color: #f5f5f5;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 10px;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ===========================
   Section Dividers
=========================== */
.section-separator,
.section-divider,
hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

/* ===========================
   Footer
=========================== */
.app-footer {
  text-align: center;
  padding: 1rem 0;
  background: #0f172a;
  color: #9ca3af;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ===========================
   Utility Classes
=========================== */
.hidden {
  display: none !important;
}

.muted {
  color: #64748b;
  font-style: italic;
}

.error {
  color: #ef4444;
}

/* ===========================
   Scrollbar Styling
=========================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

#explorer-wrapper,
.controls-grid,
.control-grid {
  scrollbar-gutter: stable;
}

/* ===========================
   Typography
=========================== */
h1,
h2,
h3 {
  color: #ffffff;
  text-shadow: 0 0 6px rgba(0, 145, 255, 0.4);
}

/* ===========================
   Dark Mode Overrides
=========================== */
.dark-mode .helper-section {
  background-color: #111827;
  color: #e5e7eb;
}

.dark-mode .helper-section h3 {
  color: #60a5fa;
}

.dark-mode .helper-section p {
  color: #9ca3af;
}

.dark-mode .helper-section details {
  border-top: 1px solid #374151;
}

.dark-mode .helper-section summary {
  color: #d1d5db;
}

.dark-mode .home-badge {
  background: linear-gradient(135deg, #0b2340, #163c60);
  color: #e0e6ed;
}

.dark-mode .home-badge .count {
  background: rgba(255, 255, 255, 0.15);
}

.dark-mode .chat-msg.bot {
  background: #2a2a2a;
  color: #e5e7eb;
}

.dark-mode #chat-box {
  background: #1e293b;
  color: #e5e7eb;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}

.dark-mode #chat-box.maximized {
  background: #111827;
  color: #e5e7eb;
}

.dark-mode #chat-box.maximized .chat-input {
  background: #1e293b;
  border-color: #374151;
}

.dark-mode #chat-handle {
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.dark-mode #chat-handle:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.dark-mode .logout-btn {
  border-color: #60a5fa;
  color: #60a5fa;
}

.dark-mode .logout-btn:hover {
  background-color: #60a5fa;
  color: #0f172a;
}

.dark-mode #compareResult {
  background: #1e293b;
  color: #e5e7eb;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.dark-mode #compareResult h3 {
  color: #60a5fa;
}

.dark-mode .visitor-tile {
  background: linear-gradient(135deg, #1e293b, #111827);
  border: 1px solid #334155;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode .visitor-tile h4 {
  color: #9ca3af;
}

.dark-mode .visitor-tile .visitor-count {
  color: #60a5fa;
}

.dark-mode .visitor-tile .subtext {
  color: #94a3b8;
}

/* ===========================
   Responsive Design
=========================== */
@media (max-width: 768px) {
  body {
    font-size: 15px;
    overflow-x: hidden;
  }

  #top-bar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  #dashboardRow {
    flex-direction: column;
    gap: 40px;
  }

  #providerChartContainer,
  #uploadSection,
  #infoCards {
    width: 90% !important;
    max-width: none !important;
    margin: 0 auto;
  }

  #chat-box {
    width: 100%;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .provider-modal__content {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .diff-grid {
    grid-template-columns: 1fr;
  }

  .top-header {
    flex-direction: row;
  }

  .app-title {
    display: block;
    margin-top: 5px;
  }

  input[type='text'] {
    width: 100%;
  }

  button,
  a.logout-btn {
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .provider-menu button {
    font-size: 1.6rem;
  }

  #providerMenu {
    width: 160px;
  }

  #search {
    width: 100%;
    max-width: 100%;
  }

  #breadcrumb {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ===========================
   Visitor Tile Styling
=========================== */
.visitor-tile {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  min-width: 120px;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.visitor-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.visitor-tile h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.visitor-tile .visitor-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
  margin-top: 4px;
}

.visitor-tile .subtext {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

/* ===========================
   Card & Container Layouts
=========================== */
.card-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin: 40px auto;
  max-width: 1100px;
}

.card-row.single {
  justify-content: center;
}

.card-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
  margin: 40px auto;
  max-width: 1400px;
  padding: 0 20px;
}

.card {
  margin: 8px;
  display: inline-block;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ===========================
   Compare Result
=========================== */
#compareResult {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 500px;
  margin: 40px auto;
  text-align: center;
}

#compareResult h3 {
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1e3a8a;
}

.compare-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.compare-inputs input[type='file'] {
  flex: 1 1 45%;
  max-width: 260px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: #111827;
}

.compare-inputs input[type='file']::file-selector-button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  margin-right: 8px;
  cursor: pointer;
}

#compareResult button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s;
}

#compareResult button:hover {
  background: #1e40af;
  transform: translateY(-2px);
}

/* ===========================
   Filter Toggle
=========================== */
.filter-toggle {
  margin-bottom: 12px;
  background: #1d4ed8;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.filter-toggle:hover {
  background: #2563eb;
}

/* ===========================
   Matched Controls Panel
=========================== */
#matches-panel {
  overflow: visible;
  max-height: none;
  height: auto;
}

#matches-panel h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.matched-controls {
  background: transparent;
  padding-inline: 1rem;
}

/* ===========================
   Command & Parameter Boxes
=========================== */
.command-box,
.cli-command-box,
.parameter-box {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.command-box pre,
.cli-command-box pre,
.parameter-box pre {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin-top: 8px;
}

.command-box h3,
.cli-command-box h3,
.parameter-box h3 {
  color: #1e3a8a;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.command-box p,
.cli-command-box p,
.parameter-box p {
  color: #334155;
  font-size: 0.95rem;
  font-weight: 400;
  opacity: 1;
}

.command-header,
.command-header h2,
.command-header h3 {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.command-desc {
  color: #cbd5e1;
  font-style: italic;
}

.command-params,
.param-box,
.command-container {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.parameter-box label,
.parameter-box span {
  color: #1e293b;
  font-weight: 500;
}

.parameter-box input,
.parameter-box .input-field {
  background: #f8fafc;
  color: #111827;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

/* ===========================
   API Groups & Mapping Cards
=========================== */
.api-group,
.mapping-card {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-left: 6px solid rgba(59, 130, 246, 0.6);
  background: linear-gradient(180deg, #ffffff, #f9fafb);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.api-group:hover,
.mapping-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.api-group small,
.mapping-card small {
  color: #475569;
  font-style: italic;
  font-size: 0.9rem;
}

.section-header,
.command-title {
  color: var(--primary, #2563eb);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(37, 99, 235, 0.15);
}

/* ===========================
   Intent & Evidence Boxes
=========================== */
.intent-text,
.evidence-text {
  background: #f8fafc;
  border-left: 4px solid var(--primary, #2563eb);
  color: #111827;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
}

/* ===========================
   Typewriter Effect
=========================== */
#typewriter {
  font-size: 1.1rem;
  font-weight: 500;
  white-space: pre-wrap;
  display: inline-block;
  border-right: 2px solid #3949ab;
  animation: blink-caret 0.8s step-end infinite;
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: #3949ab;
  }
}

/* ===========================
   Provider Label
=========================== */
.provider-label {
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 14px;
  opacity: 0.9;
  text-transform: uppercase;
}

/* ===========================
   Container Overflow Fix
=========================== */
.container {
  overflow-x: hidden;
}

/* ===========================
   Additional Classes
=========================== */
.tile {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 16px;
  line-height: 1.6;
}

.btn {
  display: inline-block;
  text-align: center;
  padding: 8px 10px;
  border-radius: 4px;
  color: white;
  text-decoration: none;
  font-size: 14px;
}

/* ===========================
   Navbar & Gradient Borders
=========================== */
.navbar {
  background: linear-gradient(90deg, #0057ff 0%, #00aaff 100%);
}

.section-divider {
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(0, 145, 255, 1) 0%,
    rgba(0, 255, 255, 0.6) 100%
  );
  box-shadow: 0 0 6px rgba(0, 145, 255, 0.7);
}

#main-header {
  border-bottom: 2px solid transparent;
  background-image: linear-gradient(
    90deg,
    rgba(0, 145, 255, 1),
    rgba(0, 255, 255, 0.7)
  );
  background-clip: padding-box;
  box-shadow: 0 0 10px rgba(0, 145, 255, 0.4);
}

/* ===========================
   Final Layout Fixes
=========================== */
.command-card,
.command-row,
.command-list-item {
  background-color: #1f2937;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.command-card:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Ensure no double borders */
header {
  border-bottom: none;
  box-shadow: none;
}

.header,
.top-bar {
  border-bottom: none;
  box-shadow: none;
}

/* Entire analysis container */

#analysisSection {
  width: min(95%, 900px);
  background: #0b1120;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.65);
  color: #e2e8f0;
  margin: 40px auto;
  max-width: 1200px;
  max-height: 85vh;       /* prevents overflow beyond screen */
  overflow-y: auto;       /* makes content scrollable */
  overflow-x: hidden;
  padding-bottom: 10px;
  padding: 20px 30px;
}

/* Optional: makes the scrollbar look good on dark backgrounds */
#analysisSection::-webkit-scrollbar {
  width: 8px;
}

#analysisSection::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
}

#analysisSection::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Header + Close button in one unified top bar */
.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  padding: 14px 20px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.analysis-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f9fafb;
  letter-spacing: 0.4px;
}

#closeAnalysisBtn {
  background: #dc2626;
  color: #f9fafb;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
#closeAnalysisBtn:hover {
  background: #ef4444;
  transform: scale(1.05);
}

/* Inner text area (executive summary block) */
#analysisSummary pre {
  background: #111827;
  color: #f3f4f6;
  padding: 25px;
  border-radius: 0 0 12px 12px;
  border-left: 4px solid #3b82f6;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: "Fira Code", monospace;
  line-height: 1.6;
}

/* Headings inside the preformatted text */
#analysisSummary pre h3,
#analysisSummary pre h4 {
  color: #93c5fd;
  margin-top: 16px;
}

/* Emphasis and highlights */
#analysisSummary pre strong {
  color: #38bdf8;
}
#analysisSummary pre em {
  color: #facc15;
}

/* Insights and anomalies sections */
#insightsList, #anomaliesList {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 15px 20px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
}
#insightsList li::before { content: "✅ "; }
#anomaliesList li::before { content: "❌ "; }

h4 {
  color: #93c5fd;
  margin: 0 20px 5px 20px;
  border-bottom: 1px solid #334155;
  padding-bottom: 5px;
  font-size: 1rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Markdown-rendered report */
.markdown-body {
  background: #111827;
  color: #e2e8f0;
  padding: 25px 30px;
  border-radius: 0 0 12px 12px;
  border-left: 4px solid #3b82f6;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
  font-family: 'Inter', 'Fira Code', monospace;
  line-height: 1.6;
}

.markdown-body h3 {
  color: #60a5fa;
  margin-top: 20px;
  border-bottom: 1px solid #1e3a8a;
  padding-bottom: 6px;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.8px;
}

.markdown-body h4 {
  color: #a5b4fc;
  margin-top: 14px;
}

.markdown-body strong {
  color: #facc15;
}

.markdown-body em {
  color: #f87171;
}

.markdown-body ul {
  margin: 10px 0 10px 20px;
}

.markdown-body li {
  margin-bottom: 6px;
}

/* Keep the dark container around everything */
#analysisSection {
  background: #0b1120;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.65);
  padding: 0;
  margin: 40px auto;
  max-width: 1200px;
  color: #e2e8f0;
}

.close-btn {
  background: #dc2626;
  color: #f9fafb;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.close-btn:hover {
  background: #ef4444;
  transform: scale(1.05);
}

#complianceDashboard {
  background: #0b1120;
  color: #e2e8f0;
  border: 1px solid #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  padding: 20px;
  margin: 40px auto;
  max-width: 1200px;
  overflow-y: auto;
  animation: fadeIn 0.4s ease-in-out;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  padding: 10px 20px;
  border-radius: 12px 12px 0 0;
  margin-bottom: 20px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: #111827;
  border-radius: 10px;
  padding: 20px;
}

.summary-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.summary-cards .card {
  background: #1e293b;
  padding: 15px 25px;
  border-radius: 10px;
  text-align: center;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
}

.controls-table {
  background: #111827;
  border-radius: 10px;
  padding: 15px;
}

.controls-table table {
  width: 100%;
  border-collapse: collapse;
}

.controls-table th, .controls-table td {
  border-bottom: 1px solid #334155;
  padding: 10px;
}

.status-dot {
  height: 10px;
  width: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-compliant { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-partial { background: #facc15; box-shadow: 0 0 6px #facc15; }
.status-noncompliant { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

#narrativeOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9998;
  backdrop-filter: blur(3px);
  justify-content: flex-end;
  align-items: flex-start;
  padding: 40px;
  animation: fadeIn 0.3s ease-in-out;
}

.narrative-box {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  padding: 20px 25px;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: slideIn 0.4s ease-in-out;
  border-left: 4px solid #3b82f6;
}

.narrative-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid #334155;
  padding-bottom: 6px;
}

.narrative-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #93c5fd;
}

#closeNarrativeBtn {
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}
#closeNarrativeBtn:hover {
  transform: scale(1.2);
  color: #f87171;
}

#narrativeContent {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 10px;
}

#narrativeContent strong {
  color: #38bdf8;
}
#narrativeContent em {
  color: #facc15;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


.analysis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(6px);
  z-index: 4000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 30px;
}

.overlay-content {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  width: 90%;
  height: 85%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.overlay-body {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.narrative-panel, .dashboard-panel {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scrollable-panel {
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.close-overlay {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.close-overlay:hover {
  background: #dc2626;
}

@media (max-width: 900px) {
  .overlay-body {
    flex-direction: column;
  }
}

.analysis-overlay {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.97);
  backdrop-filter: blur(6px);
  z-index: 4000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 30px;
  animation: fadeIn 0.3s ease;
}

.overlay-content {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  width: 90%;
  height: 85%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.overlay-body {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.narrative-panel,
.dashboard-panel {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scrollable-panel {
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.close-overlay {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.close-overlay:hover {
  background: #dc2626;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .overlay-body {
    flex-direction: column;
  }
}
#complianceDashboard {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  width: 70%;
  max-width: 1200px;
  background: rgba(10, 15, 25, 0.95);
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2rem;
  display: none;
  animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.chart-grid {
  display: flex;
  justify-content: space-around;
  gap: 2rem;
  margin-top: 2rem;
}

.chart-card {
  flex: 1;
  background: rgba(255,255,255,0.03);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  min-height: 350px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.4);
}
.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
}

/* Overlay behind the modal */
.compliance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding-top: 5vh;
  z-index: 9999;
}

.compliance-modal {
  background: #0b1624;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2.5rem 3rem;
  width: 90%;
  max-width: 1400px;
  min-height: 70vh;  /* gives room for charts */
  animation: fadeInUp 0.4s ease-out;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}


@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chart-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: flex-start;
  gap: 2rem;
  margin-top: 2rem;
}

.chart-card {
  flex: 1 1 45%;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  min-height: 420px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
 }

.summary-cards {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.compliance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.compliance-modal {
  background: #0b1624;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2.5rem 3rem;
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  color: white;
  animation: slideDown 0.4s ease-out;
  overflow-y: auto;
}

/* Header */
.compliance-modal .dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Summary cards */
.summary-cards {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Chart layout */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  flex: 1;
  align-items: stretch;
}

.chart-card {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 450px;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chart-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.chart-box {
  background: #1e293b;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;            /* ✅ This anchors the chart height */
  min-width: 400px;
  overflow: hidden;
}

.chart-box canvas {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

.compliance-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 4rem 0;
  justify-content: center;
  align-items: flex-start;
}

.dashboard-modal {
  margin: auto;
  background: #0f172a;
  color: #f9fafb;
  border-radius: 18px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2rem 2.5rem;
  width: 90%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-header {
  text-align: left;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f1f5f9;
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 0.75rem;
}

.summary-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1rem;
}

.summary-cards .card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  box-shadow: 0 0 15px rgba(0, 150, 255, 0.15);
  color: #e2e8f0;
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 160px;
  transition: all 0.25s ease;
  font-weight: 600;
}

.summary-cards .card:hover {
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
  transform: translateY(-2px);
}

.summary-cards .card i {
  font-size: 1rem;
}

.card.success { border-left: 4px solid #22c55e; }
.card.warning { border-left: 4px solid #facc15; }
.card.danger  { border-left: 4px solid #ef4444; }
.card.total   { border-left: 4px solid #3b82f6; }

.chart-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.chart-box {
  background: #1e293b;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 420px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.chart-box h3 {
  margin-bottom: 0.5rem;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 1.1rem;
}

.chart-box canvas {
  width: 90% !important;
  height: 90% !important;
  object-fit: contain;
}

.close-btn {
  align-self: center;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #ef4444;
}
.dashboard-modal {
  position: relative;
  overflow: hidden;
}

.dashboard-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(56,189,248,0.2), rgba(59,130,246,0.2), rgba(16,185,129,0.2));
  filter: blur(25px);
  z-index: 0;
  opacity: 0.3;
}

.dashboard-modal > * {
  position: relative;
  z-index: 1;
}

/* === Executive Narrative Modal Redesign === */
.narrative-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
}

.narrative-modal.hidden {
  display: none;
}

.narrative-dialog {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  width: min(95%, 1200px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.narrative-header {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.narrative-close {
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.narrative-close:hover {
  background: #b91c1c;
}

.narrative-body {
  padding: 20px 40px 30px 40px;
  overflow-y: auto;
  color: #e2e8f0;
  line-height: 1.7;
  font-size: 1rem;
}

.narrative-content {
  max-width: 1100px;
  margin: 0 auto;
}

/* --- Text and Sections --- */
.narrative-body h1, .narrative-body h2, .narrative-body h3 {
  color: #60a5fa;
  border-bottom: 1px solid rgba(96, 165, 250, 0.3);
  padding-bottom: 4px;
  margin-top: 20px;
  margin-bottom: 12px;
}

.narrative-body strong {
  color: #facc15;
  font-weight: 600;
}

.narrative-body p {
  margin: 10px 0;
}

.narrative-body ul {
  margin: 10px 0 10px 24px;
  padding-left: 16px;
}

.narrative-body li {
  margin-bottom: 6px;
}

/* --- Loader Spinner --- */
.narrative-content .loader {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  margin: 40px auto 10px auto;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
/* 🔹 Chat Drawer Container */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, sans-serif;
}

/* 🔹 Floating button */
#chat-handle {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(37,99,235,0.4);
  transition: transform 0.2s, background 0.3s;
}
#chat-handle:hover {
  transform: scale(1.05);
  background: #1d4ed8;
}

/* 🔹 Chat panel (hidden by default) */
#chat-box {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  color: #f1f5f9;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.3s ease-in-out;
  pointer-events: none;
}

/* 🔹 When opened */
#chat-box.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  z-index: 10000;
}

/* 🔹 Chat header */
#chat-box .chat-header {
  background: #1e293b;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 🔹 Messages area */
#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

/* 🔹 Input bar */
.chat-input {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #1e293b;
}
.chat-input input {
  flex: 1;
  border: none;
  background: transparent;
  color: #f1f5f9;
  padding: 10px;
}
.chat-input button {
  background: #2563eb;
  border: none;
  color: white;
  padding: 10px 16px;
  cursor: pointer;
}

#chat-box {
  display: flex !important;
  visibility: visible !important;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.3s ease-in-out;
  position: fixed;
  bottom: 90px;
  right: 20px;
  flex-direction: column;
  background: #0f172a;
  width: 380px;
  max-height: 500px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
#chat-box.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#chat-box {
  background: linear-gradient(180deg, #1e293b 0%, #111827 100%);
  color: #f9fafb;
  border: 1px solid rgba(255,255,255,0.08);
}

.chat-header {
  background: #1e3a8a;
  color: #f9fafb;
  font-weight: 600;
}

.chat-input {
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#chat-question {
  background: #1e293b;
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

#chat-handle {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

#chat-auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

#chat-auth-modal .auth-content {
  background: #111827;
  color: #f9fafb;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  min-width: 300px;
  max-width: 420px;
  text-align: center;
}

#cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, rgba(37, 99, 235, 0) 70%);
  filter: blur(120px);
  transform: translate(-50%, -50%);
  z-index: 5; /* ensure above background but below modals */
  opacity: 0.9;
  mix-blend-mode: screen;
  transition: transform 0.05s linear;
}

#cursor-glow {
  position: absolute;
  z-index: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

#cursor-glow {
  animation: pulse 6s ease-in-out infinite;
}

setInterval(() => {
  const track = document.querySelector(".slider-track");
  if (!track) return;
  track.scrollLeft += 1;
  if (track.scrollLeft >= track.scrollWidth - track.clientWidth) {
    track.scrollLeft = 0;
  }
}, 50);

.top-header {
  position: relative;
  overflow: visible !important;
  z-index: 10;
}

#providerMenu {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  position: fixed !important;
  top: 70px;
  right: 20px;
  z-index: 99999 !important;
}

#providerMenu.open {
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  opacity: 1 !important;
}

/* Make sure the header allows overflow and creates a high stacking layer */
.top-header {
  position: relative !important;
  z-index: 500 !important;
  overflow: visible !important;
}

/* Dropdown container: positioned under the toggle */
#providerMenu {
  position: absolute !important;
  top: 100%; /* directly under the button */
  right: 0;
  display: none;
  flex-direction: row;
  gap: 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  z-index: 9999 !important;
}

/* When menu is open */
#providerMenu.open {
  display: flex !important;
  opacity: 1 !important;
}

/* Optional: style each provider button nicely */
#providerMenu .provider-btn {
  background: rgba(51, 65, 85, 0.8);
  border-radius: 6px;
  padding: 6px 10px;
  color: #f8fafc;
  font-size: 0.9rem;
  transition: background 0.2s;
}

#providerMenu .provider-btn:hover {
  background: rgba(96, 165, 250, 0.6);
}

/* Body-level portal (never clipped by header overflow) */
#providerPortal {
  position: fixed;               /* anchor to viewport */
  top: 0; left: 0;
  display: none;                 /* toggled by JS */
  opacity: 0;
  transform: translateY(6px);    /* tiny drop */
  transition: opacity .18s ease, transform .18s ease;
  z-index: 100000;               /* above your blue bar */
}

/* Visible state */
#providerPortal.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* The actual menu panel */
#providerPortal .provider-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;               /* wrap when narrow */
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
}

/* Pills */
#providerPortal .provider-btn {
  background: rgba(51,65,85,.85);
  color: #f8fafc;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .9rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
#providerPortal .provider-btn:hover {
  background: rgba(96,165,250,.55);
  border-color: rgba(147,197,253,.6);
}
#providerPortal .provider-btn.active {
  outline: 2px solid #60a5fa;
}

/* Show scrollable list on small screens, hide toggle */
@media (max-width: 768px) {
  .provider-scroll { display: flex; }
  #providerToggle  { display: none; }
}
@media (min-width: 769px) {
  .provider-scroll { display: none; }
}
.provider-scroll {
  overflow-x: auto;
  gap: 8px;
  padding: 6px 8px;
}

/* --- mobile visibility and layout fix --- */
@media (max-width: 768px) {
  .top-header {
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 8px 12px;
  }

.provider-toggle {
  font-size: 0.9rem;          /* smaller text */
  font-weight: 500;           /* lighter, less blocky */
  padding: 4px 10px;          /* less vertical space */
  border-radius: 6px;         /* softer corners */
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #f1f5f9;             /* slightly softer white */
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: all 0.2s ease-in-out;
}

.provider-toggle:hover {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transform: translateY(-1px);
}

.provider-toggle span {
  font-size: 1rem;            /* keep the icon legible */
  margin-right: 4px;
  opacity: 0.8;
}

  /* Adjust search + logout spacing */
  #search, #mode-toggle, .logout-btn {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  /* prevent header overflow clipping */
  .provider-toggle-container {
    overflow: visible !important;
  }
}

.provider-menu {
  display: none;
  position: absolute;
  top: 60px;
  right: 0;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  min-width: 260px;
  z-index: 9999;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.provider-menu.open {
  display: flex;
}

.menu-switch {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.menu-type {
  flex: 1;
  background: rgba(31, 41, 55, 0.8);
  border: none;
  padding: 6px 10px;
  margin: 0 2px;
  border-radius: 6px;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background .2s ease;
}
.menu-type.active {
  background: rgba(59, 130, 246, 0.9);
  color: white;
}
.provider-btn {
  background: rgba(51, 65, 85, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: left;
  color: #e2e8f0;
  width: 100%;
  margin-top: 4px;
  cursor: pointer;
  transition: background .2s ease;
}
.provider-btn:hover {
  background: rgba(71, 85, 105, 0.9);
}

/* Mobile adjustment */
@media (max-width: 768px) {
  .provider-menu {
    right: 10px;
    top: 70px;
    min-width: 200px;
  }
}

.welcome-container {
  animation: fadeIn 0.8s ease-in forwards;
  opacity: 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Unified Menu Styling === */

.provider-menu {
  position: absolute;
  right: 12px;
  top: 64px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 0;
  width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  transform-origin: top right;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.18s ease;
  z-index: 1000;
}

.provider-menu.open {
  transform: scale(1);
  opacity: 1;
}

.menu-switch {
  display: flex;
  justify-content: space-between;
  background: rgba(37, 99, 235, 0.15);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 6px 10px;
}

.menu-type {
  flex: 1;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 8px 0;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.menu-type.active {
  background: rgba(37, 99, 235, 0.3);
  color: #fff;
  font-weight: 600;
}

.menu-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 8px;
}

/* Scrollbar styling */
.menu-content::-webkit-scrollbar {
  width: 6px;
}
.menu-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

/* Buttons inside menu */
.provider-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.provider-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  transform: translateX(2px);
}

.provider-btn.active {
  background: rgba(37, 99, 235, 0.4);
}

.empty, .error {
  padding: 12px;
  font-size: 0.85rem;
  text-align: center;
}

.provider-menu.open {
  transform: scale(1);
  opacity: 1;
  animation: fadeInUp 0.18s ease forwards;
}

@keyframes fadeInUp {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.provider-toggle[aria-expanded="true"] {
  background: rgba(37,99,235,0.25);
  border-radius: 8px;
}

/* === Unified Menu Polished Layout === */
.provider-menu {
  position: absolute;
  right: auto;
  left: 40%;
  top: 80px;
  transform: translateX(-50%) scale(0.96);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  width: 420px; /* more natural width */
  max-height: 600px;
  overflow-y: auto;
  padding: 12px 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  transform-origin: top center;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}

.provider-menu.open {
  opacity: 1;
  transform: scale(1);
}

.menu-switch {
  display: flex;
  justify-content: space-around;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 58, 138, 0.4);
  border-radius: 10px 10px 0 0;
}

.menu-type {
  flex: 1;
  font-size: 0.95rem;
  padding: 10px 0;
  color: #a1a1aa;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-type.active {
  background: rgba(37, 99, 235, 0.45);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
}

.menu-content {
  padding: 8px 14px 10px;
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.menu-content::-webkit-scrollbar {
  width: 6px;
}
.menu-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Provider + Control Buttons */
.provider-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
  text-align: left;
  transition: all 0.2s ease;
  cursor: pointer;
}

.provider-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.provider-btn.active {
  background: rgba(37, 99, 235, 0.5);
  border-color: rgba(96, 165, 250, 0.6);
}

@keyframes scaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.provider-menu.open {
  animation: scaleUp 0.2s ease;
}

.provider-toggle {
  background: rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  color: #e2e8f0;
  font-weight: 500;
  transition: all 0.2s ease;
}

.provider-toggle:hover {
  background: rgba(59, 130, 246, 0.35);
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.provider-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.provider-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.provider-card h3 {
  color: #60a5fa;
  font-size: 1.1rem;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 6px;
}

.provider-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.provider-card li {
  margin-bottom: 10px;
}

.cmd-name {
  display: block;
  color: #f3f4f6;
  font-weight: 500;
  font-family: monospace;
  font-size: 0.9rem;
}

.cmd-desc {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
}

@media (max-width: 1024px) {
  .provider-menu {
    left: 50%;
    width: 90%;
  }
}

.provider-menu.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.provider-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.provider-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.provider-card h3 {
  color: #60a5fa;
  font-size: 1rem;
  margin-bottom: 6px;
}

.provider-card p {
  color: #94a3b8;
  font-size: 0.85rem;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.provider-card {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.provider-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.provider-card h3 {
  color: #60a5fa;
  font-size: 1.1rem;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 6px;
}

.cmd-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cmd-item {
  background: rgba(31,41,55,0.6);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  transition: background 0.2s ease;
}

.cmd-item:hover {
  background: rgba(59,130,246,0.2);
}

.cmd-name {
  display: block;
  color: #f3f4f6;
  font-weight: 500;
  font-family: monospace;
  font-size: 0.9rem;
}

.cmd-desc {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
}

#headerTitle {
  font-size: 1.05rem;            /* smaller, balanced with nav buttons */
  font-weight: 500;              /* lighter than bold */
  letter-spacing: 0.3px;         /* adds subtle precision */
  color: #e2e8f0;                /* slightly muted white-blue */
  text-shadow: 0 0 4px rgba(0,0,0,0.3); /* soft depth without glow */
  margin-left: 6px;
}

.provider-toggle-container {
  padding: 0 4px;
}

/* --- Mobile adjustments --- */
@media (max-width: 768px) {
  .top-header {
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    position: relative;
  }

  /* Keep provider button on far right */
  .provider-toggle-container {
    order: 3; /* move it to the end if header items wrap */
    margin-left: auto; /* push to right edge */
    flex-shrink: 0;
  }

  .provider-toggle {
    font-size: 0.7rem;
    padding: 5px 8px;
    display: inline-flex !important;
  }

  #search, #mode-toggle, .logout-btn {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .provider-toggle-container {
    overflow: visible !important;
  }
}

.provider-toggle {
  font-size: 0.90rem !important; /* smaller text */
  font-weight: 500;
  line-height: 1.2;
  padding: 5px 9px;
}

/* Optional – scale down the ☰ icon slightly for balance */
.provider-toggle span[aria-hidden="true"] {
  font-size: 0.85em;
  margin-right: 4px;
}

#controlSearchModal input:focus + div {
  box-shadow: 0 0 12px rgba(56,189,248,0.4);
}

#providerChartContainer + div.flex.justify-center {
  margin-top: -10px; /* pull it up slightly */
}

/* Chat Panel Animations */
#chat-panel.show {
  display: flex;
  animation: slideUp 0.25s ease-out forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth scroll for chat messages */
#chat-messages {
  scroll-behavior: smooth;
}

/* Blur-glass look consistency */
#chat-bar, #chat-panel {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ============================
   Footer Chat — Enhanced Visual Design
============================ */

/* Make chat panel subtly pop from main background */
#chat-panel {
  background: rgba(15, 23, 42, 0.85); /* slightly more opaque than before */
  border-top: 1px solid rgba(148, 163, 184, 0.25); /* soft silver edge */
  box-shadow:
    0 -2px 12px rgba(0, 0, 0, 0.4),
    0 -1px 2px rgba(255, 255, 255, 0.05) inset; /* layered light and depth */
  border-radius: 12px 12px 0 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: all 0.25s ease-in-out;
}

/* When maximized — remove radius for flush look */
#chat-panel.show[maximized],
#chat-panel:has(#chat-maximize:focus-visible) {
  border-radius: 0;
}

/* Define the top "chat bar" visually */
#chat-bar {
  background: rgba(30, 41, 59, 0.9);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 1px solid rgba(148, 163, 184, 0.1);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px 12px 0 0;
  box-shadow:
    0 0 12px rgba(0, 0, 0, 0.5),
    0 -1px 3px rgba(255, 255, 255, 0.05) inset;
}

/* Add soft glow when expanded */
#chat-container.expanded #chat-panel {
  box-shadow:
    0 -4px 24px rgba(56, 189, 248, 0.15),
    0 -1px 2px rgba(255, 255, 255, 0.06) inset;
  border-color: rgba(56, 189, 248, 0.3);
}

/* Message bubbles refinement */
#chat-messages div.inline-block {
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.05);
}

/* Smooth animation on open/close */
#chat-panel.show {
  animation: slideUp 0.25s ease-out forwards;
}

#chat-bar:hover {
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Copyright footer - glassy alignment with chat */
#chat-footer-note {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  font-style: italic;
  letter-spacing: 0.3px;
  transition: opacity 0.3s ease-in-out;
}

#chat-footer-note span {
  font-style: normal;
}

/* Hide or dim when chat is maximized for clean look */
#chat-panel.show[maximized] ~ #chat-footer-note {
  opacity: 0.3;
}

#chat-container.expanded #chat-footer-note {
  opacity: 0.5;
  filter: blur(1px);
}

.chat-header {
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow:
    0 -1px 6px rgba(0, 0, 0, 0.3),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.chat-header div.absolute {
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Hover glow on footer bar */
#chat-bar:hover {
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Smooth fade for copyright when maximizing */
#chat-panel[maximized] .chat-header div.absolute {
  opacity: 0.4;
  transition: opacity 0.3s ease-in-out;
}

#chat-auth-modal {
  transition: opacity 0.25s ease-in-out;
}

#chat-auth-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.markdown-body pre {
  background: rgba(30, 41, 59, 0.9);
  border-radius: 0.5rem;
  padding: 0.75rem;
  overflow-x: auto;
}
.markdown-body code {
  color: #d1d5db;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.chat-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,41,59,0.9);
  color: #e2e8f0;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 99999;
}
.chat-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.chat-toast-success { border: 1px solid #22c55e; color: #22c55e; }
.chat-toast-error   { border: 1px solid #ef4444; color: #ef4444; }
.chat-toast-warn    { border: 1px solid #facc15; color: #facc15; }

#security-assistant-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  animation: sa-pulse 2.5s infinite;
}

#security-assistant-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 30px rgba(14, 165, 233, 0.6);
}

@keyframes sa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(14, 165, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

#security-assistant-button::after {
  content: "Security Assistant";
  position: absolute;
  bottom: 75px;
  right: 50%;
  transform: translateX(50%);
  background: rgba(15, 23, 42, 0.9);
  color: #e0f2fe;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#security-assistant-button:hover::after {
  opacity: 1;
}

#chat-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 40;
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(100, 116, 139, 0.4);
  backdrop-filter: blur(10px);
  box-shadow: 0 -2px 20px rgba(14, 165, 233, 0.25);
  transition: all 0.3s ease-in-out;
}

#chat-bar:hover {
  background: rgba(30, 41, 59, 0.9);
  box-shadow: 0 -4px 25px rgba(56, 189, 248, 0.35);
}

#chat-bar span.text-sky-400 {
  animation: pulse-chat 2.5s infinite;
}

@keyframes pulse-chat {
  0%, 100% { text-shadow: 0 0 0 rgba(56, 189, 248, 0); }
  50% { text-shadow: 0 0 12px rgba(56, 189, 248, 0.8); }
}

@layer utilities {
  .animate-rise {
    animation: rise-up 0.4s ease-out forwards;
  }

  @keyframes rise-up {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

@media (max-height: 700px) {
  #chat-container #chat-panel { height: 85vh !important; }
}

#chat-bar {
  transition: opacity 0.3s ease;
}

.markdown-body pre,
.markdown-body code {
  display: block;
  overflow-x: auto;
  white-space: pre; /* keep alignment for \ line continuation */
  word-break: normal;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 120, 180, 0.6) transparent;
  background: rgba(20, 30, 50, 0.6);
  border-radius: 0.5rem;
  padding: 0.6rem 0.9rem;
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
}

/* Special handling for smaller devices */
@media (max-width: 768px) {
  .markdown-body pre {
    font-size: 0.85rem;
    line-height: 1.3;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre; /* keep formatting intact */
  }

  /* Slight padding for mobile readability */
  .markdown-body pre code {
    display: block;
    white-space: pre;
    padding: 0.25rem 0.3rem;
  }
}

/* =========================================
   Mobile Control Mode (Base hidden state)
   ========================================= */
.mobile-controls-screen {
  display: none;
  visibility: hidden;
  opacity: 0;
  position: fixed;
  inset: 0;
  background: var(--background, #f9f9f9);
  z-index: 9999;        /* sits above everything */
  overflow-y: auto;
  transition: opacity 0.25s ease;
}

/* =========================================
   Mobile Layout Rules
   ========================================= */
@media (max-width: 768px) {

  /* Hide desktop left-side UI */
  #left-nav,
  .left-nav,
  #controls-nav {
    display: none !important;
  }

  main {
    padding: 0;
    margin: 0;
  }

  /* Mobile control screen still hidden by default */
  .mobile-controls-screen {
    background: #ffffff;
  }

  /* iOS hates backdrop-filter on modals */
  #chat-auth-modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: none !important;
  }
}

/* =========================================
   Mobile Control Mode Header
   ========================================= */
.mobile-controls-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.mobile-controls-back {
  border: none;
  background: none;
  font-size: 24px;
  padding: 4px 8px;
  cursor: pointer;
}

.mobile-controls-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

/* Navigation list inside mobile controls */
.mobile-controls-nav {
  padding: 12px 16px;
}

/* Active / hidden states */
.mobile-controls-screen.hidden {
  display: none;
}

.mobile-controls-screen.active {
  display: block;
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
}

/* Prevent portal containers from shifting */
.portal-container {
  transform: none !important;
}

/* =========================================
   Chat panel optional collapsed/expanded styles
   (Safe to keep; not used unless JS toggles them)
   ========================================= */
.chat-panel-collapsed {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}

.chat-panel-expanded {
  opacity: 1;
  max-height: 80vh;
  pointer-events: auto;
}

/* Ensure desktop modal has no unintended transitions */
#chat-auth-modal {
  transition: none !important;
}

.controls-grid {
  transform: translateZ(0);
  will-change: scroll-position;
}

#breadcrumb-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

#provider-select {
  padding: 4px 6px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
}

