/* ==========================================================================
   CSAgent Studio - White & Blue Enterprise Design System & Stylesheet
   Theme: Clean SaaS Light Mode with Royal Blue / Slate / Sky Accents
   Compact Typography & Maximum Screen Real Estate Efficiency
   ========================================================================== */

:root {
  /* Core Background Tokens */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-glass-card: #ffffff;
  --bg-glass-input: #ffffff;
  --bg-glass-hover: #f1f5f9;
  
  /* Soft Accent Surfaces */
  --bg-accent-soft: #eff6ff;
  --bg-accent-soft-hover: #dbeafe;
  --bg-emerald-soft: #ecfdf5;
  --bg-cyan-soft: #f0f9ff;
  --bg-amber-soft: #fffbeb;
  --bg-rose-soft: #fff1f2;
  --bg-purple-soft: #faf5ff;

  /* Border Tokens */
  --border-subtle: #e2e8f0;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #2563eb;
  --border-glow: rgba(37, 99, 235, 0.2);
  --border-active: #2563eb;
  --border-card: #e2e8f0;

  /* Typography Colors */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  /* Accent & Brand Colors */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-light: #3b82f6;
  --accent-secondary: #4f46e5;
  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #7c3aed;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --gradient-blue-cyan: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
  --gradient-card: #ffffff;
  --gradient-hero: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 14px rgba(37, 99, 235, 0.2);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & COMPACT BASE TYPOGRAPHY
   ========================================================================== */

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

html, body {
  height: 100%;
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 13.5px;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  letter-spacing: -0.011em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(at 10% 10%, rgba(37, 99, 235, 0.04) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(2, 132, 199, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

/* Custom Clean Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* App Root Container */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Base Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; }
h4 { font-size: 0.88rem; }

p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--accent-primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-accent-soft);
  color: var(--accent-primary);
  border-color: #bfdbfe;
}

.btn-danger {
  background: #ffffff;
  color: var(--accent-rose);
  border-color: #fecdd3;
}

.btn-danger:hover {
  background: #ffe4e6;
  border-color: var(--accent-rose);
  color: #be123c;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-accent-soft);
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.btn-icon.danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: var(--accent-rose);
}

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.form-label .req {
  color: var(--accent-rose);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.48rem 0.8rem;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-xs);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background-color: #ffffff;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-light);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .field-icon {
  position: absolute;
  left: 0.75rem;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input.with-icon {
  padding-left: 2.35rem;
}

.form-input.with-eye {
  padding-right: 2.35rem;
}

.btn-toggle-pwd {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pwd svg {
  width: 14px;
  height: 14px;
}

/* Badges & Pills */
.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-accent-soft);
  color: var(--accent-primary);
  border: 1px solid #dbeafe;
}

.badge-emerald {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-cyan {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-amber {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-rose {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.badge-purple {
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}

/* ==========================================================================
   AUTH SCREEN (LOGIN / REGISTER)
   ========================================================================== */

#view-auth {
  display: none;
  min-height: 100vh;
  background: #f8fafc;
}

#view-auth.active {
  display: flex;
}

.auth-page-container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  width: 100vw;
  min-height: 100vh;
  background: #ffffff;
}

.auth-hero-panel {
  background: linear-gradient(145deg, #070d1e 0%, #0c1a3b 35%, #17326b 75%, #1e40af 100%);
  color: #ffffff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Background Animated Cyber Ambient */
.cs-ambient-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  pointer-events: none;
  animation: csGridDrift 20s linear infinite;
}

.cs-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.6;
}

.cs-orb-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, transparent 70%);
  top: 15%;
  left: 10%;
  animation: csOrbFloat1 10s ease-in-out infinite alternate;
}

.cs-orb-2 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.3) 0%, transparent 70%);
  bottom: 10%;
  right: 5%;
  animation: csOrbFloat2 12s ease-in-out infinite alternate;
}

.cs-orb-3 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(192, 132, 252, 0.25) 0%, transparent 70%);
  top: 45%;
  right: 25%;
  animation: csOrbFloat1 8s ease-in-out infinite alternate-reverse;
}

/* Central Showcase Container */
.cs-studio-showcase {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2.25rem;
  width: 100%;
  max-width: 480px;
}

/* Animated Logo Wrapper */
.cs-logo-wrapper {
  position: relative;
  width: 230px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: csLogoFloat 6s ease-in-out infinite;
}

/* Orbital Gyroscope Rings */
.cs-orbital-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.cs-orbital-ring.ring-outer {
  width: 220px;
  height: 220px;
  border: 1.5px dashed rgba(96, 165, 250, 0.45);
  animation: csOrbitSpin 18s linear infinite;
}

.cs-orbital-ring.ring-inner {
  width: 180px;
  height: 180px;
  border: 1.5px dotted rgba(168, 85, 247, 0.5);
  animation: csOrbitSpinRev 14s linear infinite;
}

.cs-orbital-ring.ring-pulse {
  width: 130px;
  height: 130px;
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  border-radius: 28px;
  animation: csPulseWave 3.5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

/* Orbiting Energy Particles */
.cs-orbit-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 0 18px #60a5fa;
}

.cs-orbit-particle.p1 {
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
}

.cs-orbit-particle.p2 {
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #c084fc;
  box-shadow: 0 0 10px #c084fc, 0 0 18px #818cf8;
}

.cs-orbit-particle.p3 {
  top: 50%;
  right: -4px;
  transform: translateY(-50%);
  background: #60a5fa;
  box-shadow: 0 0 10px #60a5fa;
}

