/* Atlas: companheiro docked (rail 380–420px). Linear / Cloudflare: superfície nativa, sem FAB. */

:root {
  --atlas-rail-w: clamp(380px, 28vw, 420px);
  --atlas-live: #10b981;
  --atlas-amber-edge: #f59e0b;
  --atlas-coral-edge: #ef4444;
  --atlas-border: var(--border-subtle, var(--border));
}

.analyses-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--atlas-rail-w);
  gap: var(--sp-5);
  align-items: start;
}

.analyses-shell__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.atlas-rail {
  position: sticky;
  top: calc(var(--header-h, 56px) + var(--sp-4));
  max-height: calc(100vh - var(--header-h, 56px) - var(--sp-6));
  overflow: auto;
  padding: 14px 14px 12px;
  border-radius: var(--radius-lg, 8px);
  border: 1px solid var(--atlas-border);
  background: var(--bg-surface, var(--surface));
  box-shadow: none;
  animation: atlas-enter var(--duration-smooth, 320ms) var(--ease-out-quart, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

/* --- Zone A: header de telemetria --- */
.atlas-zone-a {
  margin-bottom: 10px;
}

.atlas-zone-a__row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.atlas-zone-a__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.atlas-mark {
  flex: 0 0 auto;
  color: var(--text-2, var(--text-muted));
  display: block;
}

.atlas-mark__pulse {
  transform-origin: center;
  animation: atlas-radar-pulse 2.4s ease-in-out infinite;
}

.atlas__name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.atlas-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-md, 6px);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.3;
  border: 1px solid color-mix(in srgb, var(--atlas-live) 28%, var(--atlas-border));
  color: var(--atlas-live);
  background: color-mix(in srgb, var(--atlas-live) 8%, transparent);
}

.atlas-live[data-state="paused"] {
  color: var(--text-muted);
  border-color: var(--atlas-border);
  background: transparent;
}

.atlas-live__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: none;
}

.atlas-live[data-state="active"] .atlas-live__dot {
  animation: atlas-live-pulse 2.2s ease-out infinite;
}

.atlas-rail__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 5px;
  border-radius: var(--radius-sm, 4px);
  background: var(--text);
  color: var(--surface);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.atlas-zone-a__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.atlas-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md, 6px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--duration-fast, 150ms) var(--ease-out-quart), color var(--duration-fast, 150ms) var(--ease-out-quart);
}

.atlas-icon-btn:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}

.atlas-icon-btn:focus-visible {
  outline: var(--focus-outline, 2px solid var(--text-primary));
  outline-offset: 2px;
  color: var(--text);
}

.atlas-rail__chev {
  display: inline-flex;
  transition: transform var(--duration-fast, 150ms) var(--ease-out-quart, cubic-bezier(0.22, 1, 0.36, 1));
}

.atlas-rail__chev.is-open {
  transform: rotate(180deg);
}

.atlas-zone-a__summary {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2, var(--text-muted));
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.atlas-zone-a__summary.tabular,
.tabular {
  font-variant-numeric: tabular-nums;
}

/* Focus pill: deep-link, discreto */
.atlas-focus-pill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--atlas-border);
  background: var(--bg-elevated, var(--surface-2));
  font-size: 12px;
  line-height: 1.3;
}

.atlas-focus-pill__label {
  color: var(--text-muted);
  font-weight: 500;
}

.atlas-focus-pill__job {
  font-weight: 600;
  color: var(--text);
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-focus-pill__id {
  font-size: 11px;
  color: var(--text-muted);
}

.atlas-focus-pill__clear {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 2px 6px;
  border: none;
  border-radius: var(--radius-sm, 4px);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.atlas-focus-pill__clear:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.atlas-focus-pill__clear:focus-visible {
  outline: var(--focus-outline, 2px solid var(--text-primary));
  outline-offset: 1px;
}

.atlas-rail__body {
  position: relative;
}

.atlas-rail__panel {
  border-top: 1px solid var(--atlas-border);
  padding-top: 10px;
  margin-top: 2px;
}

/* --- Zone B: fila / healthy --- */
.atlas-queue__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-finding {
  position: relative;
  padding: 10px 10px 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--atlas-border);
  border-left: 3px solid var(--neutral-border, var(--border));
  background: var(--surface);
}

.atlas-finding--is-mid {
  border-left-color: var(--atlas-amber-edge);
}

.atlas-finding--is-high,
.atlas-finding--is-critical {
  border-left-color: var(--atlas-coral-edge);
}

.atlas-finding--is-low {
  border-left-color: var(--info, #3b82f6);
}

.atlas-finding__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.atlas-finding__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--text) 4%);
  border: 1px solid var(--atlas-border);
}

