/* AMM monitor — live store viewer. Extends the tokens in ../styles.css */

.container-wide {
  max-width: 1180px;
}

/* One row: the base styles size inputs and buttons for stacked forms */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.toolbar .field.inline {
  flex: 0 1 200px;
  min-width: 140px;
  margin: 0;
}

.toolbar .btn-primary {
  flex: 0 0 auto;
  width: auto;
  padding: 12px 22px;
}

.toolbar .badge {
  flex: 0 0 auto;
  margin-bottom: 2px;
}

.badge {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.badge.is-on {
  border-color: transparent;
  background: rgba(18, 183, 106, 0.12);
  color: var(--success);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pill.is-on {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* One row, every group sharing the width */
.stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat-group {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Query names are long, so this one takes a double share */
.stat-group.heaviest {
  flex: 2 1 0;
}

.group-label {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-row {
  display: flex;
  gap: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
}

.stat.is-warn .stat-value {
  color: var(--danger);
}

/* Query names are identifiers, so they keep their case and stay small */
.compact-list {
  display: grid;
  gap: 2px 14px;
}

/* The name absorbs the group's share; numbers stay right-aligned */
.compact-list.cols-2 {
  grid-template-columns: 1fr auto;
}

.compact-list.cols-3 {
  grid-template-columns: 1fr auto auto;
}

.compact-row {
  display: contents;
}

.compact .q {
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.compact .n {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.head-tools {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.head-tools > .mono {
  white-space: nowrap;
}

.head-tools input[type='search'] {
  flex: 0 1 380px;
  min-width: 160px;
  padding: 9px 12px;
}

.table-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
}

.table-foot .hint {
  font-size: 10px;
}

.check {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

/* The shared styles strip `appearance` for form inputs; a checkbox needs it */
.check input[type='checkbox'] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.soft {
  color: var(--text-muted);
}

.table-wrap.scroll {
  max-height: 460px;
  overflow-y: auto;
}

.table-wrap.scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.table td.kind {
  font-weight: 600;
  white-space: nowrap;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Block leads both tables; fix it so they line up */
.table th:first-child,
.table td:first-child {
  width: 96px;
  text-align: left;
}

.asset {
  white-space: nowrap;
}

.asset-symbol {
  font-weight: 500;
}

.asset-id {
  margin-left: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.up {
  color: var(--success);
}

.down {
  color: var(--danger);
}

/* Recency bands: rows sharing a block share a shade, newest strongest */
tr.age-0 td {
  background: rgba(255, 0, 122, 0.1);
}

tr.age-1 td {
  background: rgba(255, 0, 122, 0.055);
}

tr.age-2 td {
  background: rgba(255, 0, 122, 0.025);
}

tr.age-0 td:first-child {
  box-shadow: inset 2px 0 0 var(--primary);
}

tr td {
  transition: background 500ms ease;
}
