/**
 * AMI Unified Demo Platform - Master Design System & Stylesheet (v1.1)
 * 100% Light Corporate Executive Standard - Zero Emoji Compliance
 */

/* ==========================================================================
   1. Design Tokens & CSS Custom Properties
   ========================================================================== */
:root {
  /* Surface & Background */
  --bg-app: #f8fafc;
  --bg-white: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-surface-active: #e2e8f0;
  --bg-sidebar: #ffffff;
  --bg-chat-user: #2563eb;
  --bg-chat-bot: #f1f5f9;

  /* Borders & Dividers */
  --border-light: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #93c5fd;

  /* Brand Palette (Blue) */
  --primary-blue: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-soft-text: #1e40af;

  /* Typography Colors */
  --text-dark: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Semantic Status Colors */
  --accent-emerald: #10b981;
  --accent-emerald-soft: #d1fae5;
  --accent-emerald-text: #065f46;

  --accent-rose: #f43f5e;
  --accent-rose-soft: #ffe4e6;
  --accent-rose-text: #9f1239;

  --accent-cyan: #06b6d4;
  --accent-cyan-soft: #cffafe;
  --accent-cyan-text: #155e75;

  --accent-purple: #8b5cf6;
  --accent-purple-soft: #ede9fe;
  --accent-purple-text: #5b21b6;

  --accent-amber: #f59e0b;
  --accent-amber-soft: #fef3c7;
  --accent-amber-text: #92400e;

  /* Typography Settings */
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.18);

  /* Geometry & Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Reset & Global Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.text-emerald { color: var(--accent-emerald) !important; }
.text-rose { color: var(--accent-rose) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-purple { color: var(--accent-purple) !important; }
.text-amber { color: var(--accent-amber) !important; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ==========================================================================
   3. Sticky Topbar Header & Demo Suite
   ========================================================================== */
.topbar-header {
  background-color: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  height: 60px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-badge-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fbbf24;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.brand-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-blue);
  background: var(--primary-soft);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-xs);
}

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

.demo-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.demo-select-wrap .select-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.demo-select {
  appearance: none;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.35rem 1.75rem 0.35rem 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.demo-select:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.demo-select:focus {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-focus);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--primary-blue);
}

.pill-btn.btn-danger:hover {
  background: var(--accent-rose-soft);
  border-color: var(--accent-rose);
  color: var(--accent-rose-text);
}

/* User Avatar Dropdown Pill */
.user-profile-wrapper {
  position: relative;
}

.user-avatar-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.65rem 0.2rem 0.25rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.user-avatar-pill:hover {
  border-color: var(--primary-blue);
  background: var(--bg-surface-hover);
}

.avatar-circle {
  width: 26px;
  height: 26px;
  background: var(--primary-blue);
  color: white;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-fullname {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
}

/* Dropdown Menu under Avatar */
.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 0;
  display: none;
  flex-direction: column;
  z-index: 150;
  animation: dropdownFade 150ms ease-out forwards;
}

.profile-dropdown-menu.show {
  display: flex;
}

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

.dropdown-user-header {
  padding: 0.25rem 1rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.dropdown-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

.dropdown-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.dropdown-role-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-body);
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item i {
  width: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dropdown-item:hover {
  background: var(--bg-surface-hover);
  color: var(--primary-blue);
}

.dropdown-item:hover i {
  color: var(--primary-blue);
}

.dropdown-item.logout-btn {
  color: var(--accent-rose);
  border-top: 1px solid var(--border-light);
  margin-top: 0.35rem;
  padding-top: 0.75rem;
}

.dropdown-item.logout-btn i {
  color: var(--accent-rose);
}

.dropdown-item.logout-btn:hover {
  background: var(--accent-rose-soft);
  color: var(--accent-rose-text);
}

/* ==========================================================================
   4. Sticky Tabs Navigation Bar (8 Tabs)
   ========================================================================== */
.tabs-nav-bar {
  background-color: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  padding: 0 1.5rem;
  gap: 0.25rem;
  position: sticky;
  top: 60px;
  z-index: 90;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav-bar::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.nav-tab-btn i {
  font-size: 0.9rem;
}

.nav-tab-btn:hover {
  color: var(--primary-blue);
}

.nav-tab-btn.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

.nav-tab-btn.tab-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   5. Content Subheader & Tenant Badge
   ========================================================================== */
.content-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.content-subheader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.3px;
}

.tenant-badge-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
  box-shadow: var(--shadow-xs);
}

