/* ==========================================================================
   BASEBRAIN Dev Cockpit & AGY Chat Hub — Design System & Stylesheet
   ========================================================================== */

:root {
  --bg-main: #0c0f14;
  --bg-surface: #141820;
  --bg-surface-elevated: #1c222c;
  --bg-surface-hover: #242c38;
  --border-subtle: #27303d;
  --border-active: #384556;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-cyan: #0284c7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  height: var(--app-height, 100%);
  max-height: var(--app-height, 100%);
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Layout Container */
.app-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  height: var(--app-height, 100%);
  max-height: var(--app-height, 100%);
  overflow: hidden;
}

/* Header & Telemetry Bar */
.top-nav {
  position: relative;
  top: 0;
  flex-shrink: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.65rem 1.15rem;
  background-color: rgba(20, 24, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 0.65rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  contain: layout style;
}

.nav-left-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Center Voice / Audio Stop Button in Navbar */
.nav-center-group {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 105;
  pointer-events: none;
}

.btn-stop-tts {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.98));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.btn-stop-tts:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.75), 0 3px 10px rgba(0, 0, 0, 0.5);
}

.btn-stop-tts:active {
  transform: scale(0.95);
}

.btn-stop-tts.playing {
  animation: tts-stop-pulse 1.8s ease-in-out infinite;
}

.btn-stop-tts.buffering {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.98));
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.stop-tts-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.stop-tts-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stop-tts-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  padding-left: 2px;
}

.stop-tts-wave .wave-bar {
  width: 2.5px;
  background-color: #ffffff;
  border-radius: 1px;
  height: 100%;
}

.btn-stop-tts.playing .stop-tts-wave .wave-bar {
  animation: tts-wave-bounce 0.8s ease-in-out infinite alternate;
}

.btn-stop-tts.playing .stop-tts-wave .wave-bar:nth-child(1) { animation-delay: 0.1s; height: 40%; }
.btn-stop-tts.playing .stop-tts-wave .wave-bar:nth-child(2) { animation-delay: 0.35s; height: 95%; }
.btn-stop-tts.playing .stop-tts-wave .wave-bar:nth-child(3) { animation-delay: 0.18s; height: 60%; }
.btn-stop-tts.playing .stop-tts-wave .wave-bar:nth-child(4) { animation-delay: 0.42s; height: 85%; }

.btn-stop-tts.buffering .stop-tts-wave .wave-bar {
  animation: tts-wave-bounce 1.4s ease-in-out infinite alternate;
  opacity: 0.7;
}

@keyframes tts-wave-bounce {
  0% { transform: scaleY(0.25); opacity: 0.5; }
  100% { transform: scaleY(1.0); opacity: 1.0; }
}

@keyframes tts-stop-pulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.85), 0 2px 12px rgba(239, 68, 68, 0.5);
  }
}

@media (max-width: 600px) {
  .btn-stop-tts {
    padding: 0.28rem 0.6rem;
    gap: 4px;
    font-size: 0.74rem;
  }
  .stop-tts-label {
    font-size: 0.7rem;
  }
  .stop-tts-wave {
    height: 10px;
    gap: 1.5px;
  }
  .stop-tts-wave .wave-bar {
    width: 2px;
  }
}

.mobile-nav-toggle-btn {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.mobile-nav-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--accent-emerald);
}

.mobile-nav-toggle-btn:active {
  transform: scale(0.92);
}

.hamburger-icon-svg {
  display: block;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  user-select: none;
}

.brand-logo-container {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(11, 106, 112, 0.16);
  border: 1px solid rgba(11, 106, 112, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  box-shadow: 0 0 12px rgba(11, 106, 112, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.brand-logo-container:hover {
  transform: scale(1.05);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.brand-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.brand-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.85);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.9); }
}

.brand-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Telemetry Cluster & Visual Gauges */
.system-telemetry-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.telemetry-gauges-cluster {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem 0.25rem 0.35rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.telemetry-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  box-shadow: 0 0 12px rgba(11, 106, 112, 0.25);
  transform: translateY(-1px);
}

.pill-radial {
  position: relative;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radial-ring-svg {
  transform: rotate(-90deg);
  width: 22px;
  height: 22px;
  display: block;
}

.radial-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2.5;
}

.radial-fill {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 66;
  stroke-dashoffset: 66;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}

.radial-icon {
  position: absolute;
  font-size: 0.62rem;
  line-height: 1;
  pointer-events: none;
}

.pill-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.pill-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pill-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  line-height: 1;
}

.pill-cap {
  font-size: 0.52rem;
  color: var(--text-dim, #64748b);
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1;
}

.pill-val {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
}

.telemetry-status-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.55rem;
  font-size: 0.74rem;
}

.status-online {
  color: var(--accent-emerald);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Tab Navigation */
.main-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
}

.main-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  font-size: 1rem;
}

/* Content Area */
.content-area {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane:not(#tab-chat):not(#tab-terminal).active {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#tab-terminal.active {
  overflow: hidden;
}

#tab-terminal.active .pane-header {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
}

.centcom-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

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

.pane-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.pane-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

kbd {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

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

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-xs:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* ==========================================================================
   AGY CHAT INTERFACE STYLES
   ========================================================================== */
.chat-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1 1 0%;
  min-height: 0;
  box-shadow: var(--shadow-md);
  position: relative;
}

/* Active Chat Content Column */
.chat-main-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Mobile Chat Threads Drawer - Fixed Viewport Overlay */
.chat-threads-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(10, 15, 26, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  transition: opacity 0.22s ease;
  touch-action: manipulation;
}

.chat-threads-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.chat-threads-drawer {
  width: 340px;
  max-width: 88vw;
  height: 100%;
  background: var(--bg-surface-elevated);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.65);
  animation: drawerSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  touch-action: pan-y;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.threads-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  min-height: 48px;
  gap: 0.4rem;
  box-sizing: border-box;
}

.threads-drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.threads-drawer-title-group h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.2;
}

.threads-count-pill {
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent-cyan);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.08rem 0.35rem;
  border-radius: 9999px;
  white-space: nowrap;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
}

.threads-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-drawer-new-thread {
  padding: 0.2rem 0.45rem !important;
  font-size: 0.72rem !important;
  gap: 0.25rem !important;
  white-space: nowrap;
}

.threads-drawer-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.threads-drawer-close-btn:hover,
.threads-drawer-close-btn:active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.threads-drawer-search {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

.threads-drawer-search input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.threads-drawer-search input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.threads-drawer-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.thread-drawer-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.thread-drawer-item:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.thread-drawer-item.active {
  border-color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.08);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.thread-drawer-item.is-loading {
  border-color: var(--accent-cyan, #38bdf8) !important;
  background: rgba(56, 189, 248, 0.12) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.22) !important;
  cursor: wait;
}

.thread-drawer-item.is-loading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-cyan, #38bdf8), transparent);
  animation: threadLoadingBar 1.2s infinite linear;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

@keyframes threadLoadingBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.thread-badge-loading {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thread-spinner-tiny {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

.thread-drawer-item.is-running {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.05);
}

.thread-drawer-item.is-sticky {
  border-left: 3px solid #a855f7;
  background: rgba(168, 85, 247, 0.04);
}

.thread-drawer-item.is-sticky:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.5);
}

.thread-drawer-item.is-sticky.active {
  border-color: #a855f7;
  border-left: 3px solid #c084fc;
  background: rgba(168, 85, 247, 0.12);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.2);
}

.thread-item-icon {
  font-size: 1.1rem;
  margin-top: 1px;
  flex-shrink: 0;
}

.thread-running-pulse {
  display: inline-block;
  animation: pulseRotate 1.2s infinite ease-in-out;
  color: #10b981;
}

@keyframes pulseRotate {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.thread-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.thread-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.18rem;
  min-height: 22px;
}

.thread-item-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.thread-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.thread-item-title-wrap .thread-badge-running,
.thread-item-title-wrap .thread-badge-current,
.thread-item-title-wrap .thread-badge-loading,
.thread-item-title-wrap .thread-badge-adhoc {
  flex-shrink: 0;
}

.thread-badge-running {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
}

.thread-badge-current {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
}

.thread-badge-adhoc {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
}

.thread-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.btn-thread-card-rename,
.btn-thread-card-delete {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.45;
  padding: 2px 4px;
  border-radius: var(--radius-xs, 4px);
  transition: all 0.15s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-thread-card-rename:hover {
  opacity: 1;
  background: rgba(37, 99, 235, 0.22);
  transform: scale(1.08);
}

.btn-thread-card-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.18);
  transform: scale(1.08);
}

.thread-item-snippet {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.thread-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.2;
}

.thread-item-meta,
.thread-item-meta * {
  white-space: nowrap;
}

.thread-item-depth {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.thread-item-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.threads-empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.threads-empty-state .empty-icon {
  font-size: 2rem;
  opacity: 0.6;
}

/* Chat Thread Transition & Loading State */
.chat-thread-loading-state {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  gap: 1.25rem;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.15s ease-out;
}

.thread-loading-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.thread-loading-spinner-ring {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--accent-cyan, #38bdf8);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.thread-loading-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.thread-loading-main-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan, #38bdf8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.thread-loading-sub-text {
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.chat-skeleton-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.chat-skeleton-bubble {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
}

.chat-skeleton-bubble.user {
  justify-content: flex-end;
}

.skeleton-avatar-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.chat-skeleton-bubble .skeleton-lines {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md, 8px);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
  width: 75%;
  max-width: 520px;
}

.chat-skeleton-bubble.user .skeleton-lines {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(56, 189, 248, 0.2);
  width: 50%;
  max-width: 360px;
}

.skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.skeleton-line.full { width: 100%; }
.skeleton-line.long { width: 85%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.short { width: 40%; }

.skeleton-avatar-dot::after,
.chat-skeleton-bubble .skeleton-lines::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.08), transparent);
  animation: skeletonShimmer 1.4s infinite;
}

@keyframes skeletonShimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(200%); }
}

.chat-thread-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  gap: 1rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md, 8px);
  margin: 1.5rem auto;
  max-width: 500px;
}

/* Chat Dynamic Content Header */
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.15rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
  min-height: 52px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1 1 auto;
}

.btn-threads-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-threads-toggle:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-surface-hover);
  color: #38bdf8;
  transform: translateY(-1px);
}

.threads-toggle-icon {
  font-size: 0.95rem;
}

.threads-count-badge {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.1rem 0.42rem;
  border-radius: 9999px;
}

.chat-header-vdiv {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 0.2rem;
  flex-shrink: 0;
}

