/* ==========================================================================
   TECLYQ AI ASSISTANT - WBM WELFARE & MUTUAL FUND PLATFORM
   SKOOLMS-CALIBER UI & EMERALD BRAND THEME
   ========================================================================== */

/* -------------------------------------------------------------
   1. 3D Interactive Floating Button
   ------------------------------------------------------------- */
.ai-faq-btn.teclyq-ai-trigger,
#ai-faq-widget-floating,
#teclyqAiTrigger {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  left: auto;
  height: 44px;
  min-width: 142px;
  padding: 0 0.95rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #065f46 0%, #059669 50%, #10b981 100%);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 5px 18px -2px rgba(5, 150, 105, 0.55), 0 2px 5px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  cursor: pointer;
  z-index: 1000;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  user-select: none;
  outline: none;
  overflow: visible !important;
  perspective: 700px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  will-change: transform;
}

.ai-faq-btn.teclyq-ai-trigger:hover,
#ai-faq-widget-floating:hover,
#teclyqAiTrigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -2px rgba(5, 150, 105, 0.7), 0 3px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  filter: brightness(1.08);
}

.ai-faq-btn.teclyq-ai-trigger:active,
.ai-faq-btn.teclyq-ai-trigger[aria-expanded="true"],
#ai-faq-widget-floating:active,
#ai-faq-widget-floating[aria-expanded="true"],
#teclyqAiTrigger:active,
#teclyqAiTrigger[aria-expanded="true"] {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.25) !important;
}

.ai-flipper {
  position: relative;
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: wbmAiFlipCycle 6s infinite ease-in-out;
}

.ai-faq-btn:hover .ai-flipper,
#teclyqAiTrigger:hover .ai-flipper {
  transform: rotateX(180deg);
  animation-play-state: paused;
}

.ai-flip-front,
.ai-flip-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  height: 100%;
  white-space: nowrap;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  position: relative;
}

.ai-flip-front { transform: rotateX(0deg); }
.ai-flip-back { position: absolute; inset: 0; transform: rotateX(180deg); }

.ai-faq-btn .sparkle,
#teclyqAiTrigger .sparkle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  line-height: 1;
}

.ai-faq-btn .ai-btn-label,
#teclyqAiTrigger .ai-btn-label {
  display: inline-block !important;
  font-weight: 800;
  white-space: nowrap;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes wbmAiFlipCycle {
  0%, 42% { transform: rotateX(0deg); }
  50%, 92% { transform: rotateX(180deg); }
  100% { transform: rotateX(360deg); }
}

/* Position back-to-top gracefully above AI trigger */
.back-to-top,
#backToTopButton,
#back-to-top-floating {
  bottom: 4.8rem !important;
  right: 1.25rem !important;
}

/* -------------------------------------------------------------
   2. Assistant Drawer Card
   ------------------------------------------------------------- */
.sc-assistant.teclyq-ai-panel,
#faq-drawer-container,
#teclyqAiPanel {
  position: fixed;
  bottom: 4.6rem;
  right: 1.25rem;
  left: auto;
  width: 330px;
  max-width: calc(100vw - 2.5rem);
  height: 500px;
  max-height: min(560px, calc(100vh - 6.5rem));
  background: #ffffff;
  color: #17211f;
  border: 1px solid rgba(22, 101, 52, 0.18);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.08);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] .sc-assistant.teclyq-ai-panel,
[data-theme="dark"] #faq-drawer-container,
[data-theme="dark"] #teclyqAiPanel {
  background: #17201e;
  color: #eef3f1;
  border-color: #273531;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.25);
}

.sc-assistant.teclyq-ai-panel.open,
#faq-drawer-container.open,
#teclyqAiPanel.open {
  display: flex !important;
  animation: wbmAiRiseIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wbmAiRiseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------
   3. Assistant Header
   ------------------------------------------------------------- */
.sc-assist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.sc-assist-header-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sc-assist-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.sc-assist-title {
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.2;
  color: #ffffff;
}

.sc-assist-subtitle {
  font-size: 0.7rem;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}