.tenant-badge-box i {
  color: var(--primary-blue);
}

.tab-viewport {
  display: none;
  animation: fadeIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ==========================================================================
   6. KPI Cards Grid & KPI Card Component
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

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

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

.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-icon.income { background: var(--accent-emerald-soft); color: var(--accent-emerald); }
.kpi-icon.expense { background: var(--accent-rose-soft); color: var(--accent-rose); }
.kpi-icon.production { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.kpi-icon.hr { background: var(--primary-soft); color: var(--primary-blue); }
.kpi-icon.market { background: var(--accent-purple-soft); color: var(--accent-purple); }
.kpi-icon.amber { background: var(--accent-amber-soft); color: var(--accent-amber); }

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.kpi-badge.positive { background: var(--accent-emerald-soft); color: var(--accent-emerald-text); }
.kpi-badge.negative { background: var(--accent-rose-soft); color: var(--accent-rose-text); }
.kpi-badge.neutral  { background: var(--bg-surface-hover); color: var(--text-muted); }

.kpi-caption {
  color: var(--text-muted);
}

/* ==========================================================================
   7. Charts Grid & Containers
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-card.span-2 {
  grid-column: span 2;
}

@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.span-2 { grid-column: span 1; }
}

.chart-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

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

.chart-title-group h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-title-group h3 i {
  color: var(--primary-blue);
}

.chart-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-container.tall {
  height: 330px;
}

/* ==========================================================================
   8. Data Table Component with Client Pagination
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background-color: var(--bg-app);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

.badge-status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status.badge-success { background: var(--accent-emerald-soft); color: var(--accent-emerald-text); }
.badge-status.badge-danger  { background: var(--accent-rose-soft); color: var(--accent-rose-text); }
.badge-status.badge-warning { background: var(--accent-amber-soft); color: var(--accent-amber-text); }
.badge-status.badge-info    { background: var(--primary-soft); color: var(--primary-soft-text); }
.badge-status.badge-purple  { background: var(--accent-purple-soft); color: var(--accent-purple-text); }

.table-pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 0.35rem;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(.disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--primary-blue);
}

.page-btn.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   9. Chatbot Viewport Component Suite (PINNED INPUT BAR FIXED HEIGHT)
   ========================================================================== */
.chat-layout-wrapper {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 1.25rem;
  /* CRITICAL: Fix height so chat input is always visible without scrolling the whole page */
  height: calc(100vh - 165px);
  min-height: 480px;
  max-height: 720px;
}

@media (max-width: 900px) {
  .chat-layout-wrapper {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }
}

/* Left Sidebar: Sub-Agents Monitor & Suggestion Chips */
.subagents-sidebar {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  height: 100%;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-header h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header h4 i {
  color: var(--primary-blue);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.subagents-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.agent-card {
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  transition: all var(--transition-fast);
}

.agent-card.active {
  border-color: var(--primary-blue);
  background: var(--primary-soft);
}

.agent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.agent-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.agent-name i {
  color: var(--primary-blue);
}

.agent-status-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
}

.agent-status-badge.status-standby {
  background: var(--bg-white);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.agent-status-badge.status-busy {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald-text);
  border: 1px solid var(--accent-emerald);
}

.agent-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Quick Suggestion Prompts Section with SEE MORE TOGGLE */
.quick-prompts-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-light);
}

.quick-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.quick-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-chip {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.quick-chip i {
  color: var(--primary-blue);
  font-size: 0.8rem;
  width: 14px;
}

.quick-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  transform: translateX(2px);
}

.quick-chip.chip-locked {
  background: #fff8f8;
  border-color: #fecdd3;
  color: #9f1239;
  opacity: 0.88;
}

.quick-chip.chip-locked i {
  color: var(--accent-rose);
}

.quick-chip.chip-locked:hover {
  background: #ffe4e6;
  border-color: var(--accent-rose);
  color: var(--accent-rose-text);
  transform: translateX(2px);
}

/* Hidden Group for More Prompts */
.prompts-hidden-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: hidden;
  transition: max-height 250ms ease-in-out, opacity 200ms;
}