.chat-thread-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.chat-title-display {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 320px;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.chat-title-display:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.btn-rename-title {
  background: transparent;
  border: none;
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0.55;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: opacity 0.15s ease;
}

.btn-rename-title:hover {
  opacity: 1;
}

.chat-thread-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.chat-depth-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.chat-depth-pill .depth-icon {
  font-size: 0.75rem;
}

.chat-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

.chat-status-pill.idle {
  color: var(--text-muted);
}

.chat-status-pill.busy {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.chat-status-pill.loading {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.chat-status-pill .status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chat-status-pill.busy .status-pulse-dot {
  animation: pulseDot 1s infinite alternate ease-in-out;
}

.chat-status-pill.loading .status-pulse-dot {
  background: #38bdf8;
  animation: pulseDot 0.6s infinite alternate ease-in-out;
}

@keyframes pulseDot {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.3); }
}

.chat-workspace-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-target-icon {
  font-size: 0.95rem;
  opacity: 0.85;
}

.chat-workspace-select {
  background: var(--bg-surface);
  color: var(--accent-cyan);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 1.7rem 0.25rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-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='%230284c7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 12px;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-workspace-select:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

.btn-new-thread {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-delete-current-thread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-delete-current-thread:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: scale(1.05);
}

.chat-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Screen Wake Lock & Sound Chime Buttons */
.btn-wakelock, .btn-sound {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.btn-wakelock:hover, .btn-sound:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-wakelock.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.btn-sound.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.btn-sound.muted, .btn-notif.muted {
  opacity: 0.6;
  color: var(--text-muted);
}

.btn-notif.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* --- Modes Dropdown Menu (Consolidated Audio, Alerts & System Modes) --- */
.modes-dropdown-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.btn-modes-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.6rem;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-modes-trigger:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-modes-trigger.active {
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--text-primary);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.btn-modes-trigger[aria-expanded="true"] {
  border-color: var(--accent-emerald);
  background: var(--bg-surface-hover);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.modes-trigger-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.modes-trigger-text {
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.modes-active-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent-emerald);
  color: #0b0f19;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  line-height: 1;
  transition: all 0.2s ease;
}

.modes-active-indicator.hidden {
  display: none !important;
}

.modes-trigger-caret {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.btn-modes-trigger[aria-expanded="true"] .modes-trigger-caret {
  transform: rotate(180deg);
}

/* Modes Dropdown Panel Overlay */
.modes-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  max-width: 92vw;
  max-height: calc(100vh - 85px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(15, 20, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(11, 106, 112, 0.25);
  z-index: 1100;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: modesDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes modesDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modes-dropdown-menu.hidden {
  display: none !important;
}

.modes-menu-header {
  padding: 0.2rem 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.15rem;
}

.modes-menu-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modes-menu-subtitle {
  display: block;
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Mode Item Row */
.modes-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.modes-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-subtle);
}

.modes-menu-item.active {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.mode-item-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.mode-item-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  line-height: 1;
}

.mode-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mode-item-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.mode-item-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modes-menu-item.active .mode-item-desc {
  color: var(--accent-emerald);
}

/* Modern Toggle Switch */
.mode-toggle-switch {
  position: relative;
  width: 32px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.mode-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.mode-toggle-switch.active {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.mode-toggle-switch.active .mode-toggle-slider {
  transform: translateX(14px);
}

.modes-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.2rem 0;
}

/* Voice Setting inside Dropdown */
.modes-menu-voice {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.2rem 0.35rem;
}

.modes-voice-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.modes-voice-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.72rem;
  outline: none;
  cursor: pointer;
}

.modes-voice-select:focus {
  border-color: var(--accent-emerald);
}

.modes-menu-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.2rem;
  padding-top: 0.2rem;
}

.modes-test-btn {
  flex: 1;
  font-size: 0.68rem !important;
  padding: 0.28rem 0.4rem !important;
  text-align: center;
  justify-content: center;
}

/* Awareness Badge Pills & Indicators */
.tab-badge-pill,
.drawer-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--accent-emerald);
  color: #0b0f19;
  border-radius: 9999px;
  margin-left: 0.4rem;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  vertical-align: middle;
}

.tab-badge-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  margin-left: 0.35rem;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  vertical-align: middle;
}

@keyframes pulseAwarenessBadge {
  0% { transform: scale(0.95); box-shadow: 0 0 4px rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.12); box-shadow: 0 0 10px rgba(16, 185, 129, 0.85); }
  100% { transform: scale(0.95); box-shadow: 0 0 4px rgba(16, 185, 129, 0.4); }
}

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

.chat-msg:first-child {
  margin-top: 1rem;
}

.chat-msg {
  display: flex;
  gap: 0.85rem;
  max-width: 90%;
  min-width: 0;
  width: fit-content;
  box-sizing: border-box;
}

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

.msg-assistant {
  align-self: flex-start;
  max-width: 92%;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.msg-avatar-assistant {
  background: rgba(11, 106, 112, 0.16);
  border: 1px solid rgba(11, 106, 112, 0.4);
  padding: 3px;
  box-shadow: 0 0 8px rgba(11, 106, 112, 0.2);
}

.msg-avatar-assistant .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.msg-avatar-user {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 1rem;
}

.msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: visible;
}

.msg-user .msg-bubble {
  background: #1e293b;
  border-color: #334155;
}

.msg-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.45rem 1.1rem;
  margin: -0.85rem -1.1rem 0.45rem -1.1rem;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.msg-user .msg-header {
  background: #1e293b;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.msg-header-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.msg-header-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-msg-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.38rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-msg-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: scale(1.06);
}

.btn-msg-speak.speaking {
  background: rgba(2, 132, 199, 0.25);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.6);
  animation: pulse-speaking 0.9s infinite alternate;
}

.btn-msg-speak.buffering {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: rgba(245, 158, 11, 0.8) !important;
  color: #fbbf24 !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6) !important;
  animation: pulse-buffering 0.75s infinite alternate !important;
}

@keyframes pulse-buffering {
  0% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
  100% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 14px rgba(245, 158, 11, 0.9); }
}

@keyframes pulse-speaking {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(2, 132, 199, 0.4); }
  100% { transform: scale(1.12); box-shadow: 0 0 12px rgba(2, 132, 199, 0.8); }
}

.msg-live-progress-box {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.live-status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.8);
  animation: pulse-live 1.2s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.live-status-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.live-elapsed-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.live-status-summary {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}

.live-tool-tag {
  font-size: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.live-tool-tag code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--accent-emerald);
}

.live-thought-snippet {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

.live-steps-feed {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.45rem;
  margin-top: 0.3rem;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.35) transparent;
}

.live-steps-feed::-webkit-scrollbar {
  width: 4px;
}

.live-steps-feed::-webkit-scrollbar-track {
  background: transparent;
}

.live-steps-feed::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.35);
  border-radius: 4px;
}

.live-steps-feed::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.6);
}

.live-step-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text-secondary);
  min-width: 0;
}

.live-step-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-cyan);
  background: rgba(2, 132, 199, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.live-step-tool {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-emerald);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.live-step-thought {
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

/* Post-Execution Accordion */
.msg-steps-accordion {
  margin-top: 0.65rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.steps-summary {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
}

.steps-summary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.steps-feed-content {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.msg-content {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #e2e8f0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}

.msg-content p {
  margin-bottom: 0.6rem;
  min-width: 0;
  max-width: 100%;
}

.msg-content p:last-child {
  margin-bottom: 0;
}

/* Headers */
.msg-h2, .msg-h3, .msg-h4, .msg-h5 {
  margin: 0.85rem 0 0.35rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.msg-h2 { font-size: 1.15rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 0.25rem; }
.msg-h3 { font-size: 1.05rem; color: var(--accent-cyan); }
.msg-h4 { font-size: 0.95rem; font-weight: 600; }
.msg-h5 { font-size: 0.88rem; }

/* Blockquotes */
.msg-quote {
  margin: 0.65rem 0;
  padding: 0.45rem 0.85rem;
  border-left: 3px solid var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #cbd5e1;
  font-style: italic;
}

/* Horizontal Divider */
.msg-hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0.85rem 0;
}

/* Links */
.msg-link {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.15s ease;
}

.msg-link:hover {
  color: #38bdf8;
}

/* Lists */
.msg-ul, .msg-ol {
  margin: 0.4rem 0 0.6rem 1.25rem;
  padding: 0;
}

.msg-li {
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

/* Responsive Table Container with Sleek Scrollbar */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.4) rgba(0, 0, 0, 0.2);
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.msg-content table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.msg-content th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.msg-content td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  line-height: 1.45;
}

.msg-content tr:last-child td {
  border-bottom: none;
}

.msg-content tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Fenced Code Blocks & Wrapper */
.code-block-wrapper {
  margin: 0.65rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #090c10;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.code-lang {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-cyan);
}

.btn-copy-code {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.msg-content pre {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: transparent;
  border: none;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 182, 212, 0.4) rgba(0, 0, 0, 0.2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.msg-content pre::-webkit-scrollbar {
  height: 6px;
}

.msg-content pre::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
}

.msg-content pre::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 4px;
}

.msg-content pre::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.msg-content code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  word-break: break-word;
}

.msg-content pre code {
  background: transparent;
  padding: 0;
  word-break: normal;
  white-space: pre;
}

.msg-content ul, .msg-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.6rem;
}

.msg-attachments-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.msg-audio-attachment {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.msg-audio-meta {
  font-size: 0.75rem;
  color: #fca5a5;
  font-weight: 500;
}

.msg-audio-meta code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.chat-inline-audio {
  width: 100%;
  height: 32px;
  outline: none;
}

.msg-img-attachment {
  display: inline-flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  cursor: pointer;
  max-width: 260px;
  transition: all 0.15s ease;
}

.msg-img-attachment:hover {
  border-color: var(--accent-cyan);
}

.chat-inline-thumb {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.chat-thumb-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-att-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  border: 1px solid var(--border-subtle);
  display: inline-block;
}

/* Quick Prompts */
.quick-prompts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.prompt-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}

/* Attachments Bar */
.attachments-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.25rem;
  background: #11151c;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
}

/* ==========================================================================
   Prompt Queue Floating Tray
   ========================================================================== */

.prompt-queue-tray {
  background: rgba(18, 24, 34, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(16, 185, 129, 0.35);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.25rem;
  animation: slide-down-queue 0.25s ease;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.35);
}

@keyframes slide-down-queue {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.queue-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.queue-tray-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-emerald);
  letter-spacing: -0.01em;
}

.queue-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.9);
  animation: pulse-live 1.2s infinite;
}

.queue-tray-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.queue-status-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.queue-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 140px;
  overflow-y: auto;
}

.queue-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid var(--accent-emerald);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  transition: all 0.15s ease;
}

.queue-item-card:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(16, 185, 129, 0.4);
}

.queue-item-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  flex: 1;
}

.queue-item-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.queue-item-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.queue-item-att-badge {
  font-size: 0.7rem;
  background: rgba(2, 132, 199, 0.2);
  color: var(--accent-cyan);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.queue-item-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.queue-item-del-btn:hover {
  color: var(--accent-rose);
}

.chat-msg.is-queued .msg-bubble {
  border: 1px dashed rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.05);
}

.badge-queued {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-emerald, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-processing-queued {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary, #818cf8);
  border: 1px solid rgba(99, 102, 241, 0.45);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-voice-satellite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.38);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: 6px;
  vertical-align: middle;
}

.btn-sync-thread {
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-sync-thread.spinning .btn-sync-icon {
  display: inline-block;
  animation: spin-sync 0.6s linear infinite;
}

@keyframes spin-sync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}



.att-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.72rem;
  white-space: nowrap;
}

.att-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.att-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  transition: all 0.15s ease;
  max-width: 260px;
}

.att-item .att-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.att-item .att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-item.att-uploading {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.att-item .att-spinner {
  display: inline-block;
  animation: pulse 1s infinite alternate;
}

.att-item:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-surface-hover);
}

.att-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.15rem;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.att-remove:hover {
  color: var(--accent-rose);
}

/* ==========================================================================
   AGY CHAT COMPOSER & INPUT SUITE
   ========================================================================== */
.chat-composer {
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  padding: 0.65rem 1.15rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-composer.dragover-composer {
  border-top: 2px dashed var(--accent-cyan) !important;
  background: rgba(6, 182, 212, 0.06) !important;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.2) inset;
}

/* Integrated Attachments Shelf */
.chat-composer .attachments-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  animation: fadeIn 0.15s ease-out;
}

/* Toolbar & Command Chips */
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.composer-chips-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.16rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-tool:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

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

.btn-tool-clipboard {
  color: var(--accent-cyan);
  border-color: rgba(14, 165, 233, 0.25);
  background: rgba(14, 165, 233, 0.06);
}

.btn-tool-clipboard:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
}

.tool-icon {
  font-size: 0.72rem;
}

