elect Modal (Overlay)
   =========================== */

#provider-select-modal.provider-modal {
  position: fixed;
  inset: 0;
  display: none; /* default from inline style, JS will change it */
  align-items: center;
  justify-content: center;

  background: rgba(15, 23, 42, 0.70); /* dark glass */
  backdrop-filter: blur(10px);

  z-index: 4500;
}

/* When JS flips style.display to block/flex, force flex for centering */
#provider-select-modal[style*="display: block"],
#provider-select-modal[style*="display: flex"] {
  display: flex !important;
}

/* ===========================
   Modal Card
   =========================== */

.provider-modal-content {
  width: 92%;
  max-width: 420px;

  background: rgba(15, 23, 42, 0.92); /* slate-900-ish */
  border-radius: 22px;
  padding: 22px 20px 24px;

  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(148, 163, 184, 0.3);
}

/* Title */

.provider-modal-content h3 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;

  color: #e5f0ff;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.4); /* subtle neon glow */
}

/* ===========================
   Provider List
   =========================== */

.provider-list {
  display: flex;
  flex-direction: column;
  gap: 12px;

  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 14px;
}

/* Individual provider button */

.provider-list .provider-option,
.provider-list button {
  width: 100%;
  text-align: left;

  padding: 12px 16px;
  border-radius: 14px;

  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left,
                              rgba(56, 189, 248, 0.12),
                              rgba(15, 23, 42, 0.95));

  color: #f9fafb;
  font-size: 0.98rem;
  font-weight: 500;

  cursor: pointer;
  outline: none;

  transition:
    background 0.16s ease,
    transform 0.12s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.provider-list .provider-option:hover,
.provider-list button:hover {
  background: radial-gradient(circle at top left,
                              rgba(59, 130, 246, 0.26),
                              rgba(15, 23, 42, 0.98));
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.provider-list .provider-option:active,
.provider-list button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.9);
}

/* ===========================
   Cancel Button
   =========================== */

.provider-cancel-btn,
#provider-select-cancel {
  width: 100%;
  margin-top: 4px;

  padding: 12px 16px;
  border-radius: 14px;

  border: 1px solid rgba(248, 113, 113, 0.5);
  background: linear-gradient(
    to bottom,
    rgba(248, 113, 113, 0.18),
    rgba(127, 29, 29, 0.28)
  );

  color: #fecaca;
  font-size: 1.02rem;
  font-weight: 600;
  text-align: center;

  cursor: pointer;
  outline: none;

  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.12s ease,
    box-shadow 0.16s ease;
}

.provider-cancel-btn:hover,
#provider-select-cancel:hover {
  background: linear-gradient(
    to bottom,
    rgba(248, 113, 113, 0.3),
    rgba(127, 29, 29, 0.45)
  );
  color: #fee2e2;
  box-shadow: 0 8px 22px rgba(127, 29, 29, 0.55);
  transform: translateY(-1px);
}

.provider-cancel-btn:active,
#provider-select-cancel:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(127, 29, 29, 0.7);
}

   PROVIDER SELECT MODAL – MODERN THEME
   Matches Cloud Explorer blue/dark aesthetic
   =============================== */

.provider-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;

  background: rgba(5, 10, 20, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  z-index: 999999;
}

.provider-modal-content {
  background: linear-gradient(180deg, #0f1a2a, #0b1522 60%, #0a121c);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.7),
    inset 0 0 12px rgba(255, 255, 255, 0.05);

  border-radius: 20px;
  padding: 28px;
  width: min(420px, 92%);
  max-height: 88vh;
  overflow-y: auto;

  animation: fadeStart 0.25s ease-out;
}

@keyframes fadeStart {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Title */
.provider-modal-content h3 {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 600;
  margin-bottom: 24px;

  background: linear-gradient(90deg, #60a5fa, #8ab4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* List container */
.provider-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Provider buttons */
.provider-list button {
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 500;

  background: rgba(18, 27, 48, 0.9);
  border: 1px solid rgba(255,255,255,0.07);

  color: #e2e8f0;
  border-radius: 14px;

  text-align: left;

  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.provider-list button:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(96, 165, 250, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.4);
}

/* Cancel Button */
.provider-cancel-btn {
  margin-top: 26px;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  width: 100%;

  color: #f1f5f9;

  background: rgba(220, 38, 38, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);

  border-radius: 14px;
  text-align: center;

  transition: all 0.2s ease;
}

.provider-cancel-btn:hover {
  background: rgba(220, 38, 38, 0.4);
  border-color: rgba(248, 113, 113, 0.5);
  transform: translateY(-1px);

  box-shadow:
    0 0 14px rgba(248, 113, 113, 0.35);
}

/* ===========================
   MODAL OVERLAY
=========================== */

#providerModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  display: none;            /* show via JS */
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

/* ===========================
   MODAL PANEL
=========================== */

#providerModal {
  width: 90%;
  max-width: 420px;

  background: rgba(15, 23, 42, 0.85);  /* slate-900 glass */
  backdrop-filter: blur(14px);
  border-radius: 24px;

  padding: 26px 22px 30px;

  box-shadow:
    0 12px 32px rgba(0,0,0,0.55),
    inset 0 0 2px rgba(255,255,255,0.08);

  animation: providerModalPop 0.18s ease-out;
}

@keyframes providerModalPop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ===========================
   TITLE
=========================== */

#providerModal h2 {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 22px;
  color: #e2e8f0;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.35); /* cyan glow */
}

/* ===========================
   LIST OF PROVIDERS
=========================== */

.provider-option {
  width: 100%;
  padding: 14px 18px;

  background: rgba(30, 41, 59, 0.85); /* slate-800 glass */
  border-radius: 14px;
  margin-bottom: 14px;

  color: #f1f5f9;
  font-size: 1rem;
  border: 1px solid rgba(255,255,255,0.06);

  transition: background 0.15s ease, transform 0.15s ease;
}

.provider-option:hover {
  background: rgba(51, 65, 85, 0.90);
  transform: translateY(-2px);
}

.provider-option:active {
  transform: translateY(0);
}

/* ===========================
   CANCEL BUTTON
=========================== */

#providerCancelBtn {
  width: 100%;
  padding: 14px 18px;

  background: rgba(220, 38, 38, 0.18); /* soft red glass */
  color: #fca5a5;

  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 14px;
  margin-top: 10px;

  font-size: 1.05rem;
  font-weight: 600;

  transition: background 0.15s ease, color 0.15s ease;
}

#providerCancelBtn:hover {
  background: rgba(220, 38, 38, 0.28);
  color: #fecaca;
}

/* ===========================
   GLOBAL ANTI-JITTER SEATBELTS
   =========================== */

/* 1) Make sizing predictable everywhere */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2) Reserve space for borders globally on interactive elements */
button,
a,
input,
select,
textarea,
[role="button"],
.interactive {
  border: 1px solid transparent; /* prevents hover border growth */
  line-height: 1;                /* avoids tiny text reflow */
  transform: translateZ(0);      /* GPU nudge */
  will-change: transform;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

/* 3) Prefer outline over border for focus/hover if you want */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid rgba(51,156,255,0.9);
  outline-offset: 2px;
}

/* 4) Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  button,
  a,
  [role="button"],
  .interactive {
    transition: none !important;
    transform: none !important;
  }
}


/* =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: #0f141a; /* a clean unified backdrop */
  border-left: 1px solid rgba(255, 255, 255, 0.04); /* subtle divider only */
}


/* ===========================
   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 {
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow-y: auto;   /* normal scrolling */
  padding: 20px;
}

#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);
}

/* ===========================
   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;
  }
}

/* ===========================
   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);
}

/* .top-header {
  height: 62px;
  background: #0a2a82;          /* your blue */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 1000;
} 

