:root {
  --gray-25: #FCFCFD;
  --gray-50: #F9FAFB;
  --gray-100: #F2F4F7;
  --gray-200: #EAECF0;
  --gray-300: #D0D5DD;
  --gray-400: #98A2B3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #182230;
  --gray-900: #101828;
  --gray-950: #0C111D;

  --neutral-25: #FAFAFA;
  --neutral-50: #F5F5F6;
  --neutral-100: #F0F0F1;
  --neutral-200: #ECECED;
  --neutral-300: #CECFD2;
  --neutral-400: #94969C;
  --neutral-500: #85888E;
  --neutral-600: #61646C;
  --neutral-700: #333741;
  --neutral-800: #1F242F;
  --neutral-900: #161B26;
  --neutral-950: #0C111D;

  --violet-25: #FFF6FE;
  --violet-50: #FFF1FE;
  --violet-100: #FFD7FB;
  --violet-200: #FA9DF0;
  --violet-300: #C544B8;
  --violet-400: #8D1982;
  --violet-500: #740D6A;
  --violet-600: #6A0C61;
  --violet-700: #4B0B4B;
  --violet-800: #400A40;
  --violet-900: #300530;
  --violet-950: #2B042B;

  --green-25: #F9FFFB;
  --green-50: #F0FDF4;
  --green-100: #DCFCE7;
  --green-300: #86EFAC;
  --green-600: #16A34A;
  --green-700: #15803D;
  --green-900: #14532D;
  --green-200: #BBF7D0;

  --red-50: #FEF3F2;
  --red-100: #FEE4E2;
  --red-600: #D92D20;
  --red-700: #B42318;

  --yellow-50: #FFFAEB;
  --yellow-100: #FEF0C7;
  --yellow-300: #FEC84B;
  --yellow-600: #DC6803;
  --yellow-700: #B54708;

  --brand: var(--violet-600);
  --brand-dark: var(--violet-800);
  --brand-light: var(--violet-100);
  --bg: var(--gray-25);
  --panel: #ffffff;
  --border: var(--gray-200);
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --text-body: var(--gray-700);
  --mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --get: var(--gray-600);
  --post: var(--green-600);
  --patch: var(--yellow-600);
  --delete: var(--red-600);
  --ok: var(--green-700);
  --err: var(--red-600);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
a { color: var(--brand); }
code, pre, .mono { font-family: var(--mono); }

/* ---------- Sidebar ---------- */
#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--neutral-900);
  color: var(--neutral-25);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}
#sidebar .brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--neutral-700);
  cursor: pointer;
}
#sidebar .brand h1 {
  font-size: 16px;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
#sidebar .brand p {
  margin: 0;
  font-size: 12.5px;
  color: var(--neutral-400);
  line-height: 1.5;
}
.lang-switch {
  display: flex;
  gap: 6px;
  padding: 12px 20px 4px;
}
.lang-switch button {
  flex: 1;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 0;
  border-radius: 6px;
  border: 1px solid var(--neutral-700);
  background: transparent;
  color: var(--neutral-400);
  cursor: pointer;
}
.lang-switch button:hover { color: var(--neutral-25); border-color: var(--neutral-500); }
.lang-switch button.active {
  background: var(--neutral-800);
  color: var(--neutral-25);
  border-color: var(--violet-300);
}
#sidebar nav { padding: 10px 10px 24px; flex: 1; }
#sidebar .group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neutral-500);
  padding: 16px 10px 6px;
  font-weight: 700;
}
.ep-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  color: var(--neutral-200);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--sans);
}
.ep-link:hover { background: var(--neutral-800); }
.ep-link.active { background: var(--neutral-800); border-left-color: var(--violet-300); color: var(--neutral-25); font-weight: 600; }
.ep-link .m {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  color: white;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}
.m-get { background: var(--get); }
.m-post { background: var(--post); }
.m-patch { background: var(--patch); }
.m-delete { background: var(--delete); }
.m-intro { background: var(--neutral-700); color: var(--neutral-50); }
.ep-link .p { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main ---------- */
#main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 80px;
  display: flex;
  flex-direction: column;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.credentials-card { padding: 16px 20px; }
h2 { margin: 0 0 8px; font-size: 20px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 10px; }
.intro p { line-height: 1.65; color: var(--text-body); }
.intro code { background: var(--gray-100); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.intro-page { max-width: 760px; }
.auth-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field input, .field textarea, .field select {
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--gray-25);
  color: var(--text);
  width: 100%;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }
.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.ep-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge-method {
  font-family: var(--mono); font-weight: 700; font-size: 12px; color: white;
  padding: 4px 10px; border-radius: 6px;
}
.ep-path { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.badge-auth {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-muted); background: var(--gray-50); display: inline-flex; align-items: center; gap: 5px;
}
.badge-auth.needed { color: var(--violet-700); background: var(--violet-50); border-color: var(--violet-200); }
.ep-desc { color: var(--text-body); line-height: 1.6; margin-top: 12px; font-size: 14.5px; }
.ep-desc .when { margin-top: 10px; padding: 10px 12px; background: var(--gray-50); border-radius: 8px; font-size: 13.5px; color: var(--gray-700); }

.params-grid { display: grid; gap: 12px; }
.params-grid + .body-panel { margin-top: 16px; }
.param-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: start; }
.param-row .meta { padding-top: 9px; }
.param-row .pname, .body-panel .pname { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--gray-800); }
.param-row .preq, .body-panel .preq { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.param-row .preq.required, .body-panel .preq.required { color: var(--err); }
.param-row input {
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.param-row input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--violet-100);
}
.empty-params { color: var(--text-muted); font-size: 13px; margin: 0; }