.composer-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  user-select: none;
  white-space: nowrap;
}

.composer-hint kbd {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Unified Main Input Row Container */
.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer-input-row:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.composer-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  flex-shrink: 0;
  padding: 0;
}

.composer-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  flex-shrink: 0;
  padding-bottom: 0;
}

/* Uniform Action Buttons (Attach, Mic) */
.btn-composer-action {
  position: relative;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-composer-action:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}

.btn-composer-action:active {
  transform: scale(0.96);
}

.composer-actions-right .btn-mic-quick {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent-emerald);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.composer-actions-right .btn-mic-quick:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-emerald);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.composer-actions-right .btn-mic-quick.active {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
  animation: pulse-mic 1.2s infinite ease-in-out;
}

.action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.attach-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
}

/* Auto-expanding Chat Textarea */
.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.4rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  color: var(--text-primary);
  outline: none;
  resize: none;
  line-height: 1.45;
  min-height: 60px;
  max-height: 180px;
  overflow-y: auto;
  box-sizing: border-box;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

/* Send Button */
.btn-composer-send {
  height: 38px;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--accent-blue);
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-composer-send:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-composer-send:active {
  transform: translateY(0);
}

.btn-composer-send.btn-busy-queue {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(37, 99, 235, 0.55);
  color: #93c5fd;
}

.btn-composer-send.btn-busy-queue:hover {
  background: rgba(37, 99, 235, 0.35);
  color: #ffffff;
}

.btn-composer-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.send-label {
  line-height: 1;
}

/* Voice Studio Panel */
.voice-studio-panel {
  background: #090c10;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeIn 0.2s ease-out;
}

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

.voice-studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-studio-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.voice-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-rose);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.8);
  animation: pulse-rec 1.2s infinite;
}

.voice-rec-dot.paused {
  background: var(--accent-amber);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-rec {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px rgba(244, 63, 94, 0.6); }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 14px rgba(244, 63, 94, 0.9); }
  100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px rgba(244, 63, 94, 0.6); }
}

.voice-status-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-meta-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.voice-timer-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.voice-format-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
}

.visualizer-wrapper {
  background: #040608;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.audio-visualizer-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.audio-preview-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-preview-player {
  width: 100%;
  height: 36px;
  outline: none;
}

.voice-studio-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ==========================================================================
   WEB TERMINAL STYLES
   ========================================================================== */
.terminal-quick-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.web-terminal-container {
  background: #090c10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  box-shadow: var(--shadow-md);
}

.web-terminal-header {
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.web-terminal-screen {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  background: #080a0e;
}

.terminal-log {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-all;
}

.web-terminal-input-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  gap: 0.75rem;
}

.terminal-prompt-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-emerald);
  white-space: nowrap;
}

.terminal-cmd-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* ==========================================================================
   DROPZONE & MEDIA GALLERY STYLES
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-active);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
}

.dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.05);
}

.file-input-hidden {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -9999 !important;
}

.dropzone-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.dropzone-heading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.dropzone-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.dropzone-btn-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.upload-status-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.upload-status-banner.success {
  border-color: rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.upload-status-banner.error {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fecdd3;
}

.hidden {
  display: none !important;
}

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

.section-title-bar h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.media-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.media-thumb-wrapper {
  height: 140px;
  background: #090c10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.media-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-icon-placeholder {
  font-size: 2.5rem;
  color: var(--text-muted);
}

.media-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.media-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.media-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================================================
   SERVICES & SCRIPTS STYLES
   ========================================================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
}

.service-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

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

.status-dot.offline {
  background: var(--accent-rose);
}

.service-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.service-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex-grow: 1;
}

.service-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}

.service-port {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.service-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-cyan);
  text-decoration: none;
}

.service-link:hover {
  text-decoration: underline;
}

.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.script-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.script-tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.35rem;
}

.script-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.script-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.terminal-container {
  background: #090c10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  background: var(--bg-surface);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.terminal-status-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.terminal-body {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #c9d1d9;
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   KNOWLEDGE & MODALS STYLES
   ========================================================================== */
.doc-selector-group {
  display: flex;
  gap: 0.4rem;
}

.doc-viewer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.doc-viewer-header {
  padding: 0.65rem 1rem;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
}

.doc-path {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
}

.doc-search-input {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-primary);
  outline: none;
  width: 200px;
}

.doc-search-input:focus {
  border-color: var(--accent-cyan);
}

.doc-content {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #d1d5db;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

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

.modal-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

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

.modal-body {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: auto;
}

.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  gap: 1rem;
}

.modal-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  max-height: 50vh;
  overflow-y: auto;
  width: 100%;
}

.attach-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.attach-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.attach-thumb {
  height: 80px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.attach-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.attach-name {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   LOCK SCREEN & AUTHORIZATION OVERLAY STYLES
   ========================================================================== */
.lock-screen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 18, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.lock-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lock-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.lock-full-logo {
  max-width: 175px;
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(1.05) drop-shadow(0 4px 16px rgba(11, 106, 112, 0.35));
}

.lock-security-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-amber);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lock-pill-icon {
  font-size: 0.9rem;
}

.lock-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pairing-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.pairing-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
}

.pairing-code {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
}

.pairing-client-ip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lock-instructions {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.inst-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.cmd-snippet-box {
  background: #080a0e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cmd-snippet-box code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-emerald);
  word-break: break-all;
}

.lock-polling-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.polling-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-active);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PWA Standalone & Install Banner
   ========================================================================== */

.pwa-install-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #10b981 0%, #0284c7 100%);
  color: #ffffff;
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.pwa-banner-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-banner-icon {
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  flex-shrink: 0;
}

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pwa-banner-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pwa-banner-desc {
  font-size: 0.72rem;
  opacity: 0.9;
}

.pwa-install-btn {
  background: #ffffff;
  color: #0b0f19;
  font-weight: 700;
  border: none;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.pwa-install-btn:hover {
  background: #f1f5f9;
}

.pwa-banner-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  opacity: 0.8;
}

.pwa-banner-close:hover {
  opacity: 1;
}

/* ==========================================================================
   Off-Screen Mobile Navigation Drawer & Backdrop
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.offscreen-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 86vw;
  background: #0e1218;
  border-right: 1px solid var(--border-subtle);
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.65);
  padding: 1.25rem 1.15rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  visibility: hidden;
  pointer-events: none;
}

.offscreen-drawer.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

@media (min-width: 769px) {
  .drawer-backdrop,
  .offscreen-drawer {
    display: none !important;
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.95rem;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-brand-text {
  display: flex;
  flex-direction: column;
}

.drawer-title {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.2;
}

.drawer-subtitle {
  font-size: 0.68rem;
  color: var(--accent-emerald);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.drawer-close-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-close-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.drawer-close-btn:active {
  transform: scale(0.92);
}

/* Drawer Live Telemetry Mini-Card */
.drawer-telemetry-card {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background: rgba(20, 24, 32, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.35rem;
  margin-bottom: 1.15rem;
}

.drawer-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
}

.drawer-stat .stat-icon {
  font-size: 0.85rem;
}

.drawer-stat .stat-details {
  display: flex;
  flex-direction: column;
}

.drawer-stat .stat-lbl {
  font-size: 0.56rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.drawer-stat .stat-num {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Drawer Nav List */
.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

.drawer-nav-item:hover {
  background: rgba(36, 44, 56, 0.5);
  color: var(--text-primary);
  border-color: rgba(56, 69, 86, 0.4);
}

.drawer-nav-item:active {
  transform: scale(0.98);
}

.drawer-nav-item.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--accent-emerald);
}

.drawer-item-icon {
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
}

.drawer-item-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.drawer-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.drawer-nav-item.active .drawer-item-title {
  color: var(--accent-emerald);
}

.drawer-item-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

.drawer-item-chevron {
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.drawer-nav-item:hover .drawer-item-chevron {
  color: var(--text-primary);
  transform: translateX(2px);
}

.drawer-nav-item.active .drawer-item-chevron {
  color: var(--accent-emerald);
}

.drawer-footer {
  margin-top: 1.25rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-subtle);
}

.drawer-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drawer-voice-setting {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.25rem;
}

.drawer-setting-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-voice-select {
  width: 100%;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.drawer-voice-select:focus {
  border-color: var(--accent-cyan);
}

.btn-drawer-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-drawer-refresh {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.4);
  color: #93c5fd;
}

.btn-drawer-refresh:hover {
  background: rgba(37, 99, 235, 0.28);
  color: #ffffff;
}

.btn-refresh-nav {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(37, 99, 235, 0.48);
  border-radius: var(--radius-sm);
  color: #93c5fd;
  flex-shrink: 0 !important;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  z-index: 10;
}

.btn-refresh-nav:hover {
  background: rgba(37, 99, 235, 0.32);
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.45);
  transform: rotate(90deg) scale(1.06);
}

.btn-refresh-nav:active {
  transform: rotate(180deg) scale(0.92);
  background: rgba(37, 99, 235, 0.48);
}

/* Direct Navbar ADHOC Microphone Button */
.btn-nav-mic {
  height: 32px;
  min-height: 32px;
  padding: 0 0.65rem;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.16), rgba(16, 185, 129, 0.18));
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: var(--radius-sm);
  color: #a5f3fc;
  flex-shrink: 0 !important;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  z-index: 10;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.btn-nav-mic:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.32), rgba(16, 185, 129, 0.32));
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.btn-nav-mic:active {
  transform: translateY(0) scale(0.96);
}

.btn-nav-mic.is-recording {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.38), rgba(244, 63, 94, 0.48)) !important;
  border-color: var(--accent-rose) !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.75) !important;
  animation: pulse-nav-rec 1.2s infinite;
}

.nav-mic-icon {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  line-height: 1;
}

.nav-mic-text {
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-mic-rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.95);
  animation: pulse-rec 1s infinite;
  display: inline-block;
  margin-right: 2px;
}

@keyframes pulse-nav-rec {
  0% { transform: scale(1); box-shadow: 0 0 6px rgba(244, 63, 94, 0.5); }
  50% { transform: scale(1.04); box-shadow: 0 0 18px rgba(244, 63, 94, 0.85); }
  100% { transform: scale(1); box-shadow: 0 0 6px rgba(244, 63, 94, 0.5); }
}

/* Quick Voice Action Button */
.btn-mic-quick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-emerald);
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-mic-quick:hover, .btn-mic-quick:active {
  background: rgba(16, 185, 129, 0.28);
  border-color: var(--accent-emerald);
  transform: scale(0.98);
}

.mic-icon-pulse {
  font-size: 1.15rem;
}

