/* Page-specific layout. Shared components live in components.css; this file only holds grid
   arrangements and one-off tweaks for individual pages. */

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.col-4 {
  grid-column: span 12;
}

.col-8 {
  grid-column: span 12;
}

@media (min-width: 1024px) {
  .col-4 {
    grid-column: span 4;
  }

  .col-8 {
    grid-column: span 8;
  }
}

/* Overview */

.scanner-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-4);
}

.scanner-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.scanner-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.scanner-telemetry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--canvas);
  border-radius: var(--radius-md);
}

.scanner-telemetry-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-caption-size);
  color: var(--text-subtle);
}

.scanner-telemetry-divider {
  width: 1px;
  height: 12px;
  background: var(--border);
}

.issues-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.issues-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.issues-card-icon.is-ok {
  background: var(--primary-soft);
  color: var(--primary);
}

.issues-card-icon.is-open {
  background: var(--danger-soft);
  color: var(--danger);
}

.issues-card-body {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stat-tile .stat-label.text-hot,
.stat-tile .stat-value.text-hot {
  color: var(--stage-hot);
}

.stat-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.issues-count {
  font-size: var(--text-h1-size);
  font-weight: var(--text-h1-weight);
  line-height: var(--text-h1-line);
  color: var(--text);
}

.issues-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  color: var(--text-subtle);
  font-size: var(--text-caption-size);
}

.issues-card-footer a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.stage-bar {
  display: flex;
  gap: 2px;
  height: 6px;
  width: 100%;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-raised);
}

.stage-bar rect {
  transition: width 0.3s;
}

.stage-bar-seg-new {
  fill: var(--stage-new);
}

.stage-bar-seg-active {
  fill: var(--stage-active);
}

.stage-bar-seg-hot {
  fill: var(--stage-hot);
}

.stage-bar-seg-dead {
  fill: var(--stage-dead);
}

.stage-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-label-caps-size);
  color: var(--text-subtle);
}

.live-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.live-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.live-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  color: var(--text-subtle);
  font-size: var(--text-caption-size);
}

.events-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.events-feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.events-feed-item:hover {
  background: var(--surface-raised);
}

.events-feed-time {
  font-family: var(--font-mono);
  font-size: var(--text-caption-size);
  color: var(--text-subtle);
  flex-shrink: 0;
  margin-top: 2px;
}

.events-feed-body {
  min-width: 0;
}

.events-feed-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-label-caps-size);
  font-weight: 600;
  letter-spacing: var(--text-label-caps-tracking);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.events-feed-message {
  font-size: var(--text-body-sm-size);
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Tokens list */

.tokens-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.tokens-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.stage-filter-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 4px var(--space-3);
  font-size: var(--text-label-caps-size);
  font-weight: 500;
  letter-spacing: var(--text-label-caps-tracking);
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stage-filter-pill:hover {
  color: var(--text);
  text-decoration: none;
}

.stage-filter-pill.is-active {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Token detail */

.token-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.token-detail-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.token-detail-avatar {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.token-detail-titles {
  min-width: 0;
}

.token-detail-titles h1 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.token-detail-mint {
  font-family: var(--font-mono);
  font-size: var(--text-caption-size);
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 48px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-body-sm-size);
  gap: var(--space-2);
}

.breakdown-row-points {
  text-align: right;
  font-family: var(--font-mono);
  font-feature-settings: var(--tabular-nums);
  font-size: var(--text-body-sm-size);
}

.filter-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-body-sm-size);
}

.filter-result-row:last-child {
  border-bottom: none;
}

/* Flex items default to a content-based min-width, so a long label/metric-ref pair on a narrow
   screen refuses to shrink and pushes the row (and the whole page) wider instead of truncating —
   found at 375-430px via the T28 screenshot tool's scroll-width assertion. */
.filter-result-label,
.filter-result-metric {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-result-row .num {
  flex-shrink: 0;
}

/* Health & Usage */

.meter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
}

.meter-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.meter-tile-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.stat-tile .meter {
  margin-top: 2px;
}

.issue-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.issue-item {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.issue-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.issue-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.issue-title {
  font-size: var(--text-body-sm-size);
  font-weight: 500;
  color: var(--text);
}

.issue-meta {
  margin-bottom: var(--space-1);
}

/* Stats: pipeline funnel */

.funnel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.funnel-stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.funnel-stage-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

@media (max-width: 720px) {
  .funnel {
    grid-template-columns: 1fr;
  }
}
