/* Enhanced AI Command Center */

.enh-ai-root {
  --enh-bg: #f6f8fb;
  --enh-surface: #ffffff;
  --enh-surface-soft: #f8fafc;
  --enh-surface-strong: #eef4fb;
  --enh-border: #d7e0ea;
  --enh-border-strong: #b8c6d8;
  --enh-text: #172033;
  --enh-text-mute: #64748b;
  --enh-primary: #2563eb;
  --enh-primary-dark: #1d4ed8;
  --enh-success: #15803d;
  --enh-warning: #b45309;
  --enh-danger: #b91c1c;
  --enh-accent: #0f766e;
  background: var(--enh-bg);
  color: var(--enh-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  min-height: 70vh;
  padding: 14px;
  border: 1px solid #e8eef5;
  border-radius: 8px;
}

.enh-ai-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--enh-surface);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.enh-ai-hero-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.enh-ai-hero-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.enh-ai-hero-kicker {
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.enh-ai-hero-title {
  margin: 0;
  color: var(--enh-text);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.15;
}

.enh-ai-hero-subtitle,
.enh-ai-hero-icon,
.enh-ai-hint {
  display: none;
}

.enh-ai-hero-right {
  display: grid;
  grid-template-columns: minmax(260px, 360px) auto;
  gap: 12px;
  align-items: end;
}

.enh-ai-control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.enh-ai-control-group--status {
  min-width: 108px;
}

.enh-ai-control-label,
.enh-ai-hero-portfolio-label,
.enh-ai-rail-title,
.enh-ai-pane-title {
  margin: 0;
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.enh-ai-portfolio-dropdown {
  min-width: 240px;
}

.enh-ai-portfolio-dropdown .Select-control,
.enh-ai-portfolio-dropdown .Select-menu-outer {
  background: var(--enh-surface) !important;
  border-color: var(--enh-border) !important;
  color: var(--enh-text) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.enh-ai-portfolio-dropdown .Select-value-label,
.enh-ai-portfolio-dropdown .Select-placeholder,
.enh-ai-portfolio-dropdown .Select-input,
.enh-ai-portfolio-dropdown input {
  color: var(--enh-text) !important;
}

.enh-ai-portfolio-dropdown .Select-menu-outer {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14) !important;
}

.enh-ai-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #ecfdf3;
  color: var(--enh-success);
  border: 1px solid #b7e4c7;
  white-space: nowrap;
}

.enh-ai-status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
}

.enh-ai-status-pill[data-state="connecting"] {
  background: #fff7ed;
  color: var(--enh-warning);
  border-color: #fed7aa;
}

.enh-ai-status-pill[data-state="error"],
.enh-ai-status-pill[data-state="closed"] {
  background: #fef2f2;
  color: var(--enh-danger);
  border-color: #fecaca;
}

.enh-ai-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(420px, 1fr) minmax(380px, 520px);
  gap: 12px;
  align-items: stretch;
}

.enh-ai-rail,
.enh-ai-center {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enh-ai-rail,
.enh-ai-pane {
  background: var(--enh-surface);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.enh-ai-rail {
  padding: 12px;
}

.enh-ai-rail-title,
.enh-ai-pane-title {
  margin-bottom: 8px;
}

.enh-ai-rail-title--secondary {
  margin-top: 12px;
}

.enh-ai-skills-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enh-ai-skill-chip {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 9px;
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
  color: var(--enh-text);
  font-size: 12px;
}

.enh-ai-skill-chip[data-active="true"] {
  background: #eff6ff;
  border-color: #93c5fd;
}

.enh-ai-skill-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.enh-ai-skill-chip[data-active="true"] .dot {
  background: var(--enh-primary);
}

.enh-ai-skill-chip .name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-skill-chip .views {
  color: var(--enh-text-mute);
  font-size: 11px;
  white-space: nowrap;
}

.enh-ai-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 390px);
  min-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.enh-ai-quick-prompt {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  background: var(--enh-surface);
  color: var(--enh-text);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.enh-ai-quick-prompt:hover,
.enh-ai-quick-prompt:focus {
  background: #eff6ff;
  border-color: #93c5fd;
  outline: none;
}

.enh-ai-rail--left {
  max-height: calc(100vh - 210px);
  overflow: hidden;
}

.enh-ai-prompt-library-header {
  padding-bottom: 2px;
}

.enh-ai-rail-subtitle {
  margin-top: -3px;
  color: var(--enh-text-mute);
  font-size: 12px;
  line-height: 1.35;
}

.enh-ai-prompt-library {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 5px;
}

.enh-ai-prompt-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.enh-ai-prompt-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--enh-text);
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0;
}