.mic-label-mobile {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ==========================================================================
   Mobile Responsive & App-Like Touch Experience
   ========================================================================== */

@media (max-width: 768px) {
  html, body {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    height: var(--app-height, 100%);
    max-height: var(--app-height, 100%);
    overflow: hidden;
    overscroll-behavior-y: none;
    margin: 0;
    padding: 0;
  }

  .app-container {
    height: 100%;
    height: var(--app-height, 100%);
    max-height: var(--app-height, 100%);
    display: flex;
    flex-direction: column;
    padding: max(0.25rem, env(safe-area-inset-top, 0px)) 0.45rem max(0.35rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow: hidden;
    flex: 1 1 0% !important;
    min-height: 0 !important;
  }

  /* Header adjustments: Pinned at top of app container */
  .top-nav {
    position: relative;
    top: 0;
    flex-shrink: 0;
    z-index: 100;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.45rem;
    gap: 0.4rem;
    max-width: 100%;
    box-sizing: border-box;
    background-color: rgba(20, 24, 32, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  }

  .content-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tab-pane.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tab-pane:not(#tab-chat).active {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-left-group {
    gap: 0.45rem;
    flex-shrink: 0;
    min-width: 0;
  }

  .mobile-nav-toggle-btn {
    display: flex;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }

  .brand-logo-container {
    width: 30px;
    height: 30px;
    padding: 2px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }

  .nav-brand {
    gap: 0;
    min-width: 0;
  }

  .brand-subtitle {
    display: none !important;
  }

  .system-telemetry-group {
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: center;
    min-width: 0;
  }

  /* Completely remove resource telemetry gauges (CPU, RAM, DISK badges) for mobile users */
  .telemetry-gauges-cluster,
  .telemetry-status-pill {
    display: none !important;
  }

  .btn-modes-trigger {
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
    gap: 0.25rem;
  }

  .modes-trigger-text {
    display: none;
  }

  .modes-dropdown-menu {
    width: 270px;
    right: 0;
  }

  .btn-refresh-nav {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0 !important;
  }

  .btn-nav-mic {
    width: 32px;
    height: 30px;
    min-width: 32px;
    min-height: 30px;
    padding: 0;
    font-size: 0.9rem;
    gap: 0;
  }

  .btn-nav-mic .nav-mic-text {
    display: none;
  }

  /* Navigation: Hide top horizontal tabs on mobile */
  .desktop-only-tabs {
    display: none !important;
  }

  /* Chat Pane Mobile App Layout */
  .chat-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
  }

  .chat-main-area {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .chat-topbar {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
    min-height: 36px;
  }

  .chat-workspace-select {
    max-width: 175px;
    font-size: 0.75rem;
    padding: 0.2rem 1.4rem 0.2rem 0.45rem;
    background-size: 11px;
  }

  .chat-messages {
    flex: 1 1 0px !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow-y: auto !important;
    padding: 0 0.6rem 0.5rem 0.6rem !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .chat-msg:first-child {
    margin-top: 0.45rem !important;
  }

  .chat-msg {
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .msg-bubble {
    padding: 0.65rem 0.8rem;
    font-size: 0.84rem;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
  }

  .msg-header {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.35rem 0.8rem;
    margin: -0.65rem -0.8rem 0.35rem -0.8rem;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  }

  .msg-user .msg-header {
    background: #1e293b;
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  .btn-msg-action {
    min-width: 28px;
    min-height: 28px;
    padding: 0.2rem 0.45rem;
    font-size: 0.82rem;
  }

  .msg-content {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .msg-content table {
    font-size: 0.76rem;
  }

  .msg-content th, .msg-content td {
    padding: 0.35rem 0.55rem;
  }

  .table-responsive {
    margin: 0.5rem 0;
    border-radius: var(--radius-sm);
  }

  .code-block-wrapper {
    margin: 0.5rem 0;
  }

  .msg-content pre {
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
  }

  .quick-prompts-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .prompt-chip {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
  }

  /* Chat Composer Mobile Optimization */
  .chat-composer {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    padding: 0.35rem 0.5rem max(0.65rem, calc(0.25rem + env(safe-area-inset-bottom, 0px))) !important;
    background: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    position: relative;
    bottom: 0;
    z-index: 10;
  }

  .composer-toolbar {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.15rem;
    margin-bottom: 0.15rem;
    gap: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .composer-toolbar::-webkit-scrollbar {
    display: none;
  }

  .composer-chips-group {
    gap: 0.25rem;
  }

  .btn-tool {
    padding: 0.1rem 0.35rem;
    font-size: 0.64rem;
    gap: 0.2rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    line-height: 1.2;
  }

  .tool-icon {
    font-size: 0.64rem;
  }

  .composer-hint {
    display: none;
  }

  /* Prevent iOS automatic zoom on focus by ensuring font-size is 16px for single-line inputs */
  .terminal-cmd-input,
  .doc-search-input,
  input[type="text"] {
    font-size: 16px !important;
  }

  .composer-input-row {
    gap: 0.35rem;
    align-items: flex-end;
    width: 100%;
    padding: 0.25rem 0.35rem;
    box-sizing: border-box;
  }

  .composer-actions-left {
    display: flex;
    align-items: center;
    gap: 3px;
    align-self: flex-end;
    flex-shrink: 0;
    padding: 0 0 2px 0;
  }

  .btn-composer-action {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
    padding: 0;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .chat-textarea {
    padding: 0.35rem 0.45rem;
    font-size: 0.83rem !important; /* ~13.3px crisp compact typography */
    line-height: 1.42;
    min-height: 48px;
    max-height: 140px;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
  }

  .composer-actions-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 2px;
  }

  .composer-actions-right .btn-mic-quick {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: var(--accent-emerald);
  }

  .composer-actions-right .btn-mic-quick.active {
    background: rgba(244, 63, 94, 0.25);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
    animation: pulse-mic 1.2s infinite ease-in-out;
  }

  .btn-composer-send {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
  }

  .send-icon {
    font-size: 0.9rem;
    line-height: 1;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .send-label {
    display: none !important;
  }

  /* Voice Studio Panel Mobile Touch Optimization */
  .voice-studio-panel {
    padding: 0.75rem;
  }

  .visualizer-wrapper {
    height: 90px;
  }

  .voice-studio-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .voice-studio-actions button {
    flex: 1;
    min-width: 100px;
    padding: 0.55rem 0.4rem;
    font-size: 0.78rem;
  }

  /* Scripts Grid & Services Grid on Mobile */
  .scripts-grid,
  .services-grid,
  .media-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pane-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Web Terminal on Mobile */
  .web-terminal-screen {
    height: 320px;
    font-size: 0.75rem;
  }

  .web-terminal-input-bar {
    padding: 0.5rem;
    gap: 0.4rem;
  }

  .terminal-prompt-label {
    display: none;
  }

  .diag-health-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .diag-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .diag-toolbar-left,
  .diag-toolbar-right {
    flex-direction: column;
    width: 100%;
  }

  .log-search-box {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Diagnostics & Live Log Viewer Styles
   -------------------------------------------------------------------------- */
.diag-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 2rem;
}

.diag-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.diag-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.diag-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.diag-card-icon {
  font-size: 1.2rem;
}

.diag-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.diag-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.diag-k {
  color: var(--text-muted);
}

.diag-v {
  color: var(--text-primary);
  font-weight: 500;
}

.diag-panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.diag-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.diag-toolbar-left,
.diag-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.log-filter-chips {
  display: flex;
  gap: 0.35rem;
}

.log-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.log-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.log-chip.active {
  background: var(--accent-cyan-subtle, rgba(6, 182, 212, 0.2));
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

.log-chip.chip-err.active {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.log-chip.chip-warn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.log-chip.chip-info.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.log-search-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  width: 180px;
}

.log-search-box:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.diag-log-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.diag-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.diag-log-title {
  font-weight: 500;
}

.diag-log-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.log-autoscroll-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}

.diag-log-viewport {
  background: #06090F;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  height: 420px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  scrollbar-width: thin;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  word-break: break-all;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-ts {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.log-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.log-badge-INFO {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.log-badge-WARNING,
.log-badge-WARN {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.log-badge-ERROR,
.log-badge-CRITICAL {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.log-msg {
  color: #E2E8F0;
  flex: 1;
}

.log-module {
  color: #94A3B8;
  font-size: 0.72rem;
}

/* Intermediate Tablet Navigation Tabs */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-tabs {
    gap: 0.25rem;
  }

  .tab-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
    gap: 0.35rem;
  }
}

/* Ultra-compact screens (<=380px) */
@media (max-width: 380px) {
  .app-container {
    padding: max(0.2rem, env(safe-area-inset-top, 0px)) 0.35rem max(0.3rem, env(safe-area-inset-bottom, 0px));
  }

  .top-nav {
    padding: 0.35rem 0.45rem;
    gap: 0.25rem;
  }

  #disk-telemetry-pill {
    display: none;
  }

  .btn-modes-trigger {
    padding: 0.2rem 0.35rem;
    font-size: 0.7rem;
  }

  .btn-refresh-nav {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.8rem;
  }

  .btn-nav-mic {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.8rem;
  }

  .modes-dropdown-menu {
    width: 250px;
  }
}

/* ==========================================================================
   AGENT CONTROL & HOSTED SERVICE ACTIONS
   ========================================================================== */
.btn-stop-agent {
  background: rgba(244, 63, 94, 0.16) !important;
  color: #f43f5e !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  animation: pulse-border 2s infinite ease-in-out;
}

.btn-stop-agent:hover {
  background: rgba(244, 63, 94, 0.28) !important;
  border-color: #f43f5e !important;
  transform: translateY(-1px);
}

.live-abort-btn {
  margin-left: auto;
  background: rgba(244, 63, 94, 0.16);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.live-abort-btn:hover {
  background: rgba(244, 63, 94, 0.3);
  border-color: #f43f5e;
}

.service-card-featured {
  border-color: rgba(6, 182, 212, 0.4) !important;
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.04) 0%, var(--bg-surface-elevated) 100%) !important;
}

.service-pid-tag {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  margin-left: 0.35rem;
}

.service-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.65rem 0 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-subtle);
}

.service-action-btn {
  font-size: 0.72rem !important;
  padding: 0.25rem 0.55rem !important;
}

.service-endpoints-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.endpoint-pill a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.15s ease;
}

.endpoint-pill a:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}



/* -----------------------------------------------------------------------------
 * CENTCOM Integration Styles
 * ----------------------------------------------------------------------------- */
.centcom-subnav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 18px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}
.centcom-mode-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.centcom-mode-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.centcom-mode-btn:hover {
  background: rgba(0, 245, 255, 0.1);
  border-color: rgba(0, 245, 255, 0.4);
  color: #00f5ff;
}
.centcom-mode-btn.active {
  background: rgba(0, 245, 255, 0.18);
  border-color: #00f5ff;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.25);
}
.centcom-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.centcom-clock-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #00f5ff;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   CENTCOM DESIGN SYSTEM - FUTURISTIC / SCI-FI / GLASSMORPHISM
   ========================================================================== */



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



/* Background Cyber Grid Effect */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    pointer-events: none;
}

.glow-bg {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    z-index: -1;
    background: radial-gradient(circle at 80% 20%, rgba(189, 0, 255, 0.07) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(0, 243, 255, 0.07) 0%, transparent 50%);
    pointer-events: none;
}

/* Glassmorphism Panel base */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37),
                inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
    border-color: var(--panel-border-hover);
    box-shadow: 0 12px 40px 0 rgba(0, 243, 255, 0.05),
                inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

/* Helper Typographies */
.font-orbitron {
    font-family: var(--font-header);
    letter-spacing: 1.5px;
}

.text-glow {
    text-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* Accented Colors */
.cyan-text { color: var(--neon-cyan); text-shadow: 0 0 8px var(--neon-cyan-glow); }
.purple-text { color: var(--neon-purple); text-shadow: 0 0 8px var(--neon-purple-glow); }
.green-text { color: var(--neon-green); text-shadow: 0 0 8px var(--neon-green-glow); }
.red-text { color: var(--neon-red); text-shadow: 0 0 8px var(--neon-red-glow); }
.amber-text { color: var(--neon-amber); text-shadow: 0 0 8px var(--neon-amber-glow); }

/* Main Layout Grid */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   HEADER COMPONENT
   ========================================================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    position: relative;
    overflow: hidden;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    animation: scanning 4s linear infinite;
    pointer-events: none;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 8px var(--neon-cyan-glow));
    animation: rotate-logo 20s linear infinite;
}

.logo-text h1 {
    font-family: var(--font-header);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #fff, var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}

.logo-text .subtitle {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: nowrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
}

.meta-item .label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 700;
}

.meta-item .value {
    font-family: var(--font-header);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

#system-clock {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--neon-cyan);
    text-shadow: 0 0 4px var(--neon-cyan-glow);
}

/* Pulse indicator dot */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--neon-green);
    border-radius: 50%;
    margin-right: 4px;
    box-shadow: 0 0 8px var(--neon-green-glow);
    animation: pulse 1.8s infinite alternate;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border: 1px solid transparent;
    color: white;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.15);
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(0, 243, 255, 0.08);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.btn-danger {
    background: rgba(255, 46, 147, 0.1);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
}

