body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100dvh;
  background: #f8fafc;
  color: #0f172a;
}

.wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

input,
select,
textarea,
button {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button {
  background: #0f172a;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.meta {
  font-size: 13px;
  color: #475569;
  margin-bottom: 8px;
}

.err {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px;
  border-radius: 8px;
  white-space: pre-wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border: 1px solid #e2e8f0;
  padding: 8px;
  text-align: left;
}

th {
  background: #f8fafc;
}

#resultsWrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

#chartCanvas {
  width: 100%;
  height: 280px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.traceWrap {
  display: grid;
  gap: 8px;
}

.traceItem {
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px 10px;
}

.traceHead {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #0f172a;
  font-weight: 600;
}

.traceDetail {
  font-size: 12px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.linkRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.toolNav {
  color: #0b5ca8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

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

  .linkRow {
    align-items: flex-start;
    flex-direction: column;
  }
}