.enh-ai-prompt-section-copy {
  margin-top: -4px;
  color: var(--enh-text-mute);
  font-size: 12px;
  line-height: 1.35;
}

.enh-ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.enh-ai-prompt-card.enh-ai-quick-prompt,
.enh-ai-prompt-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 82px;
  padding: 12px;
  background: var(--enh-surface);
  color: var(--enh-text);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.enh-ai-prompt-card:hover,
.enh-ai-prompt-card:focus {
  background: var(--enh-surface);
  border-color: #93c5fd;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.10);
  outline: none;
  transform: translateY(-1px);
}

.enh-ai-prompt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 21px;
}

.enh-ai-prompt-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.enh-ai-prompt-title {
  min-width: 0;
  overflow: hidden;
  color: var(--enh-text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-prompt-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--enh-text-mute);
  font-size: 12px;
  line-height: 1.32;
}

.enh-ai-history-panel {
  flex: 0 0 auto;
  padding-top: 12px;
  border-top: 1px solid var(--enh-border);
}

.enh-ai-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}

.enh-ai-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  width: 100%;
  padding: 9px 10px;
  background: var(--enh-surface-soft);
  color: var(--enh-text);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.enh-ai-history-item:hover,
.enh-ai-history-item:focus,
.enh-ai-history-item.is-active {
  background: #eff6ff;
  border-color: #93c5fd;
  outline: none;
}

.enh-ai-history-question {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-history-meta {
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.enh-ai-history-answer {
  grid-column: 1 / -1;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--enh-text-mute);
  font-size: 11px;
  line-height: 1.35;
}

.enh-ai-pane {
  padding: 12px;
}

.enh-ai-subtabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  background: var(--enh-surface);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.enh-ai-subtab {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--enh-text-mute);
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.enh-ai-subtab:hover,
.enh-ai-subtab:focus {
  background: #eff6ff;
  color: var(--enh-primary);
  outline: none;
}

.enh-ai-subtab.is-active {
  background: var(--enh-primary);
  color: #ffffff;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.18);
}

.enh-ai-center-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
}

.enh-ai-center-panel.is-active {
  display: flex;
}

.enh-ai-pane--thinking {
  min-height: 420px;
  flex: 1 1 auto;
}

.enh-ai-workflows-panel {
  min-height: 520px;
}

.enh-ai-workflows-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.enh-ai-workflows-title-group {
  min-width: 0;
}

.enh-ai-workflows-toolbar .enh-ai-pane-title {
  margin-bottom: 0;
}

.enh-ai-workflow-context {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--enh-text-mute);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-workflows-refresh {
  min-height: 30px;
  padding: 4px 10px;
  color: var(--enh-text-mute);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.enh-ai-active-workflows-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 66vh;
  min-height: 430px;
  overflow-y: auto;
  padding-right: 2px;
}

.enh-ai-workflow-card {
  overflow: hidden;
  background: var(--enh-surface);
  border: 1px solid var(--enh-border-strong);
  border-left: 3px solid #94a3b8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.enh-ai-workflow-card--success {
  border-left-color: var(--enh-success);
}

.enh-ai-workflow-card--primary {
  border-left-color: var(--enh-primary);
}

.enh-ai-workflow-card--warning {
  border-left-color: var(--enh-warning);
}

.enh-ai-workflow-card--danger {
  border-left-color: var(--enh-danger);
}

.enh-ai-workflow-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--enh-surface-soft);
  border-bottom: 1px solid var(--enh-border);
}

.enh-ai-workflow-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.enh-ai-workflow-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.16);
}

.enh-ai-workflow-dot--success {
  background: var(--enh-success);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.16);
}