.btn-danger:hover {
    background: var(--neon-red);
    color: white;
    box-shadow: 0 0 12px var(--neon-red-glow);
}

/* ==========================================================================
   PROJECT GRID & CARDS
   ========================================================================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 24px;
}

.project-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
}

.project-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-title h2 {
    font-family: var(--font-header);
    font-size: 18px;
    letter-spacing: 1px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.05);
}

.project-repo-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.project-repo-link:hover {
    color: var(--neon-cyan);
}

.project-status-badge {
    font-family: var(--font-header);
    font-size: 9px;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--text-muted);
}

.project-card-

/* Nodes / Servers UI */
.node-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.node-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.node-box.active-node {
    border-color: rgba(0, 243, 255, 0.15);
}

.node-box .node-env {
    font-family: var(--font-header);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.node-box .node-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-box .node-host {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.node-box .node-status-label {
    display: flex;
    align-items: center;
    font-size: 10px;
    margin-top: 4px;
}

/* GitHub Summary */
.github-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 14px;
}

.github-title {
    font-family: var(--font-header);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--neon-purple);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.github-commits-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.commit-item {
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.commit-sha {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 10px;
    background: rgba(0, 243, 255, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    text-decoration: none;
}

.commit-message {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.commit-meta {
    color: var(--text-secondary);
    font-size: 10px;
    white-space: nowrap;
}

/* Project Actions Footer */
.project-card-footer {
    padding: 16px 24px 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 12px;
}

.project-card-footer .btn {
    flex: 1;
}

/* ==========================================================================
   MODAL COMPONENT
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 9, 19, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.15);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--neon-red);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.2);
}

/* ==========================================================================
   INTERACTIVE SERVER SSH TERMINAL MODAL
   ========================================================================== */
.server-terminal-modal-container {
    max-width: 1100px;
    width: 95vw;
    height: 85vh;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.15);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    overflow: hidden;
}

.server-terminal-modal-container.fullscreen {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
}

.server-terminal-modal-header {
    background: rgba(13, 17, 23, 0.95);
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 12px;
}

.server-terminal-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.server-terminal-select {
    padding: 3px 8px;
    font-size: 11px;
    border-color: rgba(0, 240, 255, 0.3);
    border-radius: var(--radius-sm);
    background: #090c10;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
}

.server-terminal-toolbar {
    background: rgba(10, 14, 20, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.term-toolbar-label {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 1px;
    white-space: nowrap;
}

.term-quick-chips {
    display: flex;
    gap: 6px;
    align-items: center;
}

.term-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 10px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.term-chip:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.term-chip.chip-danger {
    border-color: rgba(255, 85, 114, 0.3);
    color: var(--neon-red);
}

.term-chip.chip-danger:hover {
    background: rgba(255, 85, 114, 0.15);
    border-color: var(--neon-red);
}

.term-chip.chip-cyan {
    border-color: rgba(0, 240, 255, 0.3);
    color: var(--neon-cyan);
}

.server-terminal-screen {
    flex: 1;
    background: #080c14;
    padding: 8px 10px;
    overflow: hidden;
    position: relative;
    cursor: text;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.xterm-terminal-mount {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 300px;
}

.xterm-terminal-mount .xterm {
    height: 100%;
    padding: 4px;
}

.xterm-terminal-mount .xterm-viewport {
    background-color: transparent !important;
}

.server-terminal-log {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12.5px;
    line-height: 1.55;
    color: #c9d1d9;
    word-break: break-all;
    white-space: pre-wrap;
}

.server-terminal-mobile-bar {
    display: none;
    background: rgba(13, 17, 23, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px 10px;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .server-terminal-mobile-bar {
        display: flex;
    }
    .server-terminal-modal-container {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }
}

.server-terminal-input-bar {
    background: rgba(13, 17, 23, 0.98);
    border-top: 1px solid rgba(0, 240, 255, 0.2);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.server-terminal-prompt {
    color: var(--neon-green);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    user-select: none;
}

.server-terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f0f6fc;
    font-size: 12.5px;
    caret-color: var(--neon-cyan);
}

.server-terminal-footer {
    background: rgba(10, 14, 20, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.server-terminal-footer-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.server-terminal-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ==========================================================================
   TERMINAL CONSOLE
   ========================================================================== */
.log-terminal-modal {
    max-width: 1000px;
    border-color: var(--neon-cyan);
}

.modal-toolbar {
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-header);
    font-size: 10px;
    color: var(--text-secondary);
}

.checkbox-group {
    user-select: none;
    cursor: pointer;
}

.checkbox-group input {
    cursor: pointer;
}

.toolbar-actions {
    margin-left: auto;
}

.terminal-

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
    padding: 2px 0;
    line-height: 1.6;
}

/* Color coding for standard apache logs */
.terminal-line.error-line {
    color: #ff5572;
    background: rgba(255, 46, 147, 0.05);
    border-left: 2px solid var(--neon-red);
    padding-left: 8px;
}

.terminal-line.warn-line {
    color: #ffb86c;
    background: rgba(255, 184, 108, 0.03);
    border-left: 2px solid var(--neon-amber);
    padding-left: 8px;
}

.terminal-line.system-line {
    color: var(--neon-cyan);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.terminal-dot.red { background-color: var(--neon-red); }
.terminal-dot.yellow { background-color: var(--neon-amber); }
.terminal-dot.green { background-color: var(--neon-green); }

.terminal-footer-info {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-right: auto;
}

/* ==========================================================================
   CONFIG MANAGER STYLINGS
   ========================================================================== */
.config-modal-container {
    border-color: var(--neon-purple);
    box-shadow: 0 0 30px rgba(189, 0, 255, 0.15);
}

.modal-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--neon-cyan);
}

.tab-btn.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
    background: rgba(255, 255, 255, 0.02);
}

.config-tab-content {
    display: none;
}

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

.tab-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.tab-actions h3 {
    font-family: var(--font-header);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

/* Forms Design */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.col-6 { flex: 0 0 calc(50% - 8px); }
.col-4 { flex: 0 0 calc(33.333% - 10.666px); }
.col-8 { flex: 0 0 calc(66.666% - 5.333px); }
.col-12 { flex: 0 0 100%; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-family: var(--font-header);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.input-dark {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-ui);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.masked-token-input {
    -webkit-text-security: disc !important;
    text-security: disc !important;
}

.input-dark:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan-glow);
}

.form-help {
    font-size: 10px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.project-form-container, .server-form-container {
    padding: 16px 20px;
    border-color: var(--neon-cyan);
    margin-bottom: 24px;
}

.project-form-container h4, .server-form-container h4 {
    font-family: var(--font-header);
    font-size: 12px;
    margin-bottom: 14px;
    color: var(--neon-cyan);
    letter-spacing: 1px;
}

/* Custom Data Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    font-family: var(--font-header);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: left;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, background-color 0.2s;
}

.data-table th.sortable:hover {
    color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.03);
}

.data-table th .sort-icon {
    margin-left: 6px;
    display: inline-block;
}

.data-table th .sort-icon::after {
    content: "↕";
    font-size: 10px;
    opacity: 0.3;
}

.data-table th.sorted-asc .sort-icon::after {
    content: "▲";
    color: var(--neon-cyan);
    opacity: 1;
    text-shadow: 0 0 6px var(--neon-cyan-glow);
}

.data-table th.sorted-desc .sort-icon::after {
    content: "▼";
    color: var(--neon-cyan);
    opacity: 1;
    text-shadow: 0 0 6px var(--neon-cyan-glow);
}

.table-actions-cell {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 110;
    pointer-events: none;
}

.toast {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--neon-cyan);
    padding: 14px 20px;
    border-radius: 6px;
    color: #fff;
    pointer-events: auto;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px var(--neon-cyan-glow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.toast-error {
    border-color: var(--neon-red);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px var(--neon-red-glow);
}

.toast.toast-success {
    border-color: var(--neon-green);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px var(--neon-green-glow);
}

/* Loading States */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 16px;
    font-family: var(--font-header);
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(0, 243, 255, 0.1);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: rotate-logo 1s linear infinite;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #03050a;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

/* ==========================================================================
   ANIMATIONS KEYFRAMES
   ========================================================================== */
@keyframes scanning {
    0% { top: 0; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { top: 100%; opacity: 0; }
}

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

@keyframes pulse {
    from { opacity: 0.4; box-shadow: 0 0 2px var(--neon-green-glow); }
    to { opacity: 1; box-shadow: 0 0 12px var(--neon-green-glow); }
}

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

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    .container {
        padding: 14px 10px;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .header {
        flex-direction: column;
        gap: 14px;
        align-items: flex-start;
        padding: 14px 16px;
    }
    .header-logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    .mode-switcher {
        margin-left: 0;
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 4px;
        gap: 4px;
    }
    .mode-btn {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 9.5px;
        padding: 5px 10px;
    }
    .header-meta {
        flex-wrap: wrap;
        gap: 12px;
        width: 100%;
        justify-content: space-between;
    }
    .project-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .servers-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .ha-areas-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        width: 100%;
    }
    .server-health-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        border-radius: 10px;
    }
    .server-card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .server-card-status {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    .server-card-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
        width: 100%;
    }
    .server-card-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
        padding: 6px 8px;
        font-size: 10px;
        min-height: 28px;
    }
    .server-card-body {
        padding: 12px 14px;
        gap: 12px;
        min-width: 0;
        box-sizing: border-box;
    }
    .metric-info {
        font-size: 10.5px;
    }
    .metric-label {
        font-size: 9.5px;
    }
    .metric-value {
        font-size: 10.5px;
    }
    .notification-container {
        top: 65px;
        right: 16px;
        left: 16px;
        bottom: auto;
        max-width: calc(100% - 32px);
        z-index: 10000;
        pointer-events: none;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-row > div {
        flex: 0 0 100% !important;
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px 8px;
        gap: 12px;
    }
    .server-card-header {
        padding: 10px 12px;
        gap: 8px;
    }
    .server-card-body {
        padding: 10px 12px;
        gap: 10px;
    }
    .server-card-title h2 {
        font-size: 15px;
    }
    .server-card-meta {
        font-size: 10px;
    }
    .server-card-actions .btn {
        padding: 5px 6px;
        font-size: 9px;
    }
    .alert-badge {
        font-size: 8.5px;
        padding: 2px 6px;
    }
}

/* ==========================================================================
   MODE SWITCHER AND HOME ASSISTANT CONTROL CENTER STYLING
   ========================================================================== */

.mode-switcher {
    display: flex;
    gap: 8px;
    margin-left: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-btn {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    color: var(--neon-cyan);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(189, 0, 255, 0.1));
    color: var(--neon-cyan);
    box-shadow: inset 0 0 6px var(--neon-cyan-glow), 0 0 10px rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.ha-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ha-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-color: rgba(0, 243, 255, 0.1);
}

.ha-system-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
}

.ha-meta-row {
    display: flex;
    gap: 16px;
    font-size: 11px;
}

.ha-meta-item {
    color: var(--text-secondary);
}

.ha-view-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 11px;
    color: var(--text-muted);
}

.select-sm {
    padding: 4px 8px;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.select-sm:focus {
    border-color: var(--neon-cyan);
}

/* Floor levels filter tabs */
.ha-floor-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.ha-floor-tab {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ha-floor-tab:hover {
    color: #fff;
    border-color: rgba(0, 243, 255, 0.2);
}

.ha-floor-tab.active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.05);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* Areas Grid & Cards */
.ha-areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.area-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: rgba(12, 17, 34, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.area-card:hover {
    border-color: var(--panel-border-hover);
    box-shadow: 0 8px 30px rgba(0, 243, 255, 0.04);
}

.area-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.area-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.area-title h3 {
    font-family: var(--font-header);
    font-size: 15px;
    color: #fff;
    font-weight: 700;
}

.area-floor-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.area-badges {
    display: flex;
    gap: 6px;
    align-items: center;
}

.area-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.area-badge.active {
    color: var(--neon-cyan);
    border-color: rgba(0, 243, 255, 0.2);
    background: rgba(0, 243, 255, 0.05);
}

.area-

/* Device Lists & Control elements */
.device-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-title {
    font-family: var(--font-header);
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 2px;
}

.device-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 0;
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 60%;
}

.device-name {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-status-text {
    font-size: 9px;
    color: var(--text-muted);
}

.device-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Switches and sliders custom styling */
.switch-input {
    width: 32px;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-input.active {
    background-color: var(--neon-green);
    border-color: transparent;
    box-shadow: 0 0 6px var(--neon-green-glow);
}

.switch-input::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    top: 1px;
    left: 1px;
    transition: transform 0.2s;
}

.switch-input.active::after {
    transform: translateX(16px);
}

/* Range input sliders */
.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 4px var(--neon-cyan-glow);
}

/* Climate Controller buttons */
.climate-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.climate-btn {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    transition: all 0.1s ease;
}

.climate-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.climate-target-temp {
    font-family: var(--font-header);
    font-size: 12px;
    min-width: 32px;
    text-align: center;
}

/* Vacuum, covers, locks icon controls */
.icon-btn-group {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(0, 243, 255, 0.08);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.icon-btn.active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.05);
}

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

.sensor-value {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 11px;
}

/* ==========================================================================
   SERVERS HEALTH DASHBOARD STYLINGS
   ========================================================================== */

.servers-dashboard,
.issues-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.server-health-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    word-break: break-word;
}

.server-health-card:hover {
    border-color: var(--panel-border-hover);
    box-shadow: 0 12px 40px 0 rgba(0, 243, 255, 0.05);
}

/* Status border indicator */
.server-health-card.online-server::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
}

.server-health-card.offline-server::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--neon-red);
    box-shadow: 0 0 8px var(--neon-red-glow);
}