/* Core Emblem Glass Container */
.cs-logo-core {
  width: 130px;
  height: 130px;
  border-radius: 28px;
  background: radial-gradient(135deg, rgba(30, 58, 138, 0.75) 0%, rgba(15, 23, 42, 0.95) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(147, 197, 253, 0.4);
  box-shadow: 
    0 0 35px rgba(37, 99, 235, 0.45),
    inset 0 0 25px rgba(56, 189, 248, 0.2),
    0 15px 35px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cs-logo-core:hover {
  transform: scale(1.05);
  box-shadow: 
    0 0 50px rgba(56, 189, 248, 0.6),
    inset 0 0 30px rgba(96, 165, 250, 0.35);
}

.cs-emblem-svg {
  width: 105px;
  height: 105px;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5));
}

/* SVG Element Keyframe Triggers */
.cs-hex-outer {
  animation: csHexPulse 4s ease-in-out infinite alternate;
}

.cs-hex-inner {
  animation: csDashRotate 10s linear infinite;
}

.cs-synapse-dot {
  animation: csDotGlow 2.5s ease-in-out infinite alternate;
}
.cs-synapse-dot.d2 { animation-delay: 0.4s; }
.cs-synapse-dot.d3 { animation-delay: 0.8s; }
.cs-synapse-dot.d4 { animation-delay: 1.2s; }
.cs-synapse-dot.d5 { animation-delay: 1.6s; }
.cs-synapse-dot.d6 { animation-delay: 2.0s; }

.cs-draw-letter {
  animation: csLetterGlow 3.5s ease-in-out infinite alternate;
}

/* CS STUDIO Brand Typography */
.cs-brand-text-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.cs-studio-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-title-word.cs-word-cs {
  background: linear-gradient(135deg, #ffffff 0%, #bfdbfe 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.5));
}

.cs-title-word.cs-word-studio {
  background: linear-gradient(135deg, #60a5fa 0%, #38bdf8 30%, #818cf8 70%, #c084fc 100%);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: csShimmerGradient 5s ease infinite;
  filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.4));
}

.cs-studio-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 1.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.45);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 9999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.cs-live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: csLiveDot 1.8s ease-in-out infinite;
}

/* ==========================================================================
   ANIMATION KEYFRAMES FOR CS STUDIO SHOWCASE
   ========================================================================== */

@keyframes csLogoFloat {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-10px) scale(1.02); }
}

@keyframes csOrbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes csOrbitSpinRev {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes csPulseWave {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

@keyframes csHexPulse {
  0% { stroke: #60a5fa; filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.5)); }
  100% { stroke: #38bdf8; filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.85)); }
}

@keyframes csDashRotate {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 60; }
}

@keyframes csDotGlow {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 6px #38bdf8); }
}

@keyframes csLetterGlow {
  0% { filter: drop-shadow(0 0 4px rgba(96, 165, 250, 0.4)); }
  100% { filter: drop-shadow(0 0 14px rgba(192, 132, 252, 0.8)); }
}

@keyframes csShimmerGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes csLiveDot {
  0%, 100% { transform: scale(1); opacity: 0.6; box-shadow: 0 0 4px #38bdf8; }
  50% { transform: scale(1.4); opacity: 1; box-shadow: 0 0 12px #38bdf8, 0 0 20px #60a5fa; }
}

@keyframes csGridDrift {
  0% { background-position: 0 0; }
  100% { background-position: 36px 36px; }
}

@keyframes csOrbFloat1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -25px) scale(1.15); }
}

@keyframes csOrbFloat2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-35px, 20px) scale(1.1); }
}

.auth-card-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: #ffffff;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-header {
  margin-bottom: 1.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.84rem;
  color: #64748b;
  line-height: 1.45;
}

.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 1.5rem;
}

.auth-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.5rem;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn svg {
  width: 15px;
  height: 15px;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.78rem;
}

.btn-link-forgot {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-link-forgot:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: #475569;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
}

.btn-auth-submit {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: all 0.15s ease;
}

.btn-auth-submit:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.auth-switch-prompt {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}

.auth-switch-prompt a {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.25rem;
}

.auth-switch-prompt a:hover {
  text-decoration: underline;
}

.auth-alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.78rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
}

.auth-alert.error {
  background: #fef2f2;
  border: 1px solid #fecdd3;
  color: #dc2626;
}

.auth-alert.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

/* ==========================================================================
   APP SHELL: SIDEBAR & MAIN WORKSPACE
   ========================================================================== */

.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-main);
  transition: all 0.25s ease-in-out;
}

/* Left Sidebar */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 0.85rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease-in-out;
}