.enh-ai-workflow-dot--primary {
  background: var(--enh-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.enh-ai-workflow-dot--warning {
  background: var(--enh-warning);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.16);
}

.enh-ai-workflow-dot--danger {
  background: var(--enh-danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.16);
}

.enh-ai-workflow-id,
.enh-ai-workflow-description {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-workflow-id {
  color: var(--enh-text);
  font-size: 14px;
}

.enh-ai-workflow-description {
  color: var(--enh-text-mute);
  font-size: 12px;
  font-weight: 600;
}

.enh-ai-workflow-status,
.enh-ai-workflow-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 100%;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.enh-ai-workflow-status {
  padding: 3px 7px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
}

.enh-ai-workflow-status--success,
.enh-ai-workflow-badge--success {
  background: #dcfce7;
  color: var(--enh-success);
}

.enh-ai-workflow-status--primary,
.enh-ai-workflow-badge--primary {
  background: #dbeafe;
  color: var(--enh-primary);
}

.enh-ai-workflow-status--warning,
.enh-ai-workflow-badge--warning {
  background: #fef3c7;
  color: var(--enh-warning);
}

.enh-ai-workflow-status--danger,
.enh-ai-workflow-badge--danger {
  background: #fee2e2;
  color: var(--enh-danger);
}

.enh-ai-workflow-status--neutral,
.enh-ai-workflow-badge--neutral {
  background: #e2e8f0;
  color: #475569;
}

.enh-ai-workflow-detail-btn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.enh-ai-workflow-card-body {
  padding: 10px 12px 12px;
}

.enh-ai-workflow-notes {
  display: -webkit-box;
  margin: 0 0 8px;
  max-height: 3.9em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--enh-text);
  font-size: 13px;
  line-height: 1.4;
}

.enh-ai-workflow-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.enh-ai-workflow-badge {
  padding: 4px 7px;
  font-size: 11px;
}

.enh-ai-workflow-progress {
  margin-bottom: 10px;
}

.enh-ai-workflow-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--enh-text-mute);
  font-size: 12px;
  font-weight: 800;
}

.enh-ai-workflow-progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: #e5eaf1;
  border-radius: 4px;
}

.enh-ai-workflow-progress-fill {
  height: 100%;
  min-width: 2px;
  background: #64748b;
}

.enh-ai-workflow-progress-fill--success {
  background: var(--enh-success);
}

.enh-ai-workflow-progress-fill--primary {
  background: var(--enh-primary);
}

.enh-ai-workflow-progress-fill--warning {
  background: var(--enh-warning);
}

.enh-ai-workflow-progress-fill--danger {
  background: var(--enh-danger);
}

.enh-ai-workflow-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.enh-ai-workflow-stat {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 6px;
  row-gap: 2px;
  align-items: center;
}

.enh-ai-workflow-stat i {
  grid-row: 1 / span 2;
  color: var(--enh-text-mute);
}

.enh-ai-workflow-stat-label {
  color: var(--enh-text-mute);
  font-size: 12px;
}

.enh-ai-workflow-stat-value {
  min-width: 0;
  overflow: hidden;
  color: var(--enh-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-workflow-error {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.enh-ai-workflow-error--danger {
  background: #fef2f2;
  color: var(--enh-danger);
}

.enh-ai-workflow-error--warning {
  background: #fff7ed;
  color: var(--enh-warning);
}

.enh-ai-workflow-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--enh-border);
}

.enh-ai-workflow-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.enh-ai-workflow-detail-field {
  padding: 8px;
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
}

.enh-ai-workflow-detail-label,
.enh-ai-workflow-event-time {
  display: block;
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.enh-ai-workflow-detail-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--enh-text);
  font-size: 12px;
  text-overflow: ellipsis;
}

