:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface2: #ffffff;
  --border: #e3e8f0;
  --text: #0f172a;
  --muted: #5b6878;
  --accent: #2563eb;
  --accent2: #2563eb;
  --success: #059669;
  --warn: #b45309;
  --danger: #dc2626;
  --radius: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; min-height: 100vh; }

/* NAV */
nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; }
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 52px; }
.logo { font-weight: 700; font-size: 1.1rem; letter-spacing: -.3px; }
.nav-badge { font-size: .75rem; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; }

/* TABS */
.tool-tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 2px; padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tool-tab { background: none; border: none; color: var(--muted); padding: 14px 18px; cursor: pointer; font-size: .875rem; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.tool-tab:hover { color: var(--text); }
.tool-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* CONTAINER */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

/* PANEL */
.tool-panel { display: none; }
.tool-panel.active { display: block; }

/* IO GRID */
.io-grid { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 0; align-items: start; }
.io-col { display: flex; flex-direction: column; gap: 0; }
.io-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; }
.io-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.io-actions { display: flex; gap: 6px; }
.btn-sm { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: 5px; cursor: pointer; font-size: .8rem; transition: background .15s, border-color .15s; }
.btn-sm:hover { background: var(--border); border-color: var(--accent); }
.io-area { width: 100%; height: 220px; resize: vertical; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-family: 'Consolas', 'Monaco', monospace; font-size: .875rem; padding: 14px; outline: none; transition: border-color .15s; line-height: 1.6; }
.io-area:focus { border-color: var(--accent); }
.output-area { background: var(--surface2); color: var(--success); cursor: default; }
.mode-row { display: flex; gap: 18px; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .85rem; color: var(--muted); transition: color .15s; }
.radio-label:hover { color: var(--text); }
.radio-label input[type=radio] { accent-color: var(--accent); }
.info-bar { padding: 6px 14px; font-size: .78rem; color: var(--muted); min-height: 28px; background: var(--surface2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); margin-top: -1px; }

/* ARROW COL */
.arrow-col { display: flex; align-items: center; justify-content: center; padding-top: 42px; }
.swap-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--accent); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: background .15s, transform .2s; }
.swap-btn:hover { background: var(--border); transform: rotate(180deg); }

/* TIP */
.tip-row { margin-top: 16px; padding: 12px 16px; background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }

/* JWT */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.jwt-sections { display: flex; flex-direction: column; gap: 12px; }
.jwt-part { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.jwt-part-header { padding: 10px 14px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.jwt-part-header.header-h { background: #1e3a5f; color: #2563eb; border-bottom: 1px solid #2563eb44; }
.jwt-part-header.payload-h { background: #1e3a2f; color: #059669; border-bottom: 1px solid #05966944; }
.jwt-part-header.sig-h { background: #3a1e2f; color: #f472b6; border-bottom: 1px solid #db277744; }
.jwt-json { padding: 14px; background: var(--surface2); font-family: monospace; font-size: .85rem; line-height: 1.7; white-space: pre-wrap; word-break: break-all; }
.jwt-json .key { color: #2563eb; }
.jwt-json .str { color: #059669; }
.jwt-json .num { color: #b45309; }
.jwt-json .bool { color: #f472b6; }
.jwt-error { padding: 14px; color: var(--danger); font-size: .85rem; }

/* SR ONLY */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 700px) {
  .io-grid { grid-template-columns: 1fr; }
  .arrow-col { padding-top: 4px; }
  .swap-btn { transform: rotate(90deg); }
  .swap-btn:hover { transform: rotate(270deg); }
  .io-area { height: 160px; }
}
