.analysis-dialog {
  width: min(90rem, calc(100% - 2rem));
}

.analysis-panel {
  --analysis-high: var(--toolbox-danger);
  --analysis-warning: var(--regex-warning);
  --analysis-notice: var(--toolbox-accent);
  min-height: 0;
}

.analysis-view-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem 0;
  border-bottom: 1px solid var(--toolbox-border);
  background: var(--toolbox-surface-soft);
}

.analysis-view-tabs button {
  border: 1px solid transparent;
  border-radius: calc(var(--toolbox-radius) * 0.7)
    calc(var(--toolbox-radius) * 0.7) 0 0;
  padding: 0.55rem 0.8rem;
  background: transparent;
  color: var(--toolbox-muted);
  font-weight: 750;
}

.analysis-view-tabs button[aria-selected="true"] {
  border-color: var(--toolbox-border);
  border-bottom-color: var(--toolbox-surface);
  background: var(--toolbox-surface);
  color: var(--toolbox-accent);
}

.analysis-content {
  display: grid;
  gap: 0.8rem;
  padding: 0.75rem;
}

.analysis-section,
.analysis-result-block {
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.82);
  background: var(--toolbox-surface);
}

.analysis-section > header,
.analysis-result-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--toolbox-border);
  background: var(--toolbox-surface-soft);
}

.analysis-section > header h3,
.analysis-result-block > header h3 {
  margin: 0.12rem 0 0;
  font-size: 0.96rem;
}

.analysis-section > header > span,
.analysis-result-block > header > span {
  color: var(--toolbox-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
}

.analysis-summary,
.analysis-advisory,
.analysis-stop-reason,
.analysis-error,
.analysis-unavailable {
  margin: 0;
  padding: 0.7rem 0.75rem;
  color: var(--toolbox-muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.analysis-advisory,
.analysis-stop-reason {
  border-left: 3px solid var(--toolbox-accent);
  background: var(--toolbox-accent-soft);
}

.analysis-unavailable,
.analysis-error {
  margin: 0.75rem 0.75rem 0;
  border: 1px solid
    color-mix(in srgb, var(--toolbox-danger) 45%, var(--toolbox-border));
  border-radius: calc(var(--toolbox-radius) * 0.72);
  background: color-mix(
    in srgb,
    var(--toolbox-danger) 8%,
    var(--toolbox-surface)
  );
  color: color-mix(in srgb, var(--toolbox-danger) 78%, var(--toolbox-text));
}

.analysis-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0.75rem 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.72);
  background: var(--toolbox-surface-soft);
  font-size: 0.78rem;
}

.analysis-status > span {
  border-radius: 99rem;
  padding: 0.2rem 0.42rem;
  background: var(--toolbox-accent-soft);
  color: var(--toolbox-accent);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-status > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0.75rem 0;
  color: var(--toolbox-muted);
  font-size: 0.7rem;
}

.analysis-progress progress {
  width: 100%;
  accent-color: var(--toolbox-accent);
}

.analysis-findings {
  display: grid;
  gap: 0.55rem;
  padding: 0 0.75rem;
}

.analysis-finding {
  overflow: hidden;
  border: 1px solid var(--toolbox-border);
  border-left-width: 4px;
  border-radius: calc(var(--toolbox-radius) * 0.72);
  background: var(--toolbox-surface-soft);
}

.analysis-finding.is-high {
  border-left-color: var(--analysis-high);
}

.analysis-finding.is-warning {
  border-left-color: var(--analysis-warning);
}

.analysis-finding.is-notice {
  border-left-color: var(--analysis-notice);
}

.analysis-finding-title {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.55rem;
  border: 0;
  padding: 0.65rem;
  background: transparent;
  color: var(--toolbox-text);
  text-align: left;
}

button.analysis-finding-title:hover {
  background: var(--toolbox-accent-soft);
}

.analysis-finding-title > span:last-child {
  display: grid;
  gap: 0.12rem;
}

.analysis-finding-title small {
  color: var(--toolbox-muted);
  font-size: 0.67rem;
  font-weight: 500;
}

.analysis-risk-level,
.analysis-run-badge {
  border: 1px solid currentColor;
  border-radius: 99rem;
  padding: 0.2rem 0.42rem;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analysis-risk-level.is-high {
  color: var(--analysis-high);
}

.analysis-risk-level.is-warning {
  color: color-mix(in srgb, var(--analysis-warning) 78%, var(--toolbox-text));
}

.analysis-risk-level.is-notice {
  color: var(--analysis-notice);
}

.analysis-run-badge.is-complete {
  color: color-mix(in srgb, var(--regex-mint) 72%, var(--toolbox-text));
}

.analysis-run-badge.is-timeout,
.analysis-run-badge.is-error {
  color: var(--toolbox-danger);
}

.analysis-run-badge.is-cancelled,
.analysis-run-badge.is-wall-time-limit {
  color: var(--analysis-warning);
}

.analysis-finding > p {
  padding: 0 0.65rem 0.65rem;
  color: var(--toolbox-text);
  font-size: 0.78rem;
  line-height: 1.45;
}

.analysis-finding dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin: 0;
  border-top: 1px solid var(--toolbox-border);
}

.analysis-finding dl > div {
  padding: 0.6rem;
}

.analysis-finding dt,
.analysis-result-meta dt,
.analysis-input-summary dt {
  color: var(--toolbox-muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analysis-finding dd,
.analysis-result-meta dd,
.analysis-input-summary dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.74rem;
  line-height: 1.4;
}

.analysis-details {
  margin: 0 0.75rem 0.75rem;
  color: var(--toolbox-muted);
  font-size: 0.75rem;
}

.analysis-details summary {
  cursor: pointer;
  font-weight: 750;
}

.analysis-details li,
.analysis-limitations li {
  margin-block: 0.35rem;
  line-height: 1.4;
}

.analysis-growth-text-controls,
.analysis-number-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.55rem;
  padding: 0 0.75rem;
}

.analysis-growth-text-controls > label,
.analysis-number-controls > label {
  display: grid;
  align-content: start;
  gap: 0.25rem;
}

.analysis-growth-text-controls label > span,
.analysis-number-controls label > span {
  color: var(--toolbox-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.analysis-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.75rem 0.75rem;
}

.analysis-result-block {
  margin: 0 0.75rem 0.75rem;
}

.analysis-result-meta,
.analysis-input-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin: 0;
  padding: 0 0.75rem;
}

.analysis-result-meta > div,
.analysis-input-summary > div {
  padding: 0.55rem;
  border-bottom: 1px solid var(--toolbox-border);
}

.analysis-table-scroll {
  overflow: auto;
  border-block: 1px solid var(--toolbox-border);
}

.analysis-table-scroll table {
  min-width: 48rem;
}

.analysis-table-scroll th,
.analysis-table-scroll td {
  white-space: nowrap;
}

.analysis-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.65rem;
  padding: 0 0.75rem;
}