*/

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Logo section */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.navbar-logo {
  height: 28px;
  width: auto;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

/* Cloud Providers toggle */
.provider-toggle {
  background: rgba(255,255,255,0.12);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.provider-toggle:hover {
  background: rgba(255,255,255,0.18);
}

/* Auth button */
.auth-btn-header {
  background: rgba(255,255,255,0.12);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.auth-btn-header:hover {
  background: rgba(255,255,255,0.18);
}

/* ===========================
   AUTH MODAL STYLING
   =========================== */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.auth-modal-content {
  background: #1e2b48;
  padding: 28px;
  border-radius: 10px;
  width: 360px;
  max-width: 90%;
  color: white;
  position: relative;
  box-shadow: 0 0 24px rgba(0,0,0,0.4);
  animation: fadeIn 0.2s ease-out;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 14px;
  cursor: pointer;
  font-size: 22px;
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  padding: 10px 12px;
  border-radius: 6px;
  border: none;
  background: #26355d;
  color: #fff;
  font-size: 14px;
}

.auth-btn {
  background: #4f7df1;
  border: none;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: white;
}

.auth-btn:hover {
  background: #6a92ff;
}

.auth-alt {
  text-align: center;
  font-size: 13px;
}

.auth-alt a {
  color: #7aa8ff;
  cursor: pointer;
}

.auth-user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-plan-label {
  color: #9cc0ff;
  font-size: 14px;
}

.logout-btn {
  background: #3f4f6b;
  border: none;
  padding: 6px 10px;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

.logout-btn:hover {
  background: #536a92;
}

.auth-menu-portal {
  position: absolute;
  z-index: 99999;
}

.auth-menu-panel {
  position: absolute;
  right: 0;
  top: 42px;
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.15s ease;
}

.auth-menu-item {
  text-align: left;
  padding: 8px 12px;
  background: transparent;
  color: #e2e8f0;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.auth-menu-item:hover {
  background: rgba(255,255,255,0.1);
}

#breadcrumb .crumb {
  text-decoration: none;
}

#breadcrumb .crumb:hover {
  text-decoration: underline;
}

#breadcrumb .sep {
  text-decoration: none !important; /* separator never underlines */
}

/* FORCE LAYOUT SCROLL FIX */
#center,
#explorer-wrapper,
#explorer {
  overflow-y: auto !important;
  overflow-x: hidden;
  max-height: calc(100vh - 60px);
}

/* Make provider nav bigger and readable */
#nav {
  min-width: 240px !important;
  max-width: 260px;
  padding: 16px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.88);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Provider cards — readable, touchable */
#nav .provider-card {
  padding: 12px 14px !important;
  font-size: 15px !important;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.2s ease, transform 0.15s ease;
}

#nav .provider-card:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(3px);
}

.matched-card {
  min-height: 120px;       /* increased */
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.95rem;
}

#matched-controls {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:1000;
}

.modal-content {
  background:white;
  padding:20px;
  border-radius:8px;
  width:300px;
}

.provider-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(3px);
}

.provider-modal-content {
  background: #ffffff;
  color: #1e293b;
  padding: 24px;
  border-radius: 12px;
  width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  text-align: center;
}

.provider-modal-content h3 {
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: bold;
  color: #0f172a;
}

.provider-list button {
  display: block;
  width: 100%;
  padding: 10px 0;
  margin: 6px 0;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1e293b;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s ease;
}

.provider-list button:hover {
  background: #e2e8f0;
}

.provider-cancel-btn {
  margin-top: 16px;
  padding: 8px 0;
  width: 100%;
  background: #f87171;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: 0.2s ease;
}

.provider-cancel-btn:hover {
  background: #ef4444;
}

.provider-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.provider-modal-content {
  background: #ffffff !important;
  color: #0f172a !important;
  padding: 20px;
  border-radius: 12px;
  width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  filter: none !important;
  opacity: 1 !important;
}

.provider-modal-content * {
  filter: none !important;
  opacity: 1 !important;
  color: #0f172a !important;
}

/* --- Force details panel to behave as a normal block inside #center --- */
#details {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  right: auto !important;
  top: auto !important;
  height: auto !important;
  border-left: none !important;
  margin-top: 20px;
}

/* Prevent the giant empty space caused by a fixed-flex layout */
#center {
  overflow-y: auto !important;
  display: block !important;
}

input::-ms-reveal,
input::-ms-clear {
  display: none !important;
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  transition: background-color 99999s ease-in-out 0s;
}

input:autofill {
  filter: blur(5px);
}

/* ===== Header Gradient Upgrade ===== */
header.top-header {
  background: linear-gradient(
    90deg,
    #1976ff 0%,
    #1150c9 35%,
    #0a2f74 70%,
    #05070c 100%
  );

  color: white;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.06);

  box-shadow:
    0 8px 24px rgba(0,0,0,0.35),
    inset 0 -1px 0 rgba(255,255,255,0.04);
}

/* subtle top-left glow like your marketing header */
header.top-header::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    600px 200px at 0% 0%,
    rgba(80,160,255,0.35),
    rgba(0,0,0,0) 60%
  );
  mix-blend-mode: screen;
  opacity: 0.8;
}

header.top-header .header-left,
header.top-header .provider-toggle-container {
  background: transparent;
}

.btn {
  border: 1px solid transparent;           /* stable box */
  background: rgba(255,255,255,0.03);
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform .12s ease,
    box-shadow .12s ease,
    border-color .12s ease,
    background-color .12s ease;
  will-change: transform;
  transform: translateZ(0);                /* nudge GPU */
}

.btn:hover {
  border-color: rgba(51,156,255,0.9);
  background: rgba(51,156,255,0.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}

.btn:active {
  transform: translateY(0);                /* no bounce */
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

#mode-toggle,
.logout-btn { position: relative; }

#mode-toggle::before,
.logout-btn::before {
  content: "";
  position: absolute;
  inset: -5px;     /* expands hover zone */
}

.modal.hidden { display:none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  margin: 8vh auto;
  width: min(520px, 92vw);
  background: #0b1220;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: fadeIn 0.18s ease-out;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 22px;
  cursor: pointer;
}

.auth-view input {
  width: 100%;
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: white;
}

.auth-view button {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
}

.auth-error { color: #fca5a5; margin-top: 8px; }
button.danger { background: #b91c1c; }

.top-header {
  display: flex;
  align-items: center;
  width: 100%;
  overflow: visible;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: visible;
}

.account-btn {
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.35);
  color: #cfe4ff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.account-btn:hover {
  background: rgba(59,130,246,0.2);
  border-color: rgba(59,130,246,0.6);
  transform: translateY(-1px);
}

/* --- Mobile header stabilization --- */
@media (max-width: 768px) {
  .top-header {
    flex-wrap: wrap;              /* allow wrapping */
    justify-content: center;      /* center the row content */
    gap: 8px;
    padding: 8px 10px;
  }

  .header-left {
    width: 100%;
    justify-content: center;      /* center logo/title */
  }

  .header-left a {
    justify-content: center;
  }

  .header-right {
    width: 100%;
    margin-left: 0 !important;    /* kill ml-auto on mobile */
    justify-content: center;      /* center buttons */
    gap: 8px;
  }

  .provider-toggle-container,
  .account-btn {
    flex: 0 0 auto;               /* prevent shrink jitter */
  }

  .provider-toggle,
  .account-btn {
    width: auto;
    max-width: 92vw;              /* avoid edge clipping */
  }
}

@media (max-width: 768px) {
  .top-header {
    justify-content: space-between;
    padding: 8px 10px;
  }
  .header-left { flex: 1 1 auto; }
  .header-right { margin-left: 0 !important; }
  .app-title { font-size: 16px; } /* optional */
}

/* Prevent hover/focus from changing size */
.provider-toggle,
.account-btn,
button {
  box-sizing: border-box;
  border: 1px solid transparent;  /* constant border width */
}

.provider-toggle:hover,
.account-btn:hover,
button:hover {
  border-color: rgba(255,255,255,0.2);
  transform: translateZ(0) scale(1.02); /* subtle, no reflow */
}

/* =========================
   Mobile header stabilization
   (desktop untouched)
   ========================= */

  header.top-header .header-left {
    flex: 1 1 auto;                /* left can shrink */
    min-width: 0;                  /* allow ellipsis instead of wrap */
  }

  header.top-header .header-right {
    flex: 0 0 auto;                /* right NEVER shrinks/grows */
    min-width: max-content;        /* prevents jitter on edge */
    display: flex;
    align-items: center;
    gap: 8px;                      /* override Tailwind gap-2 if needed */
  }

  /* lock button sizes so they don't reflow */
  header.top-header .provider-toggle,
  header.top-header .account-btn {
    height: 36px;
    line-height: 36px;
    padding: 0 12px;
    white-space: nowrap;
    flex: 0 0 auto;
    border-radius: 10px;
  }

  /* if title is wrapping on narrow phones, shrink slightly */
  header.top-header .app-title {
    font-size: 16px;               /* was text-lg (~18px) */
  }
}

@media (max-width: 768px) {
  header.top-header .header-right {
    margin-left: auto;          /* keep whole group on the right */
    flex: 0 0 auto;             /* DON'T grow to full width */
    width: auto;                /* ensure shrink wrap */
    justify-content: flex-end;  /* pack items to right */
    gap: 8px;
  }

  header.top-header .provider-toggle-container,
  header.top-header #account-btn {
    flex: 0 0 auto;             /* no stretching */
  }

  /* optional: make sure Account is to the RIGHT of Providers */
  header.top-header #account-btn {
    order: 2;
  }
  header.top-header .provider-toggle-container {
    order: 1;
  }
}