.enh-ai-workflow-detail-title {
  margin: 10px 0 6px;
  color: var(--enh-text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.enh-ai-workflow-step-list,
.enh-ai-workflow-event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enh-ai-workflow-step-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
}

.enh-ai-workflow-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.enh-ai-workflow-step-index--success {
  background: #dcfce7;
  color: var(--enh-success);
}

.enh-ai-workflow-step-index--primary {
  background: #dbeafe;
  color: var(--enh-primary);
}

.enh-ai-workflow-step-index--warning {
  background: #fef3c7;
  color: var(--enh-warning);
}

.enh-ai-workflow-step-index--danger {
  background: #fee2e2;
  color: var(--enh-danger);
}

.enh-ai-workflow-step-name,
.enh-ai-workflow-event-type {
  color: var(--enh-text);
  font-size: 12px;
  font-weight: 800;
}

.enh-ai-workflow-step-description,
.enh-ai-workflow-event-description,
.enh-ai-workflow-detail-empty {
  color: var(--enh-text-mute);
  font-size: 12px;
  line-height: 1.35;
}

.enh-ai-workflow-event-item {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
}

.enh-ai-pane--input {
  flex: 0 0 auto;
}

.enh-ai-thinking-stream,
.enh-ai-a2ui-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.enh-ai-thinking-stream {
  max-height: 58vh;
}

.enh-ai-a2ui-stack {
  max-height: 68vh;
}

.enh-ai-event {
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-left: 3px solid var(--enh-accent);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--enh-text);
  font-size: 13px;
  line-height: 1.45;
  animation: enh-fade-in 0.16s ease-out;
}

.enh-ai-event[data-kind="thinking"] {
  border-left-color: var(--enh-primary);
}

.enh-ai-event[data-kind="tool_start"] {
  border-left-color: var(--enh-warning);
}

.enh-ai-event[data-kind="tool_done"] {
  border-left-color: var(--enh-success);
}

.enh-ai-event[data-kind="tool_error"] {
  background: #fff7ed;
  border-left-color: var(--enh-danger);
}

.enh-ai-event[data-kind="text"] {
  border-left-color: var(--enh-accent);
}

.enh-ai-event .header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.enh-ai-event .header .badge {
  padding: 2px 7px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.enh-ai-event .header .timing {
  margin-left: auto;
  color: #94a3b8;
  font-weight: 600;
}

.enh-ai-event pre {
  max-height: 220px;
  margin: 6px 0 0;
  padding: 8px 9px;
  overflow: auto;
  background: #0f172a;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 11px;
}

.enh-ai-markdown {
  color: var(--enh-text);
  font-size: 13px;
  line-height: 1.58;
}

.enh-ai-markdown > *:first-child {
  margin-top: 0;
}

.enh-ai-markdown > *:last-child {
  margin-bottom: 0;
}

.enh-ai-markdown h1,
.enh-ai-markdown h2,
.enh-ai-markdown h3,
.enh-ai-markdown h4 {
  margin: 14px 0 8px;
  color: var(--enh-text);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.22;
}

.enh-ai-markdown h1 {
  font-size: 20px;
}

.enh-ai-markdown h2 {
  font-size: 17px;
}

.enh-ai-markdown h3 {
  font-size: 15px;
}

.enh-ai-markdown h4 {
  font-size: 14px;
}

.enh-ai-markdown p {
  margin: 0 0 10px;
}

.enh-ai-markdown ul,
.enh-ai-markdown ol {
  margin: 0 0 11px;
  padding-left: 22px;
}

.enh-ai-markdown li {
  margin: 4px 0;
  padding-left: 2px;
}

.enh-ai-markdown strong {
  color: #0f172a;
  font-weight: 800;
}

.enh-ai-markdown em {
  color: #334155;
  font-style: italic;
}

.enh-ai-markdown a {
  color: var(--enh-primary);
  font-weight: 700;
  text-decoration: none;
}

.enh-ai-markdown a:hover,
.enh-ai-markdown a:focus {
  text-decoration: underline;
}

.enh-ai-markdown code {
  padding: 2px 5px;
  border: 1px solid #dbe3ee;
  border-radius: 5px;
  background: #eef4fb;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.enh-ai-markdown pre {
  max-height: 280px;
  margin: 10px 0 12px;
  padding: 10px 11px;
  overflow: auto;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 7px;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.5;
}

.enh-ai-markdown pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.enh-ai-markdown blockquote {
  margin: 10px 0 12px;
  padding: 8px 11px;
  background: #f8fafc;
  border-left: 3px solid var(--enh-primary);
  color: #475569;
}

.enh-ai-markdown hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--enh-border);
}

.enh-ai-markdown-table-wrap {
  max-width: 100%;
  margin: 10px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--enh-border);
  border-radius: 7px;
}

