@font-face {
  font-family: 'Liberation Sans';
  src:
    url('/assets/fonts/LiberationSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Liberation Sans';
  src:
    url('/assets/fonts/LiberationSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Liberation Mono';
  src:
    url('/assets/fonts/LiberationMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ChaozCode global styles */
:root {
  --bg-dark: #050512;
  --bg-panel: #11152a;
  --bg-card: #181c31;
  --accent: #667eea;
  --accent-secondary: #764ba2;
  --success: #4caf50;
  --warning: #ffc107;
  --danger: #f44336;
  --info: #3cb9ff;
  --text-primary: #f4f6ff;
  --text-muted: #9ca7cf;
  --border-color: rgba(102, 126, 234, 0.35);
  --panel-shadow: 0 20px 45px rgba(4, 7, 24, 0.55);
  --font-body: 'Liberation Sans', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Liberation Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  --radius-lg: 1.25rem;
  --radius-md: 0.9rem;
  --radius-sm: 0.55rem;
}

html {
  font-size: clamp(14px, 0.85vw + 0.35rem, 17px);
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(102, 126, 234, 0.18), transparent 55%) fixed,
              radial-gradient(circle at 20% 20%, rgba(118, 75, 162, 0.15), transparent 45%) fixed,
              var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body[data-page="login"] {
  background: linear-gradient(135deg, #3f2b96, #a8c0ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(1.5rem, 4vh, 4rem) clamp(1rem, 4vw, 3rem);
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: var(--info);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

* {
  box-sizing: border-box;
}

code,
pre,
.tool-run-name,
.file-tree,
.card-items li {
  font-family: var(--font-mono);
}

.page-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.btn {
  border-radius: 999px !important;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.35rem 1rem;
  font-size: 0.92rem;
}

.btn.btn-sm {
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text-primary);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.container-fluid {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.global-navbar {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 10px 35px rgba(5, 0, 56, 0.35);
  position: sticky;
  top: 0;
  z-index: 999;
}

.global-navbar .brand {
  font-weight: 600;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
}

.global-navbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.global-navbar .nav-link {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 15, 35, 0.15);
  color: #fff;
  font-size: 0.88rem;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.global-navbar .nav-link.active,
.global-navbar .nav-link:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.15);
}

.global-navbar .nav-link i {
  margin-right: 0.35rem;
  font-size: 1rem;
}

.global-navbar .status-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 15, 35, 0.25);
  font-size: 0.9rem;
  color: #fff;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--success);
  animation: pulse 2.4s infinite;
}

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

.status-dot.danger {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Utility layout classes */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent) !important; }
.text-info { color: var(--info) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.btn-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.w-100 { width: 100%; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 0.75rem; }
.gap-3 { gap: 1rem; }
.p-3 { padding: 1rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.fw-bold { font-weight: 600 !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

[class*="col-md"] {
  flex: 1 1 240px;
}

.col-md-12 { flex: 1 1 100%; }

/* Cards & panels */
.panel,
.card,
.system-card,
.table-card,
.status-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--panel-shadow);
}

.system-card h6,
.panel h4,
.panel h5,
.table-card h4 {
  margin: 0 0 0.75rem 0;
  font-weight: 600;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 1.1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); }
.btn-secondary { background: rgba(255, 255, 255, 0.15); border-color: rgba(255,255,255,0.25); }
.btn-info { background: rgba(60, 185, 255, 0.9); }
.btn-success { background: rgba(76, 175, 80, 0.9); }
.btn-danger { background: rgba(244, 67, 54, 0.9); }
.btn-outline-light { background: transparent; border-color: rgba(255,255,255,0.6); }
.btn-outline-dark { background: transparent; border-color: rgba(0,0,0,0.4); color: #222; }

.btn-stream {
  background: rgba(102, 126, 234, 0.25);
  border-color: rgba(102, 126, 234, 0.55);
}

.btn-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 50%;
  width: 3.1rem;
  height: 3.1rem;
  font-size: 1.2rem;
  border: none;
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
}

.alert-info { border-color: rgba(60, 185, 255, 0.4); color: var(--info); }
.alert-success { border-color: rgba(76, 175, 80, 0.4); color: var(--success); }
.alert-danger { border-color: rgba(244, 67, 54, 0.45); color: var(--danger); }
.alert-warning { border-color: rgba(255, 193, 7, 0.45); color: var(--warning); }

.badge {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.up { background: rgba(76, 175, 80, 0.15); color: var(--success); }
.badge.down { background: rgba(244, 67, 54, 0.15); color: var(--danger); }
.badge.warning { background: rgba(255, 193, 7, 0.18); color: #ffc107; }
.badge-pill { border-radius: 999px; }
.badge-soft {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.15rem 0.45rem;
}

/* Tables */
.table-responsive,
.table-card,
.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.table-dark {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.table-hover tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.agentz-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agentz-list li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem;
}

.agentz-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.agentz-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  min-width: 160px;
}

.agentz-pill div {
  font-weight: 600;
}

.align-middle td,
.align-middle th { vertical-align: middle; }

.repo-path {
  font-size: 0.85rem;
  opacity: 0.75;
}

.repo-hash {
  font-size: 0.85rem;
}

.repo-commit-msg {
  font-size: 0.85rem;
  opacity: 0.8;
}

.repo-commit-time {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* Dashboard metrics */
.metric-value {
  font-size: clamp(1.8rem, 2vw, 2.4rem);
  font-weight: 600;
  color: var(--accent);
}

.metric-icon {
  font-size: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

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

.perf-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.9rem;
  padding: 1rem;
}

.perf-card small { color: var(--text-muted); display: block; margin-top: 0.35rem; }

.service-status { display: flex; flex-direction: column; gap: 0.4rem; }
.service-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.4rem; background: rgba(255, 255, 255, 0.02); border-radius: 0.6rem; }
.service-row strong { flex: 1; }
.service-meta { color: var(--text-muted); font-size: 0.82rem; margin-right: 0.4rem; font-family: var(--font-mono); }

.console-container {
  background: #050818;
  border-radius: 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(102, 126, 234, 0.4);
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.9rem;
}

.console-line { margin: 0.25rem 0; padding: 0.15rem 0.25rem; }
.console-line.info { color: #4fc3f7; }
.console-line.success { color: #81c784; }
.console-line.warning { color: #ffb74d; }
.console-line.error { color: #e57373; }

.stream-box {
  background: #0a0e27;
  border-radius: 0.7rem;
  padding: 0.9rem;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}

.stream-box-compact {
  padding: 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 2s infinite;
}

.status-active { background: var(--success); }
.status-idle { background: var(--warning); }
.status-offline { background: var(--danger); }
.status-dot.success { background: var(--success); }
.status-dot.info { background: var(--info); }
.status-dot.mini { width: 0.6rem; height: 0.6rem; margin-right: 0.35rem; }

/* Repair dashboard */
.repair-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  padding: 2rem 1.5rem;
  border-radius: 1.2rem;
  text-align: center;
  box-shadow: var(--panel-shadow);
}

.status-card.status-healthy { border-color: rgba(76, 175, 80, 0.6); }
.status-card.status-repairing { border-color: rgba(255, 193, 7, 0.6); animation: pulse 2s infinite; }
.status-card.status-error { border-color: rgba(244, 67, 54, 0.6); }

.metric { text-align: center; padding: 0.9rem; }
.metric-label { font-size: 0.9rem; color: var(--text-muted); }

.live-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.log-entry {
  background: #0a0e27;
  padding: 0.55rem 0.75rem;
  margin: 0.4rem 0;
  border-left: 3px solid var(--accent);
  border-radius: 0.4rem;
  font-size: 0.9rem;
}

.log-info { border-left-color: #4fc3f7; }
.log-warn { border-left-color: #ffc107; }
.log-error { border-left-color: #f44336; }
.log-success { border-left-color: #4caf50; }

.issue-card {
  background: var(--bg-card);
  border-left: 4px solid var(--danger);
  padding: 1rem;
  border-radius: 0.9rem;
}

.repair-action {
  background: rgba(102, 126, 234, 0.08);
  border-radius: 0.8rem;
  padding: 0.9rem;
  border: 1px dashed rgba(102, 126, 234, 0.4);
}

.log-scroll {
  max-height: 420px;
  overflow-y: auto;
}

/* ChatHub */
.chat-container {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

.session-panel {
  margin: 1rem clamp(0.75rem, 4vw, 2rem) 0.75rem;
  padding: 1rem 1.35rem;
  background: rgba(5, 8, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.session-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.session-toolbar-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.session-toolbar-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.session-toolbar-actions .btn {
  white-space: nowrap;
}

.session-meta-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.session-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
}

.session-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.session-stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
}

.session-list {
  margin-top: 1.25rem;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.35rem;
}

.session-list::-webkit-scrollbar {
  width: 6px;
}

.session-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.session-card {
  background: rgba(10, 14, 39, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.session-card.active {
  border-color: var(--accent);
  box-shadow: 0 15px 45px rgba(102, 126, 234, 0.35);
}

.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.session-title {
  font-weight: 600;
}

.session-id {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.session-meta-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.session-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.session-empty {
  text-align: center;
  padding: 1rem;
  border-radius: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
}

.request-panel {
  margin: 0 1.25rem 1.25rem;
  padding: 1.1rem 1.25rem;
  background: rgba(3, 6, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.integration-panel {
  margin: 0 1.25rem 1.5rem;
  padding: 1.25rem 1.35rem;
  background: rgba(2, 4, 14, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.35);
}

.integration-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.integration-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.integration-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.integration-actions .btn {
  white-space: nowrap;
}

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

#integrationAgentzCard {
  grid-column: 1 / -1;
}

@media (min-width: 1200px) {
  .integration-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

.integration-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.integration-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.integration-card-header h5 {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.integration-card-header small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
}

.integration-card .badge {
  align-self: flex-start;
}

.integration-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.integration-stat {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.6rem 0.85rem;
}

.integration-stat small {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.integration-stat div {
  font-weight: 600;
  font-size: 1.05rem;
}

.integration-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.integration-meta div {
  background: rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 0.55rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.integration-meta small {
  display: block;
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.integration-meta div div {
  font-weight: 600;
  color: #fff;
  font-size: 1rem;
}

.integration-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.agentz-meta {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.agentz-tags-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agentz-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.agentz-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: #e9ecff;
}

.agentz-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.agentz-detail {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
}

.agentz-detail summary {
  cursor: pointer;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  list-style: none;
}

.agentz-detail summary::-webkit-details-marker {
  display: none;
}

.agentz-services-grid {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.agentz-service {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.agentz-service strong {
  display: block;
  font-size: 0.82rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.integration-list-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.integration-empty {
  text-align: center;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.request-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.request-toolbar-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.request-toolbar-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.request-list {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 240px;
  overflow-y: auto;
}

.request-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.request-kind {
  font-weight: 600;
}

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

.request-status {
  text-align: right;
  font-size: 0.85rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.request-status.pending { color: #ffca28; }
.request-status.success { color: #81c784; }
.request-status.error { color: #ef5350; }
.request-status.timeout { color: #ff7043; }
.request-status.paused { color: #90caf9; }

.request-empty {
  text-align: center;
  padding: 0.75rem;
  border-radius: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
}

.chat-header {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.35), rgba(118, 75, 162, 0.35));
  padding: 0.85rem clamp(0.9rem, 2.5vw, 1.5rem);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  position: sticky;
  top: 55px;
  z-index: 10;
  border-radius: var(--radius-md);
}

.feature-badges { margin-top: 0.45rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.feature-badge,
.model-selector,
.context-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.14);
}

.context-indicator { background: rgba(76, 175, 80, 0.2); border: 1px solid rgba(76, 175, 80, 0.5); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: clamp(0.75rem, 2.5vw, 1.35rem);
  background: #050614;
}

.message { margin-bottom: 0.9rem; animation: fadeIn 0.3s ease-in; }
.message-user { text-align: right; }

.message-bubble {
  display: inline-block;
  max-width: min(680px, 90%);
  padding: 0.7rem 0.95rem;
  border-radius: 1rem;
  word-wrap: break-word;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-user .message-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #fff;
  border-bottom-right-radius: 0.4rem;
}

.message-assistant .message-bubble {
  background: rgba(12, 18, 38, 0.85);
  border-bottom-left-radius: 0.4rem;
}

.message-system .message-bubble {
  width: 100%;
  text-align: center;
  background: rgba(63, 94, 251, 0.15);
  border: 1px solid rgba(63, 94, 251, 0.45);
  color: #4fc3f7;
}

.message-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.3rem; }
.assistant-upgrade-badge {
  font-size: 0.7em;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 193, 7, 0.16);
  border: 1px solid rgba(255, 193, 7, 0.6);
  color: #ffd54f;
}

.chat-input-area {
  background: #0b1024;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.85rem 1rem;
}

.chat-input {
  flex: 1;
  border-radius: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #070b1c;
  color: var(--text-primary);
  padding: 0.7rem 1rem;
  resize: none;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.chathub-rendered img,
.chathub-rendered video {
  max-width: 100%;
  height: auto;
  border-radius: 0.7rem;
  margin: 0.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-trace {
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.65rem;
  background: rgba(10, 16, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.assistant-trace-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.35rem;
}

.assistant-trace-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.assistant-trace-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.assistant-trace-row.success { color: #9ae6b4; }
.assistant-trace-row.error { color: #fca5a5; }
.assistant-trace-row.pending { color: #fcd34d; }

.assistant-reasoning {
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.assistant-reasoning summary {
  cursor: pointer;
  color: #c7d2fe;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.assistant-reasoning ul {
  margin: 0;
  padding-left: 1rem;
}

.chathub-rendered table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.chathub-rendered th,
.chathub-rendered td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 0.6rem;
}

.chathub-rendered th {
  background: rgba(255, 255, 255, 0.04);
}

.response-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.response-card {
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.response-card.card-success { border-color: rgba(76, 175, 80, 0.8); background: rgba(76, 175, 80, 0.08); }
.response-card.card-warning { border-color: rgba(255, 193, 7, 0.8); background: rgba(255, 193, 7, 0.08); }
.response-card.card-danger { border-color: rgba(244, 67, 54, 0.8); background: rgba(244, 67, 54, 0.08); }
.response-card.card-info { border-color: rgba(3, 169, 244, 0.8); background: rgba(3, 169, 244, 0.08); }
.response-card.card-neutral { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.03); }

.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.card-title {
  font-weight: 600;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.card-badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
}

.card-items {
  list-style: none;
  padding-left: 1rem;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-items li {
  position: relative;
  color: var(--text-muted);
}

.card-items li::before {
  content: '•';
  position: absolute;
  left: -0.6rem;
  color: var(--accent);
}

.card-pill {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

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

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.attachment-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.attachment-card img {
  width: 100%;
  border-radius: 0.75rem;
  object-fit: cover;
  max-height: 200px;
}

.attachment-title {
  font-weight: 600;
}

.attachment-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.attachment-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.file-tree {
  margin-top: 0.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  background: rgba(0, 0, 0, 0.2);
}

.file-tree-node {
  padding: 0.25rem 0.5rem 0.25rem calc(0.5rem + (var(--depth, 0) * 1rem));
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.file-tree-node.dir {
  color: #fff;
  font-weight: 600;
}

.file-tree-node.dir::before {
  content: '📁';
}

.file-tree-node.file::before {
  content: '📄';
}

.typing-indicator { display: none; padding: 0.5rem 1rem; }
.typing-indicator.active { display: block; }

.typing-dots { display: inline-flex; gap: 0.3rem; }
.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1.4s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

.execution-status {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.execution-status .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.execution-status.running .status-pill {
  background: rgba(74, 222, 128, 0.15);
  color: #86efac;
}

.execution-status.paused .status-pill {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}

.sidebar {
  position: fixed;
  right: -360px;
  top: 0;
  height: 100vh;
  width: min(360px, 92vw);
  background: #0e142a;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  transition: right 0.3s ease;
  z-index: 2000;
  overflow-y: auto;
}

.sidebar.open { right: 0; }

.sidebar-toggle {
  position: fixed;
  top: 6rem;
  right: 1.5rem;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 20px 30px rgba(0,0,0,0.35);
  z-index: 2101;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1500;
  display: none;
}

.sidebar-backdrop.open { display: block; }

.tool-runs-list {
  background: #0a0e27;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  padding: 0.6rem;
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
}

.tool-run-empty {
  opacity: 0.7;
  text-align: center;
  padding: 0.5rem 0;
}

.tool-run-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.45rem 0;
}

.tool-run-row:last-child {
  border-bottom: none;
}

.tool-run-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.95rem;
  margin-left: 0.35rem;
}

.tool-run-meta {
  opacity: 0.75;
  font-size: 0.8rem;
  margin-left: 0.35rem;
}

.tool-run-detail {
  opacity: 0.8;
  white-space: pre-wrap;
  font-size: 0.85rem;
  margin-left: 1.35rem;
}

/* Forms */
.form-label { font-weight: 600; margin-bottom: 0.35rem; display: inline-block; }
.form-control,
.form-select,
.form-range,
.form-check-input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  padding: 0.65rem 0.9rem;
}

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input { width: auto; accent-color: var(--accent); }
.form-switch .form-check-input { width: 2.5rem; height: 1.3rem; border-radius: 999px; }
.form-range { padding: 0; }

/* Autonomous UI */
.console-container .console-header { font-weight: 600; display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.metric-card { background: var(--bg-panel); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 1rem; padding: 1.2rem; text-align: center; transition: transform 0.2s ease; }
.metric-card:hover { transform: translateY(-2px); }
.btn-stream-toggle {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.05rem;
}

.btn-stream-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Login */
.auth-shell {
  width: min(420px, 100%);
  margin-top: 2rem;
}

.login-container {
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.8rem);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
}

.login-container .btn-login { border-radius: 0.85rem; }

.logo-section {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-section i {
  font-size: 3rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.6rem;
}

body[data-page="login"] .global-navbar { position: static; margin-bottom: 1rem; }
body[data-page="login"] main { width: 100%; }

/* Responsive */
@media (max-width: 1024px) {
  .global-navbar { position: static; }
  .chat-header { top: 0; }
}

@media (max-width: 768px) {
  .global-navbar { flex-direction: column; align-items: flex-start; }
  .global-navbar nav { width: 100%; }
  .page-shell,
  .container-fluid { padding: 1.25rem; }
  .session-panel,
  .request-panel { margin: 0.75rem; padding: 1rem; }
  .session-meta-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .row { flex-direction: column; }
  .chat-input-area .d-flex { flex-direction: column; gap: 0.75rem; }
  .chat-input { width: 100%; }
  .btn-send { align-self: flex-end; }
  .table { font-size: 0.85rem; }
  body[data-page="login"] { padding-top: 0; }
}
/* ========================================
   ENHANCED TOGGLE SWITCHES & UI IMPROVEMENTS
   ======================================== */

/* Modern Toggle Switches */
.form-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.form-switch .form-check-input {
    width: 3rem;
    height: 1.6rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
}

.form-switch .form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.form-switch .form-check-input::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.2rem;
    height: 1.2rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-switch .form-check-input:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.form-switch .form-check-input:checked::before {
    transform: translateX(1.4rem);
    background: white;
}

.form-switch .form-check-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-check-label {
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Enhanced Form Elements */
.form-select,
.form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 0.75rem;
    padding: 0.65rem 0.9rem;
    transition: all 0.2s ease;
}

.form-select:focus,
.form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* Enhanced Range Sliders */
.form-range {
    width: 100%;
    height: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.3rem;
    height: 1.3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.5);
}

.form-range::-moz-range-thumb {
    width: 1.3rem;
    height: 1.3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.5);
}

/* Enhanced Labels */
.form-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: block;
}

.form-label.small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Settings Section Separators */
.settings-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Enhanced Buttons */
.btn-outline-light {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Enhanced Feature Badges */
.feature-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.feature-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.feature-badge .bi {
    color: var(--accent);
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.badge.up {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge.down {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

/* Enhanced Sidebar */
.sidebar {
    background: var(--bg-panel);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.sidebar h5 {
    color: var(--accent);
    font-weight: 700;
}

/* Enhanced Integration Cards */
.integration-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.integration-card:hover {
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.integration-card-header h5 {
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.integration-card-header .bi {
    color: var(--accent);
}

/* Enhanced Status Indicators */
.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.status-dot.success {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.info {
    background: var(--info);
    box-shadow: 0 0 8px var(--info);
}

.status-dot.warning {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-dot.danger {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Enhanced Tooltips */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
}

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-section {
    animation: fadeIn 0.3s ease-out;
}

/* Enhanced Input Focus States */
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
}

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

.toast-notification.success {
    border-left: 4px solid var(--success);
}

.toast-notification.error {
    border-left: 4px solid var(--danger);
}

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

/* Enhanced Model Display */
.model-selector {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.4rem 0.8rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.model-selector:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
}

/* Accessibility Improvements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* Responsive Enhancements */
@media (max-width: 768px) {
    .form-switch .form-check-input {
        width: 2.5rem;
        height: 1.4rem;
    }
    
    .form-switch .form-check-input::before {
        width: 1rem;
        height: 1rem;
    }
    
    .form-switch .form-check-input:checked::before {
        transform: translateX(1.1rem);
    }
}

/* =====================================================
   ENHANCED TOOL EXECUTION & JSON DISPLAY STYLES
   ===================================================== */

/* Tool Execution Cards */
.tool-execution {
    background: linear-gradient(135deg, var(--bg-card), rgba(102, 126, 234, 0.08));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 0.75rem 0;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.tool-execution:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.tool-execution-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.tool-execution-icon {
    font-size: 1.1rem;
}

.tool-execution-body {
    padding: 0.75rem 1rem;
}

/* Tool Status Badges */
.tool-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-left: 0.5rem;
}

.tool-status.running {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
    animation: pulse 1.5s infinite;
}

.tool-status.success {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.tool-status.error {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* JSON Output - Collapsible/Expandable */
.json-output {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.5rem;
}

.json-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.8rem;
    background: rgba(102, 126, 234, 0.15);
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.json-toggle:hover {
    background: rgba(102, 126, 234, 0.25);
}

.json-toggle::after {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.json-toggle.expanded::after {
    transform: rotate(180deg);
}

.json-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.json-content.expanded {
    max-height: 500px;
    overflow-y: auto;
}

.json-content pre {
    margin: 0;
    padding: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Enhanced Card Styles */
.card-enhanced {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
    overflow: hidden;
    transition: all 0.2s ease;
}

.card-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(4, 7, 24, 0.65);
}

.card-enhanced .card-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-enhanced .card-body {
    padding: 1.25rem;
}

/* Feature Labels/Badges */
.label-enhanced {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.label-enhanced.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
}

.label-enhanced.success {
    background: linear-gradient(135deg, #2e7d32, #388e3c);
    color: white;
}

.label-enhanced.warning {
    background: linear-gradient(135deg, #f57c00, #ff9800);
    color: #000;
}

.label-enhanced.danger {
    background: linear-gradient(135deg, #c62828, #e53935);
    color: white;
}

.label-enhanced.info {
    background: linear-gradient(135deg, #0277bd, #039be5);
    color: white;
}

/* Action Result Cards */
.action-result {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 0.75rem 0;
    overflow: hidden;
}

.action-result.success {
    border-left: 4px solid var(--success);
}

.action-result.error {
    border-left: 4px solid var(--danger);
}

.action-result.warning {
    border-left: 4px solid var(--warning);
}

.action-result-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.15);
    font-weight: 600;
    font-size: 0.85rem;
}

.action-result-body {
    padding: 0.75rem 1rem;
}

/* Expandable Sections */
.expandable-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    overflow: hidden;
}

.expandable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.expandable-header:hover {
    background: rgba(102, 126, 234, 0.1);
}

.expandable-header::after {
    content: '▶';
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.expandable-header.expanded::after {
    transform: rotate(90deg);
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.expandable-content.expanded {
    max-height: 1000px;
}

.expandable-content-inner {
    padding: 1rem;
}

/* Adaptive JSON Prompts */
.json-prompt-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
}

.json-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(102, 126, 234, 0.1);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.json-prompt-header span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.json-prompt-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.json-prompt-content {
    display: none;
    padding: 0.8rem;
}

.json-prompt-content.visible {
    display: block;
}

.json-prompt-preview {
    padding: 0.6rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Enhanced Response Formatting */
.response-message {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 0.5rem 0;
}

.response-message.assistant {
    border-left: 3px solid var(--accent);
}

.response-message.user {
    border-left: 3px solid var(--info);
    background: rgba(60, 185, 255, 0.05);
}

.response-message.system {
    border-left: 3px solid var(--warning);
    background: rgba(255, 193, 7, 0.05);
}

.response-message code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.response-message pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.85rem;
}

.response-message pre code {
    background: none;
    padding: 0;
}

/* =====================================================
   AUTONOMOUS UI ENGINE - ENHANCED STYLES
   Integrated from autonomous_ui_engine.py capabilities
   ===================================================== */

/* ---- DYNAMIC METRIC CARDS ---- */
.metric-card {
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-card));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 1.2rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary), var(--info));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.4);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card i {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: block;
}

.metric-card h6 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.metric-card.pulse .metric-value {
    animation: metricPulse 2s ease-in-out infinite;
}

@keyframes metricPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ---- ENHANCED CONSOLE CONTAINERS ---- */
.console-container {
    background: linear-gradient(180deg, #0a0a1a, #0f0f23);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    font-family: var(--font-mono);
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
    position: relative;
}

.console-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(10, 10, 26, 0.95), transparent);
    pointer-events: none;
    z-index: 1;
}

.console-container .console-header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 26, 0.95);
    padding: 0.5rem;
    margin: -1rem -1rem 0.75rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
}

.console-line {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    line-height: 1.5;
    word-break: break-word;
}

.console-line.info { color: #4fc3f7; background: rgba(79, 195, 247, 0.1); }
.console-line.success { color: #81c784; background: rgba(129, 199, 132, 0.1); }
.console-line.warning { color: #ffb74d; background: rgba(255, 183, 77, 0.1); }
.console-line.error { color: #ef5350; background: rgba(239, 83, 80, 0.1); }

/* ---- ENHANCED AGENTZ ELEMENTS ---- */
.agentz-status {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.agentz-pill {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    min-width: 140px;
    transition: all 0.25s ease;
}

.agentz-pill:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.2));
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.agentz-pill small {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.agentz-pill div {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

/* ---- ENHANCED AGENTZ TAGS ---- */
.agentz-tag {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #e0e6ff;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.agentz-tag:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.35), rgba(118, 75, 162, 0.25));
    transform: scale(1.05);
    border-color: var(--accent);
}

.agentz-tag.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #fff;
    border-color: transparent;
}

.agentz-tag i {
    font-size: 0.7rem;
}

/* ---- ENHANCED SYSTEM CARDS ---- */
.system-card {
    background: linear-gradient(145deg, var(--bg-card), rgba(17, 21, 42, 0.8));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.system-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.system-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.system-card:hover::after {
    opacity: 1;
}

.system-card h6 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #fff;
}

/* ---- STREAM BOX ENHANCEMENTS ---- */
.stream-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
}

.stream-box small {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.stream-box small span {
    color: #fff;
    font-weight: 500;
}

/* ---- INTEGRATION STATS GRID ---- */
.integration-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.integration-stat {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.85rem;
    padding: 0.75rem 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.integration-stat:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

.integration-stat small {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.integration-stat > div {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

/* ---- ENHANCED STATUS INDICATORS ---- */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.3;
}

.status-active, .status-indicator.status-active {
    background: #4caf50;
    color: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    animation: statusPulse 2s infinite;
}

.status-idle, .status-indicator.status-idle {
    background: #ffc107;
    color: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.4);
}

.status-offline, .status-indicator.status-offline {
    background: #ef5350;
    color: #ef5350;
    box-shadow: 0 0 8px rgba(239, 83, 80, 0.4);
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(76, 175, 80, 0.5); }
    50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.8); }
}

/* ---- ENHANCED AGENTZ SERVICES GRID ---- */
.agentz-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.agentz-service {
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    transition: all 0.25s ease;
}

.agentz-service:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.1), rgba(0, 0, 0, 0.25));
}

.agentz-service strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.35rem;
    text-transform: capitalize;
}

.agentz-service > div {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---- ENHANCED AGENTZ LIST ---- */
.agentz-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.agentz-list li {
    padding: 0.6rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.agentz-list li:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.25);
}

.agentz-list li strong {
    display: block;
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 0.2rem;
}

.agentz-list li .text-muted {
    font-size: 0.75rem;
}

/* ---- INTEGRATION LISTS ---- */
.integration-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* ---- ENHANCED TEXT FORMATTING ---- */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-glow {
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.text-highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.15));
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

/* ---- ENHANCED BTN STREAM ---- */
.btn-stream {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #fff;
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    cursor: pointer;
}

.btn-stream:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.2));
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-stream i {
    font-size: 1rem;
}

/* ---- SERVICE STATUS ROWS ---- */
.service-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.service-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.service-row:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

.service-row .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
    flex-shrink: 0;
}

.service-row .status-dot.danger {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
}

.service-row strong {
    flex: 1;
    font-size: 0.9rem;
}

.service-row .service-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: auto;
}

/* ---- ENHANCED BADGES ---- */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge.up {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.25), rgba(76, 175, 80, 0.15));
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.badge.down {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.25), rgba(244, 67, 54, 0.15));
    color: #ef5350;
    border: 1px solid rgba(244, 67, 54, 0.4);
}

.badge.warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25), rgba(255, 193, 7, 0.15));
    color: #ffca28;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.badge.info {
    background: linear-gradient(135deg, rgba(60, 185, 255, 0.25), rgba(60, 185, 255, 0.15));
    color: var(--info);
    border: 1px solid rgba(60, 185, 255, 0.4);
}

/* ---- METRICS GRID ---- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

/* ---- FEATURE BADGES ENHANCEMENTS ---- */
.feature-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.feature-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.feature-badge:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

.feature-badge i {
    font-size: 0.8rem;
    color: var(--accent);
}

.feature-badge .badge-pill {
    background: rgba(102, 126, 234, 0.3);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    margin-left: 0.2rem;
}

/* ---- ANIMATED LOADING STATES ---- */
.loading-shimmer {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* ---- ROW LAYOUT FIX ---- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem;
}

.row > [class*="col-"] {
    padding: 0.5rem;
}

.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }

@media (max-width: 768px) {
    .col-md-4, .col-md-6 { flex: 0 0 100%; max-width: 100%; }
}

/* ---- PANEL ENHANCEMENTS ---- */
.panel {
    background: var(--bg-panel);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--panel-shadow);
}

.panel h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel h4 i {
    color: var(--accent);
}

/* ---- CONTEXT INDICATOR ---- */
.context-indicator {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.75rem;
}

.context-indicator i {
    font-size: 0.7rem;
}

/* ---- MODEL SELECTOR ---- */
.model-selector {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.75rem;
}

.model-selector:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: var(--accent);
}

/* ==========================================
   Memory Spine Integration Styles v1.0
   ========================================== */

/* Memory sidebar */
.memory-sidebar {
    position: fixed;
    right: 0;
    top: 60px;
    width: 320px;
    height: calc(100vh - 60px);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-left: 1px solid #dee2e6;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.memory-sidebar.hidden {
    transform: translateX(100%);
}

.memory-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.memory-sidebar-header h6 {
    margin: 0;
    font-weight: 600;
}

.memory-sidebar-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

/* Memory toggle button */
.memory-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.memory-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Memory stats cards */
.memory-stats-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: transform 0.2s ease;
}

.memory-stats-card:hover {
    transform: translateY(-2px);
}

.memory-stats-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.memory-stats-card small {
    color: #6c757d;
    font-weight: 500;
}

/* Memory search results */
.memory-result-item {
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.memory-result-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.15);
}

.memory-result-item .score {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 600;
}

/* Memory panel in dashboard */
#memorySpinePanel .card {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-radius: 12px;
}

#memorySpinePanel .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0 !important;
}

#memorySpinePanel .card-header h5 {
    font-weight: 600;
}

/* Status indicators */
.memory-status-online {
    color: #28a745;
}

.memory-status-offline {
    color: #dc3545;
}

.memory-status-warning {
    color: #ffc107;
}

/* Memory timeline */
.memory-timeline-item {
    position: relative;
    padding-left: 20px;
    margin-bottom: 15px;
}

.memory-timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #667eea;
}

.memory-timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 15px;
    width: 2px;
    height: calc(100% + 5px);
    background: #e9ecef;
}

.memory-timeline-item:last-child::after {
    display: none;
}

/* ============================================================
   CHATHUB ENHANCED UI - 2026-01-18
   Better cards, panels, tool displays, response formatting
   ============================================================ */

/* Response Cards */
.response-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.5rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.response-card.thinking {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(145deg, rgba(30, 27, 15, 0.95), rgba(45, 40, 25, 0.9));
}

.response-card.tool-call {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(145deg, rgba(15, 35, 30, 0.95), rgba(20, 50, 40, 0.9));
}

.response-card.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(145deg, rgba(40, 15, 15, 0.95), rgba(50, 20, 20, 0.9));
}

.response-card.success {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(145deg, rgba(15, 40, 25, 0.95), rgba(20, 55, 35, 0.9));
}

/* Card Headers */
.card-header-enhanced {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.75rem;
}

.card-header-enhanced .icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.9rem;
}

.card-header-enhanced .icon.thinking { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.card-header-enhanced .icon.tool { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.card-header-enhanced .icon.error { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.card-header-enhanced .icon.success { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.card-header-enhanced .icon.info { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.card-header-enhanced .title {
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.card-header-enhanced .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Tool Execution Panel */
.tool-execution-panel {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
}

.tool-execution-panel .tool-name {
  color: #10b981;
  font-weight: 600;
}

.tool-execution-panel .tool-params {
  color: #94a3b8;
  margin-top: 0.25rem;
}

.tool-execution-panel .tool-result {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.tool-execution-panel .tool-duration {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Action Buttons Panel */
.action-buttons-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

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

.action-btn.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

.action-btn.secondary {
  background: rgba(71, 85, 105, 0.5);
  border-color: rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.action-btn.success {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
  color: #22c55e;
}

.action-btn.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reasoning Panel */
.reasoning-panel {
  background: linear-gradient(145deg, rgba(45, 35, 15, 0.6), rgba(55, 45, 20, 0.5));
  border-left: 3px solid #fbbf24;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: #fcd34d;
}

.reasoning-panel .reasoning-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #d97706;
  margin-bottom: 0.25rem;
}

/* Code Block Enhancements */
.code-block-enhanced {
  background: #0d1117;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.code-block-enhanced .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.code-block-enhanced .code-lang {
  font-size: 0.7rem;
  color: #818cf8;
  text-transform: uppercase;
}

.code-block-enhanced .copy-btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: rgba(99, 102, 241, 0.2);
  border: none;
  border-radius: 4px;
  color: #a5b4fc;
  cursor: pointer;
}

.code-block-enhanced pre {
  margin: 0;
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.8rem;
}

/* Status Indicators */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.4rem;
}

.status-dot.active { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-dot.pending { background: #fbbf24; animation: pulse 1.5s infinite; }
.status-dot.error { background: #ef4444; }
.status-dot.idle { background: #64748b; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Execution Progress */
.execution-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  margin: 0.5rem 0;
}

.execution-progress .progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.execution-progress .progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.3s ease;
}

.execution-progress .progress-text {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* Model Badge */
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
}

.model-badge.premium {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}

.model-badge.flagship {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.model-badge.fast {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

/* Session Coordination Panel */
.session-panel {
  background: linear-gradient(145deg, rgba(20, 25, 45, 0.95), rgba(30, 35, 55, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

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

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

.session-panel .session-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  font-size: 0.8rem;
}

/* Markdown Enhancement */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.3rem;
  margin-top: 1rem;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 1.5rem;
}

.markdown-body li {
  margin: 0.25rem 0;
}

.markdown-body blockquote {
  border-left: 3px solid #6366f1;
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: #94a3b8;
  font-style: italic;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
}

.markdown-body th, .markdown-body td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.markdown-body th {
  background: rgba(99, 102, 241, 0.1);
  font-weight: 600;
}

/* CHAOZCODE CLEAN NAVBAR CSS */
.navbar-chaoz {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
}

.navbar-chaoz .nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
}

.navbar-chaoz .brand {
  color: #f8fafc;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-chaoz .nav-links {
  display: flex;
  gap: 0.75rem;
}

.navbar-chaoz .nav-link {
  color: rgba(248, 250, 252, 0.8);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.navbar-chaoz .nav-link:hover,
.navbar-chaoz .nav-link.active {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

.navbar-chaoz .status {
  color: #22c55e;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.navbar-chaoz .status::before {
  content: "●";
  font-size: 0.6rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

body:not(.auth-shell) {
  padding-top: 56px !important;
}

@media (max-width: 768px) {
  .navbar-chaoz .nav-links {
    gap: 0.5rem;
  }
  .navbar-chaoz .nav-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
  .navbar-chaoz .brand span:last-child {
    display: none;
  }
}

@media (max-width: 480px) {
  .navbar-chaoz {
    height: 48px;
    padding: 0 0.75rem;
  }
  .navbar-chaoz .nav-link {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }
  .navbar-chaoz .status span {
    display: none;
  }
  body:not(.auth-shell) {
    padding-top: 48px !important;
  }
}