/*
Nexora Main Styles
Component styles built on design tokens
Version: 4.0 | Updated: 3 October 2026
*/

@import "./tokens.css";

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-ui);
  background-color: var(--bg-main, #11212D);
  color: var(--text, #CCD0CF);
}

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

button {
  cursor: pointer;
}

.nexora-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px 18px;
  background: rgba(12, 23, 34, 0.92);
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  color: #eaf2ff;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-wordmark {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.06em;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  margin: 0 6px 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.7);
}

.workspace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace-chip,
.sidebar-item {
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(148, 163, 184, 0.06);
  color: #eaf2ff;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  transition: 120ms ease;
}

.workspace-chip.active,
.sidebar-item:hover,
.workspace-chip:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.26), rgba(45, 212, 191, 0.18));
  border-color: rgba(96, 165, 250, 0.45);
}

.workspace-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.header-left,
.header-right,
.connect-indicator,
.status-panel,
.route-summary,
.panel-header-row,
.task-actions,
.inline-actions,
.field-row,
.routing-header,
.meter-line,
.decision-row {
  display: flex;
  align-items: center;
}

.header-left,
.header-right {
  gap: 12px;
}

.workspace-pill,
.pill-button,
.ghost-button,
.primary-button,
.secondary-button,
.mode-button,
.route-chip,
.status-badge {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-weight: 600;
}

.workspace-pill,
.pill-button {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  padding: 8px 12px;
}

.ghost-button,
.secondary-button {
  background: rgba(15, 23, 42, 0.03);
  color: var(--text);
  padding: 9px 14px;
}

.primary-button {
  background: linear-gradient(135deg, #5b6cf1 0%, #30c5d6 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.25);
}

.secondary-button {
  padding: 9px 14px;
}

.connect-indicator {
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #32d583;
  box-shadow: 0 0 10px rgba(50, 213, 131, 0.7);
}

.workspace-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4f46e5;
  font-weight: 700;
}

.eyebrow.small {
  margin-bottom: 6px;
}

.workspace-intro h1,
.panel-card h2 {
  margin: 0;
  letter-spacing: -0.05em;
}

.workspace-intro h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.status-panel {
  gap: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 10px 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(50, 213, 131, 0.12);
  border-color: rgba(50, 213, 131, 0.25);
  color: #0a7a45;
}

.status-badge.muted {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.2);
}

.main-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  overflow-x: auto;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.tab.active {
  background: rgba(99, 102, 241, 0.08);
  color: #1f2a44;
  border-color: rgba(99, 102, 241, 0.18);
}

.content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
  gap: 20px;
  min-height: 0;
}

.central-pane,
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.04);
}

.compact-panel {
  padding: 18px 20px;
}

.panel-header-row {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  gap: 18px;
}

.field-row.two-up>.field {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  color: var(--text);
  font-weight: 600;
}

.field-input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.04);
  padding: 10px 12px;
  color: var(--text);
}

.textarea {
  min-height: 130px;
  resize: vertical;
}

.routing-engine {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.02);
  border-radius: 18px;
  padding: 16px;
}

.routing-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mode-toggle {
  display: inline-flex;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.4);
}

.mode-button {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
  min-width: 92px;
}

.mode-button.active {
  background: rgba(79, 70, 229, 0.08);
  color: #1f2a44;
}

.route-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.route-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.42);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
}

.route-card.selected {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(45, 212, 191, 0.1));
  border-color: rgba(79, 70, 229, 0.25);
}

.route-name {
  font-weight: 700;
}

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

.model-row {
  margin-top: 14px;
}

.policy-banner {
  border: 1px solid rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.06);
  color: #14532d;
  border-radius: 12px;
  padding: 12px 14px;
}

.task-actions,
.inline-actions {
  justify-content: space-between;
  gap: 12px;
}

.empty-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 220px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2rem;
}

.plan-visual {
  min-height: 220px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-step {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  padding: 16px;
}

.plan-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  margin-bottom: 10px;
  font-weight: 700;
}

.plan-step p {
  margin-top: 6px;
  color: var(--text-muted);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.02);
}

.timeline-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.12);
  font-weight: 700;
}

