/**
 * AutoTrader trading cockpit — 3-column layout, status bar, density (~20% tighter than legacy tab UI).
 */
.at-cockpit {
  --at-green: #3fb950;
  --at-red: #f85149;
  --at-amber: #d4a72c;
  --at-violet: #8957e5;
  --at-blue: #58a6ff;
  --at-muted: #8b949e;
  --at-border: #30363d;
  --at-surface: #161b22;
  --at-surface2: #0d1117;
  font-size: 12px;
  color: #c9d1d9;
  box-sizing: border-box;
}

.at-cockpit *,
.at-cockpit *::before,
.at-cockpit *::after {
  box-sizing: border-box;
}

.at-cockpit-statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--at-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #1c2128 0%, var(--at-surface2) 100%);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.06), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.at-cockpit-statusbar__title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.at-cockpit-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--at-green);
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.65);
  animation: at-pulse 1.8s ease-in-out infinite;
}

.at-cockpit-pulse--warn {
  background: var(--at-amber);
  box-shadow: 0 0 8px rgba(212, 167, 44, 0.55);
}

.at-cockpit-pulse--bad {
  background: var(--at-red);
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.55);
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .at-cockpit-pulse {
    animation: none;
  }
}

@keyframes at-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.92);
  }
}

.at-cockpit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 10px;
  color: var(--at-muted);
}

.at-cockpit-chip {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--at-border);
  background: var(--at-surface);
  white-space: nowrap;
}

.at-cockpit-chip strong {
  color: #e6edf3;
  font-weight: 600;
}

.at-cockpit-main {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(200px, 260px);
  gap: 8px;
  align-items: start;
  min-height: 280px;
}

@media (max-width: 1100px) {
  .at-cockpit-main {
    grid-template-columns: 1fr;
  }
}

.at-cockpit-col {
  border: 1px solid var(--at-border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--at-surface2);
  min-height: 120px;
}

.at-cockpit-col h3 {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--at-blue);
}

.at-cockpit-col--engine {
  box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.05);
}

.at-cockpit-col--intel {
  border-color: rgba(137, 87, 229, 0.35);
  box-shadow: 0 0 20px rgba(137, 87, 229, 0.06);
}

.at-cockpit-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.at-cockpit-actions .primary,
.at-cockpit-actions .at-cockpit-btn {
  width: 100%;
  justify-content: center;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--at-border);
  background: var(--at-surface);
  color: #e6edf3;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.at-cockpit-actions .primary {
  background: linear-gradient(180deg, #238636 0%, #196c2e 100%);
  border-color: #238636;
  box-shadow: 0 0 12px rgba(35, 134, 54, 0.25);
}

.at-cockpit-actions .primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(35, 134, 54, 0.35);
}

.at-cockpit-actions .at-cockpit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--at-blue);
}

.at-cockpit-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.at-cockpit-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
}

.at-cockpit-mode button {
  font-size: 9px;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid var(--at-border);
  background: var(--at-surface);
  color: var(--at-muted);
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.at-cockpit-mode button:hover:not(:disabled) {
  border-color: var(--at-blue);
  color: #e6edf3;
}

.at-cockpit-mode button[data-at-mode-active='1'] {
  color: #e6edf3;
  border-color: var(--at-blue);
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.2);
}

.at-cockpit-mode button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.at-cockpit-gates {
  font-size: 10px;
  color: var(--at-muted);
  margin-bottom: 8px;
  line-height: 1.35;
}

.at-cockpit-gates ul {
  margin: 4px 0 0;
  padding-left: 16px;
}

.at-cockpit-blocked {
  border: 1px solid rgba(248, 81, 73, 0.45);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(248, 81, 73, 0.06);
  font-size: 10px;
}

.at-cockpit-blocked__title {
  font-weight: 700;
  color: var(--at-red);
  margin-bottom: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.at-cockpit-fix-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.at-cockpit-fix-row button {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--at-border);
  background: var(--at-surface);
  color: var(--at-blue);
  cursor: pointer;
}

.at-cockpit-fix-row button:hover {
  border-color: var(--at-blue);
}

.at-cockpit-details {
  margin-bottom: 6px;
  border: 1px solid var(--at-border);
  border-radius: 6px;
  background: var(--at-surface);
}

.at-cockpit-details > summary {
  padding: 6px 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  color: var(--at-muted);
  list-style: none;
}

.at-cockpit-details > summary::-webkit-details-marker {
  display: none;
}

.at-cockpit-details[open] > summary {
  color: #e6edf3;
  border-bottom: 1px solid var(--at-border);
}

.at-cockpit-details__body {
  padding: 8px;
  max-height: 320px;
  overflow: auto;
}

.at-cockpit-engine-scroll {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.at-cockpit-intel {
  font-size: 10px;
  color: var(--at-muted);
  line-height: 1.4;
}

.at-cockpit-intel strong {
  color: #e6edf3;
}

.at-cockpit-settings-form label {
  display: block;
  font-size: 9px;
  color: var(--at-muted);
  margin-top: 6px;
}

.at-cockpit-settings-form input[type='text'],
.at-cockpit-settings-form input[type='number'] {
  width: 100%;
  padding: 5px 6px;
  font-size: 11px;
  margin-top: 2px;
  background: var(--at-surface2);
  border: 1px solid var(--at-border);
  color: #e6edf3;
  border-radius: 4px;
}

.at-cockpit-settings-form .at-cockpit-settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}

.at-cockpit-footnote {
  font-size: 9px;
  color: #6e7681;
  margin-top: 6px;
}

/* Strategy transcript + pipeline */
.at-cockpit-transcript {
  border: 1px solid var(--at-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--at-surface2);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.at-cockpit-transcript--flash {
  border-color: rgba(88, 166, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.2), 0 0 24px rgba(88, 166, 255, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .at-cockpit-transcript--flash {
    transition: none;
  }
}

.at-cockpit-transcript__meta {
  font-size: 9px;
  color: var(--at-muted);
  margin-bottom: 10px;
  line-height: 1.45;
  max-width: 72ch;
}

.at-cockpit-transcript-card {
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--at-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.at-cockpit-transcript-card:hover {
  border-color: #444c56;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.at-cockpit-transcript-card:last-child {
  margin-bottom: 0;
}

.at-cockpit-outcome-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.at-cockpit-outcome-badge--skipped {
  background: rgba(158, 106, 3, 0.25);
  color: #e3b341;
  border: 1px solid rgba(212, 167, 44, 0.35);
}

.at-cockpit-outcome-badge--evaluated {
  background: rgba(35, 134, 54, 0.2);
  color: var(--at-green);
  border: 1px solid rgba(63, 185, 80, 0.35);
}

.at-cockpit-pipeline {
  font-size: 10px;
  color: var(--at-blue);
  margin-top: 8px;
  line-height: 1.5;
  max-width: 72ch;
  font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
}

.at-cockpit-actions .primary:focus-visible,
.at-cockpit-actions .at-cockpit-btn:focus-visible,
.at-cockpit-mode button:focus-visible,
.at-cockpit-fix-row button:focus-visible {
  outline: 2px solid var(--at-blue);
  outline-offset: 2px;
}