.atlas-finding--is-mid .atlas-finding__badge {
  color: color-mix(in srgb, var(--atlas-amber-edge) 70%, var(--text));
  border-color: color-mix(in srgb, var(--atlas-amber-edge) 30%, var(--atlas-border));
  background: color-mix(in srgb, var(--atlas-amber-edge) 8%, transparent);
}

.atlas-finding--is-high .atlas-finding__badge,
.atlas-finding--is-critical .atlas-finding__badge {
  color: color-mix(in srgb, var(--atlas-coral-edge) 75%, var(--text));
  border-color: color-mix(in srgb, var(--atlas-coral-edge) 30%, var(--atlas-border));
  background: color-mix(in srgb, var(--atlas-coral-edge) 8%, transparent);
}

.atlas-finding__ago {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.atlas-finding__job {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.atlas-finding__ids {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.atlas-finding__evidence {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-2, var(--text-muted));
  line-height: 1.45;
}

.atlas-finding__rx {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

.atlas-finding__rx-label {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.atlas-finding__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* Healthy / prova de trabalho */
.atlas-healthy {
  padding: 14px 12px;
  border-radius: 8px;
  border: 1px solid var(--atlas-border);
  background: color-mix(in srgb, var(--atlas-live) 4%, var(--surface));
  text-align: left;
}

.atlas-healthy__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  border-radius: 50%;
  color: var(--text-muted);
  border: 1px solid var(--atlas-border);
}

.atlas-healthy__icon--ok {
  color: var(--atlas-live);
  border-color: color-mix(in srgb, var(--atlas-live) 35%, var(--atlas-border));
  background: color-mix(in srgb, var(--atlas-live) 10%, transparent);
}

.atlas-healthy__title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.atlas-healthy__text {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-2, var(--text-muted));
  line-height: 1.45;
}

.atlas-healthy__log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.atlas-healthy__log-item {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* --- Zone C: cobertura --- */
.atlas-coverage {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--atlas-border);
  background: var(--surface-2, var(--surface));
}

.atlas-coverage__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.atlas-coverage__summary::-webkit-details-marker {
  display: none;
}

.atlas-coverage__summary-label {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.atlas-coverage__chev {
  display: inline-flex;
  color: var(--text-muted);
  transition: transform 180ms ease;
}

.atlas-coverage[open] > .atlas-coverage__summary .atlas-coverage__chev {
  transform: rotate(180deg);
}

.atlas-coverage__panel {
  padding: 0 10px 10px;
  border-top: 1px solid var(--atlas-border);
}

.atlas-coverage__list {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.atlas-coverage__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
}

.atlas-coverage__mark {
  flex: 0 0 auto;
  width: 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--atlas-live);
}

.atlas-coverage__mark[data-ok="0"] {
  color: var(--atlas-amber-edge);
}

.atlas-coverage__mark[data-ok="2"] {
  color: var(--text-muted);
  font-weight: 500;
}

.atlas-coverage__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.atlas-coverage__job {
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-coverage__meta {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.atlas-coverage__remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.7;
}

.atlas-coverage__remove:hover {
  opacity: 1;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.atlas-coverage__empty {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.atlas-coverage__suggest {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--atlas-border);
}

.atlas-coverage__suggest-text {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-2, var(--text-muted));
}

.atlas-coverage__suggest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.atlas-row--focus {
  outline: 1px solid color-mix(in srgb, var(--atlas-live) 40%, transparent);
  background: color-mix(in srgb, var(--atlas-live) 6%, transparent);
}

.atlas--pulse {
  animation: atlas-pulse 1.4s var(--ease-out-quart, var(--pl-ease, cubic-bezier(0.22, 1, 0.36, 1)));
}

.mono {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}

@keyframes atlas-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes atlas-radar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Live/radar pulses are opacity/scale only - no glow rings (anti-slop). */

@keyframes atlas-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes atlas-live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.65; }
}

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

  .atlas-rail {
    position: relative;
    top: auto;
    max-height: none;
    order: -1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-rail,
  .atlas--pulse,
  .atlas-mark__pulse,
  .atlas-rail__chev,
  .atlas-coverage__chev,
  .atlas-live__dot {
    animation: none;
    transition: none;
  }

  .atlas-live__dot {
    box-shadow: none;
  }
}
