:root {
  --bg: #0f1419;
  --bg-2: #161b22;
  --bg-3: #1c232c;
  --bg-4: #232c37;
  --border: #2a3340;
  --text: #e6edf3;
  --muted: #8b96a6;
  --primary: #7c5cff;
  --primary-2: #9b85ff;
  --accent: #29d1c1;
  --success: #2ecc71;
  --warning: #f5a623;
  --error: #ff5470;
  --get: #29d1c1;
  --post: #7c5cff;
  --put: #f5a623;
  --del: #ff5470;
  --shadow: 0 8px 24px rgba(0,0,0,0.3);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

code { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.hidden { display: none !important; }

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: linear-gradient(180deg, #131922, #0f1419);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand .logo {
  font-size: 32px;
  filter: drop-shadow(0 0 12px rgba(124, 92, 255, 0.4));
}
.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.brand small { color: var(--muted); font-size: 12px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 65px);
}

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}
.sidebar-title {
  padding: 0 18px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 600;
}
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  flex: 1;
}
.endpoint-list .endpoint-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.endpoint-list .endpoint-item:hover {
  background: var(--bg-3);
}
.endpoint-list .endpoint-item.active {
  background: var(--bg-4);
  border-color: var(--border);
}
.endpoint-item .row1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.endpoint-item .name {
  font-weight: 500;
  font-size: 13px;
}
.endpoint-item .row2 {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-left: 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-footer a,
.sidebar-footer .footer-link {
  color: var(--primary-2);
  text-decoration: none;
  cursor: pointer;
}
.sidebar-footer a:hover,
.sidebar-footer .footer-link:hover {
  text-decoration: underline;
}
.sidebar-footer .footer-brand {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Imprint */
.imprint-modal-content {
  width: min(640px, 94vw);
}
.imprint-body {
  gap: 4px;
}
.imprint-section {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.imprint-section:first-of-type {
  border-top: none;
  padding-top: 0;
}
.imprint-section h3 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
}
.imprint-section p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
}
.imprint-section p.small,
.imprint-section .small {
  font-size: 12.5px;
  color: var(--muted);
}

/* ===== Method pills ===== */
.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #0f1419;
  min-width: 42px;
  text-align: center;
}
.method-get { background: var(--get); }
.method-post { background: var(--post); color: #fff; }
.method-put { background: var(--put); }
.method-delete { background: var(--del); color: #fff; }

/* ===== Work area ===== */
.workarea {
  padding: 24px 28px;
  overflow-x: hidden;
}

.endpoint-header {
  margin-bottom: 18px;
}
.endpoint-header h2 {
  margin: 8px 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.endpoint-path {
  font-family: var(--mono);
  background: var(--bg-3);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 6px;
  border: 1px solid var(--border);
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.form-container {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-weight: 500;
  font-size: 13px;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field input[type="password"],
.field input[type="email"],
.field select,
.field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}
.field textarea {
  font-family: var(--mono);
  font-size: 12.5px;
  min-height: 220px;
  resize: vertical;
}

.input-row {
  display: flex;
  gap: 6px;
}
.input-row input { flex: 1; }

.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }

/* ===== Buttons & pills ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, transform .05s;
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(180deg, var(--primary), #6a4cf0);
  border-color: rgba(255,255,255,0.05);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-3); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill-ok { background: rgba(46, 204, 113, 0.18); color: #65e3a4; border-color: rgba(46, 204, 113, 0.3); }
.pill-warn { background: rgba(245, 166, 35, 0.18); color: #ffc879; border-color: rgba(245, 166, 35, 0.3); }
.pill-error { background: rgba(255, 84, 112, 0.18); color: #ff8da0; border-color: rgba(255, 84, 112, 0.3); }
.pill-neutral { background: var(--bg-3); color: var(--muted); }

/* ===== Request info panel (above response) ===== */
.request-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.request-info-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: start;
  gap: 8px;
}
.request-info-label {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
  padding-top: 3px;
}
.request-info code,
.request-info pre {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--text);
}
.request-info .response-url {
  word-break: break-all;
  white-space: pre-wrap;
}
.request-info pre.request-body {
  margin: 0;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Response ===== */
.response {
  margin: 0;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  background: #0a0e13;
  color: #d8e0eb;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.response-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Syntax highlight (very small) */
.tok-key { color: #9b85ff; }
.tok-str { color: #65e3a4; }
.tok-num { color: #ffc879; }
.tok-bool { color: #ff8da0; }
.tok-null { color: #ff8da0; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(560px, 92vw);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}
.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); gap: 10px; justify-content: flex-end; }
.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.modal-header h2 { margin: 0; font-size: 16px; }

/* ===== Tabs (in form container) ===== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: max-content;
}
.tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.tabs button.active {
  background: var(--bg);
  color: var(--text);
}

/* ===== Helpers ===== */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0 4px;
}
.field-group-title {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: #2f3a48; }

/* Responsive */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .topbar h1 { font-size: 16px; }
}
