/* ==========================================================================
   Bến Thành Chatbot Cockpit — High-End Industrial Styling (Taste-Skill Anti-Slop)
   Colors: Bến Thành Blue #003388, Energy Red-Orange #FF3300, Void Slate #09090b
   ========================================================================== */

:root {
  color-scheme: dark;
  --bt-blue: #003388;
  --bt-blue-hover: #0044aa;
  --bt-blue-glow: rgba(0, 51, 136, 0.45);
  --bt-orange: #FF3300;
  --bt-orange-hover: #e62e00;
  --bt-orange-glow: rgba(255, 51, 0, 0.4);
  
  --bt-bg: #09090b;
  --bt-surface: rgba(18, 20, 28, 0.75);
  --bt-surface-elevated: rgba(26, 29, 41, 0.85);
  --bt-surface-solid: #11131a;
  
  --bt-border: rgba(63, 63, 70, 0.45);
  --bt-border-focus: rgba(0, 51, 136, 0.8);
  
  --bt-text-white: #f4f4f5;
  --bt-text-muted: #a1a1aa;
  --bt-text-dim: #71717a;
  
  --bt-emerald: #10b981;
  --bt-emerald-glow: rgba(16, 185, 129, 0.35);
  --bt-rose: #f43f5e;
  --bt-rose-glow: rgba(244, 63, 94, 0.35);
  --bt-amber: #f59e0b;
  --bt-cyan: #38bdf8;
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Geist Mono', "SF Mono", "Fira Code", monospace;
}

html {
  color-scheme: dark;
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* ThreeUI Background Canvas Layering */
#login-energy-canvas,
#cockpit-energy-canvas,
.fixed-energy-canvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  width: 100dvw !important;
  height: 100dvh !important;
  pointer-events: none !important;
  z-index: -10 !important;
  display: block;
}

/* Essential Anti-Slop Utility Classes */
.fixed { position: fixed !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.pointer-events-none { pointer-events: none !important; }
.-z-10 { z-index: -10 !important; }
.z-10 { z-index: 10 !important; }
.w-full { width: 100% !important; }
.h-full { height: 100% !important; }
.block { display: block !important; }
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.hidden, [hidden] { display: none !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.text-center { text-align: center !important; }

/* Icon sizing utilities */
.w-3 { width: 0.75rem !important; }
.h-3 { height: 0.75rem !important; }
.w-3\.5 { width: 0.875rem !important; }
.h-3\.5 { height: 0.875rem !important; }
.w-4 { width: 1rem !important; }
.h-4 { height: 1rem !important; }
.w-5 { width: 1.25rem !important; }
.h-5 { height: 1.25rem !important; }
.w-6 { width: 1.5rem !important; }
.h-6 { height: 1.5rem !important; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite !important;
}

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

.font-mono {
  font-family: var(--font-mono);
}

.font-display {
  font-family: var(--font-display);
}

/* Glassmorphism Card System */
.bt-card {
  background: var(--bt-surface);
  border: 1px solid var(--bt-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.bt-card:hover {
  border-color: rgba(113, 113, 122, 0.7);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

.bt-card-active {
  border-left: 3px solid var(--bt-blue);
}

.bt-card-emerald {
  border-left: 3px solid var(--bt-emerald);
}

.bt-card-rose {
  border-left: 3px solid var(--bt-rose);
}

.bt-card-orange {
  border-left: 3px solid var(--bt-orange);
}

/* Topbar Header */
.bt-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bt-border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.bt-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  text-decoration: none;
}

.bt-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.bt-brand-pill {
  background: rgba(0, 51, 136, 0.2);
  border: 1px solid rgba(0, 51, 136, 0.5);
  color: #60a5fa;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* Topbar Clock & System Status */
.bt-topbar-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bt-clock {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--bt-text-muted);
  background: rgba(24, 24, 27, 0.6);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(63, 63, 70, 0.4);
}

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

.bt-btn-label {
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .bt-btn-label {
    display: none !important;
  }
}

/* User Badge & Logout Button */
.bt-user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(24, 24, 27, 0.75);
  border: 1px solid var(--bt-border);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  min-height: 34px;
}

.bt-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--bt-blue) 0%, #1e40af 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.bt-btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  min-height: 34px;
}

.bt-btn-logout:hover {
  background: rgba(244, 63, 94, 0.28);
  border-color: rgba(244, 63, 94, 0.7);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
}

/* Sub-nav Tabs */
.bt-nav-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(14, 16, 22, 0.65);
  border-bottom: 1px solid rgba(63, 63, 70, 0.3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
}

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

.bt-tab-btn {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0 !important;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--bt-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.bt-tab-btn:hover {
  color: var(--bt-text-white);
  background: rgba(39, 39, 42, 0.5);
}

.bt-tab-btn.active {
  color: #ffffff;
  background: rgba(0, 51, 136, 0.25);
  border-color: rgba(0, 51, 136, 0.6);
  box-shadow: 0 0 16px var(--bt-blue-glow);
}

/* Status Indicator Pulse */
.bt-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.bt-status-dot.online {
  background-color: var(--bt-emerald);
}

.bt-status-dot.online::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.5;
  animation: bt-pulse 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.bt-status-dot.stopped {
  background-color: var(--bt-rose);
}

.bt-status-dot.warning {
  background-color: var(--bt-amber);
}

@keyframes bt-pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(0.9); opacity: 0; }
}