/* Server selection highlight animation */
@keyframes server-highlight {
    0% { border-color: var(--panel-border); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); }
    50% { border-color: var(--neon-cyan); box-shadow: 0 0 25px rgba(0, 243, 255, 0.4), inset 0 0 10px rgba(0, 243, 255, 0.2); }
    100% { border-color: var(--panel-border); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); }
}

.server-health-card.highlight-pulse {
    animation: server-highlight 1.5s ease-in-out 3;
}

.server-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
    box-sizing: border-box;
}

.server-card-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.server-card-title h2 {
    font-family: var(--font-header);
    font-size: 16px;
    letter-spacing: 1px;
    font-weight: 700;
    color: #fff;
    word-break: break-word;
    line-height: 1.2;
}

.server-card-meta {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.server-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.server-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.server-uptime {
    font-size: 10px;
    color: var(--text-muted);
}

/* Metric Badges for Alerts */
.alerts-badge-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.alert-badge {
    font-family: var(--font-header);
    font-size: 9px;
    letter-spacing: 0.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.alert-badge.badge-danger {
    background: rgba(255, 46, 147, 0.12);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 6px rgba(255, 46, 147, 0.1);
    animation: alert-flash 1.5s infinite alternate;
}

@keyframes alert-flash {
    from { opacity: 0.75; }
    to { opacity: 1; box-shadow: 0 0 10px var(--neon-red-glow); }
}

.alert-badge.badge-warning {
    background: rgba(255, 210, 0, 0.08);
    border: 1px solid var(--neon-amber);
    color: var(--neon-amber);
}

.server-card-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Metrics rows layout */
.metric-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 11.5px;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.metric-label {
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-size: 10px;
    letter-spacing: 0.5px;
    min-width: 0;
    word-break: break-word;
}

.metric-value {
    font-family: var(--font-mono);
    color: #fff;
    font-weight: 500;
    min-width: 0;
    word-break: break-all;
    text-align: right;
}

/* Progress bar stylings */
.gauge-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.gauge-bar-fill {
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
}

.gauge-bar-fill.fill-green {
    background: linear-gradient(90deg, #00ff66, #00f3ff);
    box-shadow: 0 0 6px var(--neon-green-glow);
}

.gauge-bar-fill.fill-amber {
    background: linear-gradient(90deg, #ffd200, #ff9000);
    box-shadow: 0 0 6px var(--neon-amber-glow);
}

.gauge-bar-fill.fill-red {
    background: linear-gradient(90deg, #ff2e93, #ff003c);
    box-shadow: 0 0 8px var(--neon-red-glow);
}

/* Network Sparkline Graph */
.network-chart-container {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.chart-label {
    font-family: var(--font-header);
    font-size: 9.5px;
    letter-spacing: 0.5px;
    color: var(--neon-purple);
}

.chart-current-rates {
    font-size: 9.5px;
    color: var(--text-secondary);
    word-break: break-word;
    text-align: right;
}

.sparkline-svg {
    width: 100%;
    max-width: 100%;
    height: 46px;
    overflow: visible;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    padding: 4px;
    box-sizing: border-box;
    display: block;
}

.sparkline-path {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline-path.rx {
    stroke: var(--neon-cyan);
    filter: drop-shadow(0 0 2px var(--neon-cyan-glow));
}

.sparkline-path.tx {
    stroke: var(--neon-purple);
    filter: drop-shadow(0 0 2px var(--neon-purple-glow));
}

/* Server linking interaction */
.clickable-node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-node:hover {
    background: rgba(0, 243, 255, 0.05);
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* ==========================================================================
   BRANCH VARIANCE COMPARISON STYLING
   ========================================================================== */
.variance-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 11px;
    border: 1px solid transparent;
}

.variance-status.status-ahead {
    background: rgba(255, 210, 0, 0.08);
    border-color: rgba(255, 210, 0, 0.25);
}

.variance-status.status-sync {
    background: rgba(0, 255, 102, 0.05);
    border-color: rgba(0, 255, 102, 0.20);
}

.variance-status.status-unknown {
    background: rgba(148, 163, 184, 0.05);
    border-color: rgba(148, 163, 184, 0.15);
}

/* Glowing text colors */
.text-glow-amber {
    color: var(--neon-amber);
    text-shadow: 0 0 8px var(--neon-amber-glow);
    font-weight: 700;
}

.text-glow-green {
    color: var(--neon-green);
    text-shadow: 0 0 8px var(--neon-green-glow);
    font-weight: 700;
}

/* Flashing/Pulsing status dots */
.pulse-dot-amber {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--neon-amber);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--neon-amber-glow);
    animation: pulse 1.5s infinite alternate;
}

.pulse-dot-green {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--neon-green-glow);
}

.pulse-dot-gray {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
}

/* Highlight pending commits */
.commit-item.pending-commit {
    border-left: 2px solid var(--neon-amber);
    padding-left: 8px;
    transition: background-color 0.2s;
}

.commit-item.pending-commit:hover {
    background: rgba(255, 210, 0, 0.04);
}


/* ==========================================================================
   SERVER ANALYTICS STYLINGS
   ========================================================================== */

.analytics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.analytics-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-color: rgba(0, 243, 255, 0.1);
}

.analytics-system-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.analytics-view-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Sub-navigation tabs */
.analytics-sub-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 2px;
}

.analytics-sub-tab {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.analytics-sub-tab:hover {
    color: var(--neon-cyan);
}

.analytics-sub-tab.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.02);
    text-shadow: 0 0 8px var(--neon-cyan-glow);
}

/* KPI Widgets Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.kpi-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    opacity: 0.3;
}

.kpi-title {
    font-family: var(--font-header);
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.kpi-value {
    font-family: var(--font-header);
    font-size: 28px;
    font-weight: 900;
}

/* Overview Layout */
.overview-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.overview-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.section-header {
    font-family: var(--font-header);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    margin-bottom: 4px;
}

/* Alerts Panel */
.alerts-container-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 4px;
}

.alert-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.01);
}

.alert-card.alert-danger {
    border-color: rgba(255, 46, 147, 0.4);
    background: rgba(255, 46, 147, 0.03);
}

.alert-card.alert-danger .alert-title {
    color: var(--neon-red);
    text-shadow: 0 0 6px var(--neon-red-glow);
}

.alert-card.alert-warning {
    border-color: rgba(255, 210, 0, 0.4);
    background: rgba(255, 210, 0, 0.03);
}

.alert-card.alert-warning .alert-title {
    color: var(--neon-amber);
    text-shadow: 0 0 6px var(--neon-amber-glow);
}

.alert-title {
    font-family: var(--font-header);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.alert-msg {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}

.no-alerts-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-size: 11px;
    letter-spacing: 1px;
    text-align: center;
}

/* Virtual Hosts tab */
.vhosts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.vhost-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vhost-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vhost-server-name {
    font-family: var(--font-header);
    font-size: 15px;
    color: #fff;
    font-weight: 700;
}

.vhost-meta-item {
    font-size: 11px;
    color: var(--text-secondary);
}

.vhost-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.vhost-detail-label {
    color: var(--text-muted);
}

.vhost-detail-val {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 70%;
    word-break: break-all;
    text-align: right;
}

/* Stats view */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.stats-box {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Explorer styles */
.explorer-card {
    padding: 20px 24px;
}

.explorer-toolbar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.toolbar-filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toolbar-filter-item label {
    font-family: var(--font-header);
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.toolbar-filter-item select {
    min-width: 140px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 4px;
    outline: none;
}

.toolbar-filter-item select:focus {
    border-color: var(--neon-cyan);
}

.toolbar-filter-item.search-item {
    flex-grow: 1;
    margin-top: 15px;
}

.toolbar-filter-item.search-item input {
    width: 100%;
}

.explorer-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
    margin-top: 16px;
}

.pagination-info {
    font-size: 11px;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-page {
    font-size: 11px;
    color: var(--neon-cyan);
    text-shadow: 0 0 6px var(--neon-cyan-glow);
}

/* Status Code Badges */
.status-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-align: center;
    display: inline-block;
}

.status-badge.status-2xx {
    background: rgba(0, 255, 102, 0.08);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 102, 0.2);
}

.status-badge.status-3xx {
    background: rgba(189, 0, 255, 0.08);
    color: var(--neon-purple);
    border: 1px solid rgba(189, 0, 255, 0.2);
}

.status-badge.status-4xx {
    background: rgba(255, 210, 0, 0.08);
    color: var(--neon-amber);
    border: 1px solid rgba(255, 210, 0, 0.2);
}

.status-badge.status-5xx {
    background: rgba(255, 46, 147, 0.08);
    color: var(--neon-red);
    border: 1px solid rgba(255, 46, 147, 0.2);
}

/* Error level badges */
.level-badge {
    font-family: var(--font-header);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-align: center;
    display: inline-block;
    letter-spacing: 0.5px;
}

.level-badge.level-error {
    background: rgba(255, 46, 147, 0.08);
    color: var(--neon-red);
    border: 1px solid rgba(255, 46, 147, 0.2);
}

.level-badge.level-warn {
    background: rgba(255, 210, 0, 0.08);
    color: var(--neon-amber);
    border: 1px solid rgba(255, 210, 0, 0.2);
}

