:root {
    --bg: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-input: #0f0f14;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.2);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d2d3a;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    color: var(--text-muted);
}

.logo-badge {
    font-size: 0.65rem;
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.user-wallet {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Main */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 3rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #818cf8;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 0.9rem;
}

.key-prefix {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.badge-muted {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item:hover {
    border-color: var(--accent);
}

.checkbox-item.selected {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.checkbox-item input {
    display: none;
}

.checkbox-label {
    font-size: 0.85rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Key Display */
.key-display {
    background: var(--bg);
    border: 1px solid var(--success);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.key-display-label {
    font-size: 0.75rem;
    color: var(--success);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.key-display-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.key-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--warning);
}

/* Playground */
.playground {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.playground-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 1.25rem;
}

.endpoint-select {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.response-area {
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
}

/* Login */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.login-logo span {
    color: var(--text-muted);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.login-box .btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
    }

    .playground {
        grid-template-columns: 1fr;
    }
}

/* Textarea */
textarea.form-input {
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* OAuth scope badges in tables */
.scope-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.scope-badges .badge {
    font-size: 0.65rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
}

/* Action button group in tables */
.action-btns {
    display: flex;
    gap: 0.5rem;
}

/* Logout button */
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-logout:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(239,68,68,0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


.universal-topbar{position:fixed;top:0;left:0;right:0;height:48px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;background:rgba(10,10,15,.92);border-bottom:1px solid var(--border);z-index:2001}.universal-topbar .ut-left,.universal-topbar .ut-right{display:flex;align-items:center;gap:8px}.universal-topbar a{color:var(--text-secondary);text-decoration:none;font-size:.78rem;padding:5px 9px;border:1px solid var(--border);border-radius:7px}.universal-topbar a:hover{color:var(--text)}.universal-topbar .ut-brand{border:none;padding:0 6px;color:var(--text);font-weight:700}body{padding-top:48px}.login-screen{min-height:calc(100vh - 48px)}.sidebar{height:calc(100vh - 48px);top:48px}.layout{min-height:calc(100vh - 48px)}

/* Universal header polish (override) */
.universal-topbar{
  height:56px;
  padding:0 16px;
  background:linear-gradient(180deg, rgba(10,10,15,.98), rgba(10,10,15,.9));
  border-bottom:1px solid rgba(148,163,184,.18);
}
.universal-topbar .ut-left,.universal-topbar .ut-right{gap:10px}
.universal-topbar a{font-size:.82rem;padding:6px 10px;border-radius:9px}
.universal-topbar .ut-brand{font-size:1rem}
body{padding-top:56px}
.login-screen{min-height:calc(100vh - 56px)}
.sidebar{top:56px;height:calc(100vh - 56px)}
.layout{min-height:calc(100vh - 56px)}
@media (max-width:900px){
  .universal-topbar .ut-left a:not(.ut-brand){display:none}
  .universal-topbar .ut-right a{font-size:.75rem;padding:5px 8px}
}


/* polish pass */
.universal-topbar{box-shadow:0 8px 20px rgba(0,0,0,.25)}
.universal-topbar a{backdrop-filter:saturate(120%)}
.main{padding-top:2.5rem}
.card{box-shadow:0 8px 18px rgba(0,0,0,.18)}
.nav-link{border-radius:8px;margin:0 8px 2px 8px;border-left:none}
.nav-link.active{border-left:none;box-shadow:inset 0 0 0 1px rgba(99,102,241,.35)}


/* ===== 906 Design System v1 ===== */
:root{
  --radius: 12px;
  --space-1: 6px; --space-2: 10px; --space-3: 14px; --space-4: 20px;
  --shadow-1: 0 8px 20px rgba(0,0,0,.22);
  --shadow-2: 0 12px 28px rgba(0,0,0,.28);
}
.btn{border-radius:10px;font-weight:600;letter-spacing:.01em}
.card,.stat-card{border-radius:14px;box-shadow:var(--shadow-1)}
.form-input{border-radius:10px}
.universal-topbar{height:56px}
body{padding-top:56px}
.sidebar{top:56px;height:calc(100vh - 56px)}
.main{margin-left:260px;padding:2.25rem 2.5rem}
