:root {
  --bg: #080e1a;
  --bg-soft: #0b1322;
  --panel: #0f1a2d;
  --panel-2: #121f36;
  --panel-3: #17263f;
  --border: #1d2d47;
  --border-soft: #16243a;
  --text: #e8eefb;
  --muted: #8798b5;
  --muted-2: #627391;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.13);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.13);
  --violet: #a78bfa;
  --shadow: 0 18px 45px rgba(0, 0, 0, .32);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(34, 211, 238, .12), transparent 60%),
    radial-gradient(900px 600px at -10% 15%, rgba(167, 139, 250, .09), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
code, pre, .mono { font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--border-soft);
  background: rgba(8, 14, 26, .72);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: #041018;
  background: linear-gradient(135deg, #67e8f9, #22d3ee 55%, #34d399);
  box-shadow: 0 8px 24px rgba(34, 211, 238, .28);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-text { font-size: 13px; letter-spacing: .16em; color: var(--muted); }
.brand-text strong { display: block; color: var(--text); font-size: 16px; letter-spacing: .12em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; opacity: .9; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); text-decoration: none; }
.nav-item.active {
  color: #c8f7ff;
  background: linear-gradient(90deg, rgba(34,211,238,.14), rgba(34,211,238,.03));
  border-color: rgba(34,211,238,.22);
  box-shadow: inset 2px 0 0 var(--cyan);
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 9px; padding: 0 8px; }
.api-pill { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 12px; font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.logout-form { margin-top: 4px; }

/* Main */
.main { flex: 1; min-width: 0; padding: 30px 34px 20px; max-width: 1500px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.breadcrumb { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
.breadcrumb span { margin: 0 6px; color: var(--border); }
h1 { font-size: 27px; line-height: 1.2; margin: 0 0 5px; letter-spacing: -.02em; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.footer { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--border-soft); color: var(--muted-2); font-size: 11px; }
.footer a { color: var(--muted-2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: transform .1s, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #2b4266; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #67e8f9, #22d3ee);
  color: #041018; border-color: transparent;
  box-shadow: 0 8px 24px rgba(34,211,238,.22);
}
.btn-primary:hover { background: linear-gradient(135deg, #a5f3fc, #38dff5); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { color: #ffd8df; background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.3); }
.btn-danger:hover { background: rgba(251,113,133,.18); }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 7px; }
.btn-copy { background: rgba(34,211,238,.14); border-color: rgba(34,211,238,.28); color: #bdf4ff; }
.btn-copy:hover { background: rgba(34,211,238,.22); }
.btn-icon { padding: 7px; width: 32px; height: 32px; }

/* Flash */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); font-size: 13px;
}
.flash-ok { border-color: rgba(52,211,153,.28); background: var(--green-soft); color: #c8ffe8; }
.flash-error { border-color: rgba(251,113,133,.28); background: var(--red-soft); color: #ffd7de; }
.flash-token { border-color: rgba(34,211,238,.3); background: var(--cyan-soft); color: #c9f8ff; }
.flash-text { overflow-wrap: anywhere; }

/* Cards and grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); }
.card {
  background: linear-gradient(180deg, rgba(18,31,54,.9), rgba(15,26,45,.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); }
.card-title { font-size: 13px; font-weight: 700; letter-spacing: .02em; margin: 0; }
.card-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.card-body { padding: 18px; }
.section { margin-top: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 10px; }
.section-head h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.section-head .muted { font-size: 12px; }

/* Stats */
.stat { padding: 17px 18px; position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; right: -35px; top: -50px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.1), transparent 70%);
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.stat-value { font-size: 31px; font-weight: 750; letter-spacing: -.04em; line-height: 1.1; margin: 8px 0 3px; }
.stat-meta { color: var(--muted); font-size: 11px; }
.stat-row { display: flex; align-items: baseline; gap: 8px; }
.stat-delta { font-size: 11px; color: var(--green); background: var(--green-soft); border-radius: 999px; padding: 2px 7px; }
.stat-cyan .stat-value { color: #a5f3fc; }
.stat-green .stat-value { color: #a7f3d0; }
.stat-amber .stat-value { color: #fde68a; }
.stat-violet .stat-value { color: #ddd6fe; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; padding: 10px 12px; color: var(--muted-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: rgba(8,14,26,.35);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,.018); }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { text-align: center; padding: 38px 18px; color: var(--muted); }
.table-empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono-sm { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; }
.token-cell { display: flex; align-items: center; gap: 7px; }
.token-code { color: #bdf4ff; background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.16); border-radius: 6px; padding: 3px 6px; font-size: 11px; }
.mask { letter-spacing: .12em; color: var(--muted); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: capitalize;
  background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid transparent;
}
.badge-ok { color: #a7f3d0; background: var(--green-soft); border-color: rgba(52,211,153,.2); }
.badge-warn { color: #fde68a; background: var(--amber-soft); border-color: rgba(251,191,36,.2); }
.badge-bad { color: #ffc9d3; background: var(--red-soft); border-color: rgba(251,113,133,.2); }
.badge-cyan { color: #bdf4ff; background: var(--cyan-soft); border-color: rgba(34,211,238,.2); }
.badge-violet { color: #ddd6fe; background: rgba(167,139,250,.13); border-color: rgba(167,139,250,.2); }
.badge-muted { color: var(--muted); background: rgba(255,255,255,.04); border-color: var(--border-soft); }
.dot-badge { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 5px; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(6,12,22,.55); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(34,211,238,.55); box-shadow: 0 0 0 3px rgba(34,211,238,.1);
}
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { color: var(--muted-2); font-size: 10.5px; margin-top: 4px; }
.form-actions { display: flex; align-items: center; gap: 9px; margin-top: 15px; }
.inline-form { display: inline; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 16px; }
.filter-bar .field { min-width: 150px; }
.filter-bar .grow { flex: 1; min-width: 190px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }

/* Token detail */
.back-link { display: inline-flex; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.token-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 20px 22px; margin-bottom: 16px;
  background:
    radial-gradient(500px 180px at 100% 0%, rgba(34,211,238,.14), transparent 70%),
    linear-gradient(135deg, rgba(18,31,54,.98), rgba(12,22,40,.96));
  border: 1px solid rgba(34,211,238,.16);
}
.token-hero h2 { margin: 5px 0 4px; font-size: 24px; letter-spacing: .04em; }
.token-meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.token-copy { display: flex; align-items: center; gap: 8px; }
.token-copy code { font-size: 15px; color: #bdf4ff; }
.warning {
  padding: 12px 15px; border-radius: 10px; margin-bottom: 16px;
  background: var(--amber-soft); border: 1px solid rgba(251,191,36,.24); color: #fde68a; font-size: 12.5px;
}
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.mini-stat { padding: 13px 15px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border-soft); }
.mini-stat .k { color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.mini-stat .v { font-size: 20px; font-weight: 750; margin-top: 3px; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.sticky { position: sticky; top: 22px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 15px 18px; border-left: 1px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -3.5px; top: 4px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft);
}
.timeline .t { font-size: 11px; color: var(--muted-2); }
.timeline .m { font-size: 12px; color: var(--text); margin-top: 1px; overflow-wrap: anywhere; }
.timeline .meta { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }

/* Chart */
.chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding: 8px 2px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #67e8f9, #0e7490); min-height: 2px; opacity: .9; }
.chart-label { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; }
.chart-count { font-size: 9.5px; color: var(--muted); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.step { padding: 14px; border-radius: 12px; background: rgba(255,255,255,.02); border: 1px solid var(--border-soft); }
.step-num { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--cyan-soft); color: var(--cyan); font-weight: 800; font-size: 11px; margin-bottom: 8px; }
.step h3 { font-size: 12px; margin: 0 0 3px; }
.step p { color: var(--muted); font-size: 11px; margin: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 410px; padding: 32px;
  background: linear-gradient(180deg, rgba(18,31,54,.98), rgba(11,19,34,.98));
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--green), transparent);
}
.login-logo { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 20px; background: linear-gradient(135deg, #67e8f9, #22d3ee 55%, #34d399); color: #041018; box-shadow: 0 10px 30px rgba(34,211,238,.25); }
.login-logo svg { width: 30px; height: 30px; }
.login-card h1 { font-size: 23px; margin: 0 0 6px; }
.login-card p { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; }
.login-card .field input { padding: 11px 12px; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 11px; }
.login-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border-soft); color: var(--muted-2); font-size: 10.5px; display: flex; justify-content: space-between; gap: 10px; }
.login-error { margin-bottom: 14px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,14,.7); backdrop-filter: blur(4px);
  display: none; place-items: center; padding: 20px; z-index: 100;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { margin: 0; font-size: 14px; }
.modal-body { padding: 18px; }
.modal-body .secret { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.modal-body .secret code { flex: 1; background: rgba(6,12,22,.6); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; overflow-wrap: anywhere; font-size: 12px; }
.modal-note { color: var(--muted); font-size: 11.5px; margin: 8px 0 0; }
.modal-close { background: transparent; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.x-small { font-size: 10.5px; color: var(--muted-2); }

/* Docs */
.docs-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .7fr); gap: 16px; align-items: start; }
.endpoint { border-bottom: 1px solid var(--border-soft); padding: 18px 20px; }
.endpoint:last-child { border-bottom: 0; }
.endpoint-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.method { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 3px 7px; border-radius: 5px; background: var(--green-soft); color: #a7f3d0; border: 1px solid rgba(52,211,153,.22); }
.path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: #bdf4ff; }
.endpoint p { color: var(--muted); font-size: 12px; margin: 7px 0; }
pre {
  background: #060c16; border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 14px; overflow-x: auto; font-size: 11px; line-height: 1.55; color: #cbe6ff;
}
pre .k { color: #fbbf24; }
.side-card { padding: 18px; }
.side-card h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.side-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.side-card li { margin: 5px 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); text-align: right; overflow-wrap: anywhere; }

/* Misc */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.empty-icon { font-size: 24px; margin-bottom: 6px; opacity: .7; }
.hr { height: 1px; background: var(--border-soft); margin: 16px 0; border: 0; }
.tiny { font-size: 10.5px; }
.overflow-anywhere { overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-main, .docs-grid, .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .steps { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mini-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 12px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--border-soft);
  }
  .brand { padding: 0; }
  .brand-text { font-size: 11px; }
  .brand-text strong { font-size: 13px; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; gap: 2px; }
  .nav-item { padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .nav-item svg { width: 15px; height: 15px; }
  .sidebar-foot { flex-direction: row; align-items: center; margin-left: auto; padding: 0; gap: 10px; }
  .sidebar-foot .muted, .sidebar-foot .api-pill { display: none; }
  .main { padding: 20px 16px 16px; }
  .topbar { flex-direction: column; }
  .top-actions { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .token-hero { flex-direction: column; align-items: flex-start; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .filter-bar .field, .filter-bar .grow { min-width: 100%; }
  .filter-actions { width: 100%; }
  h1 { font-size: 22px; }
  .stat-value { font-size: 26px; }
}
