:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172026;
  --muted: #69737d;
  --line: #dbe1e7;
  --accent: #146c5f;
  --accent-2: #2459a6;
  --danger: #a63a3a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 13px;
  margin-top: 14px;
  margin-bottom: 8px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.status {
  min-width: 86px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.version {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.nav-link {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.status.ok {
  border-color: #9bc9bc;
  color: var(--accent);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  min-height: 0;
}

.samples {
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.filter-row,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.filter-row span {
  color: var(--muted);
  font-size: 12px;
}

select,
button,
textarea {
  font: inherit;
}

select,
button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  height: 28px;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.sample-list {
  overflow: auto;
  padding: 8px;
}

.sample {
  display: block;
  width: 100%;
  text-align: left;
  height: auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.sample:hover,
.sample.active {
  border-color: var(--line);
  background: #f1f5f7;
}

.sample strong {
  display: block;
  font-size: 12px;
  color: var(--accent-2);
}

.sample span {
  display: -webkit-box;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sample em {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
}

.tester {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

.input-panel,
.summary,
.json-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.input-panel {
  padding: 12px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 650;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  line-height: 1.45;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 12px;
  margin-top: 12px;
}

.summary,
.json-panel {
  padding: 12px;
  min-width: 0;
}

dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  margin: 12px 0 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 650;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #f7faf9;
  color: var(--accent);
}

.chip.danger {
  color: var(--danger);
  background: #fff7f7;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
  line-height: 1.45;
}

#json {
  min-height: 420px;
}

.monitor-app {
  min-height: 100vh;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 16px 0;
}

.metric-card,
.monitor-panel,
.monitor-recent {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric-card {
  padding: 14px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.monitor-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.monitor-panel {
  padding: 12px;
  min-width: 0;
}

.monitor-recent {
  margin: 0 16px 16px;
  padding: 12px;
}

@media (max-width: 860px) {
  .topbar,
  .top-meta {
    align-items: flex-start;
  }

  .topbar {
    gap: 10px;
  }

  .top-meta {
    flex-direction: column-reverse;
  }

  .workspace,
  .result-grid,
  .monitor-grid,
  .monitor-layout {
    grid-template-columns: 1fr;
  }

  .samples {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