.body-panel {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
  overflow: hidden;
}
.body-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}
.body-panel-title { display: flex; flex-direction: column; gap: 1px; }
.body-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
}
.body-mode-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--sans);
}
.body-mode-btn:hover { color: var(--gray-700); }
.body-mode-btn.active {
  background: #fff;
  color: var(--gray-800);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.body-fields {
  display: grid;
  gap: 14px;
  padding: 16px;
}
.body-field { display: flex; flex-direction: column; gap: 6px; }
.body-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.body-field-label .fname {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-800);
}
.body-field-control { position: relative; min-width: 0; }
.body-field-control input[type="text"],
.body-field-control input[type="email"],
.body-field-control input[type="password"],
.body-field-control input[type="number"],
.body-field-control textarea {
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.body-field-control:has(.reveal-btn) input { padding-right: 42px; }
.body-field-control textarea.body-field-json {
  font-family: var(--mono);
  font-size: 12.5px;
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}
.body-field-control input:focus,
.body-field-control textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--violet-100);
}
.body-field-control input::placeholder,
.body-field-control textarea::placeholder { color: var(--gray-400); }
.reveal-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.reveal-btn:hover { color: var(--gray-800); background: var(--gray-100); }
.body-json-view { background: var(--neutral-900); }
textarea.body-editor {
  display: block;
  width: 100%;
  min-height: 200px;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--mono);
  font-size: 13px;
  padding: 16px;
  border: none;
  background: var(--neutral-900);
  color: var(--neutral-100);
  caret-color: var(--violet-200);
  border-radius: 0;
  tab-size: 2;
}
textarea.body-editor:focus { outline: none; }
textarea.body-editor.invalid { box-shadow: inset 0 0 0 2px var(--red-600); }

.send-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
button.send-btn {
  background: var(--brand); color: white; border: none; padding: 10px 20px;
  border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer;
}
button.send-btn:hover { background: var(--violet-700); }
button.send-btn:disabled { opacity: 0.6; cursor: default; }
button.ghost-btn {
  background: none; border: 1px solid var(--gray-300); color: var(--text-muted);
  padding: 8px 14px; border-radius: 8px; font-size: 12.5px; cursor: pointer;
}
button.ghost-btn:hover { border-color: var(--brand); color: var(--brand); }
.send-status { font-size: 12.5px; color: var(--text-muted); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.workspace-col { min-width: 0; }
.workspace-col .card { margin-bottom: 0; }
.workspace-col .card + .card { margin-top: 16px; }
.expected-col { position: sticky; top: 16px; }

/* minmax(0, 1fr), not 1fr: without a 0 min-width, grid tracks refuse to shrink
   below the intrinsic width of unbreakable content (e.g. a long JWT with no
   spaces), pushing the whole card past the page's right edge. */
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.result-col { min-width: 0; }
.result-col h4 { font-size: 11.5px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; letter-spacing: 0.04em; }
pre.code-block {
  background: var(--neutral-900); color: var(--neutral-100); border-radius: 8px; padding: 14px;
  font-size: 12.5px; overflow-x: auto; margin: 0; line-height: 1.6; max-height: 520px; overflow-y: auto;
  min-width: 0; word-break: break-all; white-space: pre-wrap;
}
.json-key { color: var(--violet-200); }
.json-string { color: var(--green-300); }
.json-number { color: var(--yellow-300); }
.json-boolean { color: var(--violet-300); }
.json-null { color: var(--neutral-400); }

.status-pill { font-family: var(--mono); font-weight: 700; font-size: 12.5px; padding: 3px 9px; border-radius: 6px; }
.status-pill.ok { background: var(--green-100); color: var(--ok); }
.status-pill.err { background: var(--red-100); color: var(--err); }
.status-pill.pending { background: var(--gray-100); color: var(--text-muted); }
.status-pill.redirect { background: var(--yellow-100); color: var(--yellow-700); }

.response-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.response-meta .hint-inline { font-size: 12.5px; color: var(--text-muted); }
.response-note { font-size: 13px; color: var(--violet-700); line-height: 1.55; margin: 10px 0 0; padding: 10px 12px; background: var(--violet-50); border-radius: 8px; }
.empty-body { color: var(--text-muted); font-size: 13px; margin: 0; font-style: italic; }

.curl-box { position: relative; margin-top: 16px; }
.curl-box pre { padding-right: 90px; }
.copy-btn {
  position: absolute; top: 10px; right: 10px; background: var(--neutral-700); color: var(--neutral-50);
  border: 1px solid var(--neutral-600); border-radius: 6px; padding: 5px 10px; font-size: 11.5px; cursor: pointer;
}
.copy-btn:hover { background: var(--neutral-600); }

.top-tip { display: flex; gap: 10px; align-items: flex-start; background: var(--green-50); border: 1px solid var(--green-200); color: var(--green-900); padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.55; margin-top: 14px; }
.top-tip b { font-weight: 700; }

.steps { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
}
.steps .n {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--violet-100); color: var(--violet-600);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.intro-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

footer.note { color: var(--text-muted); font-size: 12px; text-align: center; padding: 20px 0 0; margin-top: auto; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .expected-col { position: static; }
}
@media (max-width: 860px) {
  .result-grid, .auth-bar { grid-template-columns: minmax(0, 1fr); }
  .param-row { grid-template-columns: 1fr; }
  #sidebar { width: 240px; }
}
