.portal-sources {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  max-width: 84rem;
  margin: 0 auto;
}

/* Header */
.portal-sources__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.portal-sources__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.portal-sources__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 650;
  color: var(--color-text-1);
}

.portal-sources__sub {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-3);
  max-width: 46rem;
}

/* Metric strip now uses the shared <MetricStrip>. */

/* Table cells */
.portal-sources__name-cell {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.portal-sources__name-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.portal-sources__name-text strong {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-1);
}

.portal-sources__type-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.portal-sources__type-dot--neutral {
  background: var(--color-bg-subtle);
  color: var(--color-text-3);
}
.portal-sources__type-dot--blue {
  background: var(--color-blue-light);
  color: var(--color-blue);
}
.portal-sources__type-dot--purple {
  background: var(--color-purple-light);
  color: var(--color-purple);
}
.portal-sources__type-dot--green {
  background: var(--color-green-light);
  color: var(--color-green-dark);
}
.portal-sources__type-dot--amber {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}
.portal-sources__type-dot--red {
  background: var(--color-red-light);
  color: var(--color-red);
}

.portal-sources__muted {
  font-size: 0.8125rem;
  color: var(--color-text-4);
}

.portal-sources__caret {
  display: inline-block;
  color: var(--color-text-5);
  transition: transform var(--motion-fast);
}

.portal-sources__caret.is-open {
  transform: rotate(90deg);
  color: var(--color-blue);
}

/* Expanded detail panel */
.portal-sources__expanded {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  animation: portal-sources-reveal var(--motion-fast) ease-out;
}

@keyframes portal-sources-reveal {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-sources__expanded-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.875rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.portal-sources__expanded-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-1);
}

.portal-sources__expanded-sub {
  font-size: 0.75rem;
  color: var(--color-text-4);
}

.portal-sources__expanded-close {
  margin-left: auto;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-4);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--motion-fast),
    color var(--motion-fast);
}

.portal-sources__expanded-close:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-1);
}

/* Detail body */
.portal-sources__detail {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.portal-sources__stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.875rem;
}

@media (max-width: 56rem) {
  .portal-sources__stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Stat tiles now use the shared <StatTile>. */

.portal-sources__url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-2);
  word-break: break-all;
}

/* Bars */
.portal-sources__bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
}

.portal-sources__bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-4);
}

.portal-sources__bar-head strong {
  font-size: 0.8125rem;
  color: var(--color-text-1);
  font-family: var(--font-mono);
}

/* Detail sub-sections */
.portal-sources__detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-sources__detail-heading {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-5);
  font-weight: 600;
}

.portal-sparkline {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  color: var(--color-blue);
}

.portal-sources__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Endpoint / delivery rows */
.portal-sources__endpoints {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.portal-sources__endpoint {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.625rem;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.portal-sources__method {
  font-family: var(--font-mono);
}

.portal-sources__endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-sources__endpoint-calls {
  font-size: 0.6875rem;
  color: var(--color-text-4);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.portal-sources__detail-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

/* Table skeleton */
.portal-sources__table-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Connect wizard                                                           */
/* ──────────────────────────────────────────────────────────────────────── */

.portal-sources__steps {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
}

.portal-sources__step {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  flex: 1;
  font-size: 0.75rem;
  color: var(--color-text-4);
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-light);
}

.portal-sources__step.is-active {
  color: var(--color-text-1);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--color-blue) 40%, transparent);
  background: var(--color-blue-light);
}

.portal-sources__step.is-done {
  color: var(--color-text-3);
}

.portal-sources__step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-4);
}

.portal-sources__step.is-active .portal-sources__step-mark {
  background: var(--color-blue);
  border-color: var(--color-blue);
  color: var(--color-text-on-accent);
}

.portal-sources__step.is-done .portal-sources__step-mark {
  background: var(--color-green);
  border-color: var(--color-green);
  color: var(--color-text-on-accent);
}

.portal-sources__type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}

@media (max-width: 40rem) {
  .portal-sources__type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.portal-sources__type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast);
}

.portal-sources__type-card:hover {
  border-color: var(--color-border-strong, var(--color-border));
  background: var(--color-bg-hover);
}

.portal-sources__type-card.is-selected {
  border-color: var(--color-blue);
  background: var(--color-blue-light);
  box-shadow: 0 0 0 1px var(--color-blue) inset;
}

.portal-sources__type-icon {
  font-size: 1.25rem;
  color: var(--color-text-2);
}

.portal-sources__type-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-1);
}

.portal-sources__wizard-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-sources__wizard-lead {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text-2);
}

.portal-sources__wizard-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-text-4);
}

.portal-sources__wizard-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}
