:root {
  --bg: #0b0d12;
  --bg-elev: #11141b;
  --bg-elev-2: #161a23;
  --bg-hover: #1c2230;
  --border: #232938;
  --border-soft: #1a1f2b;
  --text: #e6e8ee;
  --text-dim: #8b94a8;
  --text-faint: #5a6173;
  --accent: #7c5cff;
  --accent-2: #5eead4;
  --accent-soft: rgba(124, 92, 255, .14);
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --info: #60a5fa;

  --m-get: #34d399;
  --m-post: #60a5fa;
  --m-put: #fbbf24;
  --m-patch: #c084fc;
  --m-delete: #f87171;
  --m-other: #94a3b8;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .22s ease;
}
body[data-sidebar="closed"] { grid-template-columns: 0 1fr; }
body[data-sidebar="closed"] .sidebar {
  overflow: hidden;
  border-right-color: transparent;
}
body[data-sidebar="closed"] .sidebar > * {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}

/* Botão hamburger flutuante */
.sidebar-toggle {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 70;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s, border-color .15s;
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}
.sidebar-toggle:active { transform: scale(.95); }
.sidebar-toggle .ico-close { display: none; }
body[data-sidebar="open"] .sidebar-toggle .ico-open  { display: none; }
body[data-sidebar="open"] .sidebar-toggle .ico-close { display: block; }
/* No desktop, quando aberta a sidebar tem 280px — desloca o botão para dentro dela
   para não tampar conteúdo. */
@media (min-width: 981px) {
  body[data-sidebar="open"] .sidebar-toggle {
    left: 232px;
    background: var(--bg-elev-2);
  }
}

/* Backdrop só aparece em mobile */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 55;
}
@media (max-width: 980px) {
  body[data-sidebar="open"] .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

button { font-family: inherit; cursor: pointer; }
input, button { font-family: inherit; font-size: inherit; color: inherit; }
code { font-family: var(--mono); }

.hidden { display: none !important; }

/* ------------------------- SIDEBAR ------------------------- */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sidebar-header {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .2px;
}
.brand span { color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter .15s, transform .05s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary.lg { padding: 12px 18px; font-size: 15px; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border); background: var(--bg-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248,113,113,.3);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}
.btn-danger:hover { background: rgba(248,113,113,.08); }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-search {
  position: relative;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-search svg {
  position: absolute;
  left: 22px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
}
.sidebar-search input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 8px 10px 8px 30px;
  border-radius: var(--radius-sm);
  outline: none;
}
.sidebar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.test-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.test-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  align-items: center;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
  width: 100%;
}
.test-item:hover { background: var(--bg-hover); }
.test-item.active {
  background: var(--accent-soft);
  border-color: rgba(124,92,255,.35);
}
.test-item .name {
  color: var(--text);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.test-item .meta {
  color: var(--text-faint);
  font-size: 11.5px;
  font-family: var(--mono);
}
.test-item .badge {
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.test-item .delete-btn {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.test-item:hover .delete-btn,
.test-item.active .delete-btn,
.test-item .delete-btn:focus-visible { opacity: 1; }
.test-item .delete-btn:hover {
  color: var(--danger);
  background: rgba(248,113,113,.1);
}

.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ------------------------- MAIN ------------------------- */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: padding-left .22s ease;
}
/* Espaço para o botão hamburger não tampar o conteúdo
   e dar respiro à esquerda quando a sidebar está retraída */
body[data-sidebar="closed"] .main { padding-left: 60px; }

.empty-state {
  margin: auto;
  text-align: center;
  padding: 40px;
  max-width: 520px;
  color: var(--text-dim);
}
.empty-state h1 { color: var(--text); margin: 16px 0 8px; font-size: 22px; font-weight: 600; }
.empty-state p { line-height: 1.55; margin: 0 0 24px; }
.empty-art { color: var(--accent); }

/* ------------------------- TEST VIEW ------------------------- */
.test-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.view-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-elev);
}
.view-title {
  display: flex; align-items: center; gap: 8px;
  grid-column: 1 / -1;
}
.view-title h2 { margin: 0; font-size: 16px; font-weight: 600; }

