* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-subtle: #162033;
  --bg-muted: #1f2937;
  --bg-hover: #22304a;
  --bg-selected: #17365f;
  --border: #263244;
  --border-strong: #334155;
  --border-muted: #1e293b;
  --text: #e5e7eb;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-strong: #38bdf8;
  --danger: #f87171;
  --danger-strong: #fca5a5;
  --shadow: rgba(0, 0, 0, .42);
  --login-gradient: radial-gradient(circle at top, #14365d 0, #0b1120 44%, #020617 100%);
  --mark-bg: #854d0e;
  --mark-active-bg: #f97316;
  --status-2xx-bg: #064e3b;
  --status-2xx-text: #86efac;
  --status-3xx-bg: #713f12;
  --status-3xx-text: #fde68a;
  --status-4xx-bg: #7f1d1d;
  --status-4xx-text: #fecaca;
  --status-5xx-bg: #881337;
  --status-5xx-text: #fecdd3;
  --json-key: #93c5fd;
  --json-str: #86efac;
  --json-num: #facc15;
  --json-bool: #fca5a5;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #fafbfc;
  --bg-elevated: #fff;
  --bg-subtle: #f6f8fa;
  --bg-muted: #eef2f7;
  --bg-hover: #f6f8fa;
  --bg-selected: #dbe9ff;
  --border: #e4e7eb;
  --border-strong: #d1d5da;
  --border-muted: #eef0f2;
  --text: #1f2329;
  --text-strong: #1f2329;
  --muted: #6a737d;
  --accent: #0366d6;
  --accent-strong: #0258ba;
  --danger: #b31d28;
  --danger-strong: #cb2431;
  --shadow: rgba(31, 35, 41, .12);
  --login-gradient: radial-gradient(circle at top, #e0f2fe 0, #fafbfc 42%);
  --mark-bg: #fff5b1;
  --mark-active-bg: #f97316;
  --status-2xx-bg: #dcffe4;
  --status-2xx-text: #22863a;
  --status-3xx-bg: #fff5b1;
  --status-3xx-text: #735c0f;
  --status-4xx-bg: #ffeef0;
  --status-4xx-text: #cb2431;
  --status-5xx-bg: #ffdce0;
  --status-5xx-text: #b31d28;
  --json-key: #0366d6;
  --json-str: #22863a;
  --json-num: #b08800;
  --json-bool: #cb2431;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

[hidden] {
  display: none !important;
}

.login-view {
  align-items: center;
  background: var(--login-gradient);
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 40px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  padding: 24px;
  width: 100%;
}

.login-card h1 {
  color: var(--text-strong);
  font-size: 18px;
}

.login-card p,
.login-card label {
  color: var(--muted);
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-card input {
  padding: 8px 10px;
}

#auth-submit {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 8px 10px;
}

#auth-submit:hover {
  background: var(--accent-strong);
}

#auth-message {
  color: var(--danger-strong);
  min-height: 18px;
}

#inspect-app {
  min-height: 100vh;
}

header {
  align-items: center;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 16px;
}

h1 {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text);
}

button {
  cursor: pointer;
  padding: 4px 8px;
}

button:hover,
select:hover,
input:hover {
  background: var(--bg-muted);
}

button.danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong));
  color: var(--danger);
}

.header-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.header-controls label {
  align-items: center;
  display: flex;
  gap: 4px;
}

.theme-switcher select {
  min-width: 72px;
  padding: 3px 6px;
}

.login-card .theme-switcher select {
  padding: 8px 10px;
  width: 100%;
}

#message {
  color: var(--muted);
  min-width: 110px;
}

#message.error {
  color: var(--danger-strong);
  font-weight: 600;
}

main {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  height: calc(100vh - 42px);
}

#filters {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

#filters label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  gap: 2px;
}

#filters input,
#filters select {
  padding: 4px 6px;
}

#f-status {
  min-height: 166px;
}

#list {
  border-right: 1px solid var(--border);
  overflow: auto;
}

table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

th:nth-child(1),
td:nth-child(1) {
  width: 72px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 86px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 64px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 58px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 48px;
}

th {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  position: sticky;
  text-align: left;
  top: 0;
}

td {
  border-bottom: 1px solid var(--border-muted);
  cursor: pointer;
  overflow: hidden;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-cell {
  min-width: 160px;
}

tr:hover td {
  background: var(--bg-hover);
}

tr.selected td {
  background: var(--bg-selected);
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  min-width: 38px;
  padding: 4px 7px;
  text-align: center;
}

.status-2xx {
  background: var(--status-2xx-bg);
  color: var(--status-2xx-text);
}

.status-3xx {
  background: var(--status-3xx-bg);
  color: var(--status-3xx-text);
}

.status-4xx {
  background: var(--status-4xx-bg);
  color: var(--status-4xx-text);
}

.status-5xx {
  background: var(--status-5xx-bg);
  color: var(--status-5xx-text);
}

#detail {
  overflow: auto;
  padding: 12px;
}

nav {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

nav button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  padding: 6px 10px;
}

nav button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.response-search {
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 6px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.response-search input {
  flex: 1;
  min-width: 180px;
  padding: 4px 6px;
}

#response-search-count {
  color: var(--muted);
  min-width: 48px;
  text-align: center;
}

mark.response-search-hit {
  background: var(--mark-bg);
  border-radius: 2px;
  color: inherit;
  padding: 0 1px;
}

mark.response-search-hit.active {
  background: var(--mark-active-bg);
  color: #fff;
}

pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.hdr {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .5px;
  margin: 8px 0;
  text-transform: uppercase;
}

.kv {
  display: grid;
  gap: 2px 12px;
  grid-template-columns: auto 1fr;
}

.kv dt {
  color: var(--muted);
}

.json-key {
  color: var(--json-key);
}

.json-str {
  color: var(--json-str);
}

.json-num {
  color: var(--json-num);
}

.json-bool {
  color: var(--json-bool);
}