.sc-assist-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sc-assist-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.5rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sc-assist-home-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.sc-assist-home-btn:active {
  transform: translateY(0);
}

.sc-assist-home-btn svg {
  flex-shrink: 0;
}

.sc-assist-home-link {
  background: #f0fdf4 !important;
  color: #065f46 !important;
  border-color: #a7f3d0 !important;
  cursor: pointer;
  font-weight: 700 !important;
}

.sc-assist-home-link:hover {
  background: #dcfce7 !important;
  border-color: #34d399 !important;
}

[data-theme="dark"] .sc-assist-home-link {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.32) !important;
}

.sc-assist-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sc-assist-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* -------------------------------------------------------------
   4. Assistant Body & Shortcuts Bar
   ------------------------------------------------------------- */
.sc-assist-body {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
}

[data-theme="dark"] .sc-assist-body {
  background: #111a18;
}

.sc-assist-shortcuts-wrap {
  flex-shrink: 0;
  padding: 0.6rem 0.85rem 0.35rem;
  border-bottom: 1px solid #dcfce7;
  background: #f0fdf4;
}

[data-theme="dark"] .sc-assist-shortcuts-wrap {
  border-bottom-color: #1c2b27;
  background: #111a18;
}

.sc-assist-shortcuts-title {
  font-size: 0.72rem;
  font-weight: 750;
  color: #065f46;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .sc-assist-shortcuts-title {
  color: #4ade80;
}

.sc-assist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0 0.2rem 0;
}

.sc-assist-chip {
  padding: 0.3rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid #bbf7d0;
  background: #ffffff;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .sc-assist-chip {
  background: #17201e;
  color: #4ade80;
  border-color: #273531;
}

.sc-assist-chip:hover {
  border-color: #059669;
  color: #ffffff;
  background: #059669;
}

/* -------------------------------------------------------------
   5. Message Thread
   ------------------------------------------------------------- */
.sc-assist-thread {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
  overscroll-behavior: contain;
}

.sc-assist-msg {
  max-width: 88%;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
}

.sc-assist-msg p {
  margin: 0.25rem 0;
}

.sc-assist-msg.from-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #059669;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sc-assist-msg.from-bot {
  background: #17201e;
  color: #e2e8f0;
  border-color: #273531;
  border-left: 3px solid #10b981;
}

.sc-assist-msg.from-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.sc-assist-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.sc-assist-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #065f46;
  font-size: 0.73rem;
  font-weight: 650;
  text-decoration: none;
  transition: all 0.15s ease;
}

[data-theme="dark"] .sc-assist-link {
  background: #111a18;
  border-color: #1e2d28;
  color: #4ade80;
}

.sc-assist-link:hover {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

/* -------------------------------------------------------------
   6. Typing Wave Indicator
   ------------------------------------------------------------- */
.sc-assist-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #64748b;
  padding: 0.2rem 0;
}

[data-theme="dark"] .sc-assist-typing {
  color: #94a3b8;
}

.sc-assist-typing .typing-dots {
  display: inline-flex;
  gap: 4px;
}

.sc-assist-typing .typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #059669;
  animation: wbmTypingBounce 1.4s infinite ease-in-out both;
}

[data-theme="dark"] .sc-assist-typing .typing-dot {
  background: #10b981;
}

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

@keyframes wbmTypingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* -------------------------------------------------------------
   7. Assistant Input Form
   ------------------------------------------------------------- */
.sc-assist-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sc-assist-form {
  background: #17201e;
  border-top-color: #273531;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.sc-assist-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

[data-theme="dark"] .sc-assist-input {
  background: #111a18;
  color: #f1f5f9;
  border-color: #273531;
}

.sc-assist-input:focus {
  border-color: #059669;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .sc-assist-input:focus {
  background: #17201e;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.sc-assist-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.sc-assist-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.5);
}

.sc-assist-send:active {
  transform: scale(0.96);
}


/* Mobile layout: position on bottom-left to avoid colliding with bottom-right mobile menu FAB and back-to-top */
@media (max-width: 860px) {
  .ai-faq-btn.teclyq-ai-trigger,
  #ai-faq-widget-floating,
  #teclyqAiTrigger {
    right: auto !important;
    left: max(16px, env(safe-area-inset-left, 0px)) !important;
    bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
    z-index: 59 !important;
  }
  .sc-assistant.teclyq-ai-panel,
  #faq-drawer-container,
  #teclyqAiPanel {
    right: 0.75rem !important;
    left: 0.75rem !important;
    width: auto !important;
    max-width: calc(100vw - 1.5rem) !important;
    bottom: 4.8rem !important;
    z-index: 1001 !important;
  }
}