.view-url {
  grid-column: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.url-block {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.view-url label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 8px;
}
.proxy-pill {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-2);
  background: rgba(94,234,212,.08);
  border: 1px solid rgba(94,234,212,.25);
  padding: 1px 6px;
  border-radius: 999px;
  max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.url-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 8px 6px 10px;
  min-width: 0;
}
.url-row code {
  flex: 1;
  color: var(--accent-2);
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hint { color: var(--text-faint); font-size: 12px; }
.hint b { color: var(--text-dim); font-weight: 600; }

.view-actions {
  grid-column: 2 / 3;
  display: flex; align-items: center; gap: 8px;
}
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}
.live .dot {
  width: 7px; height: 7px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: pulse 1.6s infinite;
}
.live.off .dot { background: var(--text-faint); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* split */
.split {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  min-height: 0;
}
.requests-panel {
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
}
.panel-toolbar {
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 12px;
}
.panel-toolbar #req-count { color: var(--text); }
.filters {
  display: flex;
  gap: 6px;
  align-items: center;
}
.filters input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 12px;
  width: 200px;
}
.filters input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 12px;
}
.compare-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.compare-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 12.5px;
}
.compare-bar b { color: var(--text); }
.compare-actions { display: flex; gap: 6px; }
.compare-actions button { padding: 5px 10px; font-size: 12px; }
.compare-actions .btn-primary[disabled] { opacity: .45; pointer-events: none; }

/* Status badge (códigos HTTP) */
.status-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  letter-spacing: .3px;
}
.status-badge.inline { font-size: 10.5px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }
.status-badge.sc-2xx { color: var(--ok);     background: rgba(52,211,153,.1);  border-color: rgba(52,211,153,.3); }
.status-badge.sc-3xx { color: var(--info);   background: rgba(96,165,250,.1);  border-color: rgba(96,165,250,.3); }
.status-badge.sc-4xx { color: var(--warn);   background: rgba(251,191,36,.1);  border-color: rgba(251,191,36,.3); }
.status-badge.sc-5xx { color: var(--danger); background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); }
.status-badge.sc-pending {
  color: var(--warn);
  background: rgba(251,191,36,.12);
  border-color: rgba(251,191,36,.4);
  display: inline-flex; align-items: center; gap: 6px;
}
.dot-pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warn);
  animation: pulse-dot 1.4s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* Banner do modo debug */
.debug-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(251,191,36,.16), rgba(251,191,36,.04));
  border-bottom: 1px solid rgba(251,191,36,.35);
  color: var(--warn);
  font-size: 12.5px;
}
.debug-banner b { color: var(--text); }
.debug-banner > div { flex: 1; color: var(--text-dim); }
.debug-banner .btn-ghost {
  border-color: rgba(251,191,36,.35);
  color: var(--warn);
}
.debug-banner .btn-ghost:hover { background: rgba(251,191,36,.1); }

/* Item da lista quando pendente */
.req-item.pending { border-left: 3px solid var(--warn); padding-left: 9px; }
.req-item.pending .path { color: var(--warn); }

.btn-ghost.active,
.btn-ghost.active:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
#btn-debug.active, #btn-debug.active:hover {
  color: var(--warn);
  border-color: rgba(251,191,36,.5);
  background: rgba(251,191,36,.12);
}

.response-header {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 8px;
}

.proxy-error {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.25);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

/* Detalhe: barra de alias */
.detail-alias-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.alias-tag {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124,92,255,.35);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.req-list {
  list-style: none;
  margin: 0; padding: 0;
  overflow-y: auto;
  flex: 1;
}
.req-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  border-top: 1px solid var(--border-soft);
}
.req-empty p { margin: 0 0 6px; color: var(--text-dim); }
.req-empty code {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--accent-2);
  word-break: break-all;
}