/* Sidebar Collapsed State */
.app-shell.sidebar-collapsed .app-sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border-right: none !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.sidebar-top-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-brand-wrapper {
  padding: 0.25rem 0.35rem 0.75rem 0.35rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-sidebar-collapse {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-sidebar-collapse:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.btn-topbar-toggle-sidebar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.btn-topbar-toggle-sidebar:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.btn-topbar-toggle-sidebar svg {
  width: 16px;
  height: 16px;
}

.nav-ext-icon {
  width: 12px !important;
  height: 12px !important;
  margin-left: 0.4rem !important;
  opacity: 0.45;
  color: var(--text-muted) !important;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.sidebar-nav-item:hover .nav-ext-icon {
  opacity: 1;
  color: var(--accent-primary) !important;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.sidebar-brand-wrapper .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.sidebar-brand-wrapper .brand-icon svg {
  width: 17px;
  height: 17px;
  color: #ffffff;
}

.sidebar-brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  color: var(--accent-primary);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Sidebar Active Workspace Card */
.sidebar-company-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
}

.company-card-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.company-card-info {
  flex: 1;
  min-width: 0;
}

.company-card-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.company-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e3a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-status-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: #ecfdf5;
  color: #059669;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

/* Sidebar Nav Menu */
.nav-section-heading {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  padding: 0 0.4rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: var(--transition-fast);
  position: relative;
}

.sidebar-nav-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.sidebar-nav-item:hover svg {
  color: var(--accent-primary);
}

.sidebar-nav-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

.sidebar-nav-item.active svg {
  color: var(--accent-primary);
}

.nav-count-badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: var(--text-secondary);
  font-weight: 700;
}

.sidebar-nav-item.active .nav-count-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.nav-new-pill {
  margin-left: auto;
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 700;
}

/* Sidebar User Footer */
.sidebar-user-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.5rem 0.25rem 0.5rem;
  border-top: 1px solid var(--border-light);
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.btn-sidebar-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-sidebar-logout:hover {
  background: #fee2e2;
  color: var(--accent-rose);
}

.btn-sidebar-logout svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   MAIN VIEWPORT & TOPBAR
   ========================================================================== */

.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-main);
}

.app-topbar {
  height: 50px;
  min-height: 50px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  width: 100%;
  box-sizing: border-box;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
}

.crumb-root {
  color: var(--text-muted);
}

.crumb-sep {
  color: var(--text-light);
}

.crumb-current {
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.company-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a8a;
}

.app-content-viewport {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1.5rem 2rem 1.5rem;
  box-sizing: border-box;
}

.view-section {
  display: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.view-section.active {
  display: block;
}

/* ==========================================================================
   PAGE HERO BANNER & METRICS
   ========================================================================== */

.dash-hero {
  margin-bottom: 1.15rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.dash-hero-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.2rem;
}

.dash-hero-title p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-normal);
  min-width: 0;
  box-sizing: border-box;
}

.metric-card.clickable-card:hover {
  border-color: #bfdbfe;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   CHARTS & ANALYTICS CARDS
   ========================================================================== */

.dash-analytics-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.charts-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-xs);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.chart-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #eff6ff;
  color: var(--accent-primary);
}

.chart-title-wrap h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-title-wrap p {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.chart-canvas-wrap canvas {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
}

/* Table Card & Responsive Table */
.table-responsive-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.analytics-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.analytics-matrix-table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analytics-matrix-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-fast);
}

.analytics-matrix-table tbody tr:hover {
  background-color: #f8fafd;
}

.analytics-matrix-table tbody td {
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

.analytics-matrix-table tbody td strong {
  color: var(--text-primary);
}

/* ==========================================================================
   AGENTS VIEW & AGENTS GRID
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.type-filter-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.filter-tab {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background: #ffffff;
  color: var(--accent-primary);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* Agents Grid & Cards (Rows and Columns) */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.agent-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-normal);
  position: relative;
  min-height: 220px;
}

.agent-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.agent-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.agent-title-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.agent-title-box h3, .agent-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drag-handle {
  cursor: grab;
  color: var(--text-light);
  padding: 0.2rem;
  display: flex;
  align-items: center;
}

.agent-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3rem;
}

.agent-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  background: #f8fafc;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.meta-pill.clickable-pill {
  cursor: pointer;
}

.meta-pill.clickable-pill:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.agent-card-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.agent-card-actions .btn-chat {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.42rem 0.75rem;
}

/* Knowledge Base Table Details */
.kb-file-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.kb-file-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.btn-doc-action {
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-doc-action:hover {
  background: #f8fafc;
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.btn-doc-delete:hover {
  background: #fee2e2;
  border-color: #fecdd3;
  color: var(--accent-rose);
}

.icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

svg {
  max-width: 100%;
  max-height: 100%;
}

/* ==========================================================================
   WIZARD / REGISTER AGENT VIEW & 5-STEP STEPPER (0. TEMPLATE -> 4. DOCS)
   ========================================================================== */

.builder-wizard-container {
  max-width: 840px;
  margin: 0 auto;
}

.form-container {
  width: 100%;
}

.form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.form-header p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Wizard Stepper */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.35rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.stepper-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.stepper-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.stepper-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
  white-space: nowrap;
}

.stepper-item.active .stepper-circle {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.stepper-item.active .stepper-label {
  color: var(--accent-primary);
  font-weight: 700;
}

.stepper-item.completed .stepper-circle {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.stepper-item.completed .stepper-label {
  color: #059669;
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  margin: 0 0.75rem;
  transition: var(--transition-fast);
}

.stepper-line.completed, .stepper-line.active {
  background: var(--accent-primary);
}

/* Wizard Step Panels */
.wizard-step-panel {
  display: none;
}

.wizard-step-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  margin-bottom: 1.25rem;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.form-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.form-section-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.35rem;
  line-height: 1.45;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  margin-bottom: 0;
}

.form-label .req {
  color: #ef4444;
  margin-left: 0.15rem;
}

.form-hint {
  font-size: 0.73rem;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  color: var(--text-primary);
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background-color: #ffffff;
}

.form-textarea {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  min-height: 190px;
  resize: vertical;
}

/* Slider Controls in Step 3 */
.slider-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.slider-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
}

.slider-value-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.slider-value-badge.cyan {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}

.custom-range {
  width: 100%;
  height: 6px;
  border-radius: 6px;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0.35rem 0;
}

.custom-range.cyan {
  accent-color: #0284c7;
}

/* Wizard Actions Bar & Buttons */
.wizard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 1.2rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-primary {
  background: var(--accent-primary);
  border: 1px solid #1d4ed8;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Role Templates Grid */
.role-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.role-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.role-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.role-card.selected {
  border-color: var(--accent-primary) !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18) !important;
}

/* Dropzone */
.dropzone-area {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition-normal);
}