.analysis-chart {
  display: grid;
  min-width: 0;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) * 0.72);
  background: var(--toolbox-surface-soft);
}

.analysis-chart figcaption {
  display: grid;
  gap: 0.12rem;
}

.analysis-chart figcaption strong {
  font-size: 0.78rem;
}

.analysis-chart figcaption span {
  color: var(--toolbox-muted);
  font-size: 0.65rem;
}

.analysis-chart svg {
  width: 100%;
  height: 10rem;
  overflow: visible;
}

.analysis-chart-axis {
  fill: none;
  stroke: var(--toolbox-border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.analysis-chart-line {
  fill: none;
  stroke: var(--toolbox-accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.analysis-chart circle {
  fill: var(--toolbox-surface);
  stroke: var(--toolbox-accent);
  stroke-width: 2;
}

.analysis-empty-chart {
  display: grid;
  min-height: 10rem;
  place-items: center;
  color: var(--toolbox-muted);
  font-size: 0.75rem;
}

.analysis-outcome-plot {
  display: flex;
  min-height: 10rem;
  align-items: end;
  gap: 0.22rem;
}

.analysis-outcome-plot > span {
  min-width: 0.35rem;
  max-width: 2rem;
  height: 45%;
  flex: 1;
  border-radius: 0.2rem 0.2rem 0 0;
  background: var(--toolbox-muted);
}

.analysis-outcome-plot > span.is-match {
  height: 88%;
  background: var(--regex-mint);
}

.analysis-outcome-plot > span.is-no-match {
  background: var(--toolbox-accent);
}

.analysis-outcome-plot > span.is-timeout {
  height: 100%;
  background: var(--toolbox-danger);
}

.analysis-outcome-plot > span.is-crash,
.analysis-outcome-plot > span.is-compile-error {
  height: 100%;
  background: var(--analysis-warning);
}

.analysis-outcome-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  color: var(--toolbox-muted);
  font-size: 0.64rem;
}

.analysis-outcome-key span::before {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.25rem;
  border-radius: 0.15rem;
  background: var(--toolbox-muted);
  content: "";
}

.analysis-outcome-key .is-match::before {
  background: var(--regex-mint);
}

.analysis-outcome-key .is-no-match::before {
  background: var(--toolbox-accent);
}

.analysis-outcome-key .is-timeout::before {
  background: var(--toolbox-danger);
}

.analysis-outcome-key .is-crash::before {
  background: var(--analysis-warning);
}

.analysis-limitations {
  margin: 0;
  padding: 0 1.6rem 0.75rem 2rem;
  color: var(--toolbox-muted);
  font-size: 0.7rem;
}

@media (max-width: 40rem) {
  .analysis-section > header,
  .analysis-result-block > header {
    align-items: start;
    flex-direction: column;
  }

  .analysis-section > header > span,
  .analysis-result-block > header > span {
    text-align: left;
  }

  .analysis-status {
    grid-template-columns: 1fr;
  }

  .analysis-status > strong {
    white-space: normal;
  }
}