.level-badge.level-info {
    background: rgba(0, 243, 255, 0.08);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.level-badge.level-notice {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Detail modal/tooltip button */
.btn-log-detail {
    color: var(--neon-cyan);
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-log-detail:hover {
    color: #fff;
    text-shadow: 0 0 4px var(--neon-cyan-glow);
}

/* Responsive Analytics */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .overview-layout {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stats-box {
        grid-column: span 1 !important;
    }
}

/* Detailed Folder Sizes Styles */
.folder-sizes-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    margin-top: 10px;
    color: var(--neon-cyan);
    user-select: none;
}

.folder-sizes-toggle:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--neon-cyan-glow);
}

.folder-sizes-container {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 6px;
    font-size: 11px;
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
}

.folder-sizes-container::-webkit-scrollbar {
    width: 4px;
}

.folder-sizes-container::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 2px;
}

.folder-sizes-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-size: 9px;
    letter-spacing: 1px;
}

.folder-sizes-section-title {
    font-family: var(--font-header);
    font-size: 10px;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 2px;
    font-weight: 700;
}

.folder-sizes-section-title.root-title {
    color: var(--neon-cyan);
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
}

.folder-sizes-section-title.var-www-title {
    color: var(--neon-purple);
    border-bottom: 1px solid rgba(189, 0, 255, 0.15);
    margin-top: 14px;
}

.folder-size-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.folder-size-row-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.folder-size-name {
    color: var(--text-primary);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 75%;
}

.folder-size-val {
    font-family: var(--font-mono);
    font-weight: 700;
}

.folder-size-val.root-val {
    color: var(--neon-cyan);
}

.folder-size-val.var-www-val {
    color: var(--neon-purple);
}

.folder-size-bar-bg {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.folder-size-bar-fill {
    height: 100%;
    border-radius: 2px;
}

.folder-size-bar-fill.root-fill {
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
}

.folder-size-bar-fill.var-www-fill {
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-red));
}

.folder-sizes-empty {
    color: var(--text-muted);
    font-size: 10px;
    font-style: italic;
    padding: 4px 0;
}

/* ==========================================================================
   TWO-CLICK RESTART & TOAST NOTIFICATION STYLES
   ========================================================================== */

.btn-danger-confirm {
    background: rgba(255, 46, 147, 0.25) !important;
    border-color: var(--neon-red) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px var(--neon-red-glow) !important;
    animation: pulseDanger 0.8s infinite alternate !important;
}

@keyframes pulseDanger {
    from {
        box-shadow: 0 0 4px var(--neon-red-glow);
        border-color: rgba(255, 46, 147, 0.6);
    }
    to {
        box-shadow: 0 0 16px var(--neon-red-glow), 0 0 24px rgba(255, 46, 147, 0.4);
        border-color: var(--neon-red);
    }
}

.notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    pointer-events: none;
}

.toast-notification {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(12, 17, 34, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.toast-success {
    border-color: var(--neon-green);
    box-shadow: 0 4px 16px var(--neon-green-glow);
    color: #e6fff0;
}

.toast-notification.toast-error {
    border-color: var(--neon-red);
    box-shadow: 0 4px 16px var(--neon-red-glow);
    color: #ffe6f0;
}

.toast-notification.toast-warning {
    border-color: var(--neon-amber);
    box-shadow: 0 4px 16px var(--neon-amber-glow);
    color: #fffde6;
}

.toast-notification.toast-info {
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 16px var(--neon-cyan-glow);
    color: #e6fcff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   TOP ACTIVE CLIENTS TARGET INSPECTOR STYLES
   ========================================================================== */

.tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.tag-server, .tag-vhost, .tag-project, .tag-path, .tag-level-error, .tag-level-warn, .tag-level-notice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    white-space: nowrap;
    border: 1px solid transparent;
}

.tag-server {
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-cyan);
    border-color: rgba(0, 243, 255, 0.3);
}

.tag-vhost {
    background: rgba(255, 210, 0, 0.1);
    color: var(--neon-amber);
    border-color: rgba(255, 210, 0, 0.3);
    text-decoration: none;
    transition: all 0.15s ease;
}

.tag-vhost:hover {
    background: rgba(255, 210, 0, 0.2);
    border-color: var(--neon-amber);
    box-shadow: 0 0 8px rgba(255, 210, 0, 0.4);
}

.tag-project {
    background: rgba(0, 255, 157, 0.12);
    color: var(--neon-green);
    border-color: rgba(0, 255, 157, 0.35);
    font-weight: 700;
}

.tag-level-error {
    background: rgba(255, 0, 85, 0.15);
    color: var(--neon-red);
    border-color: rgba(255, 0, 85, 0.4);
    font-weight: 700;
}

.tag-level-warn {
    background: rgba(255, 210, 0, 0.15);
    color: var(--neon-amber);
    border-color: rgba(255, 210, 0, 0.4);
    font-weight: 700;
}

.tag-level-notice {
    background: rgba(0, 243, 255, 0.15);
    color: var(--neon-cyan);
    border-color: rgba(0, 243, 255, 0.4);
    font-weight: 700;
}

.tag-path {
    background: rgba(189, 0, 255, 0.1);
    color: #e0b0ff;
    border-color: rgba(189, 0, 255, 0.3);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-server small, .tag-vhost small, .tag-project small, .tag-path small {
    opacity: 0.75;
}

.clickable-error-preview {
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.clickable-error-preview:hover {
    color: #ffffff;
    background: rgba(255, 0, 85, 0.15);
    text-shadow: 0 0 6px rgba(255, 0, 85, 0.5);
}

.pulse-dot-red {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: var(--neon-red);
    border-radius: 50%;
    margin-right: 4px;
    box-shadow: 0 0 8px var(--neon-red-glow);
    animation: pulse 1.2s infinite alternate;
}

.pulse-dot-amber {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: var(--neon-amber);
    border-radius: 50%;
    margin-right: 4px;
    box-shadow: 0 0 6px var(--neon-amber);
    animation: pulse 1.5s infinite alternate;
}

.tag-status-active {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    background: rgba(255, 0, 85, 0.15);
    color: var(--neon-red);
    border: 1px solid rgba(255, 0, 85, 0.4);
    white-space: nowrap;
}

.tag-status-today {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    background: rgba(255, 210, 0, 0.15);
    color: var(--neon-amber);
    border: 1px solid rgba(255, 210, 0, 0.4);
    white-space: nowrap;
}

.tag-status-dormant {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.preset-btn {
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.preset-btn.active {
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
    border-color: var(--neon-cyan);
}

.issue-code-container {
    background: #080c16;
    border: 1px solid rgba(255, 0, 85, 0.3);
    border-radius: 6px;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    color: #f1f5f9;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    position: relative;
}

.cyan-text-link {
    color: var(--neon-cyan);
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.cyan-text-link:hover {
    color: #ffffff;
    text-shadow: 0 0 8px var(--neon-cyan-glow);
    text-decoration: underline;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 3px;
    cursor: pointer;
}

/* Modal styling fallback / enhancement */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 15, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg-dark);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

.modal-close {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--neon-red);
}

/* Cloud SQL Insights Dashboard Styling */
.cloudsql-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cloudsql-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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




/* --- Compact High-Density Header & Navigation Overrides --- */
.top-nav {
  padding: 0.45rem 1rem !important;
  gap: 0.75rem !important;
}

.brand-title {
  font-size: 1rem !important;
}

.brand-subtitle {
  font-size: 0.65rem !important;
}

.telemetry-pill {
  padding: 0.2rem 0.45rem !important;
  gap: 0.35rem !important;
}

.pill-label {
  font-size: 0.52rem !important;
}

.pill-val {
  font-size: 0.7rem !important;
}

@media (min-width: 769px) {
  .main-tabs {
    display: flex !important;
    gap: 0.25rem !important;
    margin-bottom: 0.65rem !important;
    padding: 0.25rem 0.35rem !important;
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .tab-btn {
    padding: 0.38rem 0.7rem !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    gap: 0.35rem !important;
    border-radius: 6px !important;
  }

  .tab-icon {
    font-size: 0.85rem !important;
  }
}

.centcom-subnav-bar {
  padding: 6px 12px !important;
  margin-bottom: 14px !important;
}

.centcom-mode-btn {
  font-size: 10.5px !important;
  padding: 4px 9px !important;
}

/* ==========================================================================
   ACTIONABLE ALERTS & RECOMMENDATIONS SUBSYSTEM STYLING
   ========================================================================== */
.alerts-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.alerts-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.alerts-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.alerts-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.alerts-icon-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alerts-header-icon {
  font-size: 1.35rem;
}

.alerts-live-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-amber);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

.alerts-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.alerts-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.btn-scan-alerts {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* Stats Ribbon */
.alerts-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.alert-stat-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.alert-stat-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.alert-stat-card.active {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.alert-stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-stat-card .stat-count {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.alert-stat-card.stat-critical .stat-count {
  color: var(--accent-rose);
}

.alert-stat-card.stat-warning .stat-count {
  color: var(--accent-amber);
}

.alert-stat-card.stat-recommendation .stat-count {
  color: #38bdf8;
}

.alert-stat-card.stat-applied .stat-count {
  color: var(--accent-emerald);
}

.alert-stat-card .stat-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Toolbar & Filters */
.alerts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.alerts-filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.alerts-status-chips,
.alerts-severity-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.filter-chip.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--accent-blue);
  color: #93c5fd;
  font-weight: 600;
}

.filter-chip.chip-crit.active {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
  color: #fca5a5;
}

.filter-chip.chip-warn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-amber);
  color: #fcd34d;
}

.filter-chip.chip-rec.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #bae6fd;
}

.alerts-cat-select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.alerts-cat-select:focus {
  border-color: var(--accent-blue);
}

/* Alert Cards List */
.alerts-feed-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alert-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--accent-blue);
  transition: all 0.2s ease;
}

.alert-card:hover {
  border-color: var(--border-active);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.alert-card.severity-critical {
  border-left: 5px solid var(--accent-rose);
}

.alert-card.severity-warning {
  border-left: 5px solid var(--accent-amber);
}

.alert-card.severity-recommendation {
  border-left: 5px solid #38bdf8;
}

.alert-card.severity-info {
  border-left: 5px solid var(--text-muted);
}

.alert-card.status-applied {
  border-left-color: var(--accent-emerald);
  opacity: 0.85;
}

.alert-card.status-dismissed {
  border-left-color: var(--text-muted);
  opacity: 0.65;
}

.alert-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.alert-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.alert-sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.alert-sev-badge.sev-critical {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.alert-sev-badge.sev-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.alert-sev-badge.sev-recommendation {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.alert-sev-badge.sev-info {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.alert-subsystem-badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.18rem 0.5rem;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.alert-status-badge {
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
}

.alert-status-badge.status-applied {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert-status-badge.status-dismissed {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.alert-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.alert-id-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
}

.alert-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Card Sections */
.alert-card-sections {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.alert-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.alert-section-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

/* High-Visibility Recommended Direction Box */
.alert-section-direction {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.08);
}

.alert-direction-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.direction-heading {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #38bdf8;
  text-transform: uppercase;
}

.direction-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: #f0f9ff;
  line-height: 1.5;
}

/* Tech Command Snippet */
.alert-section-tech {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.alert-tech-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.alert-command-box {
  margin: 0;
  padding: 0.4rem 0.6rem;
  background: #090c10;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  font-size: 0.78rem;
  color: #a5f3fc;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Card Actions Footer */
.alert-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-work-with-agy {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.btn-work-with-agy:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(124, 58, 237, 0.6);
  background: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
}

.btn-work-with-agy:active {
  transform: scale(0.97);
}

.alert-secondary-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty State */
.empty-alerts-state {
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.empty-alerts-icon {
  font-size: 2.5rem;
}

.empty-alerts-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-alerts-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.5;
}

/* ==========================================================================
   BASEBRAIN System Settings Modal & Audio Controls
   ========================================================================== */
.modes-volume-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.2rem 0.35rem;
}

.modes-slider {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border-subtle);
  outline: none;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.btn-settings-nav {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid rgba(124, 58, 237, 0.48);
  border-radius: var(--radius-sm);
  color: #c4b5fd;
  flex-shrink: 0 !important;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  z-index: 10;
}

.btn-settings-nav:hover {
  background: rgba(124, 58, 237, 0.32);
  border-color: #a78bfa;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.45);
  transform: rotate(45deg) scale(1.06);
}

.btn-settings-nav:active {
  transform: rotate(90deg) scale(0.92);
  background: rgba(124, 58, 237, 0.48);
}

#settings-modal {
  z-index: 10500 !important;
}

.settings-modal-content {
  max-width: 620px;
  width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 18, 26, 0.98);
  border: 1px solid rgba(0, 243, 255, 0.22);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(0, 243, 255, 0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.settings-modal-header-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.settings-modal-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.settings-modal-body {
  padding: 1.15rem 1.25rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.settings-modal-body::-webkit-scrollbar {
  width: 6px;
}

.settings-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.settings-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.settings-section {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 10px);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-sizing: border-box;
  width: 100%;
}

.settings-section-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-cyan, #00f3ff);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.settings-control-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.settings-control-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.25;
}

.settings-control-sub {
  font-size: 0.71rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.35;
}

.settings-control-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: nowrap;
}

.settings-control-stacked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.settings-sound-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 320px;
  min-width: 240px;
  box-sizing: border-box;
}

.settings-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  background: var(--bg-surface-elevated, #1e2433);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 6px);
  color: #fff;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.settings-select:focus {
  border-color: var(--accent-cyan, #00f3ff);
}

.settings-preview-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
}

.settings-volume-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 1 260px;
  min-width: 200px;
  box-sizing: border-box;
}

.settings-volume-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan, #00f3ff);
  min-width: 2.75rem;
  text-align: right;
  flex-shrink: 0;
}

