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

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #d1d5db;
  --accent: #005EB8;
  --accent-hover: #004c99;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --text: #1f2937;
  --muted: #6b7280;
  --code-bg: #f0f4f8;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── header ── */
header {
  background: #1f2937;
  color: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}

.logo { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }

.badge {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 99px;
  font-weight: 500;
}
.badge-ok   { background: #166534; color: #bbf7d0; }
.badge-warn { background: #78350f; color: #fde68a; }

.tab-bar {
  display: flex;
  padding: 0 12px;
  border-top: 1px solid #374151;
}

.tab-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #f9fafb; }
.tab-btn.active { color: #ffffff; border-bottom-color: #60a5fa; }

/* ── main ── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px;
}

.tab { display: none; }
.tab.active { display: block; }

h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h3 { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
h4 { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 99px;
}

/* ── card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card.nested {
  background: transparent;
  margin-top: 4px;
}
.card.nested summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.card.nested[open] summary { margin-bottom: 12px; }
.card.nested > .field:first-of-type { margin-top: 12px; }

/* ── form ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.field:last-child { margin-bottom: 0; }

label {
  font-size: 13px;
  font-weight: 500;
}
.opt { font-weight: 400; color: var(--muted); }

input[type=text], input[type=password], select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  width: 100%;
  background: #fafafa;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,94,184,0.12);
  background: #fff;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; }
select { cursor: pointer; }

/* ── buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn.primary   { background: var(--accent); color: #fff; text-decoration: none; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.secondary:hover { background: #d1d5db; }
.btn.tiny {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  background: #e5e7eb;
  color: var(--text);
  margin-top: 4px;
  align-self: flex-start;
}
.btn.tiny:hover { background: #d1d5db; }

.row-actions { display: flex; gap: 10px; align-items: center; }
.btn-row { display: flex; gap: 10px; margin-top: 4px; }

/* ── result ── */
.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.result.error { border-color: #fca5a5; background: #fff5f5; color: var(--danger); }
.hidden { display: none !important; }

.result-section { display: flex; flex-direction: column; gap: 4px; }

/* ── json pre ── */
pre.json {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 8px;
}

.decoded-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 4px;
}

/* ── token cards ── */
.token-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface);
}
.meta-card {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--muted);
}
.meta-card strong { color: var(--text); }

.token-raw {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.token-raw code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  color: #1e40af;
  word-break: break-all;
  flex: 1;
}

.decoded { margin-top: 6px; }

/* ── status badges ── */
.status-ok  { color: var(--success); font-weight: 700; margin-left: 6px; }
.status-err { color: var(--danger);  font-weight: 700; margin-left: 6px; }

/* ── scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