.dropzone-area:hover {
  border-color: var(--accent-primary);
  background: #eff6ff;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  background: #eff6ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.dropzone-icon svg {
  width: 24px;
  height: 24px;
}

.dropzone-area h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.dropzone-area p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.dropzone-hint {
  font-size: 0.73rem;
  color: var(--text-light);
  display: block;
}

/* File list */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
}

/* Progress Overlay & Processing Modal */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.progress-overlay.active {
  display: flex;
}

.progress-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.spinner-glow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #e2e8f0;
  border-top-color: var(--accent-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.progress-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.progress-step-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ==========================================================================
   MODALS & DIALOGS (KB MODALS & OVERLAYS)
   ========================================================================== */

.modal-overlay, .kb-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.active, .kb-modal-overlay.active {
  display: flex;
}

.modal-container, .kb-modal-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header, .kb-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.kb-modal-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kb-modal-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.modal-title, .kb-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-close-modal, .kb-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: var(--transition-fast);
}

.btn-close-modal:hover, .kb-modal-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.modal-body, .kb-modal-body {
  padding: 1.25rem;
}

.modal-footer, .kb-modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ==========================================================================
   CHAT WORKSPACE & INNER CHAT STYLES
   ========================================================================== */

.chat-workspace-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 100px);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-sidebar {
  background: #f8fafc;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}

.chat-main-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  line-height: 1.5;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-primary);
  color: #ffffff;
  border-bottom-right-radius: var(--radius-xs);
}

.chat-bubble.bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-xs);
}

.chat-input-bar {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
}

.chat-input-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-textarea {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  resize: none;
  background: #ffffff;
  color: var(--text-primary);
}

.chat-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-send:hover {
  background: var(--accent-primary-hover);
}

.btn-send svg {
  width: 16px;
  height: 16px;
}

.chat-input-footer {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-align: center;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  animation: toast-in 0.25s ease-out;
  max-width: 380px;
}

.toast svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0 !important;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  border-left: 4px solid #059669;
}

.toast.success svg {
  color: #059669;
}

.toast.error {
  border-left: 4px solid #e11d48;
}

.toast.error svg {
  color: #e11d48;
}

.toast.info {
  border-left: 4px solid var(--accent-primary);
}

.toast.info svg {
  color: var(--accent-primary);
}

/* ==========================================================================
   RESPONSIVE LAYOUT BREAKPOINTS
   ========================================================================== */

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .auth-page-container {
    grid-template-columns: 1fr;
  }
  .auth-hero-panel {
    display: none;
  }
  .app-sidebar {
    width: 64px;
    min-width: 64px;
    padding: 0.75rem 0.5rem;
  }
  .sidebar-brand-title, .sidebar-brand-sub, .sidebar-company-card, .sidebar-user-info, .sidebar-nav-item span, .nav-count-badge, .nav-new-pill, .nav-section-heading {
    display: none;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Animated 3 Bouncing Dots Typing Indicator
   ========================================================================== */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-primary, #2563eb);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.3s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.55);
    opacity: 0.35;
  }
  40% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* ==========================================================================
   Animated Red 'NEW' Notification Badge & Pop-Up Alerts
   ========================================================================== */
.notif-badge-new {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  padding: 2px 7px !important;
  border-radius: 9999px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7) !important;
  animation: pulseNotifBadge 1.5s infinite ease-in-out !important;
  margin-left: auto !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.2 !important;
}

.notif-badge-new.hidden {
  display: none !important;
}

@keyframes pulseNotifBadge {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1.06);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Floating Incoming Escalation / Message Pop-Up */
.new-escalation-popup-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.new-escalation-popup {
  pointer-events: auto;
  width: 380px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #fecaca;
  border-left: 5px solid #ef4444;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  animation: slideInRightPopup 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.2s ease;
}

.new-escalation-popup:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -5px rgba(239, 68, 68, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
}

