/* Analytics */
.ia-page-head,
.ia-filter-panel,
.ia-panel,
.ia-kpi {
  border-color: var(--sre-slate-200);
  border-radius: var(--sre-radius-lg);
  background: var(--sre-white);
  box-shadow: var(--sre-shadow-sm);
}

.ia-page-head {
  padding: var(--sre-panel-padding);
}

.ia-page-head h1,
.ia-panel-head h2,
.ia-kpi strong {
  color: var(--sre-slate-950);
  font-family: var(--sre-font-sans);
  letter-spacing: -0.02em;
}

.ia-page-head h1 {
  font-size: clamp(1.75rem, 3vw, 2.375rem);
}

.ia-page-head p,
.ia-kpi small {
  color: var(--sre-slate-600);
  font-size: 0.875rem;
}

.ia-filter-field span,
.ia-kpi span {
  color: var(--sre-slate-500);
  font-size: 0.875rem;
  letter-spacing: 0.035em;
}

.ia-filter-field input,
.ia-filter-field select {
  min-height: var(--sre-control-height);
  border-color: var(--sre-slate-300);
  border-radius: var(--sre-radius-md);
  color: var(--sre-slate-950);
  font-size: 0.9375rem;
  font-weight: 600;
}

.ia-filter-field input:focus,
.ia-filter-field select:focus {
  border-color: var(--sre-purple-600);
  outline: 0;
  box-shadow: var(--sre-focus-ring);
}

.ia-kpi {
  min-height: 7rem;
  padding: var(--sre-panel-padding);
  border-top-width: 3px;
}

.ia-chart-frame {
  max-width: 100%;
}

/* Reliability and engineering detail pages */
.rm-anomaly-hero,
.rm-anomaly-status-card,
.rm-anomaly-region-card,
.rm-database-card,
.rm-exec-spotlight,
.rm-kc-section,
.rm-kc-webhook-section,
.rm-kc-follow-up-item,
.rm-compare-card {
  border-color: var(--sre-slate-200);
  border-radius: var(--sre-radius-lg);
  background: var(--sre-white);
  box-shadow: var(--sre-shadow-sm);
}

.rm-anomaly-region-card-danger {
  border-left-color: var(--sre-danger);
}

.rm-anomaly-region-card-warning {
  border-left-color: var(--sre-warning);
}

.rm-anomaly-region-card-success {
  border-left-color: var(--sre-success);
}

.rm-kc-command-bar,
.rm-kc-tab-shell,
.rm-jmx-filter-panel,
.rm-chat-filter-panel {
  max-width: 100%;
}