.req-item {
  display: grid;
  grid-template-columns: 0 56px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background .12s, grid-template-columns .14s ease;
}
.req-item:hover { background: var(--bg-hover); }
.req-item.active { background: var(--accent-soft); }
.req-item.compare-mode {
  grid-template-columns: 18px 56px 1fr auto auto auto;
}
.req-item .check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  color: transparent;
  background: var(--bg-elev);
  transition: border-color .12s, background .12s, color .12s;
  visibility: hidden;
}
.req-item.compare-mode .check { visibility: visible; }
.req-item.compare-checked .check {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.req-item.compare-checked { background: var(--accent-soft); }

.req-item .alias-btn,
.req-item .delete-btn {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.req-item:hover .alias-btn,
.req-item:hover .delete-btn,
.req-item.active .alias-btn,
.req-item.active .delete-btn,
.req-item .alias-btn:focus-visible,
.req-item .delete-btn:focus-visible { opacity: 1; }
.req-item .alias-btn:hover { color: var(--accent); background: var(--accent-soft); }
.req-item .delete-btn:hover { color: var(--danger); background: rgba(248,113,113,.1); }
.req-item.compare-mode .alias-btn,
.req-item.compare-mode .delete-btn { display: none; }
.req-item.compare-mode { cursor: pointer; }

.req-item .path .alias {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.req-item .path .sub {
  display: block;
  color: var(--text-faint);
  font-size: 11.5px;
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.req-item .method {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .5px;
  text-align: center;
  padding: 3px 0;
  border-radius: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
}
.method.GET    { color: var(--m-get);    border-color: rgba(52,211,153,.3); }
.method.POST   { color: var(--m-post);   border-color: rgba(96,165,250,.3); }
.method.PUT    { color: var(--m-put);    border-color: rgba(251,191,36,.3); }
.method.PATCH  { color: var(--m-patch);  border-color: rgba(192,132,252,.3); }
.method.DELETE { color: var(--m-delete); border-color: rgba(248,113,113,.3); }
.method.OTHER  { color: var(--m-other); }

.req-item .path {
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.req-item .when {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
}
.req-item.new {
  animation: highlight 1.4s ease;
}
@keyframes highlight {
  0%   { background: rgba(124,92,255,.25); }
  100% { background: transparent; }
}

/* ------------- DETAIL ------------- */
.detail-panel {
  min-width: 0;
  overflow: auto;
  background: var(--bg);
}
.detail-empty {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.detail {
  padding: 20px 24px 32px;
}
.detail .detail-alias-row { margin-bottom: 12px; }
.detail .row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.detail .row:last-child { border-bottom: 0; }
.detail .row .key { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.detail .row .val { font-family: var(--mono); font-size: 13px; color: var(--text); word-break: break-word; }
.detail h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  margin: 24px 0 8px;
  font-weight: 600;
}
.detail h4.subhead {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  margin: 18px 0 6px;
  font-weight: 600;
}
.detail .empty-line { color: var(--text-faint); font-size: 12.5px; padding: 4px 0; }
.detail-headline {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.detail-headline .method {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 700;
  background: var(--bg-elev);
}
.detail-headline .detail-path {
  color: var(--accent-2);
  font-size: 13.5px;
  font-family: var(--mono);
  word-break: break-all;
}

/* Cards: Requisição / Resposta / Reproduzir */
.detail-section {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin-top: 16px;
  overflow: hidden;
}
.detail-section:first-of-type { margin-top: 4px; }
.detail-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border-soft);
}
.detail-section-header .section-meta {
  margin-left: auto;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--text-faint);
}
.section-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.section-tag.tag-req {
  color: var(--info);
  background: rgba(96,165,250,.1);
  border-color: rgba(96,165,250,.3);
}
.section-tag.tag-res {
  color: var(--accent-2);
  background: rgba(94,234,212,.1);
  border-color: rgba(94,234,212,.3);
}
.section-tag.tag-res-err {
  color: var(--danger);
  background: rgba(248,113,113,.1);
  border-color: rgba(248,113,113,.3);
}
.section-tag.tag-tools {
  color: var(--text-dim);
  background: var(--bg-elev);
}
.detail-response { border-color: rgba(94,234,212,.25); }
.detail-response .detail-section-header {
  background: linear-gradient(180deg, rgba(94,234,212,.06), var(--bg-elev-2));
}
.detail-response-error { border-color: rgba(248,113,113,.3); }
.detail-response-error .detail-section-header {
  background: linear-gradient(180deg, rgba(248,113,113,.06), var(--bg-elev-2));
}
.section-body {
  padding: 14px 16px 16px;
}
.detail-actions-section .copy-row { margin-top: 0; margin-bottom: 10px; }

/* Card "Requisição pausada" */
.detail-pending {
  border-color: rgba(251,191,36,.4);
}
.detail-pending .detail-section-header {
  background: linear-gradient(180deg, rgba(251,191,36,.12), var(--bg-elev-2));
}
.section-tag.tag-pending {
  color: var(--warn);
  background: rgba(251,191,36,.12);
  border-color: rgba(251,191,36,.4);
}

.pending-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  margin: 10px 0 6px;
}
.pending-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pending-field.span-2 { grid-column: span 1; }
.pending-field > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-faint);
  font-weight: 600;
}
.pending-field input,
.pending-field select {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}
.pending-field input:focus,
.pending-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pe-headers {
  display: flex; flex-direction: column; gap: 6px;
}
.pe-header-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 6px;
}
.pe-header-row input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  min-width: 0;
}
.pe-header-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pe-header-row .pe-h-key { color: var(--accent-2); }

