:root {
  color-scheme: light;
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-muted: #eef1f2;
  --ink: #172126;
  --muted: #657178;
  --line: #d8dfe2;
  --accent: #087f5b;
  --accent-strong: #056247;
  --blue: #1769aa;
  --amber: #a35b00;
  --danger: #b4232f;
  --shadow: 0 12px 30px rgba(23, 33, 38, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.topbar {
  color: #f8fbfa;
  background: #172126;
  border-bottom: 3px solid var(--accent);
}

.topbar__inner,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar__inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-block > div {
  min-width: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  border: 7px solid #34c99a;
  border-right-color: #58a9e0;
  border-radius: 50%;
}

.brand-kicker,
.section-index {
  margin: 0 0 3px;
  color: #8da0a8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

.state-label,
.progress-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbd4d8;
  font-size: 13px;
  white-space: nowrap;
}

.language-select {
  flex: 0 0 auto;
  min-width: 118px;
  min-height: 34px;
  padding: 0 30px 0 10px;
  color: #f8fbfa;
  background-color: #172126;
  border: 1px solid #56666d;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.language-select:hover,
.language-select:focus {
  background: #26343a;
  border-color: #829198;
  outline: none;
}

.state-label,
.progress-count {
  color: var(--muted);
}

main {
  padding: 28px 0 22px;
}

.trace-command,
.panel,
.environment {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.trace-command {
  padding: 22px 24px 24px;
  border-top: 3px solid var(--accent);
}

.trace-command--secondary {
  margin-top: 16px;
  border-top-color: var(--blue);
}

.command-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary-command {
  min-height: 46px;
  min-width: 132px;
  padding: 0 22px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-weight: 750;
}

.primary-command:hover {
  background: var(--accent-strong);
}

.primary-command:disabled {
  cursor: wait;
  opacity: 0.62;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-heading--panel {
  min-height: 68px;
  margin: 0;
  padding: 15px 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.environment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.report-state {
  min-width: 42px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.section-index {
  color: var(--accent);
}

.trace-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trace-form__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
}

.trace-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aeb9be;
  border-radius: 4px;
  outline: none;
}

.trace-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.15);
}

.trace-form button {
  min-height: 46px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-weight: 750;
}

.trace-form button:hover {
  background: var(--accent-strong);
}

.trace-form button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.notice {
  margin-top: 12px;
  padding: 10px 14px;
  color: #694000;
  background: #fff4d8;
  border: 1px solid #e8c774;
  border-radius: 4px;
  font-size: 13px;
}

.notice--error {
  color: #7f1720;
  background: #fff0f1;
  border-color: #e2a1a7;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.text-button {
  padding: 4px 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 700;
}

.text-button:disabled {
  cursor: not-allowed;
  color: #aeb9be;
}

.result-list {
  min-height: 272px;
}

.result-row {
  min-height: 88px;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

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

.result-row__label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  display: inline-block;
  background: #93a0a6;
  border-radius: 50%;
}

.status-dot--loading {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(163, 91, 0, 0.12);
}

.status-dot--ok {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(8, 127, 91, 0.12);
}

.status-dot--error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 47, 0.11);
}

.result-row__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.result-row__value {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  line-height: 1.35;
}

.result-row__meta {
  min-height: 18px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.result-row[data-state="error"] .result-row__value {
  color: var(--danger);
  font-family: inherit;
  font-size: 14px;
}

.environment {
  margin-top: 16px;
  overflow: hidden;
}

.environment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.environment-grid > div {
  min-width: 0;
  padding: 17px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.environment-grid > div:nth-child(2) {
  border-right: 0;
}

.environment-grid > div:last-child {
  border-bottom: 0;
}

.environment-grid__wide {
  grid-column: 1 / -1;
  border-right: 0 !important;
}

.environment-grid dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.environment-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 12px;
}

footer code {
  color: var(--ink);
}

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

@media (max-width: 620px) {
  .topbar__inner,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .topbar__inner {
    min-height: 76px;
    gap: 8px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-block {
    gap: 8px;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    border-width: 6px;
  }

  h1 {
    font-size: 15px;
  }

  .language-select {
    min-width: 104px;
    padding-left: 8px;
  }

  main {
    padding-top: 14px;
  }

  .trace-command {
    padding: 17px 16px 18px;
  }

  .trace-form__controls {
    grid-template-columns: 1fr;
  }

  .result-row {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 104px;
    padding: 14px 16px;
  }

  .section-heading--panel {
    padding-inline: 16px;
  }

  .environment-actions {
    flex-wrap: wrap;
    gap: 5px 12px;
  }

  .report-state {
    flex-basis: 100%;
    min-height: 16px;
    text-align: right;
  }

  .environment-grid {
    grid-template-columns: 1fr;
  }

  .environment-grid > div,
  .environment-grid > div:nth-child(2) {
    border-right: 0;
  }

  .environment-grid__wide {
    grid-column: auto;
  }

  footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .status-dot--loading {
    animation: pulse 1.25s ease-in-out infinite;
  }

  @keyframes pulse {
    50% { opacity: 0.45; }
  }
}
