* { box-sizing: border-box; }

/* ---------- Dark theme (default) ---------- */
:root {
  --bg: #0B0C0E;
  --surface: #131418;
  --surface-2: #1B1D23;
  --border: #25282F;
  --border-strong: #393D47;
  --text: #E8E5DE;
  --text-soft: #C4BFB6;
  --muted: #7B7770;
  --accent: #E8E5DE;
  --accent-hover: #FAF7F2;
  --accent-soft: rgba(232, 229, 222, 0.10);
  --accent-rgb: 232, 229, 222;
  --accent-text: #0B0C0E;
  --danger: #E07070;
  --danger-soft: rgba(224, 112, 112, 0.12);
  --ok: #6BC07F;
  --ok-soft: rgba(107, 192, 127, 0.14);
  --warn: #D8A23A;
  --warn-soft: rgba(216, 162, 58, 0.14);
  --info: #6FA0D0;
  --info-soft: rgba(111, 160, 208, 0.14);
  --coral: #E0934C;
  --coral-soft: rgba(224, 147, 76, 0.14);
  --surface-overlay: rgba(20, 22, 28, 0.55);
  --globe-glow: rgba(232, 229, 222, 0.10);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);

  --radius: 10px;
  --radius-sm: 6px;

  --font-sans: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: "Crimson Text", "Tiempos Text", "Georgia", "Charter", serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---------- Light theme (cream / Claude) ---------- */