.pe-body {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  resize: vertical;
  min-height: 120px;
}
.pe-body:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pending-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}
.pending-actions .btn-primary,
.pending-actions .btn-danger {
  display: inline-flex; align-items: center;
  padding: 9px 16px;
  font-size: 13px;
}
.detail .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  margin-right: 6px;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
}
.kv-table tr { border-bottom: 1px solid var(--border-soft); }
.kv-table tr:last-child { border-bottom: 0; }
.kv-table td {
  padding: 6px 8px;
  vertical-align: top;
}
.kv-table td.k { color: var(--accent-2); white-space: nowrap; width: 35%; }
.kv-table td.v { color: var(--text); word-break: break-all; }

.code-block {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
}
.tabs {
  display: flex; gap: 4px;
  margin-bottom: 8px;
}
.tabs button {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.tabs button.active {
  color: var(--text);
  background: var(--bg-elev-2);
  border-color: var(--border);
}
.tabs button:hover { color: var(--text); }
.copy-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.copy-row h3 { margin: 0; }

/* JSON syntax highlight */
.tok-key   { color: #93c5fd; }
.tok-str   { color: #6ee7b7; }
.tok-num   { color: #fbbf24; }
.tok-bool  { color: #c084fc; }
.tok-null  { color: var(--text-faint); font-style: italic; }
.tok-punct { color: var(--text-dim); }

/* Diff view (fullscreen overlay) */
.diff-view {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 90;
  display: flex; flex-direction: column;
  animation: modal-in .14s ease-out;
}
.diff-header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev);
}
.diff-header h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.diff-header .btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }

.diff-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); }
.diff-legend .leg { display: inline-flex; align-items: center; gap: 6px; }
.diff-legend .dot {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
}
.leg-add .dot { background: rgba(52,211,153,.35); border: 1px solid rgba(52,211,153,.55); }
.leg-del .dot { background: rgba(248,113,113,.3);  border: 1px solid rgba(248,113,113,.55); }
.leg-chg .dot { background: rgba(251,191,36,.3);   border: 1px solid rgba(251,191,36,.55); }

.diff-content {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 40px;
}