.enh-ai-markdown table {
  width: 100%;
  border-collapse: collapse;
  background: var(--enh-surface);
  font-size: 12px;
}

.enh-ai-markdown th,
.enh-ai-markdown td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--enh-border);
  text-align: left;
  vertical-align: top;
}

.enh-ai-markdown th {
  background: var(--enh-surface-soft);
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.enh-ai-markdown tbody tr:last-child td {
  border-bottom: 0;
}

@keyframes enh-fade-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.enh-ai-textarea {
  width: 100%;
  min-height: 86px;
  padding: 10px 11px;
  resize: vertical;
  background: var(--enh-surface);
  color: var(--enh-text);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
}

.enh-ai-textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

.enh-ai-input-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 8px;
}

.enh-ai-send-btn {
  min-width: 96px;
  border-color: var(--enh-primary) !important;
  background: var(--enh-primary) !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
}

.enh-ai-send-btn:hover,
.enh-ai-send-btn:focus {
  border-color: var(--enh-primary-dark) !important;
  background: var(--enh-primary-dark) !important;
}

.enh-ai-card {
  background: var(--enh-surface);
  border: 1px solid var(--enh-border);
  border-radius: 8px;
  padding: 10px;
  animation: enh-fade-in 0.18s ease-out;
}

.enh-ai-card .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  color: var(--enh-text);
  font-size: 13px;
  font-weight: 800;
}

.enh-ai-card .card-title .icon {
  color: var(--enh-primary);
  font-size: 10px;
}

.enh-ai-card .card-title .tag {
  margin-left: auto;
  color: var(--enh-text-mute);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.enh-ai-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.enh-ai-tile {
  min-width: 0;
  padding: 9px;
  background: var(--enh-surface-soft);
  border: 1px solid var(--enh-border);
  border-radius: 6px;
}

.enh-ai-tile .label {
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.enh-ai-tile .value {
  min-width: 0;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--enh-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.enh-ai-tile[data-tone="success"] .value {
  color: var(--enh-success);
}

.enh-ai-tile[data-tone="warning"] .value {
  color: var(--enh-warning);
}

.enh-ai-tile[data-tone="danger"] .value {
  color: var(--enh-danger);
}

.enh-ai-tile[data-tone="primary"] .value {
  color: var(--enh-primary);
}

.enh-ai-tile[data-tone="accent"] .value {
  color: var(--enh-accent);
}

.enh-ai-mini-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--enh-border);
  border-radius: 7px;
}

.enh-ai-mini-table {
  min-width: 620px;
  width: 100%;
  border-collapse: collapse;
  color: var(--enh-text);
  font-size: 12px;
  table-layout: fixed;
}

.enh-ai-mini-table th,
.enh-ai-mini-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--enh-border);
  text-align: left;
  vertical-align: top;
}

.enh-ai-mini-table th {
  white-space: nowrap;
}

.enh-ai-mini-table th[data-column="status"],
.enh-ai-mini-table td[data-column="status"] {
  width: 96px;
}

.enh-ai-mini-table th[data-column="ticker"],
.enh-ai-mini-table td[data-column="ticker"] {
  width: 72px;
}

.enh-ai-mini-table th[data-column="symbol"],
.enh-ai-mini-table td[data-column="symbol"] {
  width: 68px;
}

.enh-ai-mini-table th[data-column="side"],
.enh-ai-mini-table td[data-column="side"] {
  width: 76px;
}

.enh-ai-mini-table th[data-column="qty"],
.enh-ai-mini-table td[data-column="qty"] {
  width: 54px;
}

.enh-ai-mini-table th[data-column="price"],
.enh-ai-mini-table td[data-column="price"],
.enh-ai-mini-table th[data-column="notional"],
.enh-ai-mini-table td[data-column="notional"],
.enh-ai-mini-table th[data-column="cash_flow"],
.enh-ai-mini-table td[data-column="cash_flow"],
.enh-ai-mini-table th[data-column="realized_pnl"],
.enh-ai-mini-table td[data-column="realized_pnl"] {
  width: 84px;
}

.enh-ai-mini-table th[data-column="updated"],
.enh-ai-mini-table td[data-column="updated"],
.enh-ai-mini-table th[data-column="filled_at"],
.enh-ai-mini-table td[data-column="filled_at"] {
  width: 142px;
}

