/* httpcollab console — a calm inbox for out-of-band callbacks. */

/* self-hosted fonts (no third-party render-block / font-swap CLS) */
@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:700;font-display:optional;src:url(/fonts/chakra-petch-700.woff2) format("woff2")}
@font-face{font-family:"Sora";font-style:normal;font-weight:400;font-display:optional;src:url(/fonts/sora-400.woff2) format("woff2")}
@font-face{font-family:"Sora";font-style:normal;font-weight:500;font-display:optional;src:url(/fonts/sora-500.woff2) format("woff2")}
@font-face{font-family:"Sora";font-style:normal;font-weight:600;font-display:optional;src:url(/fonts/sora-600.woff2) format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:400;font-display:optional;src:url(/fonts/jetbrains-mono-400.woff2) format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:500;font-display:optional;src:url(/fonts/jetbrains-mono-500.woff2) format("woff2")}

:root {
  --bg: #16181d;
  --surface: #1e2128;
  --surface-2: #23262e;
  --border: #2c303a;
  --border-2: #3a404c;
  --text: #eef1f6;
  --muted: #9aa4b2;
  --faint: #6b7482;
  --amber: #ffb454;
  --amber-2: #ffc477;
  --ink: #16181d;
  --green: #4ade80;
  --red: #f77;

  --brand: "Chakra Petch", system-ui, sans-serif;
  --sans: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

/* ---------- top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(22, 24, 29, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--brand);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: var(--amber);
}
.bar-right { display: flex; align-items: center; gap: 10px; }

.dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot-off { color: var(--faint); }
.dot-wait { color: var(--amber); }
.dot-live { color: var(--green); }
.dot-live::before { animation: breathe 2s ease-in-out infinite; }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 15px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 600; }
.btn-primary:hover { background: var(--amber-2); border-color: var(--amber-2); }
.btn-ghost { background: transparent; }
.btn-icon { background: transparent; border-color: transparent; padding: 8px 11px; font-size: 18px; line-height: 1; color: var(--muted); }
.btn-icon:hover { background: var(--surface-2); border-color: var(--border-2); }

.menu { position: relative; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 6px;
  min-width: 190px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.7);
}
.menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.menu-pop button:hover { background: var(--surface-2); }
.menu-pop .danger { color: var(--red); }

/* ---------- app container ---------- */

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- capture URL card ---------- */

.url-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}
.url-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.url-row { display: flex; gap: 10px; align-items: stretch; }
.url {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--amber);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.url-row .btn { padding-left: 20px; padding-right: 20px; }
.url-help { color: var(--muted); font-size: 13.5px; margin: 14px 0 0; max-width: 66ch; }
.url-actions { display: flex; gap: 20px; margin-top: 14px; }
.link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--amber);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.link:hover { border-bottom-color: var(--amber); }

/* ---------- inbox ---------- */

.inbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.inbox-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.inbox-head h2 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 9px; }
.badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 1px 9px;
}
.inbox-head input {
  margin-left: auto;
  width: 190px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 7px 11px;
}
.inbox-head input:focus { outline: none; border-color: var(--amber); }

.split { display: grid; grid-template-columns: 300px 1fr; min-height: 440px; }
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: 620px;
}
.list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
  padding: 60px 24px;
}
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--green); animation: breathe 2s ease-in-out infinite; }

.item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  cursor: pointer;
  display: grid;
  gap: 4px;
}
.item:hover { background: var(--surface-2); }
.item.active { background: var(--surface-2); border-left-color: var(--amber); }
.item .r1 { display: flex; align-items: center; gap: 8px; }
.item .verb {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.item.hit .verb { color: var(--amber); font-weight: 600; }
.item .path {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item .r2 { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--faint); }
.chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
}
.item.hit .chip { color: var(--ink); background: var(--amber); border-color: var(--amber); }
.item.arrive { animation: arrive 0.5s ease-out; }

/* ---------- detail ---------- */

.detail { overflow-y: auto; padding: 22px; max-height: 620px; }
.detail-empty { color: var(--faint); text-align: center; margin-top: 70px; }
.detail h3 { font-size: 18px; margin: 0 0 14px; word-break: break-all; }
.detail h3.hit { color: var(--amber); }
.kv {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 6px 14px;
  font-size: 13px;
  margin: 0 0 16px;
}
.kv dt { color: var(--faint); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-all; }
.detail h4 {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 20px 0 7px;
  font-weight: 600;
}
pre.block {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  overflow: auto;
  max-height: 300px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}
.shot { max-width: 100%; border: 1px solid var(--border-2); border-radius: 9px; }

/* ---------- footnote ---------- */

.footnote { text-align: center; color: var(--faint); font-size: 12px; padding: 18px; margin: 0; }

/* ---------- modals ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 11, 14, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 22px 24px 24px;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
  animation: pop 0.16s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h3 { font-size: 18px; margin: 0; }
.modal-x {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 7px;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-help { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.modal-help code { font-family: var(--mono); font-size: 12px; color: var(--amber); }

.toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; cursor: pointer; }
.toggle input { accent-color: var(--amber); }

.payloads { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.pl-row { display: grid; gap: 5px; min-width: 0; }
.pl-row .pl-label { font-size: 11px; color: var(--faint); }
.pl-line { display: flex; gap: 8px; min-width: 0; align-items: stretch; }
.pl-line .btn { flex: none; padding: 6px 12px; font-size: 13px; }
.pl-line code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  white-space: nowrap;
}

.resp-grid { display: flex; gap: 12px; }
.mini { display: block; margin-bottom: 12px; font-size: 12px; color: var(--faint); }
.mini.grow { flex: 1; }
.resp-grid .mini:first-child { width: 90px; flex: none; }
.mini input, .mini textarea {
  width: 100%;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px;
}
.mini textarea { resize: vertical; line-height: 1.5; }
.mini input:focus, .mini textarea:focus { outline: none; border-color: var(--amber); }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- motion ---------- */
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes arrive { from { background: rgba(255, 180, 84, 0.14); } to { background: transparent; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .list { border-right: none; border-bottom: 1px solid var(--border); max-height: 300px; }
  .url { font-size: 14px; }
  .app { padding: 18px 14px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