.diff-titles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.diff-title {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.diff-title .tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.diff-title-a .tag { color: var(--info); background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.3); }
.diff-title-b .tag { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(124,92,255,.35); }
.diff-title .t { font-size: 13.5px; color: var(--text); word-break: break-word; }
.diff-title .ts { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; font-family: var(--mono); }

.diff-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  margin: 18px 0 8px;
  font-weight: 600;
}

.diff-block {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  margin-top: 18px;
  padding: 0 18px 18px;
  overflow: hidden;
}
.diff-block-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 14px;
  margin: 0 -18px 6px;
  padding-left: 18px; padding-right: 18px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border-soft);
}
.block-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}
.block-tag.tag-req {
  color: var(--info);
  background: rgba(96,165,250,.1);
  border-color: rgba(96,165,250,.3);
}
.block-tag.tag-res {
  color: var(--accent-2);
  background: rgba(94,234,212,.1);
  border-color: rgba(94,234,212,.3);
}
.diff-block-response { border-color: rgba(94,234,212,.25); }
.diff-block-response .diff-block-header {
  background: linear-gradient(180deg, rgba(94,234,212,.06), var(--bg-elev-2));
}

.diff-warning {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12.5px;
}
.diff-warning b { color: var(--text); }
.diff-warning .pill { margin-left: 4px; }

.diff-summary {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.diff-summary th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-faint);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
.diff-summary th:first-child { width: 200px; }
.diff-summary td {
  padding: 7px 10px;
  vertical-align: top;
  border-top: 1px solid var(--border-soft);
  word-break: break-all;
}
.diff-summary td.lbl { color: var(--text-dim); width: 200px; white-space: nowrap; }
.diff-summary tr.add td { background: rgba(52,211,153,.08); }
.diff-summary tr.del td { background: rgba(248,113,113,.08); }
.diff-summary tr.chg td { background: rgba(251,191,36,.06); }
.diff-summary .empty { color: var(--text-faint); font-style: italic; }

.diff-body {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.diff-body th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-faint);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
.diff-body td {
  padding: 3px 8px;
  border-top: 1px solid var(--border-soft);
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-all;
}
.diff-body td.ln {
  width: 42px;
  text-align: right;
  color: var(--text-faint);
  background: var(--bg-elev-2);
  user-select: none;
}
.diff-body td.src { color: var(--text); }
.diff-body tr.add td { background: rgba(52,211,153,.08); }
.diff-body tr.add td.src { color: #6ee7b7; }
.diff-body tr.del td { background: rgba(248,113,113,.08); }
.diff-body tr.del td.src { color: #fca5a5; }
.diff-body td.empty-cell { background: var(--bg); }

/* Modal genérico */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: modal-in .14s ease-out;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  width: min(440px, calc(100% - 32px));
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  animation: card-in .18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.modal-message {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
  margin: 6px 0 14px;
  white-space: pre-wrap;
}
.modal-input-wrap { margin-bottom: 14px; }
.modal-input-wrap input {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 13.5px;
}
.modal-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-actions .btn-primary,
.modal-actions .btn-ghost,
.modal-actions .btn-danger { padding: 8px 14px; }

.modal.danger .modal-header h3 { color: var(--danger); }
.modal.danger #modal-confirm {
  background: var(--danger);
  color: #1a0808;
}
.modal.danger #modal-confirm:hover { filter: brightness(1.08); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translate(-50%, 20px);
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-soft); background: #2c3445; }

/* responsivo */
@media (max-width: 980px) {
  body { grid-template-columns: 1fr !important; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 60;
    box-shadow: 6px 0 30px rgba(0,0,0,.4);
  }
  body[data-sidebar="open"] .sidebar { transform: translateX(0); }
  body[data-sidebar="closed"] .sidebar > * { opacity: 1; pointer-events: auto; }

  .test-view { height: auto; }
  .split { grid-template-columns: 1fr; }
  .requests-panel { border-right: 0; border-bottom: 1px solid var(--border-soft); }

  /* Em mobile o botão fica sempre visível e o conteúdo precisa do mesmo respiro */
  .main { padding-left: 60px; }
}