/* =========================================================
   ACCOUNT / AUTH MODAL — PRO THEME POLISH
   (safe: no DOM changes required)
========================================================= */

#account-modal.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 24px);
}

/* show/hide uses your existing "hidden" class */
#account-modal.hidden { 
  display: none; 
}

#account-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px circle at 50% -10%, rgba(40,120,255,0.18), transparent 55%),
    rgba(2,6,16,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modalFade 160ms ease-out;
}

#account-modal .modal-card {
  position: relative;
  width: min(92vw, 420px);
  background:
    linear-gradient(180deg, rgba(14,25,46,0.98), rgba(8,14,27,0.98));
  border: 1px solid rgba(120,170,255,0.18);
  border-radius: 14px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 18px 18px 16px;
  color: #e6ecff;
  animation: modalPop 180ms cubic-bezier(.2,.8,.2,1);
}

#account-modal .modal-close,
#account-modal #account-close {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 30px;
  width: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(12,18,30,0.9);
  color: #cbd5ff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
#account-modal .modal-close:hover,
#account-modal #account-close:hover {
  transform: translateY(-1px);
  background: rgba(18,28,48,0.95);
  border-color: rgba(150,190,255,0.25);
}

/* headings */
#account-modal h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin: 4px 0 10px;
}
#account-modal h4 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 10px 0 6px;
  color: #9fb5ff;
}

/* section spacing */
#account-modal .auth-view {
  display: grid;
  gap: 8px;
}

#account-modal hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120,170,255,0.25), transparent);
  margin: 8px 0;
}

/* inputs */
#account-modal input[type="email"],
#account-modal input[type="password"] {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(6,10,18,0.9);
  color: #eaf0ff;
  padding: 0 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

#account-modal input::placeholder {
  color: rgba(180,195,235,0.6);
}

#account-modal input:focus {
  border-color: rgba(70,130,255,0.85);
  box-shadow: 0 0 0 3px rgba(70,130,255,0.18);
  background: rgba(8,14,26,0.98);
}

/* primary buttons */
#account-modal button {
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(120,170,255,0.25);
  background: linear-gradient(180deg, #1b68ff 0%, #0f47c9 100%);
  color: white;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
  box-shadow: 0 6px 18px rgba(16,80,220,0.35);
}

#account-modal button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  border-color: rgba(150,200,255,0.5);
}

#account-modal button:active {
  transform: translateY(0px) scale(0.98);
}

/* danger button (logout) */
#account-modal button.danger,
#account-modal #auth-logout-btn {
  background: linear-gradient(180deg, #e14949 0%, #b91c1c 100%);
  border-color: rgba(255,120,120,0.35);
  box-shadow: 0 6px 18px rgba(220,40,40,0.35);
}

/* meta info block (logged in view) */
#account-modal .meta {
  background: rgba(4,8,16,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  font-size: 0.92rem;
  color: #d6defa;
}

#account-modal .meta strong {
  color: #ffffff;
  font-weight: 700;
}

/* error text */
#account-modal .auth-error,
#account-modal #auth-error {
  min-height: 18px;
  font-size: 0.9rem;
  color: #ff8b8b;
  margin-top: 2px;
}

/* subtle enter animations */
@keyframes modalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal shell (keep your existing .modal + .modal-backdrop rules if you have them) */
.account-card {
  width: 380px;
  max-width: calc(100vw - 24px);
  background: rgba(10, 14, 22, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 60px rgba(0,0,0,0.65);
  border-radius: 16px;
  padding: 16px;
  color: #e6eaf2;
  backdrop-filter: blur(8px);
}

/* Header */
.account-header { margin-bottom: 12px; }
.account-header.compact { margin-bottom: 8px; }

.account-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
}
.account-subtitle {
  font-size: 13px;
  color: rgba(230,234,242,0.7);
  margin: 0;
}

/* Identity + badge */
.identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.email {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.plan-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}
.plan-badge.pro {
  background: rgba(80,200,255,0.14);
  border-color: rgba(80,200,255,0.35);
}

/* Forms */
.form-stack { display: grid; gap: 10px; }

.field { display: grid; gap: 6px; font-size: 12px; }
.field span { color: rgba(230,234,242,0.75); }
.field input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  outline: none;
}
.field input:focus {
  border-color: rgba(80,200,255,0.6);
  box-shadow: 0 0 0 3px rgba(80,200,255,0.12);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  margin: 4px 0 0;
}

/* Divider */
.divider {
  display: grid;
  place-items: center;
  margin: 12px 0;
  position: relative;
}
.divider::before {
  content: "";
  height: 1px;
  width: 100%;
  background: rgba(255,255,255,0.08);
  position: absolute;
  left: 0;
}
.divider span {
  font-size: 11px;
  color: rgba(230,234,242,0.6);
  background: rgba(10,14,22,0.96);
  padding: 0 8px;
  z-index: 1;
}

/* Usage cards */
.usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 6px;
}
.usage-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
}
.card-label {
  font-size: 11px;
  color: rgba(230,234,242,0.7);
}
.card-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}
.card-value.inline { font-size: 16px; font-weight: 700; }
.card-sub {
  font-size: 11px;
  color: rgba(230,234,242,0.6);
}
.muted { opacity: 0.6; margin: 0 4px; }

/* Progress bar */
.progress-track {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(80,200,255,0.9), rgba(120,240,200,0.9));
  transition: width 0.3s ease;
}

/* CTA */
.cta { margin-top: 8px; display: grid; gap: 6px; }
.cta-note {
  font-size: 11px;
  color: rgba(230,234,242,0.65);
  margin: 0;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .06s ease, opacity .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  color: #031018;
  background: #58c9ff;
}
.btn-primary:hover { background: #76d6ff; }

.btn-ghost {
  color: #e6eaf2;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); }

.btn-danger {
  color: #fff;
  background: rgba(255,90,90,0.9);
}
.btn-danger:hover { background: rgba(255,90,90,1); }

/* Utilities */
.w-full { width: 100%; }
.mt-12 { margin-top: 12px; }

/* Auth error */
.auth-error {
  color: #ffb3b3;
  font-size: 12px;
  margin-top: 2px;
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar .title {
    flex: 1 1 100%;
  }
  #account-btn {
    margin-left: auto; /* stays right aligned on its own row */
  }
}

.global-loading {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 9999;
}

.global-loading.hidden {
  display: none;
}

.global-loading-card {
  background: rgba(10, 14, 22, 0.96);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.6);
  color: #e6eaf2;
  font-weight: 600;
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: rgba(88, 201, 255, 0.95);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Base header styling */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0A0E16;
  padding: 0.75rem 1rem;
  color: #e6eaf2;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 1000;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-header,
.header-desktop {
  pointer-events: auto !important;
}

main, #chartContainer {
  position: relative;
  z-index: 1;
}

.top-header {
  z-index: 1000;
}

.backdrop, .account-backdrop, .global-loading {
  outline: 2px solid red !important;
}
.backdrop,
.account-backdrop,
.global-loading {
  pointer-events: none !important;
}

