/* v2 polish for the portal queries page. Scoped to
   body[data-theme="v2"] #page-portal-queries. The page is built
   almost entirely from shared primitives (card, btn, field, table,
   metric-card) which are already styled by primitives.css +
   pages/dashboard.css. This sheet picks up the page-specific
   leftovers: filter rows, alerts, badges, btn-sm, key-value meta. */

body[data-theme="v2"] #page-portal-queries {
  padding: var(--space-6) 0;
}

/* ──────────────────────────────────────────────────────────────
   Filter / search row
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .filter-row,
body[data-theme="v2"] .filter-row {
  background: var(--panel);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

/* ──────────────────────────────────────────────────────────────
   Metric grid — handed in by JS with auto-fit columns. Spacing
   only; the .metric-card primitives are already v2-styled in
   pages/dashboard.css.
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .metric-grid,
body[data-theme="v2"] .metric-grid {
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* ──────────────────────────────────────────────────────────────
   Key/value metadata pairs (lots of these on the query detail view)
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .meta-label,
body[data-theme="v2"] .meta-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--muted);
  font-weight: var(--weight-strong);
  margin-bottom: var(--space-1);
}

body[data-theme="v2"] #page-portal-queries .meta-value,
body[data-theme="v2"] .meta-value {
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
}

body[data-theme="v2"] #page-portal-queries .meta-value code,
body[data-theme="v2"] .meta-value code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--text-xs);
  background: var(--bg-soft);
  border: var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px var(--space-2);
  color: var(--text-strong);
}

/* ──────────────────────────────────────────────────────────────
   Alerts
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .alert,
body[data-theme="v2"] .alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: var(--border-subtle);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
}

body[data-theme="v2"] #page-portal-queries .alert-error,
body[data-theme="v2"] .alert-error {
  background: rgba(243, 124, 145, .10);
  border-color: rgba(243, 124, 145, .32);
  color: var(--danger-soft);
}

body[data-theme="v2"] #page-portal-queries .alert-warning,
body[data-theme="v2"] .alert-warning {
  background: rgba(245, 199, 115, .10);
  border-color: rgba(245, 199, 115, .32);
  color: var(--warning-soft);
}

body[data-theme="v2"] #page-portal-queries .alert-success,
body[data-theme="v2"] .alert-success {
  background: rgba(47, 223, 163, .10);
  border-color: rgba(47, 223, 163, .32);
  color: var(--positive-soft);
}

/* ──────────────────────────────────────────────────────────────
   Inline status badges (different from the v2 .status-chip in
   primitives.css — these are inline-flow markers used inside
   table cells, so they get a tighter look).
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .badge:not(.status-chip):not(.pill),
body[data-theme="v2"] .table .badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: var(--radius-xs);
  background: var(--panel-2);
  color: var(--text-secondary);
  border: var(--border-subtle);
}

body[data-theme="v2"] #page-portal-queries .badge-danger,
body[data-theme="v2"] .badge-danger {
  background: rgba(243, 124, 145, .16);
  border-color: rgba(243, 124, 145, .32);
  color: var(--danger-soft);
}

body[data-theme="v2"] #page-portal-queries .badge-success,
body[data-theme="v2"] .badge-success {
  background: rgba(47, 223, 163, .16);
  border-color: rgba(47, 223, 163, .32);
  color: var(--positive-soft);
}

body[data-theme="v2"] #page-portal-queries .badge-warning,
body[data-theme="v2"] .badge-warning {
  background: rgba(245, 199, 115, .16);
  border-color: rgba(245, 199, 115, .32);
  color: var(--warning-soft);
}

/* ──────────────────────────────────────────────────────────────
   Small button — used for inline table actions
   ────────────────────────────────────────────────────────────── */
body[data-theme="v2"] #page-portal-queries .btn-sm,
body[data-theme="v2"] .btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: .02em;
  border-radius: var(--radius-xs);
  min-height: 28px;
}