.prompts-hidden-group.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.prompts-hidden-group.expanded {
  max-height: 600px;
  opacity: 1;
  pointer-events: auto;
}

.see-more-prompts-btn {
  background: none;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  margin-top: 0.25rem;
}

.see-more-prompts-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-blue);
}

/* Right Chat Window Area */
.chat-main-area {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

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

.chat-msg {
  display: flex;
  gap: 0.75rem;
  max-width: 84%;
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.chat-msg.bot .msg-avatar {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
}

.chat-msg.user .msg-avatar {
  background: var(--text-dark);
  color: white;
}

.msg-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.msg-bubble {
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.55;
}

.chat-msg.bot .msg-bubble {
  background: var(--bg-chat-bot);
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  border-top-left-radius: var(--radius-xs);
}

.chat-msg.user .msg-bubble {
  background: var(--bg-chat-user);
  color: white;
  border-top-right-radius: var(--radius-xs);
}

.msg-bubble h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0.65rem 0 0.35rem 0;
}

.msg-bubble ul, .msg-bubble ol {
  padding-left: 1.25rem;
  margin: 0.45rem 0;
}

.msg-bubble li {
  margin-bottom: 0.25rem;
}

.msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.65rem 0;
}

.msg-bubble th {
  background: var(--bg-white);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-light);
  font-weight: 700;
}

.msg-bubble td {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-light);
}

.chat-inline-chart-box {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-top: 0.65rem;
}

.chat-box-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.chat-box-header i {
  color: var(--primary-blue);
}

.chat-canvas-wrap {
  position: relative;
  width: 100%;
  height: 210px;
}

.token-meter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  align-self: flex-start;
}

.token-meter-badge i {
  color: var(--primary-blue);
}

.token-meter-badge .model-tag {
  color: var(--primary-blue);
  font-family: var(--font-code);
  font-weight: 500;
}

/* Chat Input Bar - PINNED AT BOTTOM */
.chat-input-bar {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-white);
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.chat-input-bar input:focus {
  border-color: var(--primary-blue);
  background: var(--bg-white);
  box-shadow: var(--shadow-focus);
}

.btn-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.btn-send:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.6rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   10. Market Intel & Comparative Module Styles (SWOT + Margin)
   ========================================================================== */
.moat-gap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .moat-gap-grid { grid-template-columns: 1fr; }
}

.insight-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.insight-card.moat {
  border-left: 4px solid var(--accent-emerald);
}

.insight-card.gap {
  border-left: 4px solid var(--accent-rose);
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.insight-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.insight-header i.emerald { color: var(--accent-emerald); }
.insight-header i.rose { color: var(--accent-rose); }

.insight-card p {
  font-size: 0.85rem;
  color: var(--text-body);
  line-height: 1.55;
}

/* SWOT 4-Quadrant Grid */
.swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

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

.swot-box {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.swot-box.strength { border-top: 3px solid var(--accent-emerald); }
.swot-box.weakness { border-top: 3px solid var(--accent-rose); }
.swot-box.opportunity { border-top: 3px solid var(--accent-cyan); }
.swot-box.threat { border-top: 3px solid var(--accent-amber); }

.swot-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.swot-box ul {
  padding-left: 1.15rem;
  font-size: 0.8rem;
  color: var(--text-body);
}

.swot-box li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   11. Access Control List (ACL) Module
   ========================================================================== */
.acl-permission-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.acl-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.acl-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-blue);
  cursor: pointer;
}

