:root {
  --primary: #4f8cff;
  --primary-dark: #2563eb;
  --primary-light: #5b96ff;

  --bg-page: #1a1d24;
  --bg-card: #232730;
  --bg-elev: #2a2f3a;
  --bg-input: #1f232b;

  --text: #e8eaed;
  --text-secondary: #9ba1ac;
  --text-muted: #6b7280;

  --border: #353a45;
  --border-input: #424754;

  --chip-bg: rgba(79, 140, 255, 0.15);
  --chip-color: #7fb0ff;

  --code-bg: #14171d;
  --code-text: #e6edf3;

  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-color: #fca5a5;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-btn: 8px;
  --radius-chip: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
.mono, code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }

/* ───────── Top bar ───────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 600;
  font-size: 18px;
  color: var(--primary);
  letter-spacing: 0.2px;
}
.hint {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ───────── Layout ───────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}
.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

/* ───────── Cards ───────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
}
.card-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.block-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ───────── Buttons ───────── */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.btn {
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #ffffff;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
  background: var(--bg-elev);
  border-color: var(--border-input);
  color: var(--text);
}
.btn-secondary:hover { background: #313742; }
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-color);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: var(--danger);
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ───────── Inputs ───────── */
label.field {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

/* ───────── URL block ───────── */
.urlbox {
  display: flex;
  align-items: stretch;
  gap: 8px;
  position: relative;
}
.urlbox code {
  flex: 1;
  min-width: 0;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 10px 12px;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
  user-select: all;
}
.url-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}
.url-meta b { color: var(--text); font-weight: 600; }

.copy-hint {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-btn);
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.4);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.copy-hint.show {
  opacity: 1;
  transform: translateY(0);
}

/* ───────── Request list ───────── */
.req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-elev);
}
.req-list li {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s ease;
}
.req-list li:last-child { border-bottom: none; }
.req-list li:hover { background: #313742; }
.req-list li.active {
  background: var(--chip-bg);
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}
.req-list .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.req-list .meta {
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty {
  color: var(--text-secondary);
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
}

/* ───────── Method badges (HTTP verb chips) ───────── */
.method {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  color: #ffffff;
  letter-spacing: 0.3px;
  background: var(--primary-dark);
}
.method.GET    { background: #047857; }
.method.POST   { background: #1d4ed8; }
.method.PUT    { background: #b45309; }
.method.DELETE { background: #b91c1c; }
.method.PATCH  { background: #7c3aed; }

/* ───────── Detail ───────── */
.detail-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.detail-head .path {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}
.detail-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}
.detail-meta b { color: var(--text); font-weight: 500; }
.resp-ok {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: var(--radius-btn);
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 600;
  font-size: 12px;
}

/* ───────── KV table ───────── */
.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.kv td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  vertical-align: top;
  word-break: break-all;
}
.kv tr:last-child td { border-bottom: none; }
.kv td:first-child {
  color: var(--text-secondary);
  width: 30%;
  font-weight: 500;
}

/* ───────── Body code block ───────── */
.body-block {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 14px 16px;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.5;
  font-family: ui-monospace, monospace;
  margin: 0;
}

/* JSON syntax highlight */
.j-key  { color: #79c0ff; }
.j-str  { color: #a5d6ff; }
.j-num  { color: #ffa657; }
.j-bool { color: #ff7b72; }
.j-null { color: #ff7b72; }

/* ───────── Modal ───────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.7);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.modal[hidden] { display: none; }
.modal.show { opacity: 1; }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  min-width: 360px;
  max-width: 520px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(-8px);
  transition: transform 0.15s ease;
}
.modal.show .modal-card { transform: translateY(0); }
.modal-card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.modal-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 20px;
  white-space: pre-line;
}
.modal-body b { color: var(--text); font-weight: 600; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