#chartContainer,
#providerChart {
  position: relative !important;
  z-index: 5 !important;  /* not 5000 */
  pointer-events: auto !important;
}

#providerMenu {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.top-header {
  z-index: 1000;
  position: relative;
}

#providerChart {
  max-width: none !important;
  height: auto !important;
}

#providerChart {
  width: 340px !important;
  height: 340px !important;
}

.provider-modal {
  z-index: 2000 !important;
}

/* ============================================================
   PROVIDER MODAL — CLEAN, ISOLATED, GUARANTEED STABLE
   ============================================================ */

#provider-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(4px) !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 99999 !important;
  padding: 20px !important;
}

#provider-modal[hidden] {
  display: none !important;
}

/* Dialog container */
#provider-modal .provider-modal__dialog {
  background: #0f172a !important;
  border-radius: 12px !important;
  width: 90% !important;
  max-width: 900px !important;
  max-height: 80vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6) !important;
  position: relative !important;
  z-index: 100000 !important;
}

/* Header */
#provider-modal .provider-modal__header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 20px !important;
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  border-bottom: 1px solid rgba(255,255,255,0.1) !important;
}

#provider-modal-title {
  margin: 0 !important;
  font-size: 1.4rem !important;
  color: #60a5fa !important;
  font-weight: 600 !important;
}

/* Close button */
#provider-modal-close {
  background: none !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 1.5rem !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 32px !important;
}

#provider-modal-close:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #f87171 !important;
}

/* Body */
#provider-modal .provider-modal__body {
  padding: 20px !important;
  overflow-y: auto !important;
}

/* Stats */
#provider-modal .provider-modal__stats {
  display: flex !important;
  gap: 20px !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  margin-bottom: 20px !important;
}

/* Panels container */
#provider-modal .provider-modal__content {
  display: flex !important;
  gap: 20px !important;
  overflow: hidden !important;
  flex: 1 !important;
}

/* Individual panels */
#provider-modal .provider-modal__panel {
  flex: 1 !important;
  background: #1e293b !important;
  padding: 16px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  overflow-y: auto !important;
  max-height: 60vh !important;
}

/* Panel titles */
#provider-modal .provider-modal__panel h4 {
  margin: 0 0 12px !important;
  padding-bottom: 8px !important;
  font-size: 1rem !important;
  color: #93c5fd !important;
  border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}

/* About Plan modal inherits .modal + .modal-backdrop + .modal-card */

.about-plan-card {
  max-width: 720px;
  width: 90%;
  padding: 24px;
}

.about-plan-body section {
  margin-bottom: 18px;
}

.about-plan-body h4 {
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: #9fb5ff;
}

.about-plan-body ul {
  padding-left: 18px;
  list-style: disc;
}

.link-button {
  background: none;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  margin-top: 8px;
  text-decoration: underline;
}

.link-button:hover {
  color: #93c5fd;
}

/* FINAL OVERRIDE — force all modals to behave consistently */
.modal {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.6) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 9999 !important;
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  z-index: 10000 !important;
}

.link-button {
  background: none;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 0;
  text-decoration: underline;
}
.link-button:hover {
  color: #93c5fd;
}

.account-extra-link {
  margin-top: 20px;
  text-align: center;
  width: 100%;
}

.account-extra-link .link-button {
  color: #3b82f6;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 10px 0;
  width: 100%;
}

.account-extra-link .link-button:hover {
  color: #60a5fa;
}

#open-about-plan {
  pointer-events: auto !important;
    position: relative;
      z-index: 100000 !important;
}

#disable-pro-modal {
  display: none !important;
}

#disable-pro-modal.hidden {
  display: none !important;
}

/* --- DESKTOP / MOBILE SPLIT --- */

/* Desktop only */
@media (min-width: 769px) {
  .header-desktop {
    display: flex !important;
  }
  .header-mobile {
    display: none !important;
  }
}

/* Mobile only */
@media (max-width: 768px) {
  .header-desktop {
    display: none !important;
  }
  .header-mobile {
    display: flex !important;
  }

  /* Push UI down under the fixed mobile header */
  body {
    padding-top: 56px !important;
  }
}

/* --- MOBILE HEADER STYLING --- */

.header-mobile {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;

  /* Brightened, visible slate tone */
  background: rgba(51, 65, 85, 0.96); /* slate-600 */
  backdrop-filter: blur(6px);

  border-bottom: 1px solid rgba(255,255,255,0.18);

  display: flex;
  align-items: center;
  justify-content: space-between;

  z-index: 2000 !important;
  padding: 0.6rem 1rem;
}

.navbar-logo-mobile {
  width: 28px;
  height: 28px;
}

.header-mobile .app-title {
  color: #f8fafc !important; /* almost white */
}

/* --- MOBILE DROPDOWN PANEL --- */

/* Allow iOS to apply safe-area insets */
html, body {
  padding: 0;
  margin: 0;
  background-color: #0f172a; /* your dark background */
  height: 100%;
}

/* Make mobile header respect the iPhone notch */
@supports(padding: env(safe-area-inset-top)) {
  .header-mobile {
    padding-top: env(safe-area-inset-top);
  }
}

/* Remove the default Safari top gap */
body {
  padding-top: calc(56px + env(safe-area-inset-top));
}

:root {
  /* Apple safe-area */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

/* Mobile header respects safe-top */
.header-mobile {
  padding-top: calc(0.6rem + var(--safe-top));
}

/* Force hide desktop header on mobile */
@media screen and (max-width: 768px) {
  header.header-desktop {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}

/* Force hide mobile header on desktop */
@media screen and (min-width: 769px) {
  header.header-mobile {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}

@media (max-width: 768px) {
  #top-bar {
    margin-top: calc(56px + env(safe-area-inset-top, 0));
    padding: 8px 12px;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(8px);
  }
}

.header-mobile {
  position: fixed !important;
  top: env(safe-area-inset-top, 0) !important;
  left: 0;
  right: 0;
  z-index: 99999 !important;
}
body {
  padding-top: 0 !important;
}
@media (max-width: 768px) {
  body {
    padding-top: calc(56px + env(safe-area-inset-top, 0)) !important;
  }
}

#top-bar {
  background: transparent !important;
  border: none !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.top-header {
  margin-bottom: 0 !important;
  border-bottom: none !important;
}

main {
  margin-top: 0 !important;
  padding-top: 0 !important;
  background-color: #0b0e12; /* same as header’s dark edge */
}

.top-header {
  position: relative;
  top: -1px;
}
/* Remove stray border/line under top bar */
#top-bar {
  border-bottom: none !important;
  background: transparent !important;
  box-shadow: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Kill unintended separators created by flex children */
#top-bar > div {
  border: none !important;
  box-shadow: none !important;
}

/* Tighten spacing so content sits flush */
#welcome-container,
.welcome-container {
  margin-top: 0 !important;
  padding-top: 10px !important; /* adjustable */
}

/* Collapse breadcrumb row when empty */
#breadcrumb-container {
  display: flex;
  align-items: center;
  height: auto;       /* no forced height */
  padding: 0;
  margin: 0;
}

/* If the breadcrumb has no content, hide whole row */
#breadcrumb:empty {
  display: none !important;
}

/* When breadcrumb is empty, collapse the container too */
#breadcrumb-container:has(#breadcrumb:empty) {
  display: none !important;
}

#breadcrumb-container {
  height: auto;
  padding: 0;
  margin: 0;
}

#breadcrumb:empty {
  display: none;
}

/* ─────────────────────────────
   Flatten the top bar completely
   ───────────────────────────── */

#top-bar {
  /* make it a single row with no extra vertical space */
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;

  padding-top: 4px !important;
  padding-bottom: 0 !important;
  margin: 0 !important;

  /* kill the stripe */
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* make sure the two inner blocks behave as a single row */
#top-bar > div:first-child {
  display: flex;
  align-items: center;
  gap: 16px;
}

#top-bar > div:last-child {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;  /* pushes right side over */
}

/* do not let anything below add a gap */
#top-bar + * {
  margin-top: 0 !important;
}

/* Modal backdrop */
#provider-select-modal.provider-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(6px) !important;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999 !important;
}

