/* Atlas — companheiro em rail estável na home Análises (não FAB flutuante). */

:root {
  --atlas-amber: #d4a017;
  --atlas-amber-soft: rgba(212, 160, 23, 0.14);
  --atlas-ink: #e8e6df;
  --atlas-rail: rgba(212, 160, 23, 0.55);
  --atlas-rail-w: min(340px, 100%);
}

[data-theme="light"] {
  --atlas-amber: #a67c00;
  --atlas-amber-soft: rgba(166, 124, 0, 0.1);
  --atlas-ink: #1a1814;
  --atlas-rail: rgba(166, 124, 0, 0.45);
}

/* Shell: coluna principal + rail Atlas */
.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: var(--sp-4);
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--atlas-amber) 28%, var(--border));
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--atlas-amber) 8%, var(--surface-2)) 0%,
      var(--surface) 38%,
      var(--surface-2) 100%
    );
  animation: atlas-enter 420ms var(--pl-ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.atlas-rail::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, var(--atlas-amber) 0%, transparent 88%);
  opacity: 0.9;
  pointer-events: none;
}

.atlas-rail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.atlas__brand {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 0;
}

/* Midjourney mark — leve bob + glint */
.atlas-mark {
  --atlas-mark-size: 40px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: var(--atlas-mark-size);
  height: var(--atlas-mark-size);
  border-radius: 10px;
  overflow: hidden;
  filter: drop-shadow(0 1px 0 color-mix(in srgb, var(--atlas-amber) 35%, transparent));
  animation: atlas-mark-bob 3.4s ease-in-out infinite;
}

.atlas-mark__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.atlas-mark__sparkle {
  position: absolute;
  top: 11%;
  right: 10%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--atlas-amber) 90%, #fff) 0%,
    color-mix(in srgb, var(--atlas-amber) 35%, transparent) 42%,
    transparent 72%
  );
  opacity: 0.15;
  animation: atlas-mark-sparkle 3.4s ease-in-out infinite;
}

.atlas__titles { min-width: 0; }

.atlas__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--atlas-amber);
}

.atlas-rail__name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.atlas__name {
  margin: 0;
  font-family: "Segoe UI Variable Display", "Segoe UI Variable", Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.atlas-rail__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--atlas-amber);
  color: #1a1408;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.atlas__tag {
  margin: 6px 0 0;
  font-size: var(--fs-13);
  color: var(--text-2);
  max-width: 28ch;
}

.atlas-rail__status {
  margin: 0 0 var(--sp-3);
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--atlas-amber) 22%, var(--border));
  background: color-mix(in srgb, var(--atlas-amber) 6%, var(--surface));
  font-size: var(--fs-13);
  color: var(--text);
  line-height: 1.35;
}

.atlas-rail__toggle {
  flex: 0 0 auto;
  margin-top: 2px;
}

.atlas-rail__chev {
  display: inline-flex;
  transition: transform 180ms ease;
}

.atlas-rail__chev.is-open {
  transform: rotate(180deg);
}

.atlas-rail__body {
  position: relative;
}

.atlas__focus {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--atlas-amber) 35%, var(--border));
  background: var(--atlas-amber-soft);
  color: var(--text);
  font-size: var(--fs-13);
}

.atlas__actions {
  margin-top: var(--sp-2);
}

.atlas-section__title {
  margin: 0 0 var(--sp-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.atlas-queue__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.atlas-finding {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--atlas-amber) 16%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, var(--atlas-amber-soft));
}

.atlas-finding__top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.atlas-finding__title {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.atlas-finding__meta {
  margin: 4px 0 0;
}

.atlas-finding__evidence {
  margin: 8px 0 0;
  font-size: var(--fs-13);
  color: var(--text-2);
  line-height: 1.4;
}

.atlas-finding__cta {
  margin-top: 10px;
}

.atlas-empty {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--atlas-amber) 30%, var(--border));
  background: color-mix(in srgb, var(--atlas-amber) 5%, transparent);
}

.atlas-empty__title {
  margin: 0 0 6px;
  font-size: var(--fs-14);
  font-weight: 650;
  color: var(--text);
}

.atlas-empty__text {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-13);
  color: var(--text-2);
}

.atlas-coverage {
  margin-top: var(--sp-2);
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 90%, var(--atlas-amber));
  background: var(--surface);
}

.atlas-coverage__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text);
}

.atlas-coverage__summary::-webkit-details-marker {
  display: none;
}

.atlas-coverage__count {
  font-weight: 500;
  color: var(--text-muted);
}

.atlas-coverage__fleet {
  margin: 0;
  padding: 0 12px 8px;
}

.atlas-coverage__list {
  list-style: none;
  margin: 0;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-coverage__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: var(--radius);
}

.atlas-coverage__job {
  font-size: var(--fs-13);
  color: var(--text);
}

.atlas-row--focus {
  outline: 1px solid color-mix(in srgb, var(--atlas-amber) 50%, transparent);
  background: color-mix(in srgb, var(--atlas-amber) 8%, transparent);
  border-radius: var(--radius);
}

.atlas--pulse {
  animation: atlas-pulse 1.4s var(--pl-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

@keyframes atlas-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes atlas-mark-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes atlas-mark-sparkle {
  0%, 100% { opacity: 0.12; transform: scale(0.85); }
  35% { opacity: 0.7; transform: scale(1.15); }
  55% { opacity: 0.25; transform: scale(0.95); }
  75% { opacity: 0.85; transform: scale(1.2); }
}

@keyframes atlas-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--atlas-amber) 0%, transparent); }
  35% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--atlas-amber) 22%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--atlas-amber) 0%, transparent); }
}

@media (max-width: 960px) {
  .analyses-shell {
    grid-template-columns: 1fr;
  }

  .atlas-rail {
    position: relative;
    top: auto;
    max-height: none;
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-rail,
  .atlas--pulse,
  .atlas-mark,
  .atlas-mark__sparkle,
  .atlas-rail__chev {
    animation: none;
    transition: none;
  }

  .atlas-mark__sparkle {
    opacity: 0;
  }
}
