:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --surface: #f9fafb;
  --text: #18212f;
  --muted: #667085;
  --line: #d6dde7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f3ef;
  --danger: #b42318;
  --shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 420px) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand h1 {
  font-size: 21px;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.base-url,
.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.base-url {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.secondary-button {
  color: var(--accent-strong);
  border-color: #9ad8cf;
  background: #f4fffd;
}

.status-badge {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.status-badge.ok {
  color: var(--accent-strong);
  border-color: #9ad8cf;
  background: var(--accent-soft);
}

.status-badge.error {
  color: var(--danger);
  border-color: #f3b1a8;
  background: #fff1f0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  padding: 14px;
}

.panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-title,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title h2 {
  font-size: 18px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.token-panel {
  grid-row: span 1;
}

textarea {
  min-height: 184px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

pre {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 980px) {
  .topbar,
  .workspace,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