/* Modal box */
#provider-select-modal .provider-modal-content {
  background: #0f141a !important;   /* your dark theme */
  border-radius: 18px !important;
  padding: 32px !important;
  width: 380px !important;
  max-height: 80vh !important;
  overflow-y: auto;
  box-shadow:
    0 0 25px rgba(0, 0, 0, 0.8),
    0 0 65px rgba(0, 76, 255, 0.25) inset !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Title matches your theme */
#provider-select-modal .provider-modal-content h3 {
  font-size: 1.35rem !important;
  font-weight: 600 !important;
  color: #cbd5ff !important;
  text-align: center !important;
  margin-bottom: 24px !important;
  text-shadow: 0 0 10px rgba(60, 120, 255, 0.4) !important;
}

/* Provider buttons */
#provider-select-modal .provider-select {
  width: 100%;
  padding: 14px 18px !important;
  margin-bottom: 14px !important;
  border-radius: 12px !important;

  background: #1b2536 !important;
  color: #eef3ff !important;

  border: 1px solid rgba(255,255,255,0.08) !important;
  transition: background 0.15s ease, transform 0.15s ease !important;
}

#provider-select-modal .provider-select:hover {
  background: #263449 !important;
  transform: translateY(-1px) !important;
}

/* Cancel button — styled red */
#provider-select-modal .provider-cancel-btn {
  width: 100%;
  padding: 14px !important;
  margin-top: 10px !important;

  background: #d14545 !important;
  color: white !important;
  border-radius: 12px !important;
  font-weight: 600 !important;

  transition: background 0.15s ease !important;
}

#provider-select-modal .provider-cancel-btn:hover {
  background: #b83838 !important;
}


/* ===========================
   Provider Select Modal — Final Polish
   =========================== */

/* Modal Overlay */
.provider-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 999999;
  animation: fadeBackdrop 0.25s ease-out forwards;
}

@keyframes fadeBackdrop {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Modal Box */
.provider-modal-content {
  background: linear-gradient(to bottom right, #0f172a, #111827);
  padding: 28px 30px;
  width: 360px;
  border-radius: 18px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.55),
    0 0 20px rgba(30, 60, 120, 0.3);
  border: 1px solid rgba(255,255,255,0.07);

  animation: modalPop 0.28s cubic-bezier(.16,.76,.37,1.2) forwards;
  transform: translateY(12px) scale(.95);
  opacity: 0;
}

@keyframes modalPop {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Title */
.provider-modal-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #c7d7ff;
  text-align: center;
  letter-spacing: 0.3px;
  margin-bottom: 18px;

  text-shadow: 0 0 8px rgba(90, 150, 255, 0.55);
}

/* Provider list container */
.provider-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 22px;
}

/* Provider Button */
.provider-select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;

  background: linear-gradient(to bottom, #1e293b, #0f172a);
  color: #e2e8f0;
  border-radius: 12px;

  border: 1px solid rgba(255,255,255,0.08);

  text-align: left;
  font-size: 0.95rem;
  letter-spacing: 0.2px;

  transition: all 0.18s ease;
}

.provider-select:hover {
  background: linear-gradient(to bottom, #233044, #111a24);
  border-color: rgba(100,150,255,0.35);
  box-shadow: 0 0 10px rgba(80,120,255,0.25);
}

/* Cancel Button */
.provider-cancel-btn {
  width: 100%;
  padding: 12px 14px;
  background: linear-gradient(145deg, #b91c1c, #ef4444);
  color: #fff;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  letter-spacing: 0.3px;

  box-shadow: 0 0 18px rgba(120,20,20,0.4);

  transition: all 0.18s ease;
}

.provider-cancel-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 24px rgba(255,50,50,0.45);
}

/* Hide specific elements on mobile */
@media (max-width: 768px) {
  #mode-toggle,
  #provider-mode-toggle,
  .mode-toggle-btn {
    display: none !important;
  }
}

html, body {
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
}

#center {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.provider-modal {
  will-change: opacity, transform;
}

body {
  overscroll-behavior-x: none;
}

* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.code-block, .json-output {
  user-select: text;
}

.provider-modal-content {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .hover\:bg-gray-700:hover {
    background: inherit !important;
  }
}

.provider-list {
  scroll-snap-type: y proximity;
}

.provider-select {
  scroll-snap-align: start;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: -0.2px;
}

h1, .h1 { font-size: 2rem; font-weight: 600; }
h2, .h2 { font-size: 1.5rem; font-weight: 600; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; }
h4, .h4 { font-size: 1.125rem; font-weight: 600; }

p, span, div, input, button, select {
  font-size: 0.95rem;
}

body {
  line-height: 1.45;
}

.markdown-body {
  line-height: 1.6;
  font-size: 0.97rem;
}

.text-primary { color: #f1f5f9; }
.text-secondary { color: #cbd5e1; }
.text-muted { color: #64748b; }

input, select, button {
  border-radius: 8px;
  font-weight: 500;
}

#breadcrumb, .breadcrumb-display {
  font-size: 0.85rem;
  letter-spacing: 0.25px;
  color: #94a3b8;
}

.box-shadow-soft {
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

* {
  --vspace: 4px;
}

section, div, header {
  margin-bottom: var(--vspace);
}

svg.lucide {
  stroke-width: 1.8;
}

.top-header {
  position: relative;
  z-index: 50;
}

#provider-onboarding {
  position: relative;
  z-index: 1;
}

/* ============================================================
   DIFF BREADCRUMB CLEANUP — Kill ghost bar + isolate styling
   ============================================================ */

/* Reset everything the global .breadcrumbs styling applied */
#diffBreadcrumbs {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  display: none; /* hidden until content arrives */
}

/* Kill empty ghost row */
#diffBreadcrumbs:empty {
  display: none !important;
}

/* If we ever render crumbs, apply a minimal, clean row */
#diffBreadcrumbs:not(:empty) {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 0 !important;
  background: transparent !important; /* no box */
}

/* Style diff crumbs themselves */
#diffBreadcrumbs span {
  color: #cbd5e1;
  font-size: 0.85rem;
}

#diffBreadcrumbs .sep {
  color: #64748b;
  padding: 0 4px;
}

#provider-auth-modal {
  position: fixed;
  z-index: 999999 !important;
  inset: 0;
}

.provider-auth-content {
  position: relative;
  z-index: 1000000 !important;
}
#provider-auth-modal {
  position: fixed;
  z-index: 999999 !important;
  inset: 0;
}

.provider-auth-content {
  position: relative;
  z-index: 1000000 !important;
}

.provider-toggle-container,
#provider-menu,
#provider-menu-panel {
  z-index: 5000 !important;
}

#provider-status-summary {
  padding-top: env(safe-area-inset-top, 0);
}

#provider-auth-modal {
  z-index: 5000 !important;
}

#provider-select-modal {
  z-index: 4000 !important;
}

#provider-onboarding {
  z-index: 2000 !important;
}

/* Make sure provider auth modal is ABOVE everything */
.provider-auth-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;             /* sits above provider list + header */
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
}

/* ===============================
   CLEAN MOBILE MENU (FINAL & SAFE)
   =============================== */

/* Base hidden state */
#mobile-menu-panel {
  position: fixed;
  top: 56px;                      /* directly below mobile header */
  left: 0;
  right: 0;
  background: rgba(15,23,42,0.97);
  backdrop-filter: blur(10px);
  padding: 12px 0;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  border-top: 1px solid rgba(148,163,184,0.25);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.22s ease-out;
  z-index: 99999 !important;      /* ABOVE everything except auth modal */
}


/* Menu items */
.mobile-menu-item {
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  font-size: 1rem;
  color: #e5e7eb;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
  background: rgba(51,65,85,0.65);
}

/* Prevent hidden overlays from eating taps */
.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile-only menu; never interfere with desktop */
#mobile-menu-panel {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: rgba(15,23,42,0.97);
  padding: 12px 0;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  border-top: 1px solid rgba(148,163,184,0.25);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.22s ease-out;
  z-index: 300 !important;
}

/* Desktop disable */
@media (min-width: 769px) {
  #mobile-menu-panel {
    position: absolute !important;
    z-index: 0 !important;
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }
}