.settings-voice-select {
  flex: 0 1 320px;
  min-width: 240px;
}

.settings-toggle-btn {
  flex-shrink: 0;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-sm, 6px);
  white-space: nowrap;
  transition: all 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  cursor: pointer;
}

.settings-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.settings-control-header-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.settings-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.42rem;
  border-radius: 9999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  flex-shrink: 0;
}

.settings-status-badge.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.settings-status-badge.badge-inactive {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.settings-status-badge.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.settings-status-badge.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.settings-button-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.settings-test-alert-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.42rem 0.65rem;
  white-space: nowrap;
}

.settings-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.settings-footer-btn {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm, 6px);
}

/* Mobile Responsiveness for BASEBRAIN Settings */
@media (max-width: 768px) {
  #settings-modal.modal-overlay {
    padding: 0.5rem !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .settings-modal-content {
    width: calc(100vw - 1rem) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 1rem) !important;
    border-radius: var(--radius-md, 10px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9) !important;
  }

  .settings-modal-header {
    padding: 0.7rem 0.85rem !important;
  }

  .settings-modal-header-title {
    font-size: 0.85rem !important;
  }

  .settings-modal-body {
    padding: 0.75rem 0.65rem !important;
    gap: 0.75rem !important;
    overflow-x: hidden !important;
  }

  .settings-section {
    padding: 0.7rem 0.65rem !important;
    gap: 0.7rem !important;
    border-radius: 8px !important;
  }

  .settings-section-title {
    font-size: 0.78rem !important;
    padding-bottom: 0.35rem !important;
  }

  /* In mobile view, stacked controls (dropdowns, volume slider) take the full width below the label */
  .settings-control-stacked {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.4rem !important;
  }

  .settings-control-stacked .settings-control-info {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Toggle rows stay on a tight, clean single horizontal row */
  .settings-control-toggle {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
  }

  .settings-control-toggle .settings-control-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .settings-control-label {
    font-size: 0.8rem !important;
    line-height: 1.25 !important;
  }

  .settings-control-sub {
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
  }

  .settings-sound-picker {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    gap: 0.4rem !important;
  }

  .settings-select {
    font-size: 0.78rem !important;
    padding: 0.42rem 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .settings-voice-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .settings-preview-btn {
    font-size: 0.72rem !important;
    padding: 0.42rem 0.6rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .settings-volume-picker {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 0.5rem !important;
  }

  .settings-volume-val {
    font-size: 0.75rem !important;
    min-width: 2.2rem !important;
  }

  .settings-toggle-btn {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.55rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .settings-button-group {
    gap: 0.3rem !important;
    flex-shrink: 0 !important;
  }

  .settings-test-alert-btn {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.5rem !important;
    flex-shrink: 0 !important;
  }

  .settings-modal-footer {
    padding: 0.65rem 0.75rem !important;
    gap: 0.5rem !important;
  }

  .settings-footer-btn {
    flex: 1 1 50% !important;
    padding: 0.55rem 0.5rem !important;
    font-size: 0.78rem !important;
    text-align: center !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
  }
}

/* ==========================================================================
   BASEBRAIN IN-PAGE CONFIRMATION MODAL
   ========================================================================== */
.confirmation-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(5, 8, 15, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10500 !important;
  padding: 1.25rem !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirmation-modal-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.confirmation-modal-overlay.hidden {
  display: none !important;
}

.confirmation-modal-content {
  max-width: 480px;
  width: 100%;
  background: #121722;
  border: 1px solid var(--border-active, #384556);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(37, 99, 235, 0.12);
  transform: scale(0.94);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.confirmation-modal-overlay.active .confirmation-modal-content {
  transform: scale(1);
}

.confirmation-modal-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle, #27303d);
  background: rgba(255, 255, 255, 0.02);
}

.confirmation-modal-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.confirmation-modal-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.confirmation-modal-icon.danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
}

.confirmation-modal-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
}

.confirmation-modal-icon.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

.confirmation-modal-content.danger-theme {
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(244, 63, 94, 0.2);
}

.confirmation-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.confirmation-modal-body {
  padding: 1.25rem 1.4rem;
  background: transparent;
  display: block;
}

.confirmation-modal-message {
  font-size: 0.95rem;
  color: var(--text-primary, #f1f5f9);
  line-height: 1.55;
  margin: 0;
  word-break: break-word;
}

.confirmation-modal-details {
  margin-top: 0.85rem;
  padding: 0.6rem 0.85rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle, #27303d);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
  word-break: break-all;
}

.confirmation-modal-footer {
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-subtle, #27303d);
  background: rgba(0, 0, 0, 0.25);
}

.confirmation-btn-cancel {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.confirmation-btn-confirm {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
}

.confirmation-btn-confirm.btn-danger {
  background: var(--accent-rose, #f43f5e) !important;
  border-color: var(--accent-rose, #f43f5e) !important;
  color: #ffffff !important;
}

.confirmation-btn-confirm.btn-danger:hover {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.45) !important;
}

/* ==========================================================================
   BASEBRAIN IN-PAGE PROMPT / INPUT MODAL
   ========================================================================== */
.prompt-modal-content {
  max-width: 480px;
  width: 95vw;
}

.prompt-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.prompt-modal-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.prompt-modal-input {
  width: 100%;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid var(--border-active, #384556);
  border-radius: var(--radius-sm, 8px);
  color: var(--text-primary, #f1f5f9);
  font-family: var(--font-sans, inherit);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.72rem 2.2rem 0.72rem 0.85rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.prompt-modal-input:focus {
  border-color: var(--accent-blue, #2563eb);
  background: rgba(15, 22, 34, 0.98);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 0 18px rgba(37, 99, 235, 0.2);
}

.prompt-modal-input::placeholder {
  color: var(--text-muted, #64748b);
  opacity: 0.7;
}

.prompt-modal-clear-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 1.25rem;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: all 0.15s ease;
}

.prompt-modal-clear-btn:hover {
  opacity: 1;
  color: var(--text-primary, #f1f5f9);
  background: rgba(255, 255, 255, 0.1);
}

.prompt-modal-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  padding: 0 2px;
}

.prompt-modal-count {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  opacity: 0.75;
}

/* ==========================================================================
   LARGE SCREEN & WIDESCREEN RESPONSIVE SUITE
   - Maximize screen usage on desktop/widescreen displays
   - Persistent, responsive THREADS column side-by-side with active chat
   ========================================================================== */
@media (min-width: 1024px) {
  /* Expand layout to maximize screen usage */
  .app-container {
    max-width: 100% !important;
    padding: 0.65rem 1.5rem !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .pwa-banner-content {
    max-width: 100% !important;
  }

  /* Two-column Chat Workspace: Left = Threads List, Right = Active Chat */
  .chat-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  /* Threads Column - Responsive & open by default */
  .chat-threads-overlay {
    position: static !important;
    inset: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 10 !important;
    width: 320px !important;
    min-width: 290px !important;
    max-width: 360px !important;
    flex-shrink: 0 !important;
    height: 100% !important;
    border-right: 1px solid var(--border-subtle) !important;
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, border-color 0.2s ease;
  }

  /* Collapsed state when toggled off by user on large screen */
  .chat-threads-overlay.hidden {
    display: none !important;
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border-right: none !important;
  }

  .chat-threads-drawer {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
    border-right: none !important;
    animation: none !important;
    background: var(--bg-surface-elevated) !important;
  }

  /* Right-side Active Chat Column */
  .chat-main-area {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .chat-topbar {
    flex-shrink: 0;
  }

  .chat-title-display {
    max-width: 480px;
  }

  .chat-messages {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
  }

  .chat-msg {
    max-width: 95%;
  }

  .msg-assistant {
    max-width: 96%;
  }

  .btn-threads-toggle.active {
    background: rgba(2, 132, 199, 0.16);
    border-color: var(--accent-cyan);
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
  }
}

@media (min-width: 1400px) {
  .app-container {
    padding: 0.75rem 2rem !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .chat-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  .chat-threads-overlay {
    width: 350px !important;
    max-width: 380px !important;
  }

  .chat-title-display {
    max-width: 650px;
  }

  .chat-messages {
    padding: 1.25rem 1.75rem;
  }
}

@media (min-width: 1800px) {
  .app-container {
    padding: 0.85rem 2.5rem !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .chat-threads-overlay {
    width: 380px !important;
    max-width: 420px !important;
  }

  .chat-title-display {
    max-width: 850px;
  }
}





/* ==========================================================================
   SCHEDULE DASHBOARD & AUTOMATIONS STYLES
   ========================================================================== */
.schedule-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.schedule-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.schedule-stat-card .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
}

.schedule-stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  font-family: "Orbitron", monospace, sans-serif;
}

.schedule-stat-card .stat-value.highlight-next {
  color: var(--accent-emerald, #10b981);
}

.schedules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.schedule-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.schedule-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.schedule-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.schedule-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.schedule-card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.schedule-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.3;
}

.schedule-category-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.schedule-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.schedule-status-indicator.active {
  color: var(--accent-emerald, #10b981);
}

.schedule-status-indicator.inactive {
  color: var(--text-muted);
}

.schedule-timing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  color: #93c5fd;
  font-size: 0.8rem;
  font-weight: 600;
  width: fit-content;
}

.schedule-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.78rem;
}

.schedule-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-meta-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
}

.schedule-meta-val {
  color: var(--text-primary);
  font-weight: 600;
}

.schedule-meta-val.next-run {
  color: var(--accent-emerald, #10b981);
}

.schedule-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
  flex-grow: 1;
}

.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.schedule-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Fail-safe enforcement: Desktop navigation tabs strictly hidden on mobile viewports */
@media (max-width: 768px) {
  .desktop-only-tabs,
  nav.main-tabs.desktop-only-tabs,
  nav.main-tabs {
    display: none !important;
  }
}