:root[data-theme="light"] {
  --bg: #F5F0E8;
  --surface: #FAF7F2;
  --surface-2: #EFE9DD;
  --border: #E5DFD2;
  --border-strong: #D6CEBC;
  --text: #1F1E1B;
  --text-soft: #3D3929;
  --muted: #87806E;
  --accent: #0B0C0E;
  --accent-hover: #1F1E1B;
  --accent-soft: rgba(11, 12, 14, 0.08);
  --accent-rgb: 11, 12, 14;
  --accent-text: #FAF7F2;
  --danger: #B33A3A;
  --danger-soft: rgba(179, 58, 58, 0.08);
  --ok: #4F7A4A;
  --ok-soft: rgba(79, 122, 74, 0.1);
  --warn: #9C7A2D;
  --warn-soft: rgba(156, 122, 45, 0.1);
  --info: #4A6B95;
  --info-soft: rgba(74, 107, 149, 0.1);
  --coral: #C9722D;
  --coral-soft: rgba(201, 114, 45, 0.10);
  --surface-overlay: rgba(245, 240, 232, 0.55);
  --globe-glow: rgba(11, 12, 14, 0.08);
  --shadow-sm: 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow: 0 2px 8px rgba(60, 50, 30, 0.06);
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

button, input { font-family: inherit; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 296px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  padding: 20px 20px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo {
  height: 38px;
  width: auto;
  display: block;
}

:root[data-theme="dark"] .light-only,
:root[data-theme="light"] .dark-only {
  display: none;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.theme-toggle:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}

.endpoint-list {
  list-style: none;
  margin: 0;
  padding: 4px 12px 16px 12px;
  overflow-y: auto;
  flex: 1;
}

.endpoint-list li {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 120ms ease;
}

.endpoint-list li:hover { background: var(--surface-2); }

.endpoint-list li.active {
  background: var(--surface-2);
}

.endpoint-list .ep-name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.endpoint-list li.active .ep-name { color: var(--text); }

.endpoint-list .ep-id {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 16px;
}

#endpoint-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.url-bar {
  padding: 24px 32px 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.endpoint-name-wrap {
  display: inline-block;
  align-self: flex-start;
}

.endpoint-name {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 2px 0;
  outline: none;
  width: 100%;
  cursor: text;
}

.endpoint-name:focus {
  border-bottom: 1px dashed var(--border-strong);
}

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

.forward-row {
  margin-top: 2px;
  animation: forward-slide-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}

@keyframes forward-slide-in {
  from { opacity: 0; transform: translateY(-4px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 80px; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.icon-btn svg {
  display: block;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.icon-btn[aria-expanded="true"],
.icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.forward-label {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-sans);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.forward-input {
  font-size: 12.5px;
  padding: 7px 12px;
}

.response-status-input {
  flex: 0 0 80px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.forward-status {
  font-size: 11px;
  color: var(--muted);
  min-width: 70px;
  font-family: var(--font-mono);
  transition: color 200ms ease;
}

.forward-status.ok { color: var(--ok); }
.forward-status.err { color: var(--danger); }

.url-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

.url-input:focus { border-color: var(--border-strong); }

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

/* ---------- Buttons ---------- */

.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}

.btn-danger {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-soft);
  border-color: transparent;
}

/* ---------- Request list ---------- */

.list-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 50%;
  min-width: 280px;
  min-height: 0;
}

.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ---------- Filter bar ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
  animation: forward-slide-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-wrap {
  flex: 1;
  position: relative;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

#filter-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 32px 7px 32px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease;
}

#filter-search:focus { border-color: var(--border-strong); }
#filter-search::-webkit-search-cancel-button { display: none; }

.filter-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 4px;
  line-height: 1;
}

.filter-clear:hover { background: var(--surface-2); color: var(--text); }

.method-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.method-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.method-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.method-pill.active {
  border-color: transparent;
}

.method-pill.active[data-method="GET"]    { background: var(--ok-soft);     color: var(--ok); }
.method-pill.active[data-method="POST"]   { background: var(--info-soft);   color: var(--info); }
.method-pill.active[data-method="PUT"]    { background: var(--coral-soft);  color: var(--coral); }
.method-pill.active[data-method="PATCH"]  { background: var(--warn-soft);   color: var(--warn); }
.method-pill.active[data-method="DELETE"] { background: var(--danger-soft); color: var(--danger); }

.empty-filter {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 14px;
  font-style: italic;
}

.request-list li {
  border-bottom: 1px solid var(--border);
}

@keyframes request-enter {
  0% {
    opacity: 0;
    transform: translateY(-10px);
    background: var(--accent-soft);
  }
  35% {
    opacity: 1;
    transform: translateY(0);
    background: var(--accent-soft);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    background: transparent;
  }
}

.request-list li.is-new {
  animation: request-enter 1.6s ease-out;
  position: relative;
}

.request-list li.is-new::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  animation: bar-fade 1.6s ease-out forwards;
}

@keyframes bar-fade {
  0% { opacity: 1; }
  60% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes count-pulse {
  0% { transform: scale(1); color: var(--muted); }
  20% { transform: scale(1.18); color: var(--accent); }
  100% { transform: scale(1); color: var(--muted); }
}

#request-count {
  display: inline-block;
  transition: color 200ms ease;
  transform-origin: left center;
}

#request-count.pulse {
  animation: count-pulse 900ms ease-out;
}

.req-header {
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 120ms ease;
}

.req-header:hover { background: var(--surface); }

.method {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  min-width: 60px;
  text-align: center;
  border: 1px solid transparent;
}
.method-GET { background: var(--ok-soft); color: var(--ok); }
.method-POST { background: var(--info-soft); color: var(--info); }
.method-PUT { background: var(--coral-soft); color: var(--coral); }
.method-PATCH { background: var(--warn-soft); color: var(--warn); }
.method-DELETE { background: var(--danger-soft); color: var(--danger); }
.method-OPTIONS, .method-HEAD { background: var(--surface-2); color: var(--muted); }

.req-path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-soft);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.req-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fwd-badge,
.sig-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.fwd-badge.err,
.sig-badge.err {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-soft);
}

.sig-badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-soft);
}

.sig-badge.neutral {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border);
}

.detail-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.replay-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.replay-input { flex: 1; }

.replay-status {
  font-size: 11px;
  font-family: var(--font-mono);
  min-width: 100px;
  transition: color 200ms ease;
}

.replay-status.ok { color: var(--ok); }
.replay-status.err { color: var(--danger); }

.req-detail {
  padding: 16px 32px 22px 32px;
  background: var(--surface);
  display: none;
  border-top: 1px solid var(--border);
}

.req-detail.open { display: block; }

.req-detail h4 {
  margin: 18px 0 8px 0;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.req-detail h4:first-child { margin-top: 0; }

.req-detail pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 44px 12px 14px;
  overflow-x: auto;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.req-detail pre.no-wrap {
  white-space: pre;
  word-break: normal;
}

.code-block {
  position: relative;
  margin: 0;
}

.code-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 3px;
  opacity: 0.45;
  transition: opacity 140ms ease;
  z-index: 1;
}

.code-block:hover .code-toolbar,
.code-block:focus-within .code-toolbar {
  opacity: 1;
}

.icon-btn-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.icon-btn-sm:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.code-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.icon-btn-sm svg { display: block; }

.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 6px 20px;
  font-size: 13px;
}
.kv .k { color: var(--muted); }
.kv .v { color: var(--text-soft); font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }

