:root {
  --ink: #14201c;
  --ink-soft: #3d4f47;
  --muted: #6b7c73;
  --line: #d5ddd8;
  --paper: #f3f6f4;
  --surface: #ffffff;
  --accent: #0d7a5f;
  --accent-deep: #085a46;
  --accent-soft: #e3f2ed;
  --danger: #b42318;
  --danger-soft: #fcebea;
  --get: #0d7a5f;
  --post: #1a5fb4;
  --put: #9a6700;
  --patch: #8250df;
  --delete: #b42318;
  --other: #6b7c73;
  --shadow: 0 18px 40px rgba(20, 32, 28, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(13, 122, 95, 0.09), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(26, 95, 180, 0.06), transparent 50%),
    linear-gradient(165deg, #eef3f0 0%, var(--paper) 45%, #e8eeea 100%);
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 1.5rem 1.15rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--accent) 0%, #1a9a78 55%, #1a5fb4 120%);
  box-shadow: 0 8px 20px rgba(13, 122, 95, 0.28);
  flex-shrink: 0;
  animation: pulse-mark 3.2s ease-in-out infinite;
}

@keyframes pulse-mark {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 20px rgba(13, 122, 95, 0.28);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 10px 26px rgba(13, 122, 95, 0.38);
  }
}

.brand-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-tag {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  color: var(--accent-deep);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 12%, white);
}

.bin-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: auto;
  flex: 1;
}

.bin-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bin-item:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-color: var(--line);
}

.bin-item.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.bin-item-name {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
}

.bin-item-meta {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--mono);
}

.main {
  min-width: 0;
  padding: 1.5rem 1.75rem 2rem;
}

.welcome {
  max-width: 40rem;
  margin: 12vh auto 0;
  animation: rise 0.55s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

.welcome h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3.5vw, 2.55rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.lede {
  margin: 1rem 0 1.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 34rem;
}

.welcome .btn-primary {
  width: auto;
  padding-inline: 1.25rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 3rem);
  animation: rise 0.4s ease both;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.bin-title {
  border: none;
  background: transparent;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0;
  width: min(100%, 28rem);
  color: var(--ink);
}

.bin-title:focus {
  outline: none;
  color: var(--accent-deep);
}

.url-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.hook-url {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--ink-soft);
  word-break: break-all;
}

.workspace-actions {
  display: flex;
  gap: 0.5rem;
}

.workspace-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1rem;
}

.request-list-pane,
.detail-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.count {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.request-list {
  overflow: auto;
  flex: 1;
}

.request-item {
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: grid;
  gap: 0.35rem;
  transition: background 0.12s ease;
}

.request-item:hover {
  background: color-mix(in srgb, var(--paper) 80%, white);
}

.request-item.active {
  background: var(--accent-soft);
}

.request-item-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.method {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.4rem;
  border-radius: 5px;
  color: #fff;
}

.method-GET { background: var(--get); }
.method-POST { background: var(--post); }
.method-PUT { background: var(--put); }
.method-PATCH { background: var(--patch); }
.method-DELETE { background: var(--delete); }
.method-OTHER { background: var(--other); }

.request-path {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-time {
  font-size: 0.72rem;
  color: var(--muted);
}

.empty-list,
.empty-detail {
  padding: 2rem 1.25rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.5;
}

.detail {
  overflow: auto;
  flex: 1;
  padding: 1.1rem 1.25rem 1.5rem;
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.meta-box {
  background: var(--paper);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.meta-box dt {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.meta-box dd {
  margin: 0.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--ink);
}

.section {
  margin-top: 1.15rem;
}

.section-title {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.kv-table th,
.kv-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.kv-table th {
  width: 38%;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent-soft) 55%, white);
}

.kv-table td {
  font-family: var(--mono);
  word-break: break-all;
  color: var(--ink-soft);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.tab {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.code-block {
  margin: 0;
  background: #101816;
  color: #d7efe5;
  border-radius: 12px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  overflow: auto;
  max-height: 28rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: rise 0.25s ease both;
}

.auth-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.auth-status {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  word-break: break-all;
}

.auth-hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.auth-actions {
  display: flex;
  gap: 0.4rem;
}

.auth-actions .btn,
.auth-user .btn {
  width: auto;
  flex: 1;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
}

.btn-compact {
  width: auto;
}

.auth-user {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.welcome-actions .btn-primary,
.welcome-actions .btn-ghost {
  width: auto;
  padding-inline: 1.15rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 22, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
  animation: rise 0.2s ease both;
}

.modal {
  position: relative;
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.25rem;
}

.modal h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.modal-sub {
  margin: 0.4rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.85rem;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--paper);
  color: var(--ink);
}

.auth-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--accent);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.modal-switch {
  margin: 0.95rem 0 0;
  text-align: center;
}

.linkish {
  border: none;
  background: none;
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .bin-list {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
  }

  .bin-item {
    min-width: 160px;
  }

  .workspace {
    height: auto;
  }

  .workspace-body {
    grid-template-columns: 1fr;
    min-height: 70vh;
  }

  .request-list-pane {
    max-height: 280px;
  }
}