/* Backdrop stays the same */
.exec-terminal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.exec-terminal-backdrop.hidden {
  display: none;
}

/* Modal shell: FLEX COLUMN */
.exec-terminal {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  width: 100%;
  max-height: 80vh;
  background: #050816;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

/* Header pinned at top */
.exec-terminal-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

/* Body takes remaining space */
.exec-terminal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  min-height: 0;          /* 🔑 allows the log to scroll */
}

.exec-context-pill {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
}

/* Log **only** scrolls */
.exec-terminal-log {
  flex: 1;
  min-height: 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-y: auto;       /* 🔑 scroll inside here */
}

/* Footer pinned at bottom */
.exec-terminal-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.9);
  background: rgba(15, 23, 42, 0.97);
}

.exec-context-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #cbd5f5; /* light bluish text */
}

.exec-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85); /* dark slate */
  border: 1px solid rgba(148, 163, 184, 0.4); /* border-ish */
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exec-pill-command {
  font-weight: 500;
  border-color: rgba(96, 165, 250, 0.7); /* highlight command pill */
}

/* 🔒 SaaS hosted-mode banner */
.saas-mode-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, #020617, #111827);
  color: #e5e7eb;
  border-bottom: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.85rem;
}

.saas-mode-pill {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.5);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.saas-mode-text {
  opacity: 0.9;
}

@media (max-width: 640px) {
  .saas-mode-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

main {
  padding-bottom: 4rem; /* ~64px, adjust to match the chat bar */
  box-sizing: border-box;
}

.exec-hint-banner {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #0f172a0f; /* very soft slate */
  font-size: 0.8rem;
}

.exec-hint-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.exec-hint-sub {
  opacity: 0.8;
}

.saas-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.9);      /* dark slate */
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.8rem;
}

.saas-mode-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.saas-mode-pill {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);   /* soft blue */
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #bfdbfe;
  font-size: 0.7rem;
  white-space: nowrap;
}

.saas-mode-text {
  color: #e5e7eb;
  opacity: 0.9;
}

/* === Toggle button === */

.exec-mode-pill {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.75rem;
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.exec-mode-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8; /* cyan for preview */
}

/* Toggle is interactive in self-hosted mode */
.exec-mode-pill.live-enabled {
  cursor: pointer;
  border-color: rgba(52, 211, 153, 0.8);
}

.exec-mode-pill.live-enabled:hover {
  background: rgba(22, 163, 74, 0.2);
}

/* Currently in LIVE mode */
.exec-mode-pill.live-active {
  background: rgba(22, 163, 74, 0.35);
  color: #bbf7d0;
}

.exec-mode-pill.live-active::before {
  background: #22c55e; /* green */
}

/* Hosted / locked – can’t change mode */
.exec-mode-pill.locked {
  opacity: 0.7;
  cursor: not-allowed;
}

.exec-hint-banner {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  background: rgba(56, 189, 248, 0.08); /* soft cyan-ish */
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.exec-hint-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.exec-hint-sub {
  opacity: 0.8;
}

/* Backdrop */
.cx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 30, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.cx-modal-backdrop.hidden {
  display: none;
}

/* Modal shell */
.cx-modal {
  background: radial-gradient(circle at top left, #172341, #050816);
  border-radius: 14px;
  border: 1px solid rgba(120, 164, 255, 0.25);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  width: 480px;
  max-width: 92vw;
  padding: 18px 20px 16px;
  color: #f7f9ff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

/* Header */
.cx-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.cx-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 0%, #ffb347, #ff5e62);
  box-shadow: 0 0 18px rgba(255, 148, 82, 0.7);
  font-size: 18px;
}

.cx-modal-title-block {
  flex: 1;
}

.cx-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.cx-modal-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: #c3ceff;
}

/* Body */
.cx-modal-body {
  background: linear-gradient(to right, rgba(32, 45, 95, 0.55), transparent);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(104, 136, 222, 0.4);
  margin-bottom: 12px;
}

.cx-modal-body-title {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ea4ff;
}

.cx-modal-command {
  margin: 0;
  padding: 8px 10px;
  background: rgba(4, 10, 30, 0.85);
  border-radius: 8px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  max-height: 160px;
  overflow: auto;
  border: 1px solid rgba(64, 85, 150, 0.7);
}

.cx-modal-body-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #ffc67e;
}

/* Footer buttons */
.cx-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Button base */
.cx-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out,
    background 0.12s ease-out, opacity 0.12s ease-out;
}

/* Ghost / secondary */
.cx-btn-ghost {
  background: rgba(16, 26, 63, 0.95);
  color: #c7d0ff;
}

.cx-btn-ghost:hover {
  background: rgba(32, 47, 96, 1);
}

/* Danger / primary live action */
.cx-btn-danger {
  background: linear-gradient(135deg, #ff4b5c, #ff9f5a);
  color: #050816;
  box-shadow: 0 8px 24px rgba(255, 93, 94, 0.6);
}

.cx-btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(255, 93, 94, 0.75);
}

.cx-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Tenant modal tweaks */
#tenant-prompt-modal .tenant-modal {
  max-width: 420px;
  padding: 24px;
}

.tenant-input-field {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #111;
  color: #fff;
  font-size: 15px;
  margin-top: 8px;
}

.tenant-input-field::placeholder {
  color: #777;
}

#tenant-submit-btn {
  margin-top: 18px;
  width: 100%;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
}

/* Connect Azure sheet tweak */
.provider-auth-modal--connect .connect-sheet {
  max-width: 540px;
  padding: 28px 28px 22px;
  border-radius: 24px;
  background: radial-gradient(circle at top left, rgba(80,140,255,0.2), transparent 55%),
              rgba(5,10,30,0.96);
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
}

/* Header */
.connect-sheet .sheet-header h2 {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  margin: 6px 0 4px;
}

.connect-sheet .sheet-eyebrow {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: rgba(180, 210, 255, 0.7);
}

.connect-sheet .sheet-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(210, 223, 255, 0.9);
}

/* Layout */
.connect-sheet .sheet-body {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.connect-sheet .field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connect-sheet .field-inline-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .connect-sheet .field-inline-group {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Labels / inputs */
.connect-sheet .field-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(190, 210, 255, 0.85);
}

.connect-sheet .required {
  color: #ff7b96;
  margin-left: 4px;
}

.connect-sheet .optional-tag {
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(180, 200, 240, 0.7);
  margin-left: 6px;
}

.connect-sheet .field-input {
  border-radius: 12px;
  border: 1px solid rgba(90, 120, 200, 0.6);
  background: rgba(7, 14, 40, 0.95);
  padding: 8px 10px;
  font-size: 0.86rem;
  color: #eef3ff;
  outline: none;
  width: 100%;
}

.connect-sheet .field-input::placeholder {
  color: rgba(150, 178, 230, 0.55);
}

.connect-sheet .field-input:focus {
  border-color: #4f8cff;
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.7);
}

/* Help text */
.connect-sheet .field-help {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(170, 195, 240, 0.8);
}

/* Divider for advanced section */
.connect-sheet .sheet-divider {
  margin-top: 4px;
  margin-bottom: -4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(150, 175, 230, 0.7);
  font-size: 0.75rem;
}

.connect-sheet .sheet-divider::before,
.connect-sheet .sheet-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: radial-gradient(circle, rgba(120, 155, 230, 0.6), transparent);
}

.connect-sheet .divider-label {
  white-space: nowrap;
}

/* Footer buttons */
.connect-sheet .sheet-footer {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.provider-btn.ghost {
  background: transparent;
  border: 1px solid rgba(110, 135, 200, 0.7);
}

.provider-btn.primary {
  min-width: 120px;
}

/* When waiting for Azure to issue a device code */
#provider-auth-modal .code.waiting {
  opacity: 0.6;
  position: relative;
  overflow: hidden;
}

#provider-auth-modal .code.waiting::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.6s infinite ease-in-out;
}

@keyframes shimmer {
  0% {
    left: -120%;
  }
  100% {
    left: 120%;
  }
}

