:root {
  --bg: #080b10;
  --surface: #0e1219;
  --surface-2: #131923;
  --surface-3: #171f2b;
  --line: #252e3d;
  --line-soft: #1b2330;
  --text: #edf3f8;
  --muted: #8490a3;
  --cyan: #48d7c5;
  --cyan-soft: rgba(72, 215, 197, .12);
  --blue: #4f8cff;
  --green: #63d98b;
  --red: #ff6b78;
  --amber: #f2b84b;
  --radius: 14px;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 80% -10%, rgba(36, 74, 91, .26), transparent 34%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: rgba(10, 14, 20, .94); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; padding: 22px 14px 16px; backdrop-filter: blur(18px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(72, 215, 197, .5); background: linear-gradient(145deg, rgba(72, 215, 197, .22), rgba(79, 140, 255, .08)); color: var(--cyan); font-weight: 700; border-radius: 10px; box-shadow: inset 0 0 22px rgba(72, 215, 197, .08); }
.brand strong, .brand small { display: block; letter-spacing: .16em; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font: 500 9px "DM Mono", monospace; margin-top: 2px; }

.search-box { margin: 0 6px 16px; height: 40px; display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 0 11px; color: var(--muted); }
.search-box:focus-within { border-color: rgba(72, 215, 197, .55); box-shadow: 0 0 0 3px rgba(72, 215, 197, .07); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }

#endpoint-nav { overflow-y: auto; padding: 0 4px 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-group { margin-bottom: 17px; }
.nav-group-title { padding: 0 9px 7px; color: #5d6879; font: 500 9px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.endpoint-link { width: 100%; border: 0; background: transparent; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 4px; text-align: left; padding: 8px 9px; border-radius: 8px; cursor: pointer; color: #aab3c1; font-size: 11px; }
.endpoint-link:hover { color: var(--text); background: rgba(255,255,255,.035); }
.endpoint-link.active { color: var(--text); background: var(--cyan-soft); }
.method-mini { font: 500 8px "DM Mono", monospace; color: var(--muted); }
.method-mini.POST { color: var(--cyan); }
.method-mini.PUT, .method-mini.PATCH { color: var(--amber); }
.method-mini.DELETE { color: var(--red); }
.endpoint-link span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 15px 8px 2px; display: grid; grid-template-columns: 9px 1fr 30px; gap: 10px; align-items: center; }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { font-size: 11px; }
.sidebar-footer small { color: var(--muted); font-size: 9px; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(242,184,75,.1); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(99,217,139,.1); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 0 4px rgba(255,107,120,.1); }

.main-content { min-width: 0; }
.topbar { height: 72px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; padding: 0 34px; background: rgba(8,11,16,.7); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.environment-pill { font: 500 9px "DM Mono", monospace; letter-spacing: .1em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.environment-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.user-setting { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 7px 5px 11px; background: var(--surface); }
.user-setting span { color: var(--muted); font-size: 9px; }
.user-setting input { width: 260px; border: 0; outline: 0; color: #bbc5d4; background: var(--surface-2); border-radius: 6px; padding: 7px 9px; font: 400 9px "DM Mono", monospace; }

.workspace { max-width: 1480px; margin: 0 auto; padding: 44px 36px 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font: 500 9px "DM Mono", monospace; letter-spacing: .14em; }
.page-heading h1 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.04em; font-weight: 600; }
.page-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.endpoint-badge { display: flex; align-items: center; gap: 10px; min-width: 0; background: var(--surface); border: 1px solid var(--line); padding: 9px 12px; border-radius: 9px; }
.endpoint-badge span { color: var(--cyan); font: 500 9px "DM Mono", monospace; }
.endpoint-badge code { color: #aeb8c7; font: 400 10px "DM Mono", monospace; white-space: nowrap; }

.workspace-grid { display: grid; grid-template-columns: minmax(390px, .88fr) minmax(420px, 1.12fr); gap: 18px; align-items: start; }
.panel { background: linear-gradient(145deg, rgba(19,25,35,.94), rgba(12,16,23,.96)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 24px 65px rgba(0,0,0,.18); }
.panel-header { min-height: 82px; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.panel-header > div { display: flex; gap: 12px; align-items: center; }
.panel-header h2 { font-size: 13px; margin: 0 0 4px; font-weight: 600; }
.panel-header p { font-size: 9px; margin: 0; color: var(--muted); }
.step-number { color: var(--cyan); font: 500 9px "DM Mono", monospace; border: 1px solid rgba(72,215,197,.28); border-radius: 6px; padding: 6px; }

#request-form { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 13px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: flex; align-items: center; gap: 5px; margin-bottom: 7px; color: #bdc6d3; font-size: 9px; }
.field label code { color: var(--cyan); font: 400 8px "DM Mono", monospace; }
.field .optional { margin-left: auto; color: #566174; font-size: 8px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); outline: 0; border-radius: 8px; background: #0b0f15; color: var(--text); padding: 11px 12px; font-size: 11px; transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 108px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(72,215,197,.55); box-shadow: 0 0 0 3px rgba(72,215,197,.06); }
.field input::placeholder, .field textarea::placeholder { color: #455062; }
.field-help { color: #5d6879; font-size: 8px; margin: 5px 1px 0; }

.request-preview { margin-top: 18px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0a0e14; }
.request-preview summary { cursor: pointer; padding: 11px 13px; color: var(--muted); font-size: 9px; user-select: none; }
.request-preview pre { margin: 0; padding: 0 13px 13px; color: #93a2b7; font: 400 9px/1.6 "DM Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.request-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.primary-button, .secondary-button { border: 0; border-radius: 8px; cursor: pointer; font-weight: 600; }
.primary-button { flex: 1; min-height: 43px; display: flex; justify-content: center; align-items: center; gap: 14px; background: var(--cyan); color: #071411; font-size: 11px; box-shadow: 0 8px 25px rgba(72,215,197,.12); }
.primary-button:hover { filter: brightness(1.08); }
.primary-button:disabled { cursor: wait; opacity: .6; }
.secondary-button { background: var(--surface-2); border: 1px solid var(--line); padding: 9px 12px; font-size: 10px; }
.secondary-button span { margin-left: 5px; color: var(--cyan); }
.reset-data-button { color: #e7a1a8; border-color: rgba(255,107,120,.28); background: rgba(255,107,120,.06); }
.reset-data-button:hover:not(:disabled) { color: #fff; border-color: rgba(255,107,120,.55); background: rgba(255,107,120,.14); }
.reset-data-button:disabled { cursor: wait; opacity: .55; }
.secondary-button.danger { color: var(--red); width: calc(100% - 36px); margin: 18px; }
.text-button, .icon-button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.text-button { font-size: 9px; }
.text-button:hover:not(:disabled) { color: var(--cyan); }
.text-button:disabled { opacity: .35; cursor: default; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.shortcut-hint { color: #4f5a6b; font-size: 8px; white-space: nowrap; }
kbd { background: #141a23; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 4px; font: 400 7px "DM Mono", monospace; }

.response-panel { min-height: 515px; }
.response-empty { min-height: 430px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted); }
.response-empty strong { color: #aab4c2; font-size: 12px; margin-top: 22px; }
.response-empty p { font-size: 9px; }
.pulse-orbit { width: 58px; height: 58px; border: 1px solid #293343; border-radius: 50%; display: grid; place-items: center; position: relative; }
.pulse-orbit::before { content: ""; width: 34px; height: 34px; border: 1px solid #202938; border-radius: 50%; }
.pulse-orbit span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.response-result { padding: 18px; }
.response-summary { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; color: var(--muted); font: 400 8px "DM Mono", monospace; }
.response-summary > span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.http-status.success { color: var(--green); border-color: rgba(99,217,139,.25); background: rgba(99,217,139,.06); }
.http-status.error { color: var(--red); border-color: rgba(255,107,120,.25); background: rgba(255,107,120,.06); }
.chat-result { display: grid; gap: 12px; margin-bottom: 12px; }
.assistant-response-card { border: 1px solid rgba(72,215,197,.3); border-radius: 10px; padding: 16px; background: linear-gradient(145deg, rgba(72,215,197,.1), rgba(11,15,21,.92) 62%); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.result-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.result-section-heading > div { display: flex; align-items: center; gap: 10px; }
.result-section-heading small, .result-section-heading strong { display: block; }
.result-section-heading small { color: var(--cyan); font: 500 8px "DM Mono", monospace; letter-spacing: .12em; margin-bottom: 3px; }
.result-section-heading strong { font-size: 11px; font-weight: 600; }
.result-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(72,215,197,.35); border-radius: 7px; color: var(--cyan); background: rgba(72,215,197,.08); font-size: 10px; font-weight: 700; }
.assistant-response-card > p { margin: 16px 0 2px; color: #eef6f5; font-size: 13px; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.suggestions-section { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: rgba(12,17,24,.8); }
.suggestion-icon { color: var(--amber); border-color: rgba(242,184,75,.3); background: rgba(242,184,75,.07); }
.suggestions-list { display: grid; gap: 9px; margin-top: 13px; }
.suggestion-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px; background: #0a0f15; }
.suggestion-card.approved { border-color: rgba(99,217,139,.25); background: rgba(99,217,139,.04); }
.suggestion-content { min-width: 0; }
.suggestion-content strong { display: block; color: #dce4ed; font-size: 10px; margin-bottom: 5px; }
.suggestion-content p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-meta { display: flex; gap: 5px; margin-top: 7px; }
.suggestion-meta span { color: #718096; border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; font: 400 7px "DM Mono", monospace; }
.approve-suggestion { min-width: 112px; border: 1px solid rgba(72,215,197,.35); border-radius: 7px; padding: 9px 10px; background: rgba(72,215,197,.1); color: var(--cyan); cursor: pointer; font-size: 9px; font-weight: 600; }
.approve-suggestion:hover:not(:disabled) { background: var(--cyan); color: #071411; }
.approve-suggestion:disabled { cursor: default; opacity: .58; }
.suggestion-card.approved .approve-suggestion { color: var(--green); border-color: rgba(99,217,139,.28); background: rgba(99,217,139,.08); }
.raw-response { border: 1px solid var(--line-soft); border-radius: 8px; background: #080c11; overflow: hidden; }
.raw-response summary { cursor: pointer; padding: 11px 14px; color: var(--muted); font-size: 9px; user-select: none; }
#response-body { height: 285px; margin: 0; overflow: auto; border-top: 1px solid var(--line-soft); background: #080c11; padding: 16px; color: #b8c4d3; font: 400 10px/1.65 "DM Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: var(--line) transparent; }

.history-drawer { position: fixed; z-index: 40; top: 0; right: 0; width: min(430px, 94vw); height: 100vh; background: #0d1219; border-left: 1px solid var(--line); transform: translateX(102%); transition: transform .25s ease; display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.35); }
.history-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; backdrop-filter: blur(2px); }
.drawer-header { padding: 24px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: start; }
.drawer-header h2 { margin: 0; font-size: 20px; }
.history-list { padding: 14px; overflow-y: auto; flex: 1; }
.history-item { border: 1px solid var(--line-soft); border-radius: 9px; padding: 12px; margin-bottom: 9px; background: var(--surface); cursor: pointer; }
.history-item:hover { border-color: #354156; }
.history-item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.history-item strong { font: 500 9px "DM Mono", monospace; }
.history-item small { color: var(--muted); font-size: 8px; }
.history-item p { margin: 0; color: #9da8b8; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-empty { color: var(--muted); font-size: 10px; text-align: center; padding: 45px 10px; }
.history-status-success { color: var(--green); }
.history-status-error { color: var(--red); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #18212d; border: 1px solid #344155; border-radius: 8px; padding: 10px 15px; color: #d8e0e9; font-size: 10px; transition: .22s ease; box-shadow: 0 10px 35px rgba(0,0,0,.35); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .response-panel { min-height: 460px; }
  .response-empty { min-height: 360px; }
}

@media (max-width: 760px) {
  .mobile-only { display: grid; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); transition: transform .25s ease; width: 284px; box-shadow: 20px 0 50px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .brand .icon-button { margin-left: auto; }
  .topbar { padding: 0 14px; height: 62px; }
  .environment-pill { display: none; }
  .topbar-actions { margin-left: auto; }
  .user-setting span { display: none; }
  .user-setting input { width: 175px; }
  .reset-data-button { padding-inline: 9px; }
  .workspace { padding: 28px 15px 45px; }
  .page-heading { display: block; }
  .endpoint-badge { margin-top: 18px; width: fit-content; max-width: 100%; }
  .endpoint-badge code { overflow: hidden; text-overflow: ellipsis; }
  .form-grid { grid-template-columns: 1fr; }
  .field { grid-column: 1 !important; }
  .panel-header { padding: 17px; }
  #request-form { padding: 17px; }
  .suggestion-card { grid-template-columns: 1fr; }
  .approve-suggestion { width: 100%; }
  .shortcut-hint { display: none; }
}

@media (max-width: 520px) {
  .user-setting input { width: 128px; }
  .reset-data-button { font-size: 0; }
  .reset-data-button::after { content: "Zerar"; font-size: 9px; }
  #open-history { font-size: 0; }
  #open-history span { font-size: 9px; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