@keyframes slideInRightPopup {
  from {
    transform: translateX(120%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes ringBell {
  0% { transform: rotate(0); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-15deg); }
  60% { transform: rotate(10deg); }
  80% { transform: rotate(-10deg); }
  100% { transform: rotate(0); }
}

/* Notifications Feed Cards */
.notif-item-card {
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.notif-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.notif-item-card.pending {
  border-left: 4px solid #ef4444;
}

.notif-item-card.resolved {
  border-left: 4px solid #10b981;
  background: #fcfdfd;
}

.notif-filter-tab {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-color, #e2e8f0);
  background: #ffffff;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notif-filter-tab.active {
  background: var(--accent-primary, #2563eb);
  color: #ffffff;
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   CONVERSATION HISTORY 2-COLUMN WORKSPACE
   ========================================================================== */

#view-history.view-section.active {
  display: flex !important;
  flex-direction: column !important;
  height: calc(100vh - 60px - 2.5rem) !important;
  max-height: calc(100vh - 60px - 2.5rem) !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

.history-header-strip {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.history-2col-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.history-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
  min-height: 0;
  box-sizing: border-box;
}

.history-sessions-pane {
  background: #ffffff;
  border-right: 1px solid var(--border-color, #e2e8f0);
}

.history-transcript-pane {
  background: #f8fafc;
  flex: 1;
  min-width: 0;
}

.history-pane-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: #ffffff;
  flex-shrink: 0;
}

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

.history-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #94a3b8;
  pointer-events: none;
}

.history-search-input {
  width: 100%;
  padding: 0.4rem 0.65rem 0.4rem 2rem;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-primary, #0f172a);
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.history-search-input:focus {
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.history-items-scrollable {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Agent Item Card in History */
.history-agent-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.history-agent-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateX(2px);
}

.history-agent-item.active {
  background: #eff6ff;
  border-color: var(--accent-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.history-agent-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--accent-primary, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.history-agent-item.active .history-agent-avatar {
  background: #2563eb;
  color: #ffffff;
}

.history-agent-meta {
  flex: 1;
  min-width: 0;
}

.history-agent-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-agent-sub {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Session Item Card in History */
.history-session-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.history-session-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(2px);
}

.history-session-item.active {
  background: #eff6ff;
  border-color: var(--accent-primary, #2563eb);
  border-left: 3.5px solid var(--accent-primary, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.history-session-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  position: relative;
}

.history-session-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.history-item-actions-wrap {
  position: relative;
  flex-shrink: 0;
}

.btn-history-more {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  opacity: 0.7;
}

.history-session-item:hover .btn-history-more,
.history-session-item.active .btn-history-more {
  opacity: 1;
}

.btn-history-more:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.history-item-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  min-width: 140px;
  z-index: 120;
  padding: 4px;
}

.history-item-dropdown-menu.show {
  display: block;
  animation: fadeInHistoryMenu 0.12s ease-out;
}

@keyframes fadeInHistoryMenu {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  box-sizing: border-box;
}

.history-dropdown-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.history-dropdown-btn.delete {
  color: #dc2626;
}

.history-dropdown-btn.delete:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.history-session-preview {
  font-size: 0.74rem;
  color: #475569;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 0.2rem;
}

/* Transcript Header & Feed */
.history-transcript-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: #ffffff;
  flex-shrink: 0;
}

.history-transcript-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Message Bubble Styles */
.history-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: fadeInMsg 0.2s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-msg-row.user {
  align-items: flex-end;
}

.history-msg-row.bot {
  align-items: flex-start;
}

.history-msg-row.human {
  align-items: flex-start;
}

.history-msg-sender {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.history-msg-row.user .history-msg-sender {
  color: var(--text-muted, #64748b);
  justify-content: flex-end;
}

.history-msg-row.bot .history-msg-sender {
  color: var(--accent-primary, #2563eb);
}

.history-msg-row.human .history-msg-sender {
  color: #4338ca;
}

.history-msg-bubble {
  max-width: 82%;
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.55;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.history-msg-row.user .history-msg-bubble {
  background: linear-gradient(135deg, var(--accent-primary, #2563eb) 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid #1d4ed8;
  border-radius: 14px 14px 2px 14px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.2);
}

.history-msg-row.user .history-msg-bubble p,
.history-msg-row.user .history-msg-bubble span,
.history-msg-row.user .history-msg-bubble div {
  color: #ffffff;
}

.history-msg-row.bot .history-msg-bubble {
  background: #ffffff;
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px 14px 14px 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.history-msg-row.human .history-msg-bubble {
  background: #eef2ff;
  color: #1e1b4b;
  border: 1px solid #c7d2fe;
  border-radius: 14px 14px 14px 2px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.history-msg-row.human .history-msg-bubble p,
.history-msg-row.human .history-msg-bubble span,
.history-msg-row.human .history-msg-bubble div {
  color: #1e1b4b;
}

.history-sources-wrap {
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 0.72rem;
}

.history-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #334155;
  font-weight: 600;
  margin-top: 0.25rem;
  margin-right: 0.35rem;
}

.history-empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 2rem;
}

@media (max-width: 1080px) {
  .history-workspace-layout {
    grid-template-columns: 240px 260px 1fr;
  }
}

@media (max-width: 860px) {
  .history-workspace-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .history-pane {
    height: 400px;
  }
}

/* ==========================================================================
   BACKGROUND KNOWLEDGE BASE UPLOADING PROGRESS STYLES
   ========================================================================== */
.kb-uploading-row {
  animation: kbRowPulse 2s infinite ease-in-out;
  transition: all 0.3s ease;
}

@keyframes kbRowPulse {
  0%, 100% {
    background-color: rgba(37, 99, 235, 0.02);
  }
  50% {
    background-color: rgba(37, 99, 235, 0.06);
  }
}

/* ==========================================================================
   RICH HTML & STRUCTURED CONTENT STYLES (TABLES, LISTS, HEADINGS, BLOCKQUOTES)
   ========================================================================== */

.table-responsive-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0.85rem 0;
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

.chat-bubble.bot table,
.history-msg-bubble table,
.customer-msg-bubble table,
.msg-bubble table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0.75rem 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.82rem;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-bubble.bot th,
.history-msg-bubble th,
.customer-msg-bubble th,
.msg-bubble th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  text-align: left;
}

.chat-bubble.bot th:last-child,
.history-msg-bubble th:last-child,
.customer-msg-bubble th:last-child,
.msg-bubble th:last-child {
  border-right: none;
}

.chat-bubble.bot td,
.history-msg-bubble td,
.customer-msg-bubble td,
.msg-bubble td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f8fafc;
  color: #334155;
  line-height: 1.45;
  vertical-align: top;
}

.chat-bubble.bot td:last-child,
.history-msg-bubble td:last-child,
.customer-msg-bubble td:last-child,
.msg-bubble td:last-child {
  border-right: none;
}

.chat-bubble.bot tr:last-child td,
.history-msg-bubble tr:last-child td,
.customer-msg-bubble tr:last-child td,
.msg-bubble tr:last-child td {
  border-bottom: none;
}

.chat-bubble.bot tr:nth-child(even) td,
.history-msg-bubble tr:nth-child(even) td,
.customer-msg-bubble tr:nth-child(even) td,
.msg-bubble tr:nth-child(even) td {
  background: #fbfcfe;
}

.chat-bubble.bot tr:hover td,
.history-msg-bubble tr:hover td,
.customer-msg-bubble tr:hover td,
.msg-bubble tr:hover td {
  background: #eff6ff;
}

.chat-bubble.bot h1, .chat-bubble.bot h2, .chat-bubble.bot h3, .chat-bubble.bot h4,
.history-msg-bubble h1, .history-msg-bubble h2, .history-msg-bubble h3, .history-msg-bubble h4,
.customer-msg-bubble h1, .customer-msg-bubble h2, .customer-msg-bubble h3, .customer-msg-bubble h4,
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
  color: var(--text-primary, #0f172a);
  font-weight: 700;
  margin: 0.85rem 0 0.4rem 0;
  line-height: 1.35;
}

.chat-bubble.bot h2, .history-msg-bubble h2, .customer-msg-bubble h2, .msg-bubble h2 {
  font-size: 1.05rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.35rem;
}

.chat-bubble.bot h3, .history-msg-bubble h3, .customer-msg-bubble h3, .msg-bubble h3 {
  font-size: 0.95rem;
}

.chat-bubble.bot h4, .history-msg-bubble h4, .customer-msg-bubble h4, .msg-bubble h4 {
  font-size: 0.88rem;
}

.chat-bubble.bot ul, .chat-bubble.bot ol,
.history-msg-bubble ul, .history-msg-bubble ol,
.customer-msg-bubble ul, .customer-msg-bubble ol,
.msg-bubble ul, .msg-bubble ol {
  margin: 0.4rem 0 0.65rem 0;
  padding-left: 1.25rem;
}

.chat-bubble.bot li,
.history-msg-bubble li,
.customer-msg-bubble li,
.msg-bubble li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.chat-bubble.bot blockquote,
.history-msg-bubble blockquote,
.customer-msg-bubble blockquote,
.msg-bubble blockquote {
  border-left: 3px solid var(--accent-primary, #2563eb);
  background: #f8fafc;
  padding: 0.45rem 0.85rem;
  margin: 0.6rem 0;
  border-radius: 0 6px 6px 0;
  color: #475569;
  font-size: 0.8rem;
}

.chat-bubble.bot hr,
.history-msg-bubble hr,
.customer-msg-bubble hr,
.msg-bubble hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 0.85rem 0;
}

.chat-bubble.bot code,
.history-msg-bubble code,
.customer-msg-bubble code,
.msg-bubble code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

/* ==========================================================================
   BUSINESS INTELLIGENCE & ENTERPRISE REPORTS STYLES
   ========================================================================== */

.report-filter-bar {
  transition: box-shadow var(--transition-normal);
}

.report-preset-btn {
  background: #f1f5f9;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.report-preset-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.report-preset-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Report Navigation Tabs */
.report-nav-tabs-wrapper {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2px;
}

.report-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: max-content;
}

.report-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}

.report-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(241, 245, 249, 0.7);
}

.report-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 700;
  background: rgba(37, 99, 235, 0.05);
}

/* Tab Panels Visibility */
.report-tab-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.report-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Export Dropdown Menu */
.report-export-dropdown-wrap {
  position: relative;
}

.report-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  padding: 0.4rem;
  min-width: 190px;
  flex-direction: column;
  gap: 0.2rem;
}

.export-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.export-menu-item:hover {
  background: var(--bg-accent-soft);
  color: var(--accent-primary);
}

/* Print-Ready PDF Media Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }
  .app-sidebar, .app-topbar, .report-filter-bar, .report-nav-tabs-wrapper, .btn, .btn-secondary, .btn-primary, #btn-report-export-toggle {
    display: none !important;
  }
  .app-main, .app-content-viewport {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  .view-section {
    display: none !important;
  }
  #view-reports {
    display: block !important;
  }
  .report-tab-content {
    display: block !important;
    page-break-after: always;
    margin-bottom: 2rem;
  }
  .card, .metric-card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid;
  }
}

/* Auth Responsive Layout */
@media (max-width: 900px) {
  .auth-page-container {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }
  .auth-hero-panel {
    padding: 3rem 1.5rem 2rem 1.5rem;
  }
  .cs-studio-title-wrap {
    font-size: 2.2rem;
  }
}

/* ==========================================================================
   SINGLE GRAPH FULL-SCREEN / FOCUS VIEW MODAL STYLES
   ========================================================================== */

.single-graph-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.single-graph-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.single-graph-modal-dialog {
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  width: 92vw;
  max-width: 1240px;
  height: 86vh;
  max-height: 860px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.single-graph-modal-backdrop.active .single-graph-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Header */
.single-graph-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.75rem;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  gap: 1rem;
}

.single-graph-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.single-graph-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--accent-primary, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

.btn-close-single-graph {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-close-single-graph:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: rotate(90deg);
}

/* Body & Canvas */
.single-graph-modal-body {
  flex: 1;
  padding: 1.5rem 1.75rem;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0; /* Crucial for child percentage heights inside flexbox */
}

.single-graph-canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  min-height: 300px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.single-graph-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Footer */
.single-graph-modal-footer {
  padding: 0.75rem 1.75rem;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.chart-focus-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
  cursor: pointer;
}

.chart-focus-card:hover {
  border-color: #93c5fd !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08) !important;
}

@media (max-width: 768px) {
  .single-graph-modal-dialog {
    width: 96vw;
    height: 92vh;
    border-radius: 14px;
  }
  .single-graph-modal-header {
    padding: 0.85rem 1rem;
  }
  .single-graph-modal-body {
    padding: 0.85rem 1rem;
  }
}

/* ==========================================================================
   ENTERPRISE DARK THEME SYSTEM TOKENS & OVERRIDES
   ========================================================================== */

[data-theme="dark"] {
  /* Core Backgrounds */
  --bg-main: #0b1120;
  --bg-surface: #111a2e;
  --bg-surface-elevated: #18223c;
  --bg-sidebar: #0d1527;
  --bg-header: #0d1527;
  --bg-glass: rgba(13, 21, 39, 0.95);
  --bg-glass-card: #111a2e;
  --bg-glass-input: #18223c;
  --bg-glass-hover: #1e2d4d;

  /* Soft Accent Surfaces */
  --bg-accent-soft: rgba(37, 99, 235, 0.18);
  --bg-accent-soft-hover: rgba(37, 99, 235, 0.3);
  --bg-emerald-soft: rgba(16, 185, 129, 0.16);
  --bg-cyan-soft: rgba(14, 165, 233, 0.16);
  --bg-amber-soft: rgba(245, 158, 11, 0.16);
  --bg-rose-soft: rgba(244, 63, 94, 0.16);
  --bg-purple-soft: rgba(139, 92, 246, 0.16);

  /* Border Tokens */
  --border-subtle: #1e293b;
  --border-color: #24344f;
  --border-light: #1b263b;
  --border-focus: #3b82f6;
  --border-glow: rgba(59, 130, 246, 0.35);
  --border-active: #3b82f6;
  --border-card: #24344f;

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverse: #0f172a;

  /* Accent & Gradients */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #60a5fa;
  --gradient-card: #111a2e;
  --gradient-hero: linear-gradient(135deg, #111a2e 0%, #0b1120 100%);
}

[data-theme="dark"] body {
  background-color: #0b1120;
  color: #f8fafc;
}

[data-theme="dark"] .app-sidebar,
[data-theme="dark"] .app-topbar,
[data-theme="dark"] .card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .history-transcript-header,
[data-theme="dark"] .history-sessions-pane,
[data-theme="dark"] .history-agent-top,
[data-theme="dark"] .kb-modal-container,
[data-theme="dark"] .single-graph-modal-dialog,
[data-theme="dark"] .dash-hero,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .data-table thead,
[data-theme="dark"] .company-pill {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .sidebar-nav-item {
  color: #94a3b8;
}

[data-theme="dark"] .sidebar-nav-item:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #f8fafc;
}

[data-theme="dark"] .sidebar-nav-item.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .data-table tr {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .history-session-item {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .history-session-item:hover {
  background: #18243e;
}

[data-theme="dark"] .history-session-item.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

[data-theme="dark"] .history-msg-row.bot .history-msg-bubble {
  background: #18223c;
  border-color: #24344f;
  color: #f8fafc;
}

[data-theme="dark"] .history-msg-row.bot .history-msg-bubble p,
[data-theme="dark"] .history-msg-row.bot .history-msg-bubble span,
[data-theme="dark"] .history-msg-row.bot .history-msg-bubble li {
  color: #f8fafc !important;
}

[data-theme="dark"] .history-transcript-feed {
  background: #0b1120;
}

[data-theme="dark"] .btn-secondary {
  background: #18223c;
  color: #e2e8f0;
  border-color: #2e3f5d;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #24344f;
  color: #ffffff;
}

[data-theme="dark"] .settings-field-row {
  background: #0d1527;
  border-color: #1e293b;
}

[data-theme="dark"] .settings-field-row code {
  background: #18223c !important;
  color: #93c5fd !important;
}

/* ==========================================================================
   SETTINGS & THEME VIEW STYLES
   ========================================================================== */

.btn-settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-settings-tab:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.btn-settings-tab.active {
  color: #ffffff;
  background: var(--accent-primary);
}

.settings-avatar-big {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.85rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  gap: 1rem;
}

.settings-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-field-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.btn-icon-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.12s ease;
}

.btn-icon-copy:hover {
  color: var(--accent-primary);
}

/* Theme Choices Cards */
.theme-choice-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.theme-choice-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

.theme-choice-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2), 0 8px 24px rgba(37, 99, 235, 0.12);
}

.theme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.theme-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.theme-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.theme-card-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.15s ease;
}

.theme-choice-card.active .theme-card-check {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* Theme Previews */
.theme-preview-box {
  width: 100%;
  height: 120px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: flex;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.theme-preview-box.light-preview {
  background: #f8fafc;
}
.theme-preview-box.light-preview .preview-sidebar {
  width: 28%;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}
.theme-preview-box.light-preview .preview-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-preview-box.light-preview .preview-topbar {
  height: 12px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.theme-preview-box.light-preview .preview-cards-row {
  display: flex;
  gap: 5px;
}
.theme-preview-box.light-preview .preview-card-item {
  flex: 1;
  height: 22px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.theme-preview-box.light-preview .preview-card-item.accent {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.theme-preview-box.light-preview .preview-chart-box {
  flex: 1;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* Dark Preview */
.theme-preview-box.dark-preview {
  background: #0b1120;
}
.theme-preview-box.dark-preview .preview-sidebar {
  width: 28%;
  background: #0d1527;
  border-right: 1px solid #1e293b;
}
.theme-preview-box.dark-preview .preview-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-preview-box.dark-preview .preview-topbar {
  height: 12px;
  background: #111a2e;
  border-radius: 4px;
  border: 1px solid #1e293b;
}
.theme-preview-box.dark-preview .preview-cards-row {
  display: flex;
  gap: 5px;
}
.theme-preview-box.dark-preview .preview-card-item {
  flex: 1;
  height: 22px;
  background: #111a2e;
  border-radius: 4px;
  border: 1px solid #1e293b;
}
.theme-preview-box.dark-preview .preview-card-item.accent {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}
.theme-preview-box.dark-preview .preview-chart-box {
  flex: 1;
  background: #111a2e;
  border-radius: 4px;
  border: 1px solid #1e293b;
}

.theme-card-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   WINDOWS 11 STYLE LIST SETTINGS & NAVIGATION
   ========================================================================== */

.btn-settings-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-settings-back:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateX(-2px);
}

/* Win11 Hero User Profile Card (Static, Non-Clickable) */
.win11-hero-tile-static {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  user-select: none;
}

/* Win11 Hero User Profile Card (Interactive) */
.win11-hero-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.win11-hero-tile:hover {
  border-color: #93c5fd;
  background: var(--bg-surface-elevated, var(--bg-surface));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.06);
}

.win11-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
  flex-shrink: 0;
}

.win11-user-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.win11-user-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.win11-chevron-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.win11-hero-tile:hover .win11-chevron-circle,
.win11-list-item:hover .win11-chevron {
  color: var(--accent-primary);
  transform: translateX(3px);
}

/* Win11 List Container */
.win11-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Win11 Clickable Category Item */
.win11-list-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.win11-list-item:hover {
  border-color: #93c5fd;
  background: var(--bg-glass-hover, #f8fafc);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}

[data-theme="dark"] .win11-list-item:hover {
  background: #18243e;
  border-color: #3b82f6;
}

.win11-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.win11-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.win11-item-icon.blue {
  background: #eff6ff;
  color: #2563eb;
}
[data-theme="dark"] .win11-item-icon.blue {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.win11-item-icon.purple {
  background: #f5f3ff;
  color: #7c3aed;
}
[data-theme="dark"] .win11-item-icon.purple {
  background: rgba(124, 58, 237, 0.2);
  color: #c084fc;
}

.win11-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.win11-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.win11-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.win11-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.win11-item-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.win11-chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

/* Win11 Section Header */
.win11-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Win11 Detail Rows (Profile) */
.win11-detail-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.win11-detail-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.win11-detail-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.win11-detail-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.win11-detail-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.win11-detail-val {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Win11 Theme Rows */
.win11-theme-row {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 1.15rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  gap: 1rem;
}

.win11-theme-row:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

.win11-theme-row.active {
  border-color: var(--accent-primary);
  background: var(--bg-surface-elevated, var(--bg-surface));
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 6px 18px rgba(37, 99, 235, 0.1);
}

.win11-theme-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.win11-theme-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.win11-theme-row.active .win11-theme-radio {
  border-color: var(--accent-primary);
}

.win11-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.15s ease;
}

.win11-theme-row.active .win11-radio-dot {
  background: var(--accent-primary);
}

.win11-theme-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.win11-theme-icon-box.light {
  background: #fef3c7;
}

.win11-theme-icon-box.dark {
  background: #1e293b;
}

.win11-theme-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.win11-theme-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.win11-theme-preview-mini {
  width: 90px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.win11-theme-preview-mini.light-preview {
  background: #f8fafc;
}
.win11-theme-preview-mini.light-preview .mini-bar {
  height: 8px;
  background: #2563eb;
}
.win11-theme-preview-mini.light-preview .mini-body {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.win11-theme-preview-mini.light-preview .mini-line {
  height: 5px;
  background: #e2e8f0;
  border-radius: 2px;
}
.win11-theme-preview-mini.light-preview .mini-line.accent {
  width: 60%;
  background: #93c5fd;
}

.win11-theme-preview-mini.dark-preview {
  background: #0b1120;
}
.win11-theme-preview-mini.dark-preview .mini-bar {
  height: 8px;
  background: #1e293b;
}
.win11-theme-preview-mini.dark-preview .mini-body {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.win11-theme-preview-mini.dark-preview .mini-line {
  height: 5px;
  background: #1e293b;
  border-radius: 2px;
}
.win11-theme-preview-mini.dark-preview .mini-line.accent {
  width: 60%;
  background: #3b82f6;
}

/* ==========================================================================
   BOT ANALYTICS QUESTION INTELLIGENCE COMPONENTS
   ========================================================================== */

.bot-question-item {
  background: var(--bg-surface-elevated, var(--bg-surface));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  transition: all 0.15s ease;
}

.bot-question-item:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
}

.bot-q-rank {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}

.bot-q-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.bot-q-bar-bg {
  width: 100%;
  height: 5px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

[data-theme="dark"] .bot-q-bar-bg {
  background: #1e293b;
}

.bot-q-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.bot-failed-item {
  background: var(--bg-surface-elevated, var(--bg-surface));
  border: 1px solid var(--border-color);
  border-left: 3.5px solid #ef4444;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  transition: all 0.15s ease;
}

.bot-failed-item:hover {
  border-color: #fca5a5;
  border-left-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.06);
}

.bot-failed-query {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.2rem;
}

.bot-failed-reason {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.3;
}