#provider-auth-modal .status-line {
  font-size: 0.85rem;
  color: #4c7df0; /* accent blue */
  margin-bottom: 0.75rem;
  font-weight: 500;
  animation: fadeInStatus 0.3s ease-out;
}

@keyframes fadeInStatus {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#azure-connect-spinner.provider-auth-modal.mini {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.35);
}

#azure-connect-spinner .provider-auth-content.mini {
  padding: 1.5rem 2rem;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* subtle spinner */
#azure-connect-spinner .spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #d7d7d7;
  border-top-color: #4c7df0;
  border-radius: 50%;
  animation: spinMini 0.8s linear infinite;
}

@keyframes spinMini {
  100% {
    transform: rotate(360deg);
  }
}

#azure-connect-spinner p {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: #444;
}

#provider-auth-modal .code.updated {
  background-color: #e8f0ff;
  transition: background-color 0.6s ease-out;
}

/* Progress bar container under the modal header */
#provider-auth-modal .auth-progress {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin: 0.5rem 0 1rem;
}

/* Actual animated bar */
#provider-auth-modal .auth-progress-bar {
  height: 100%;
  width: 100%;               /* full width, we scaleX it */
  transform-origin: 0 50%;
  transform: scaleX(0.1);
  background: linear-gradient(90deg, #4c7df0, #8b5cf6);
  transition: transform 0.25s ease-out;
}

#provider-auth-modal .code.waiting {
  opacity: 0.7;
  position: relative;
  overflow: hidden;
}

#provider-auth-modal .code.waiting::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.6s infinite ease-in-out;
}

@keyframes shimmer {
  0% {
    left: -120%;
  }
  100% {
    left: 120%;
  }
}

#provider-auth-modal .auth-progress-bar {
  background: linear-gradient(90deg, #10b981, #059669); /* emerald → deep green */
}

#provider-auth-modal .auth-progress {
  animation: pulse-bg 2.5s infinite ease-in-out;
}

@keyframes pulse-bg {
  0%   { background: rgba(0,0,0,0.06); }
  50%  { background: rgba(0,0,0,0.12); }
  100% { background: rgba(0,0,0,0.06); }
}

#provider-auth-modal .auth-progress-bar {
  box-shadow: 0 0 8px rgba(0, 153, 255, 0.4);
}

#provider-auth-modal .status-line {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0077b6; /* brighter Azure blue */
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.provider-status-row .prov-meta {
  font-size: 0.8rem;
  opacity: 0.9;
}

.provider-status-row .prov-meta.subtle {
  opacity: 0.6;
}

.auth-link.auth-link-disabled {
  pointer-events: none;
  opacity: 0.6;
  cursor: default;
  text-decoration: none;
}

/* Hidden by default */
.azure-only {
  display: none;
}

/* Only visible when Azure is the active provider */
body[data-provider="azure"] .azure-only {
  display: inline-flex; /* or inline-block / block to match your layout */
}

/* Highlight + enlarge close button so it's easy to hit */
#exec-terminal-close {
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 1.1rem;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* When the exec terminal is open, let the SaaS banner get out of the way */
@media (max-width: 768px) {
  body.exec-terminal-open .saas-mode-banner {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }
}

/* ===========================
   Azure Execution Terminal – Themed
   =========================== */

/* Backdrop tint (keep whatever positioning you already have) */
#exec-terminal-backdrop {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.98));
}

/* Terminal chrome */
.exec-terminal {
  background: radial-gradient(circle at top left, #020617, #050816 55%, #020617);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(37, 99, 235, 0.2);
  overflow: hidden;
}

/* Subtle top accent bar */
.exec-terminal::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #38bdf8, #6366f1);
}

/* Header */
.exec-terminal-header {
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.6));
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.exec-terminal-header #exec-terminal-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e5e7eb;
  opacity: 0.95;
}

/* Close button: make it obvious and tappable */
#exec-terminal-close {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: radial-gradient(circle at top, #0b1120, #020617);
  color: #e5e7eb;
  padding: 0.25rem 0.8rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
  transition:
    background 120ms ease-out,
    transform 80ms ease-out,
    box-shadow 120ms ease-out,
    border-color 120ms ease-out;
}

#exec-terminal-close:hover {
  background: radial-gradient(circle at top, #1d4ed8, #020617);
  border-color: rgba(129, 140, 248, 1);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.9),
    0 0 18px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

#exec-terminal-close:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 1);
}

#exec-terminal-close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* Body area */
.exec-terminal-body {
  padding: 0.75rem 1rem 0.75rem 1rem;
  color: #e5e7eb;
  font-size: 0.85rem;
}

/* Context row pills */
.exec-context-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.exec-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e5e7eb;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Mode-specific pill accents */
.exec-pill-mode {
  border-color: rgba(52, 211, 153, 0.9);
  background: rgba(22, 163, 74, 0.2);
}

.exec-pill-command {
  border-color: rgba(59, 130, 246, 0.85);
  background: rgba(37, 99, 235, 0.18);
}

/* Dry-run note strip */
.exec-mode-note {
  margin: 0.4rem 0 0.6rem 0;
  padding: 0.45rem 0.65rem;
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed rgba(96, 165, 250, 0.6);
  font-size: 0.78rem;
  color: #bfdbfe;
}

.exec-mode-note strong {
  color: #fbbf24;
}

/* Log panel */
.exec-terminal-log {
  margin-top: 0.4rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  background: radial-gradient(circle at top left, #020617, #020617 45%, #020617);
  border: 1px solid rgba(30, 64, 175, 0.7);
  box-shadow:
    inset 0 0 20px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #e5e7eb;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Footer status */
.exec-terminal-footer {
  padding: 0.5rem 1rem 0.75rem 1rem;
  border-top: 1px solid rgba(30, 64, 175, 0.6);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 1));
  font-size: 0.78rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#exec-terminal-status::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  background: radial-gradient(circle, #22c55e, #16a34a);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.9);
}

/* ============================================
   SAFE Cloud Explorer Close Button Styling
   ============================================ */

#exec-terminal-close {
  /* Keep original sizing exactly */
  padding: inherit;
  margin: 0;
  line-height: inherit;

  /* Visual style only */
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: white;

  border: 1px solid rgba(147, 197, 253, 0.85);
  border-radius: 999px;

  font-size: 1.05rem;       /* Slight bump, safe */
  font-weight: 600;

  cursor: pointer;

  box-shadow:
    0 0 10px rgba(37, 99, 235, 0.6),
    0 0 0 1px rgba(59, 130, 246, 0.8);

  transition:
    background 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.1s ease-out;
}

#exec-terminal-close:hover {
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  box-shadow:
    0 0 16px rgba(59, 130, 246, 0.85),
    0 0 0 1px rgba(147, 197, 253, 1);
  transform: translateY(-1px);
}

#exec-terminal-close:active {
  transform: translateY(0);
}

#exec-terminal-close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* ===========================
   Footer layout
   =========================== */
.exec-terminal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 1rem 0.75rem 1rem;
  border-top: 1px solid rgba(30, 64, 175, 0.6);
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.95),
    rgba(2, 6, 23, 1)
  );
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Status text stays chill */
#exec-terminal-status {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   Footer Close button
   =========================== */
#exec-terminal-footer-close {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;

  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;

  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #ffffff;

  border: 1px solid rgba(147, 197, 253, 0.85);
  box-shadow:
    0 0 12px rgba(37, 99, 235, 0.6),
    0 0 0 1px rgba(15, 23, 42, 1);

  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;

  transition:
    background 0.16s ease-out,
    box-shadow 0.16s ease-out,
    transform 0.1s ease-out,
    border-color 0.16s ease-out;
}

/* Hover (desktop) */
#exec-terminal-footer-close:hover {
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  border-color: rgba(191, 219, 254, 1);
  box-shadow:
    0 0 18px rgba(59, 130, 246, 0.8),
    0 0 0 1px rgba(30, 64, 175, 0.9);
  transform: translateY(-1px);
}

/* Pressed (mobile tap / active) */
#exec-terminal-footer-close:active {
  transform: translateY(0);
  box-shadow:
    0 0 10px rgba(29, 78, 216, 0.9),
    0 0 0 1px rgba(37, 99, 235, 1);
}