/* ==========================================================================
   12. Omnichannel Hub Modal & Integrations
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

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

.modal-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  animation: modalPop 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header h3 i {
  color: var(--primary-blue);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.channel-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.channel-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color var(--transition-fast);
}

.channel-item:hover {
  border-color: var(--primary-blue);
}

.channel-info-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.channel-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.channel-title-wrap h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
}

.channel-title-wrap p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.channel-status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   13. Simulation Login Screen Overlay
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-app);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1.5rem;
}

.login-overlay.show {
  display: flex;
}

.login-card {
  position: relative;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  padding: 1.5rem 1.75rem;
  text-align: center;
}

.login-modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.login-modal-close-btn:hover {
  color: var(--text-dark);
  background: var(--border-light);
}

.login-header-center {
  margin-bottom: 1rem;
}

.login-brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.login-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
  line-height: 1.4;
}

/* Search bar inside login modal */
.login-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.login-search-wrap .search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.login-search-wrap input {
  width: 100%;
  padding: 0.6rem 2.2rem 0.6rem 2.25rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  background: var(--bg-app);
  font-family: inherit;
  color: var(--text-dark);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.login-search-wrap input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.clear-search-btn {
  position: absolute;
  right: 0.55rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.clear-search-btn:hover {
  color: var(--text-dark);
  background: var(--border-light);
}

/* Compact accounts list */
.login-accounts-compact-list {
  max-height: 195px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.25rem;
  margin-bottom: 0.85rem;
  text-align: left;
}

.login-accounts-compact-list::-webkit-scrollbar {
  width: 5px;
}
.login-accounts-compact-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.compact-account-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--bg-white);
  transition: all var(--transition-fast);
  user-select: none;
}

.compact-account-item:hover {
  border-color: var(--primary-blue);
  background: #f8fafc;
}

.compact-account-item.selected {
  border-color: var(--primary-blue);
  background: rgba(37, 99, 235, 0.06);
  box-shadow: 0 0 0 1px var(--primary-blue);
}

.compact-account-item.superadmin-item {
  border-color: #e9d5ff;
}
.compact-account-item.superadmin-item.selected {
  border-color: var(--accent-purple);
  background: rgba(147, 51, 234, 0.08);
  box-shadow: 0 0 0 1px var(--accent-purple);
}

.compact-account-item .item-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.compact-account-item .avatar-circle {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.compact-account-item .item-info {
  min-width: 0;
}

.compact-account-item .item-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.compact-account-item .item-role-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-account-item .select-indicator {
  font-size: 0.95rem;
  color: var(--border-light);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.compact-account-item.selected .select-indicator {
  color: var(--primary-blue);
}
.compact-account-item.superadmin-item.selected .select-indicator {
  color: var(--accent-purple);
}

/* Empty state for search */
.login-empty-search {
  padding: 1.25rem 0.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Selected preview box */
.selected-account-preview {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.85rem;
  text-align: left;
  font-size: 0.74rem;
  color: var(--text-dark);
}

.selected-account-preview .preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 0.75rem;
}

.selected-account-preview .preview-scope {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.selected-account-preview .preview-tabs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.selected-account-preview .mini-tag {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 0.12rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dark);
}

.selected-account-preview .mini-tag.tag-primary {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--primary-blue);
}

/* Confirm button */
.btn-confirm-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: var(--primary-blue);
  color: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.68rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-confirm-login:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.btn-confirm-login:active {
  transform: translateY(0);
}

/* ==========================================================================
   14. Shimmer Skeleton & Toast
   ========================================================================== */
.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--text-dark);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
  transform: translateY(0);
  opacity: 1;
  transition: all var(--transition-base);
  pointer-events: auto;
}

.toast.toast-hide {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

.toast i.success { color: var(--accent-emerald); }
.toast i.danger { color: var(--accent-rose); }
.toast i.info { color: var(--primary-blue); }