.timeline-item.completed .timeline-icon {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

.timeline-item.active .timeline-icon {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.timeline-stage {
  font-weight: 700;
  margin-bottom: 2px;
}

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

.policy-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.policy-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.policy-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.policy-tag.allow {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.policy-tag.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.policy-tag.info {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.code-block,
.test-results,
.evidence-box,
.decision-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-header {
  font-weight: 700;
  margin-bottom: 6px;
}

.code-block pre {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #e2e8f0;
  overflow-x: auto;
  font-family: var(--font-code);
}

:root.light .code-block pre {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.result-row,
.metric-row,
.decision-row,
.meter-line {
  justify-content: space-between;
  gap: 12px;
}

.result-row,
.metric-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.03);
}

.result-row.success {
  background: rgba(34, 197, 94, 0.06);
}

.result-row.warning {
  background: rgba(245, 158, 11, 0.06);
}

.metric-row,
.decision-row,
.meter-line {
  display: flex;
  align-items: center;
}

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

.side-panel {
  gap: 16px;
}

.inspector-box {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 18px 16px;
}

.decision-box {
  margin-top: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.02);
  border-radius: 12px;
}

.decision-box.compact {
  gap: 8px;
}

.meter-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.meter-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.meter-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #5b6cf1 0%, #2dd4bf 100%);
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 220px;
  max-width: 320px;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 20px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.96);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.2);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.2);
}

.toast.warning {
  border-color: rgba(245, 158, 11, 0.2);
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .nexora-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  }

  .content-shell {
    grid-template-columns: 1fr;
  }

  .route-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace-main {
    padding: 12px;
  }

  .topbar,
  .workspace-intro,
  .panel-header-row,
  .task-actions,
  .inline-actions,
  .routing-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-left,
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .field-row.two-up {
    flex-direction: column;
  }
}

/* Streaming Typewriter Cursor & Real-time Indicator */
.streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  background-color: var(--color-brand-cyan, #00f0ff);
  vertical-align: middle;
  animation: stream-blink 0.8s infinite;
  box-shadow: 0 0 8px var(--color-brand-cyan, #00f0ff);
  border-radius: 1px;
}

@keyframes stream-blink {

  0%,
  100% {
    opacity: 1;
    transform: scaleY(1);
  }

  50% {
    opacity: 0;
    transform: scaleY(0.8);
  }
}

.streaming-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.1);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.3);
  margin-bottom: 8px;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.5px;
}

/* ========================================================================== */
/* Visual Diff Viewer (GitHub-Style Side-by-Side & Unified Diffs)             */
/* ========================================================================== */