/* -------------------------------------------------------------
   Connected Floating Dock (AI + Diagnostics)
   ------------------------------------------------------------- */
.teclyq-floating-dock {
  position: fixed !important;
  bottom: 1.25rem !important;
  right: 1.25rem !important;
  left: auto !important;
  z-index: 1050 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

@media (max-width: 860px) {
  .teclyq-floating-dock {
    left: max(14px, env(safe-area-inset-left)) !important;
    right: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    gap: 0.35rem !important;
  }
}

/* Diagnostics Pill Trigger - Hidden by default, shown strictly for Platform Owner */
.teclyq-diag-pill {
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 0.95rem !important;
  border-radius: 9999px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), 0 2px 5px rgba(0, 0, 0, 0.15) !important;
  display: none !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
  font-family: inherit !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
  user-select: none !important;
}

.teclyq-diag-pill.is-platform-owner {
  display: inline-flex !important;
}

.teclyq-diag-pill:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45) !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  background: #1e293b !important;
}

.teclyq-diag-pill:active {
  transform: translateY(1px) scale(0.98) !important;
}

.teclyq-diag-pill .dbg-pill-dot {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
  display: inline-block !important;
  box-shadow: 0 0 8px #10b981 !important;
}

.teclyq-diag-pill.has-errors .dbg-pill-dot {
  background: #ef4444 !important;
  box-shadow: 0 0 8px #ef4444 !important;
}

.teclyq-diag-pill.has-errors {
  border-color: rgba(239, 68, 68, 0.5) !important;
  animation: pulseDiagRed 2s infinite !important;
}

@keyframes pulseDiagRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.teclyq-diag-pill .dbg-pill-text {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.teclyq-diag-pill .dbg-pill-badge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  border-radius: 9999px !important;
  padding: 0.12rem 0.45rem !important;
  font-size: 0.7rem !important;
  font-weight: 800 !important;
}

@media (max-width: 768px) {
  .teclyq-diag-pill .dbg-pill-text {
    display: none !important;
  }
  .teclyq-diag-pill {
    padding: 0 0.65rem !important;
  }
}

/* Diagnostics Console Drawer */
.teclyq-diag-drawer {
  position: fixed !important;
  bottom: 4.6rem !important;
  right: 1.25rem !important;
  left: auto !important;
  width: min(680px, calc(100vw - 2.5rem)) !important;
  height: min(540px, calc(100vh - 6rem)) !important;
  z-index: 1055 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
  font-size: 0.82rem !important;
}

[data-theme="dark"] .teclyq-diag-drawer,
body.dark .teclyq-diag-drawer {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #1e293b !important;
}

.teclyq-diag-drawer.open {
  display: flex !important;
  animation: diagRiseIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes diagRiseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .teclyq-diag-drawer {
    left: 0.75rem !important;
    right: 0.75rem !important;
    width: calc(100vw - 1.5rem) !important;
    bottom: 4.6rem !important;
  }
}

.dbg-drawer-header {
  padding: 0.75rem 1rem !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}
[data-theme="dark"] .dbg-drawer-header {
  background: #172138 !important;
  border-color: #1e293b !important;
}

