*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 220px;
  --bg: #f5f6fa;
  --sidebar-bg: #1e2130;
  --sidebar-hover: #2c3050;
  --sidebar-active: #3d4470;
  --accent: #5c6bc0;
  --accent-light: #7986cb;
  --text: #2d3142;
  --text-muted: #7c8098;
  --border: #dde1ee;
  --card-bg: #ffffff;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

body {
  display: flex;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* ── Sidebar ── */
aside {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .6;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  color: rgba(255,255,255,.75);
  transition: background .15s, color .15s;
  user-select: none;
}

.nav-item:hover  { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

.nav-item .badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.badge-any  { background: #546e7a; color: #fff; }
.badge-get  { background: #2e7d32; color: #fff; }
.badge-post { background: #1565c0; color: #fff; }

/* ── Main ── */
main {
  flex: 1;
  padding: 28px 32px;
  max-width: 860px;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.panel-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Form elements ── */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fafbff;
  outline: none;
  transition: border-color .15s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus { border-color: var(--accent-light); }

textarea {
  resize: vertical;
  min-height: 90px;
  font-family: "Cascadia Code", "Fira Mono", "Consolas", monospace;
}

.form-row { margin-bottom: 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .08s;
}

.btn:active             { transform: scale(.97); }
.btn:disabled           { opacity: .6; cursor: default; }
.btn-primary            { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-secondary          { background: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { opacity: .8; }
.btn-sm                 { padding: 5px 12px; font-size: 12px; }
.btn-danger             { background: #ffebee; color: #e53935; }
.btn-danger:hover       { background: #ffcdd2; }
.btn-group              { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Method selector ── */
.method-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

.method-tab {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all .15s;
  color: var(--text-muted);
  background: var(--bg);
}

.method-tab:hover { border-color: var(--accent-light); color: var(--accent); }

.method-tab.active[data-method="GET"]     { background: #e8f5e9; border-color: #66bb6a; color: #2e7d32; }
.method-tab.active[data-method="POST"]    { background: #e3f2fd; border-color: #42a5f5; color: #1565c0; }
.method-tab.active[data-method="PUT"]     { background: #fff8e1; border-color: #ffca28; color: #f57f17; }
.method-tab.active[data-method="PATCH"]   { background: #f3e5f5; border-color: #ba68c8; color: #6a1b9a; }
.method-tab.active[data-method="DELETE"]  { background: #ffebee; border-color: #ef5350; color: #b71c1c; }
.method-tab.active[data-method="HEAD"]    { background: #e0f7fa; border-color: #26c6da; color: #00838f; }
.method-tab.active[data-method="OPTIONS"] { background: #fce4ec; border-color: #f06292; color: #880e4f; }

/* ── KV editor ── */
.kv-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.kv-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.kv-row input { margin: 0; }

/* ── Status code quick-picks ── */
.code-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.code-pill {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}

.code-pill:hover { opacity: .8; }
.c2xx { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.c4xx { background: #fff3e0; color: #e65100; border-color: #ffcc80; }
.c5xx { background: #ffebee; color: #b71c1c; border-color: #ef9a9a; }

/* ── Range slider ── */
.slider-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.slider-value { min-width: 80px; text-align: right; font-weight: 600; font-size: 13px; }

/* ── Response area ── */
.response-area { margin-top: 20px; }

.response-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}

.s2xx { background: #e8f5e9; color: #2e7d32; }
.s3xx { background: #e3f2fd; color: #1565c0; }
.s4xx { background: #fff3e0; color: #e65100; }
.s5xx { background: #ffebee; color: #b71c1c; }

.response-time { color: var(--text-muted); font-size: 12px; font-weight: 500; }

details { margin-bottom: 10px; }

details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 6px 0;
  user-select: none;
}

details summary:hover { color: var(--accent); }

.headers-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.headers-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.headers-table td:first-child { width: 40%; font-weight: 600; color: var(--text-muted); font-family: monospace; }
.headers-table td:last-child  { font-family: monospace; word-break: break-all; }

.response-body {
  background: #1e2130;
  color: #cdd6f4;
  padding: 14px 16px;
  border-radius: 6px;
  font-family: "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
}

.json-key  { color: #89dceb; }
.json-str  { color: #a6e3a1; }
.json-num  { color: #fab387; }
.json-bool { color: #cba6f7; }
.json-null { color: #f38ba8; }

/* ── URL preview ── */
.url-preview {
  background: #f0f2ff;
  border: 1px solid #c5cae9;
  border-radius: 6px;
  padding: 7px 12px;
  font-family: monospace;
  font-size: 12px;
  color: var(--accent);
  word-break: break-all;
  margin-top: 12px;
}

/* ── Home grid ── */
.endpoint-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.endpoint-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.endpoint-card:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 16px rgba(92,107,192,.12);
}

.endpoint-card .name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.endpoint-card .path { font-family: monospace; font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.endpoint-card .desc { color: var(--text-muted); font-size: 12px; line-height: 1.4; }

/* ── Toggle switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.2);
  border-radius: 18px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* light-background variant (standalone pages) */
.toggle-slider-light { background: var(--border); }
.toggle input:checked + .toggle-slider-light { background: var(--accent); }

.toggle-label-dark  { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.6); }
.toggle-label-light { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