/* Chat workspaces */
@media (min-width: 61.3125rem) {
  /*
   * Deep Search predates the sidebar shell and used the body as its viewport
   * grid. The application top bar now lives inside that viewport, so allowing
   * the main region to keep the old 100% height placed the composer one top-bar
   * height below the visible screen. Keep the desktop chat workspace bounded
   * to the app frame instead.
   */
  body:has(.rm-deep-chat-shell) {
    display: block;
  }

  body:has(.rm-deep-chat-shell) .sre-app-shell,
  body:has(.rm-deep-chat-shell) .sre-app-frame {
    height: 100dvh;
    min-height: 0;
  }

  body:has(.rm-deep-chat-shell) .sre-app-frame {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  body:has(.rm-deep-chat-shell) .sre-main.rm-shell {
    height: auto;
    min-height: 0;
    overflow: hidden;
  }
}

.rm-deep-chat-shell,
.rm-deep-chat-sidebar,
.rm-deep-chat-main,
.rm-deep-chat-history-panel,
.rm-deep-chat-composer,
.rm-chat-live-card,
.rm-kc-chat-surface {
  border-color: var(--sre-slate-200);
  background: var(--sre-white);
  box-shadow: none;
}

.rm-deep-chat-shell {
  max-width: 100%;
  border: 1px solid var(--sre-slate-200);
  border-radius: var(--sre-radius-lg);
  overflow: hidden;
}

.rm-deep-chat-sidebar {
  border-right: 1px solid var(--sre-slate-200);
}

.rm-deep-chat-history-item,
.rm-deep-chat-history-row {
  border-color: transparent;
  border-radius: var(--sre-radius-md);
}

.rm-deep-chat-history-item:hover,
.rm-deep-chat-history-row:hover {
  background: var(--sre-slate-50);
}

.rm-deep-chat-message-body,
.rm-chat-message-preview,
.rm-chat-log-preview {
  color: var(--sre-slate-700);
  font-size: 0.9375rem;
}

.rm-deep-chat-message-agent .rm-deep-chat-message-body {
  border-color: var(--sre-slate-200);
  background: var(--sre-slate-50);
}

.rm-deep-chat-message-user .rm-deep-chat-message-body {
  background: var(--sre-purple-600);
  color: var(--sre-white);
}

/* Security */
.rm-security-dashboard-page,
.rm-security-dashboard-header,
.rm-security-chart-card,
.rm-security-repo-risk-row,
.rm-security-score-card {
  border-color: var(--sre-slate-200);
  background: var(--sre-white);
  color: var(--sre-slate-950);
  box-shadow: var(--sre-shadow-sm);
}

.rm-security-dashboard-page {
  padding: 0;
}

.rm-security-dashboard-header,
.rm-security-chart-card,
.rm-security-score-card {
  border-radius: var(--sre-radius-lg);
}

.rm-security-dashboard-header h1,
.rm-security-chart-head h2,
.rm-security-score-card strong {
  color: var(--sre-slate-950);
  font-family: var(--sre-font-sans);
}

/* Onboarding */
.ob-page {
  --ob-ink: var(--sre-slate-950);
  --ob-muted: var(--sre-slate-600);
  --ob-panel: var(--sre-white);
  --ob-line: var(--sre-slate-200);
  --ob-soft: var(--sre-slate-50);
  --ob-blue: var(--sre-purple-700);
  --ob-teal: var(--sre-purple-600);
  width: 100%;
  max-width: 82rem;
  margin: 0 auto;
  padding: 0;
}

.ob-hero,
.ob-session-hero,
.ob-section {
  border-color: var(--sre-slate-200);
  border-radius: var(--sre-radius-lg);
  background: var(--sre-white);
  box-shadow: var(--sre-shadow-sm);
}

.ob-eyebrow,
.ob-facts span,
.ob-stat-row span,
.ob-note {
  font-size: 0.875rem;
}

.ob-hero-copy h1,
.ob-session-hero h1,
.ob-section-heading h2,
.ob-role-summary h3,
.ob-list-block h4,
.ob-node-details h3,
.ob-repo-card h3,
.ob-session-card h3,
.ob-info-panel h3 {
  color: var(--sre-slate-950);
  font-family: var(--sre-font-sans);
}

@media (max-width: 75rem) {
  .ia-filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ia-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 48rem) {
  .ia-page-head,
  .ia-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .ia-page-actions {
    justify-content: flex-start;
  }

  .ia-filter-panel,
  .ia-kpi-grid,
  .ia-chart-grid,
  .ob-hero,
  .ob-session-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .rm-deep-chat-shell {
    min-height: calc(100vh - var(--sre-topbar-height) - 2rem);
    border-radius: var(--sre-radius-md);
  }

  .rm-deep-chat-shell,
  .rm-deep-chat-sidebar,
  .rm-deep-chat-main,
  .rm-deep-chat-header,
  .rm-deep-chat-header > div,
  .rm-deep-chat-messages,
  .rm-deep-chat-composer {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .rm-deep-chat-header h2,
  .rm-deep-chat-header p,
  .rm-deep-chat-root code,
  .rm-deep-chat-message-body {
    overflow-wrap: anywhere;
  }

  .rm-deep-chat-header-actions {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .rm-deep-chat-header-actions > * {
    max-width: 100%;
    white-space: normal;
  }

  .ob-tab,
  .ob-diagram-tab,
  .ob-primary-action,
  .ob-secondary-action,
  .ob-primary-link,
  .ob-back-link {
    min-height: 2.75rem;
  }

  .rm-deep-chat-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--sre-slate-200);
  }
}

/* Routine interface copy never drops below the 14px acceptance floor. */
.sre-app-shell :where(p, li, dt, dd, td, th, label, input, select, textarea, button, a, code, pre, small, summary, figcaption, span),
.sre-app-shell :where(.rm-section-label, .rm-cell-sub, .rm-card-subtitle, .rm-stat-label, .rm-stat-copy, .rm-inline-notes, .sre-nav-group-label, .sre-sidebar-caption) {
  font-size: max(0.875rem, 1em);
}