.dbg-drawer-toolbar {
  padding: 0.5rem 0.85rem !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
}
[data-theme="dark"] .dbg-drawer-toolbar {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

.dbg-drawer-tabs {
  display: flex !important;
  gap: 0.3rem !important;
  flex-wrap: wrap !important;
}

.dbg-drawer-tab {
  border: 1px solid #e2e8f0 !important;
  background: transparent !important;
  color: #64748b !important;
  border-radius: 6px !important;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  font-family: inherit !important;
}
[data-theme="dark"] .dbg-drawer-tab {
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

.dbg-drawer-tab.active {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

.dbg-btn {
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #334155 !important;
  border-radius: 6px !important;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.3rem !important;
}
[data-theme="dark"] .dbg-btn {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}
.dbg-btn:hover {
  background: #e2e8f0 !important;
}
[data-theme="dark"] .dbg-btn:hover {
  background: #334155 !important;
}

.dbg-filter-bar {
  padding: 0.4rem 0.75rem !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  gap: 0.5rem !important;
  align-items: center !important;
}
[data-theme="dark"] .dbg-filter-bar {
  border-color: #1e293b !important;
}

.dbg-search-input {
  flex: 1 !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.78rem !important;
  color: inherit !important;
  font-family: inherit !important;
}
[data-theme="dark"] .dbg-search-input {
  background: #172138 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.dbg-tray {
  flex: 1 1 0% !important;
  overflow-y: auto !important;
  padding: 0.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem !important;
}

.dbg-log-item {
  padding: 0.55rem 0.75rem !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-radius: 6px !important;
  background: #f8fafc !important;
  cursor: pointer !important;
}
[data-theme="dark"] .dbg-log-item {
  background: #162035 !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}
.dbg-log-item.is-error {
  border-left: 3px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.dbg-details-box {
  margin-top: 0.35rem !important;
  padding: 0.45rem !important;
  background: #090d16 !important;
  color: #e2e8f0 !important;
  border-radius: 4px !important;
  font-family: monospace !important;
  font-size: 0.7rem !important;
  white-space: pre-wrap !important;
  word-break: break-all !important;
  max-height: 180px !important;
  overflow-y: auto !important;
  display: none;
}
.dbg-log-item.open .dbg-details-box {
  display: block !important;
}


/* ==========================================================================
   TECLYQ FLOATING DOCK & CONNECTED BUTTONS POSITIONING FIX
   Guarantees that Diagnostics button and AI button sit side-by-side
   and NEVER overlap or hide beneath each other.
   ========================================================================== */

.teclyq-floating-dock,
#teclyqFloatingDock {
  position: fixed !important;
  bottom: 1.25rem !important;
  right: 1.25rem !important;
  left: auto !important;
  top: auto !important;
  z-index: 1050 !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.65rem !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

.teclyq-floating-dock > * {
  pointer-events: auto !important;
}

/* Force both buttons inside the dock to be relative flex items with NO position:fixed */
.teclyq-floating-dock #teclyqAiTrigger,
.teclyq-floating-dock .ai-faq-btn.teclyq-ai-trigger,
#teclyqFloatingDock #teclyqAiTrigger,
#teclyqFloatingDock .ai-faq-btn.teclyq-ai-trigger {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  z-index: 10 !important;
  order: 2 !important; /* On desktop, AI button is on far right corner */
}

.teclyq-floating-dock #teclyqDiagTrigger,
.teclyq-floating-dock .teclyq-diag-pill,
#teclyqFloatingDock #teclyqDiagTrigger,
#teclyqFloatingDock .teclyq-diag-pill {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
  z-index: 11 !important;
  order: 1 !important; /* Diagnostics sits connected immediately to the left of AI */
}

/* Mobile responsive layout */
@media (max-width: 860px) {
  .teclyq-floating-dock,
  #teclyqFloatingDock {
    left: max(16px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    justify-content: flex-start !important;
    gap: 0.45rem !important;
    z-index: 1050 !important;
  }

  .teclyq-floating-dock #teclyqAiTrigger,
  .teclyq-floating-dock .ai-faq-btn.teclyq-ai-trigger,
  #teclyqFloatingDock #teclyqAiTrigger {
    order: 1 !important; /* On mobile bottom-left, AI is first on the left */
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    margin: 0 !important;
  }

  .teclyq-floating-dock #teclyqDiagTrigger,
  .teclyq-floating-dock .teclyq-diag-pill,
  #teclyqFloatingDock #teclyqDiagTrigger {
    order: 2 !important; /* Diagnostics sits next to it on the right */
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    margin: 0 !important;
    padding: 0 0.65rem !important;
    min-width: unset !important;
  }

  .teclyq-diag-pill .dbg-pill-text {
    display: none !important;
  }
}


/* ==========================================================================
   COMPACT SHORTCUTS & FULLY VISIBLE GREETING FIX
   Reduces vertical space consumed by shortcuts so the welcome greeting is 100% visible
   ========================================================================== */

.sc-assist-shortcuts-wrap,
#sc-assist-shortcuts-wrap {
  flex-shrink: 0 !important;
  padding: 0.35rem 0.65rem 0.35rem !important;
  border-bottom: 1px solid #dcfce7 !important;
  background: #f0fdf4 !important;
  margin: 0 !important;
}