/* Keyboard focus */
#exec-terminal-footer-close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* ===========================
   Mobile tweaks
   =========================== */
@media (max-width: 768px) {
  .exec-terminal-footer {
    padding-bottom: 1rem;
  }

  #exec-terminal-footer-close {
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
  }
}

.exec-terminal-footer {
  position: relative;
  z-index: 10;
}

#exec-terminal-footer-close {
  pointer-events: auto;
  position: relative;
  z-index: 20;
}

/* ===========================
   Shared modal backdrop
   =========================== */

#account-modal .modal-backdrop,
#about-plan-modal .modal-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.25), transparent 55%),
    radial-gradient(circle at bottom, rgba(0, 0, 0, 0.9), #020617);
  backdrop-filter: blur(10px);
}

/* ===========================
   Account modal shell
   =========================== */

#account-modal .modal-card.account-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 55%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 60%),
    #020617;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  padding: 0;
  color: #e5e7eb;
  overflow: hidden;
}

/* Close pill in top-right */
#account-modal .modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(30, 64, 175, 0.9);
  background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.5), rgba(15, 23, 42, 1));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#account-modal .modal-close::before {
  content: "✕";
  font-size: 0.8rem;
  color: #e5e7eb;
}

#account-modal .modal-close:hover {
  filter: brightness(1.1);
}

/* ===========================
   Account header
   =========================== */

#account-modal .account-header {
  position: relative;
  padding: 1.25rem 1.5rem 1rem;
  background: linear-gradient(135deg, #020617, #02081b 40%, #0f172a 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

#account-modal .account-header.compact {
  padding-bottom: 0.8rem;
}

#account-modal .account-header::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0.9rem;
  width: 22px;
  height: 22px;
  border-radius: 0 0 16px 16px;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.2), transparent 70%),
    #020617;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
}

#account-modal .account-title {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f9fafb;
}

#account-modal .account-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(156, 163, 175, 0.96);
}

/* Identity layout (logged-in view) */
#account-modal .identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#account-modal .identity .email {
  font-size: 0.92rem;
  color: #e5e7eb;
}

#account-modal .plan-badge {
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.9);
  color: #bfdbfe;
}

/* ===========================
   Form stack & fields
   =========================== */

#account-modal .form-stack {
  padding: 1.25rem 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

#account-modal .form-stack:last-of-type {
  padding-bottom: 1.5rem;
}

#account-modal .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#account-modal .field > span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

#account-modal .field input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(51, 65, 85, 0.92);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.92), #020617);
  color: #e5e7eb;
  font-size: 0.92rem;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    transform 0.08s ease;
}

#account-modal .field input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

#account-modal .field input:focus {
  border-color: rgba(59, 130, 246, 0.95);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.9),
    0 0 0 6px rgba(59, 130, 246, 0.28);
  transform: translateY(-0.5px);
}

/* Section title ("Create account") */
#account-modal .section-title {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #bfdbfe;
}

/* Auth error text */
#account-modal .auth-error {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #fca5a5;
}

/* ===========================
   Buttons (scoped to modal)
   =========================== */

#account-modal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.12s ease-out,
    filter 0.12s ease-out,
    background 0.12s ease-out;
}

/* primary */
#account-modal .btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #0ea5e9);
  color: #f9fafb;
  box-shadow:
    0 12px 30px rgba(37, 99, 235, 0.6),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

/* ghost (for Create account) */
#account-modal .btn-ghost {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), #020617);
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.9);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.95);
}

/* secondary (About plan) */
#account-modal .btn-secondary {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), #020617);
  color: #e5e7eb;
  border: 1px solid rgba(59, 130, 246, 0.8);
}

/* danger (Log out) */
#account-modal .btn-danger {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fef2f2;
  box-shadow:
    0 12px 30px rgba(248, 113, 113, 0.5),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

/* shared button hover/active */
#account-modal .btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

#account-modal .btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
}

/* ===========================
   Divider "or"
   =========================== */

#account-modal .divider {
  position: relative;
  margin: 0.6rem 1.5rem 0.4rem;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(30, 64, 175, 0.7),
    transparent
  );
}

#account-modal .divider span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  background: #020617;
  color: #9ca3af;
  border-radius: 999px;
  border: 1px solid rgba(30, 64, 175, 0.95);
}

/* ===========================
   Usage cards / plan section
   =========================== */

#account-modal .usage-grid {
  padding: 1.25rem 1.5rem 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

#account-modal .usage-card {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), #020617);
  border-radius: 16px;
  border: 1px solid rgba(30, 64, 175, 0.75);
  padding: 0.75rem 0.9rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.9);
}

#account-modal .card-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

#account-modal .card-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e5e7eb;
}

#account-modal .card-value.inline {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

#account-modal .card-value .muted {
  color: #6b7280;
}

#account-modal .card-sub {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

#account-modal .progress-track {
  margin-top: 0.4rem;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 1);
  overflow: hidden;
}

#account-modal .progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #a3e635);
}

/* CTA + extra link */
#account-modal .cta {
  padding: 1rem 1.5rem 0.25rem;
}

#account-modal .cta-note {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

#account-modal .account-extra-link {
  padding: 0.75rem 1.5rem 0.25rem;
}

/* ===========================
   About Plan modal
   =========================== */

#about-plan-modal .modal-card.about-plan-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 60%),
    #020617;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  padding: 1.25rem 1.5rem 1.4rem;
  color: #e5e7eb;
  position: relative;
}

#about-plan-modal .modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 1.1rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(30, 64, 175, 0.9);
  background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.5), rgba(15, 23, 42, 1));
  color: #e5e7eb;
  cursor: pointer;
}

#about-plan-modal h3 {
  margin: 0 0 0.8rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

#about-plan-modal .about-plan-body {
  max-height: min(60vh, 480px);
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-right: -0.25rem;
}

#about-plan-modal .about-plan-body section {
  margin-bottom: 0.9rem;
}

#about-plan-modal h4 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #bfdbfe;
}

#about-plan-modal p,
#about-plan-modal li {
  font-size: 0.86rem;
  color: #cbd5f5;
}

#about-plan-modal ul {
  margin: 0.2rem 0 0.5rem 1.1rem;
}

/* ===========================
   Mobile tweaks
   =========================== */

@media (max-width: 480px) {
  #account-modal .modal-card.account-card,
  #about-plan-modal .modal-card.about-plan-card {
    max-width: 100%;
    border-radius: 18px;
  }

  #account-modal .account-header,
  #account-modal .form-stack,
  #account-modal .usage-grid,
  #account-modal .cta,
  #account-modal .account-extra-link {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  #account-modal .usage-grid {
    grid-template-columns: 1fr;
  }
}

.provider-connection-bar{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
}

.provider-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.92);
  font-size:12px;
  font-weight:800;
  letter-spacing:.2px;
  white-space:nowrap;
  cursor:pointer;
}

.provider-pill .dot{
  width:8px;height:8px;border-radius:50%;
  background:#38d36f;
  box-shadow:0 0 0 3px rgba(56,211,111,.14);
}

/* Popover overlay */
.provider-popover.hidden{ display:none; }

.provider-popover{
  position:fixed;
  inset:0;
  z-index:99999;
  pointer-events:none; /* only the card is clickable */
}

.provider-popover-card{
  position:fixed;
  width:min(380px, calc(100vw - 20px));
  pointer-events:auto;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(10,14,22,.97);
  color:rgba(255,255,255,.92);
  box-shadow:0 14px 40px rgba(0,0,0,.45);
  padding:10px 12px;
}

.provider-popover-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,255,255,.08);
  margin-bottom:8px;
}

.provider-popover-title{
  font-size:13px;
  font-weight:900;
  letter-spacing:.3px;
}

.provider-popover-close{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.9);
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
}

.provider-popover-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:6px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.provider-popover-row:last-child{ border-bottom:none; }

.provider-popover-row .k{
  opacity:.7;
  font-weight:700;
}
.provider-popover-row .v{
  opacity:.95;
  font-weight:700;
  max-width:230px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.provider-popover-empty{
  opacity:.8;
  padding:8px 0;
  font-weight:600;
}