.visual-diff-component {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-main, #141416);
  color: var(--text-light, #e2e8f0);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.visual-diff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(22, 23, 27, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.diff-mode-switcher {
  display: inline-flex;
  background: rgba(10, 10, 12, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.diff-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.diff-mode-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.diff-mode-btn.active {
  background: var(--brand, #6366f1);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.4);
}

.diff-summary-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.diff-badge.add {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.diff-badge.del {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.diff-badge.info {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.diff-view-pane {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.diff-file-block {
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.diff-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: rgba(30, 31, 38, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  font-size: 11px;
}

.diff-file-name {
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  line-height: 1.5;
}

.diff-gutter-head,
.diff-side-head {
  padding: 5px 8px;
  background: rgba(18, 19, 23, 0.9);
  color: #64748b;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.diff-side-head.original {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: #f87171;
}

.diff-side-head.modified {
  color: #4ade80;
}

.diff-hunk-cell {
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
  padding: 4px 12px;
  font-style: italic;
  font-size: 11px;
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}

.diff-line-num {
  width: 48px;
  min-width: 48px;
  padding: 1px 8px;
  text-align: right;
  color: #475569;
  user-select: none;
  -webkit-user-select: none;
  background: rgba(15, 16, 20, 0.6);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10px;
  vertical-align: top;
  box-sizing: border-box;
}

.diff-line-num::before {
  content: attr(data-line);
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.diff-file-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 24px;
  box-sizing: border-box;
}

.diff-btn.icon-only {
  width: 24px;
  min-width: 24px;
  padding: 0;
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.25);
}

.diff-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.diff-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}

:root.light .diff-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

:root.light .diff-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

:root.light .diff-btn.active {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #38bdf8;
}

:root.light .diff-btn.copied {
  background: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}

.diff-line-num.del {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.diff-line-num.add {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.diff-line-num.empty {
  background: rgba(15, 16, 20, 0.4);
}

.diff-code-cell {
  padding: 1px 8px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  vertical-align: top;
}

.diff-split-table .diff-code-cell:first-of-type {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.diff-code-cell.del {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.diff-code-cell.add {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.diff-code-cell.empty {
  background: rgba(15, 16, 20, 0.4);
}

.diff-row.diff-del-row {
  background: rgba(239, 68, 68, 0.1);
}

.diff-row.diff-add-row {
  background: rgba(34, 197, 94, 0.1);
}

.diff-op {
  display: inline-block;
  width: 12px;
  font-weight: 700;
  user-select: none;
}

.diff-code-cell.del .diff-op {
  color: #f87171;
}

.diff-code-cell.add .diff-op {
  color: #4ade80;
}

.diff-empty {
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
  font-style: italic;
}

/* Light Mode Diff Viewer & Code View Polish */
:root.light .visual-diff-component {
  background: #ffffff;
}

:root.light .diff-toolbar {
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

:root.light .diff-modes {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

:root.light .diff-mode-btn {
  color: #475569;
}

:root.light .diff-mode-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

:root.light .diff-mode-btn.active {
  background: var(--brand, #4f46e5);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.35);
}

:root.light .diff-badge.add {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

:root.light .diff-badge.del {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

:root.light .diff-badge.info {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

:root.light .diff-file-block {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

:root.light .diff-file-header {
  background: #f1f5f9 !important;
  border-top: none !important;
  border-bottom: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

:root.light .diff-file-name {
  color: #0369a1 !important;
  font-weight: 600;
}

:root.light .diff-file-name svg {
  stroke: #0284c7 !important;
}

:root.light .diff-code-wrapper {
  background: #ffffff !important;
}

:root.light .diff-table {
  background: #ffffff !important;
}

:root.light .diff-gutter-head,
:root.light .diff-side-head {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 1px solid #cbd5e1;
}

:root.light .diff-side-head.original {
  border-right: 1px solid #cbd5e1;
  color: #b91c1c;
}

:root.light .diff-side-head.modified {
  color: #15803d;
}

:root.light .diff-hunk-cell {
  background: #e0f2fe;
  color: #0369a1;
  border-top: 1px solid #bae6fd;
  border-bottom: 1px solid #bae6fd;
}

:root.light .diff-line-num {
  background: #f8fafc !important;
  color: #64748b !important;
  border-right: 1px solid #e2e8f0 !important;
  font-weight: 500;
}

:root.light .diff-line-num.del {
  background: #fee2e2;
  color: #b91c1c;
}

:root.light .diff-line-num.add {
  background: #dcfce7;
  color: #15803d;
}

:root.light .diff-line-num.empty {
  background: #f8fafc;
}

:root.light .diff-code-cell {
  color: #0f172a !important;
  background: #ffffff;
}

:root.light .diff-split-table .diff-code-cell:first-of-type {
  border-right: 1px solid #e2e8f0;
}

:root.light .diff-code-cell.del {
  background: #fef2f2;
  color: #991b1b;
}

:root.light .diff-code-cell.add {
  background: #f0fdf4;
  color: #166534;
}

:root.light .diff-code-cell.empty {
  background: #f8fafc;
}

:root.light .diff-row.diff-del-row {
  background: #fef2f2;
}

:root.light .diff-row.diff-add-row {
  background: #f0fdf4;
}

:root.light .diff-empty {
  color: #64748b;
}

/* ========================================================================== */
/* Antigravity-Style Interactive Tool Cards & Chain of Thought UI             */
/* ========================================================================== */

.tool-call-card {
  margin: 10px 0;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 20, 26, 0.75);
  backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-call-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.tool-call-card.executing {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}

.tool-call-card.success {
  border-color: rgba(34, 197, 94, 0.3);
}

.tool-call-card.failed {
  border-color: rgba(239, 68, 68, 0.35);
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s ease;
}

.tool-card-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tool-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tool-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-icon.pulsing {
  animation: tool-pulse 1.4s infinite ease-in-out;
}

@keyframes tool-pulse {

  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px #00f0ff);
  }

  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px #00f0ff);
  }
}

.tool-name {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: #38bdf8;
  white-space: nowrap;
}

.tool-args {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  opacity: 0.85;
}

.tool-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tool-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
}

.tool-badge.badge-running {
  background: rgba(0, 240, 255, 0.15);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.tool-badge.badge-completed {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.tool-badge.badge-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.tool-chevron {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease;
  user-select: none;
}

.tool-call-card.collapsed .tool-chevron {
  transform: rotate(-90deg);
}

.tool-call-card.collapsed .tool-card-body {
  display: none;
}

.tool-card-body {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  background: rgba(10, 11, 15, 0.9);
}

.tool-terminal {
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.5;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Light Mode Tool Cards */
:root.light .tool-call-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

:root.light .tool-call-card:hover {
  border-color: #94a3b8;
}

:root.light .tool-call-card.executing {
  border-color: #0284c7;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.15);
}

:root.light .tool-call-card.success {
  border-color: #86efac;
}

:root.light .tool-call-card.failed {
  border-color: #fca5a5;
}

:root.light .tool-card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

:root.light .tool-card-header:hover {
  background: #f1f5f9;
}

:root.light .tool-name {
  color: #0369a1;
  font-weight: 700;
}

:root.light .tool-args {
  color: #475569;
}

:root.light .tool-badge.badge-running {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #7dd3fc;
}

:root.light .tool-badge.badge-completed {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

:root.light .tool-badge.badge-failed {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

:root.light .tool-card-body {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

:root.light .tool-terminal {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
}

/* Chain of Thought / Thinking Accordion */
.thought-accordion {
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid rgba(168, 85, 247, 0.25);
  background: rgba(168, 85, 247, 0.04);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.thought-accordion:hover {
  border-color: rgba(168, 85, 247, 0.4);
}

.thought-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: #c084fc;
  list-style: none;
  background: rgba(255, 255, 255, 0.01);
}

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

.thought-sparkle {
  font-size: 13px;
  animation: sparkle-glow 2s infinite ease-in-out;
}

@keyframes sparkle-glow {

  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(0 0 4px #c084fc);
  }
}

.thought-chevron {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.thought-accordion[open] .thought-chevron {
  transform: rotate(180deg);
}

.thought-body {
  padding: 10px 14px;
  font-size: 12.5px;
  color: #94a3b8;
  border-top: 1px solid rgba(168, 85, 247, 0.12);
  line-height: 1.6;
}

/* Light Mode Thought Accordion */
:root.light .thought-accordion {
  background: #faf5ff;
  border: 1px solid #d8b4fe;
}

:root.light .thought-accordion:hover {
  border-color: #c084fc;
}

:root.light .thought-summary {
  background: #f3e8ff;
  color: #7e22ce;
}

:root.light .thought-chevron {
  color: #6b21a8;
}

:root.light .thought-body {
  color: #1e293b;
  border-top: 1px solid #e9d5ff;
  background: #faf5ff;
}

/* ==========================================================================
   Phase 4: Inline Policy Approval Card & Workspace File Explorer
   ========================================================================== */

/* Inline Policy Approval Card */
.inline-approval-card {
  margin: 14px 0;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(30, 24, 15, 0.95), rgba(20, 17, 12, 0.98));
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 12px rgba(245, 158, 11, 0.08);
  overflow: hidden;
  transition: all 0.2s ease;
}

:root.light .inline-approval-card {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.approval-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
  gap: 10px;
}

.approval-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.approval-icon {
  font-size: 15px;
}

.approval-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.approval-title {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
  letter-spacing: 0.2px;
}

:root.light .approval-title {
  color: #b45309;
}

.approval-subtitle {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.approval-badge {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2.5px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.approval-details {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}

.approval-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.approval-detail-row .detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  width: 48px;
  flex-shrink: 0;
}

.approval-detail-row .detail-value {
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-detail-row .detail-value.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

:root.light .approval-detail-row .detail-value.mono {
  background: #f1f5f9;
}

.approval-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 12px 14px;
}

.approval-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.approval-btn.approve-btn {
  background: #10b981;
  color: #ffffff;
}

.approval-btn.approve-btn:hover {
  background: #059669;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.approval-btn.deny-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.approval-btn.deny-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

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

.approval-status-done {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.approval-status-done.status-approved {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.approval-status-done.status-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Phase 3: Mathematical Formula & Symbol Typography
   ========================================================================== */

/* Block Equations: $$ ... $$ */
.math-block {
  margin: 14px 0;
  padding: 14px 18px;
  background: rgba(18, 19, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.math-block:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(22, 23, 30, 0.85);
}

:root.light .math-block {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

:root.light .math-block:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

/* Inline Math: $ ... $ */
.math-inline {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px;
  font-family: 'KaTeX_Math', 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 1.05em;
  color: #f1f5f9;
  vertical-align: baseline;
  line-height: 1.2;
}

:root.light .math-inline {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

/* Fallback Math Display styling */
.math-display {
  display: inline-block;
  font-family: 'KaTeX_Math', 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 15px;
  color: #f1f5f9;
  letter-spacing: 0.5px;
}

:root.light .math-display {
  color: #0f172a;
}

/* Subscripts and superscripts in math expressions */
.math-inline sub,
.math-block sub {
  font-size: 0.75em;
  vertical-align: sub;
  line-height: 0;
  color: #94a3b8;
}

.math-inline sup,
.math-block sup {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  color: #94a3b8;
}

/* KaTeX Dark-Mode Overrides for maximum clarity */
.katex {
  color: #f1f5f9 !important;
  font-size: 1.08em;
  text-rendering: geometricPrecision;
}

:root.light .katex {
  color: #0f172a !important;
}

.katex-display {
  margin: 6px 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.katex-display>.katex {
  text-align: center;
  max-width: 100%;
}

/* Math block scrollbar */
.math-block::-webkit-scrollbar {
  height: 5px;
}

.math-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

:root.light .math-block::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}