[data-theme="dark"] .sc-assist-shortcuts-wrap,
[data-theme="dark"] #sc-assist-shortcuts-wrap {
  border-bottom-color: #1c2b27 !important;
  background: #111a18 !important;
}

.sc-assist-shortcuts-title,
#sc-assist-shortcuts-wrap .sc-assist-shortcuts-title {
  display: none !important;
}

.sc-assist-chips,
#sc-assist-chips {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 0.35rem !important;
  padding: 0 0 0.15rem 0 !important;
  scrollbar-width: none !important;
  -webkit-overflow-scrolling: touch !important;
}

.sc-assist-chips::-webkit-scrollbar,
#sc-assist-chips::-webkit-scrollbar {
  display: none !important;
}

.sc-assist-chip,
#sc-assist-chips .sc-assist-chip {
  padding: 0.24rem 0.6rem !important;
  border-radius: 9999px !important;
  border: 1px solid #bbf7d0 !important;
  background: #ffffff !important;
  color: #166534 !important;
  font-size: 0.72rem !important;
  font-weight: 650 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1.3 !important;
  transition: all 0.15s ease !important;
}

[data-theme="dark"] .sc-assist-chip,
[data-theme="dark"] #sc-assist-chips .sc-assist-chip {
  background: #17201e !important;
  color: #4ade80 !important;
  border-color: #273531 !important;
}

.sc-assist-chip:hover,
#sc-assist-chips .sc-assist-chip:hover {
  border-color: #059669 !important;
  color: #ffffff !important;
  background: #059669 !important;
}

.sc-assistant.teclyq-ai-panel,
#faq-drawer-container,
#teclyqAiPanel {
  width: 350px !important;
  max-width: calc(100vw - 2.5rem) !important;
  height: 520px !important;
  max-height: min(580px, calc(100vh - 6.5rem)) !important;
}

.sc-assist-thread,
#teclyqAiMessages {
  flex: 1 1 0% !important;
  overflow-y: auto !important;
  padding: 0.85rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.6rem !important;
  min-height: 0 !important;
  overscroll-behavior: contain !important;
}

.sc-assist-msg,
#teclyqAiMessages .sc-assist-msg {
  max-width: 90% !important;
  padding: 0.65rem 0.85rem !important;
  border-radius: 14px !important;
  font-size: 0.82rem !important;
  line-height: 1.5 !important;
  word-break: break-word !important;
}

/* Never display AI or Diagnostics button on the login screen */
body:has(#staffAuth:not(.hidden)) #teclyqFloatingDock,
body:has(#staffAuth:not(.hidden)) .teclyq-floating-dock,
body:has(#staffAuth:not(.hidden)) #teclyqAiTrigger,
body:has(#staffAuth:not(.hidden)) #teclyqDiagTrigger,
body:has(#staffAuth:not(.hidden)) #teclyqAiPanel,
body:has(#staffAuth:not(.hidden)) #teclyqDiagDrawer,
#staffAuth:not(.hidden) ~ #teclyqFloatingDock,
#staffAuth:not(.hidden) ~ .teclyq-floating-dock,
#staffAuth:not(.hidden) ~ #teclyqAiPanel,
#staffAuth:not(.hidden) ~ #teclyqDiagDrawer,
body:has(.page-login-card:not(.hidden)) #teclyqFloatingDock,
body:has(.home-login-card:not(.hidden)) #teclyqFloatingDock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