/* Bento Grid System */
.bt-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
}

.bt-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

/* Col spans */
.col-span-12 { grid-column: span 12; }
.col-span-8 { grid-column: span 8; }
.col-span-6 { grid-column: span 6; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }

/* KPI Cards */
.bt-kpi-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.1;
  margin: 0.65rem 0 0.25rem 0;
}

.bt-kpi-sub {
  font-size: 0.75rem;
  color: var(--bt-text-dim);
}

/* Bot Health Card Details */
.bt-bot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.bt-bot-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bt-bot-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 51, 136, 0.2);
  border: 1px solid rgba(0, 51, 136, 0.4);
  color: #60a5fa;
}

.bt-bot-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bt-text-white);
}

.bt-bot-role {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--bt-text-muted);
}

.bt-bot-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(63, 63, 70, 0.3);
}

.bt-metric-item {
  background: rgba(24, 24, 27, 0.5);
  border: 1px solid rgba(63, 63, 70, 0.3);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
}

.bt-metric-label {
  font-size: 0.6875rem;
  color: var(--bt-text-dim);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.bt-metric-val {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* Primary & Action Buttons */
.bt-btn-primary {
  background: linear-gradient(135deg, #003388 0%, #0284c7 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8125rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 2px 8px rgba(0, 51, 136, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bt-btn-primary:hover {
  background: linear-gradient(135deg, #002666 0%, #0369a1 100%);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35), 0 4px 12px rgba(0, 51, 136, 0.5);
  transform: translateY(-1px);
}

.bt-btn-primary:active {
  transform: translateY(0) scale(0.98);
}

/* Dark-Tech Chart Tooltip */
.bt-chart-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(9, 14, 26, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 12px rgba(2, 132, 199, 0.25);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 40;
}

.group:hover .bt-chart-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-2px);
}

.bt-btn-energy {
  background: var(--bt-orange);
  color: #ffffff;
  border: 1px solid rgba(255, 51, 0, 0.8);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8125rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.bt-btn-energy:hover {
  background: var(--bt-orange-hover);
  box-shadow: 0 0 16px var(--bt-orange-glow);
}

.bt-btn-secondary {
  background: rgba(39, 39, 42, 0.7);
  color: #f4f4f5;
  border: 1px solid rgba(82, 82, 91, 0.6);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
  min-height: 34px;
}

.bt-btn-secondary:hover {
  background: rgba(63, 63, 70, 0.9);
  border-color: rgba(113, 113, 122, 0.9);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Modals */
.bt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bt-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.bt-modal-box {
  background: #10121a;
  border: 1px solid var(--bt-border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px var(--bt-blue-glow);
  transform: translateY(16px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bt-modal-backdrop.open .bt-modal-box {
  transform: translateY(0);
}

.bt-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(63, 63, 70, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

/* Data Tables & Lists (Swiss Precision Anti-Slop) */
.bt-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--bt-border);
  background: rgba(14, 16, 22, 0.6);
}

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

.bt-table th {
  background: rgba(24, 24, 27, 0.85);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--bt-text-muted);
  border-bottom: 1px solid var(--bt-border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bt-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(63, 63, 70, 0.25);
  color: var(--bt-text-white);
  vertical-align: middle;
}

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

.bt-table tr:hover td {
  background: rgba(39, 39, 42, 0.35);
}

.bt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.bt-badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.bt-badge-rose {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.bt-badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.bt-badge-blue {
  background: rgba(0, 51, 136, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(0, 51, 136, 0.5);
}

.bt-code-tag {
  font-family: var(--font-mono);
  background: rgba(24, 24, 27, 0.7);
  border: 1px solid rgba(63, 63, 70, 0.5);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #a1a1aa;
}

/* Flex & Grid Utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Typography & Spacing Utilities */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-\[10px\] { font-size: 10px; line-height: 14px; }
.leading-tight { line-height: 1.25; }
.leading-none { line-height: 1; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }

.text-white { color: #ffffff; }
.text-zinc-100 { color: #f4f4f5; }
.text-zinc-200 { color: #e4e4e7; }
.text-zinc-300 { color: #d4d4d8; }
.text-zinc-400 { color: #a1a1aa; }
.text-zinc-500 { color: #71717a; }
.text-emerald-400 { color: #34d399; }
.text-rose-400 { color: #fb7185; }
.text-amber-400 { color: #fbbf24; }
.text-blue-400 { color: #60a5fa; }
.text-cyan-400 { color: #22d3ee; }

.p-3 { padding: 0.75rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }

.bg-zinc-900 { background: #18181b; }
.bg-zinc-900\/50 { background: rgba(24, 24, 27, 0.5); }
.bg-zinc-900\/60 { background: rgba(24, 24, 27, 0.6); }
.bg-zinc-950\/70 { background: rgba(9, 9, 11, 0.7); }
.border-zinc-800 { border-color: #27272a; }
.border-zinc-800\/40 { border-color: rgba(39, 39, 42, 0.4); }
.border-zinc-800\/50 { border-color: rgba(39, 39, 42, 0.5); }
.border-zinc-800\/60 { border-color: rgba(39, 39, 42, 0.6); }

.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

/* Form Controls & Toolbar */
.bt-input-text {
  background: #12151c;
  border: 1px solid #27272a;
  border-radius: 6px;
  color: #f4f4f5;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.bt-input-text:focus {
  border-color: var(--bt-blue);
  box-shadow: 0 0 0 2px var(--bt-blue-glow);
}

/* Dark-Tech Select & Dropdown Controls (Anti-Slop High Contrast) */
select,
.bt-select {
  color-scheme: dark !important;
  background-color: #18181b !important;
  color: #f4f4f5 !important;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  padding: 0.45rem 2.2rem 0.45rem 0.75rem;
  font-size: 0.8125rem;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 0.875rem !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

select:focus,
.bt-select:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35) !important;
}

select option,
.bt-select option,
option {
  color-scheme: dark !important;
  background-color: #18181b !important;
  color: #f4f4f5 !important;
  padding: 8px 12px !important;
}

select option:checked,
select option:hover,
select option:focus,
option:checked {
  background-color: #003388 !important;
  color: #ffffff !important;
}

select optgroup,
optgroup {
  background-color: #18181b !important;
  color: #a1a1aa !important;
  font-weight: 600;
}

.bt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  background: rgba(18, 21, 28, 0.45);
  border: 1px solid rgba(63, 63, 70, 0.35);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.bt-avatar-pill {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(0, 51, 136, 0.6) 0%, rgba(30, 64, 175, 0.6) 100%);
  border: 1px solid rgba(96, 165, 250, 0.3);
  text-transform: uppercase;
}

.bt-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  border: 1px solid transparent;
}

/* Responsive Media Queries (Mobile-First Polish) */
.max-w-4xl { max-width: 56rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-xl { max-width: 36rem; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; }
.max-w-sm { max-width: 24rem; }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

@media (max-width: 1024px) {
  .col-span-8, .col-span-6 { grid-column: span 12; }
  .col-span-4, .col-span-3 { grid-column: span 6; }
}

@media (max-width: 768px) {
  /* Mobile Topbar */
  .bt-topbar {
    padding: 0 0.75rem;
    height: 56px;
    gap: 0.5rem;
  }
  .bt-logo-img {
    height: 28px;
  }
  .bt-brand-pill {
    display: none !important;
  }
  .bt-topbar-center {
    display: none !important;
  }
  .bt-clock {
    display: none !important;
  }
  .bt-topbar-right {
    gap: 0.35rem;
  }
  .bt-btn-secondary,
  .bt-btn-logout {
    padding: 0.35rem 0.55rem;
    min-height: 32px;
  }
  .bt-btn-label {
    display: none !important;
  }
  .bt-user-badge {
    padding: 0.25rem 0.4rem;
    min-height: 32px;
    gap: 0;
  }
  .bt-user-badge .flex.flex-col {
    display: none !important;
  }
  .bt-user-avatar {
    width: 24px;
    height: 24px;
  }

  /* Sub-nav Tabs on Mobile */
  .bt-nav-bar {
    padding: 0.4rem 0.65rem;
    gap: 0.35rem;
    -webkit-overflow-scrolling: touch;
  }
  .bt-tab-btn {
    flex-shrink: 0 !important;
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
    min-height: 36px;
  }

  /* Container */
  .bt-container {
    padding: 0.75rem 0.5rem;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Bento Grid Stacking */
  .bt-bento-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  .col-span-12, .col-span-8, .col-span-6, .col-span-4, .col-span-3 {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  /* Responsive Grids */
  .grid-cols-4,
  .doc-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }
  .grid-cols-3,
  .grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .grid-cols-12 {
    grid-template-columns: 1fr !important;
  }

  .bt-bot-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .bt-kpi-value {
    font-size: 1.5rem;
    margin: 0.35rem 0 0.15rem 0;
  }
  .bt-card {
    padding: 1rem 0.85rem;
    border-radius: 10px;
  }

  /* Table horizontal scrolling */
  .bt-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
  }
  .bt-table {
    min-width: 650px;
  }

  /* Modals on mobile */
  .bt-modal-backdrop {
    padding: 0.5rem;
    align-items: flex-end;
  }
  .bt-modal-box {
    max-width: 100% !important;
    max-height: 94vh;
    border-radius: 14px 14px 0 0;
    display: flex;
    flex-direction: column;
  }
  .bt-modal-header {
    padding: 0.75rem 1rem;
  }
  .bt-modal-body {
    padding: 0.75rem 1rem;
    max-height: calc(94vh - 120px);
  }

  .bt-toast-container {
    top: auto;
    bottom: 1rem;
    right: 0.75rem;
    left: 0.75rem;
  }
  .bt-toast {
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 400px) {
  .grid-cols-4,
  .doc-stat-grid {
    grid-template-columns: 1fr !important;
  }
  .bt-bot-metrics {
    grid-template-columns: 1fr;
  }
}

/* Toast Notification System (Anti-Slop Swiss Precision) */
.bt-toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.bt-toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 460px;
  background: #11141c;
  border-radius: 10px;
  padding: 0.85rem 1.15rem;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 51, 136, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: #f4f4f5;
  border: 1px solid rgba(63, 63, 70, 0.5);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.bt-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.bt-toast-success {
  border-color: rgba(16, 185, 129, 0.65);
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.5) 0%, rgba(17, 20, 28, 0.96) 100%);
}

.bt-toast-error {
  border-color: rgba(244, 63, 94, 0.65);
  background: linear-gradient(135deg, rgba(136, 19, 55, 0.5) 0%, rgba(17, 20, 28, 0.96) 100%);
}

.bt-toast-info {
  border-color: rgba(59, 130, 246, 0.65);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.5) 0%, rgba(17, 20, 28, 0.96) 100%);
}

.bt-toast-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

@keyframes rowHighlight {
  0% { background: rgba(16, 185, 129, 0.35); }
  100% { background: transparent; }
}

.bt-row-updated {
  animation: rowHighlight 2.5s ease-out;
}

/* ==========================================================================
   Document Management & Smart Dropzone Styles (Anti-Slop)
   ========================================================================== */
.bt-dropzone {
  border: 2px dashed rgba(63, 63, 70, 0.6);
  border-radius: 12px;
  background: rgba(18, 24, 38, 0.4);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
}

.bt-dropzone:hover {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(0, 51, 136, 0.1);
}

.bt-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(0, 51, 136, 0.22);
  transform: scale(1.008);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.15);
}

.bt-dropzone-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  margin-bottom: 0.75rem;
}

.bt-badge-catalog {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.bt-badge-pricing {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.bt-badge-manual {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bt-badge-technical {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.bt-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(39, 39, 42, 0.8);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.bt-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #003388, #38bdf8);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.bt-preview-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid rgba(63, 63, 70, 0.5);
  border-radius: 8px;
  background: rgba(9, 9, 11, 0.8);
}

.bt-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.bt-preview-table th {
  background: rgba(24, 24, 27, 0.95);
  position: sticky;
  top: 0;
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: #a1a1aa;
  border-bottom: 1px solid rgba(63, 63, 70, 0.5);
  white-space: nowrap;
}

.bt-preview-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(39, 39, 42, 0.6);
  color: #e4e4e7;
  white-space: nowrap;
}