/* ---------- Split row (list | globe) ---------- */

.content-row {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.resizer {
  flex: 0 0 6px;
  cursor: col-resize;
  position: relative;
  background: transparent;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  transition: background 120ms ease, border-color 120ms ease;
}

.resizer:hover,
.resizer.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  background: var(--border-strong);
  border-radius: 1px;
  transition: background 120ms ease;
}

.resizer:hover::after,
.resizer.active::after {
  background: var(--accent);
}

/* ---------- Globe ---------- */

.globe-section {
  position: relative;
  flex: 1 1 50%;
  min-width: 280px;
  background:
    radial-gradient(circle at 50% 45%, var(--globe-glow), transparent 62%),
    var(--bg);
  overflow: hidden;
}

#globe {
  width: 100%;
  height: 100%;
}

#globe canvas { display: block; }

.globe-caption {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  background: var(--surface-overlay);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------- Signature ---------- */

.limits {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.limits .limit-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.limits .limit-label {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.limits .limit-value {
  color: var(--text-soft);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.signature {
  padding: 12px 20px 16px 20px;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: center;
}

.signature a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 120ms ease;
}

.signature a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-version {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
}

/* ---------- Tooltip (JS-rendered, portaled to body) ---------- */

.js-tooltip {
  position: fixed;
  background: var(--text);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.45;
  max-width: 280px;
  text-align: center;
  word-wrap: break-word;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 1100;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.js-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.js-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
}

.js-tooltip[data-position="bottom"]::after {
  bottom: 100%;
  border-bottom-color: var(--text);
}

.js-tooltip[data-position="top"]::after {
  top: 100%;
  border-top-color: var(--text);
}

/* ---------- Mobile menu ---------- */

.menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 90;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: var(--shadow);
  transition: background 120ms ease;
}

.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}

body.sidebar-open .menu-toggle span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
body.sidebar-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}
body.sidebar-open .menu-toggle span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99;
  animation: backdrop-in 160ms ease-out;
}

/* ---------- Toasts ---------- */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 32px);
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  box-shadow: var(--shadow), 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast:hover { border-color: var(--border-strong); }

.toast.removing {
  animation: toast-out 220ms ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.toast.info .toast-icon { background: var(--info-soft); color: var(--info); }
.toast.success .toast-icon { background: var(--ok-soft); color: var(--ok); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.toast-message {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  word-wrap: break-word;
}

.toast .method {
  font-size: 10px;
  padding: 1px 6px;
  min-width: 0;
}

@media (max-width: 540px) {
  .toast-container { top: 60px; right: 12px; left: 12px; max-width: none; width: auto; }
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: backdrop-in 160ms ease-out;
}

:root[data-theme="light"] .modal-backdrop {
  background: rgba(40, 35, 25, 0.30);
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 420px;
  padding: 24px 24px 20px 24px;
  animation: modal-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-title {
  margin: 0 0 8px 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}

.modal-message {
  margin: 0 0 22px 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal.danger .btn-primary {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFF;
}

.modal.danger .btn-primary:hover {
  background: #8E2929;
  border-color: #8E2929;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .menu-toggle { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: 296px;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar { transform: translateX(0); }
  body:not(.sidebar-open) .sidebar-overlay { display: none; }

  .url-bar { padding-left: 70px; }
  .main { width: 100%; }
}

@media (max-width: 768px) {
  .content-row {
    flex-direction: column;
    overflow-y: auto;
  }
  .resizer { display: none; }

  .request-list,
  .globe-section {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100%;
  }

  .request-list {
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }

  .globe-section {
    height: 50vh;
    min-height: 320px;
  }

  .url-bar {
    padding: 16px 20px 14px 70px;
    gap: 10px;
  }

  .endpoint-name { font-size: 20px; }

  .actions { flex-wrap: wrap; gap: 6px; }
  .actions .spacer { display: none; }
}

@media (max-width: 540px) {
  .forward-row {
    flex-wrap: wrap;
  }
  .forward-label {
    flex-basis: 100%;
    margin-bottom: 2px;
  }
  .forward-input { width: 100%; min-width: 0; }
  .forward-status { display: block; flex-basis: 100%; min-width: 0; }

  .url-row { flex-wrap: wrap; }
  .url-input { min-width: 0; }

  .req-header { padding: 10px 16px; gap: 8px; }
  .req-detail { padding: 12px 16px 16px; }
  .req-path { font-size: 12px; }
  .kv { grid-template-columns: 110px 1fr; }
}

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