.enh-ai-mini-table td[data-column="workflow"] .enh-ai-cell-text {
  display: -webkit-box;
  max-height: 3.2em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.6;
}

.enh-ai-mini-table td:not([data-column="workflow"]) .enh-ai-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-cell-text[data-tone="success"] {
  color: var(--enh-success);
  font-weight: 800;
}

.enh-ai-cell-text[data-tone="warning"] {
  color: var(--enh-warning);
  font-weight: 800;
}

.enh-ai-cell-text[data-tone="danger"] {
  color: var(--enh-danger);
  font-weight: 800;
}

.enh-ai-mini-table th {
  background: var(--enh-surface-soft);
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.enh-ai-mini-table tr:hover td {
  background: #f1f5f9;
}

.enh-ai-json-preview {
  max-height: 280px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  background: #0f172a;
  border-radius: 7px;
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.45;
}

.enh-ai-workflow-list {
  display: flex;
  flex-direction: column;
}

.enh-ai-workflow-item {
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid var(--enh-border);
}

.enh-ai-workflow-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.enh-ai-workflow-item:last-child {
  padding-bottom: 0;
}

.enh-ai-workflow-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.enh-ai-workflow-ticker {
  min-width: 0;
  overflow: hidden;
  color: var(--enh-text);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enh-ai-workflow-title {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--enh-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.enh-ai-workflow-updated {
  margin-top: 4px;
  color: var(--enh-text-mute);
  font-size: 11px;
  font-weight: 600;
}

.enh-ai-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.enh-ai-chip[data-tone="success"] {
  background: #dcfce7;
  color: var(--enh-success);
}

.enh-ai-chip[data-tone="warning"] {
  background: #fef3c7;
  color: var(--enh-warning);
}

.enh-ai-chip[data-tone="danger"] {
  background: #fee2e2;
  color: var(--enh-danger);
}

.enh-ai-chip[data-tone="neutral"] {
  background: #e2e8f0;
  color: #475569;
}

.enh-ai-chip[data-tone="primary"] {
  background: #dbeafe;
  color: var(--enh-primary);
}

.enh-ai-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 14px;
  border: 1px dashed var(--enh-border-strong);
  border-radius: 8px;
  background: var(--enh-surface-soft);
  color: var(--enh-text-mute);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1180px) {
  .enh-ai-workspace {
    grid-template-columns: minmax(320px, 420px) 1fr;
  }

  .enh-ai-rail--right {
    grid-column: 1 / -1;
  }

  .enh-ai-a2ui-stack {
    max-height: 360px;
  }
}

@media (max-width: 860px) {
  .enh-ai-root {
    padding: 10px;
  }

  .enh-ai-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .enh-ai-hero-right,
  .enh-ai-workspace {
    grid-template-columns: 1fr;
  }

  .enh-ai-control-group--status {
    min-width: 0;
  }

  .enh-ai-pane--thinking {
    min-height: 320px;
  }

  .enh-ai-workflow-card-header,
  .enh-ai-workflow-heading {
    align-items: flex-start;
  }

  .enh-ai-workflow-card-header {
    flex-direction: column;
  }

  .enh-ai-workflow-detail-btn {
    align-self: flex-start;
  }

  .enh-ai-workflow-stats,
  .enh-ai-workflow-detail-grid,
  .enh-ai-workflow-event-item {
    grid-template-columns: 1fr;
  }

  .enh-ai-workflow-step-item {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .enh-ai-workflow-step-item .enh-ai-workflow-status {
    grid-column: 2;
    justify-self: start;
  }

  .enh-ai-thinking-stream,
  .enh-ai-a2ui-stack {
    max-height: 360px;
  }

  .enh-ai-rail--left {
    max-height: none;
  }

  .enh-ai-prompt-library {
    max-height: 520px;
  }
}

@media (max-width: 520px) {
  .enh-ai-hero-title {
    font-size: 20px;
  }

  .enh-ai-grid-4 {
    grid-template-columns: 1fr;
  }

  .enh-ai-status-pill {
    width: 100%;
  }

  .enh-ai-prompt-grid {
    grid-template-columns: 1fr;
  }
}
