/* User center app shell & components */

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    font-weight: 700;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { color: #f8fafc; font-weight: 600; font-size: 0.92rem; }
.brand-sub { color: var(--sidebar-text); font-size: 0.72rem; margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #e0e7ff; }
.nav-item.active { background: rgba(99, 102, 241, 0.25); color: var(--sidebar-active); }

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

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 0.8125rem;
}
.sidebar-link svg { width: 16px; height: 16px; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #e0e7ff; }

.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    border: none;
    background: transparent;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}
.menu-toggle svg { width: 22px; height: 22px; }

.topbar-title h2 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.topbar-title p { font-size: 0.8125rem; color: var(--text-muted); }

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.topbar-icon-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text);
}

.topbar-icon-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.topbar-icon-btn.is-spinning svg {
    animation: topbar-spin 0.6s ease;
}

@keyframes topbar-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.topbar-user-panel {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-muted);
    box-shadow: var(--shadow-xs);
}

.topbar-user-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 6px;
    min-width: 0;
}

.topbar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    user-select: none;
}

.topbar-user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 12px;
    border: none;
    border-radius: calc(var(--radius-lg) - 3px);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.topbar-logout-btn:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.topbar-logout-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
}

.content {
    flex: 1;
    padding: var(--space-6);
}

.page-shell {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    max-width: 1120px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.page-desc { color: var(--text-secondary); font-size: 0.875rem; max-width: 560px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
}

.stat-label { font-size: 0.8125rem; color: var(--text-muted); }
.stat-value { font-size: 1.75rem; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.02em; }
.stat-meta { font-size: 0.8125rem; color: var(--text-secondary); }

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 0.9375rem; font-weight: 600; }
.panel-link { font-size: 0.8125rem; color: var(--primary); font-weight: 500; }
.panel-link:hover { text-decoration: underline; }
.panel-body { padding: var(--space-5); }

.quota-meter-bar {
    height: 10px;
    background: var(--bg-subtle);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.quota-meter-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #4f46e5);
    border-radius: 999px;
    transition: width .4s ease;
    width: 0;
}
.quota-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.usage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.usage-row:last-child { border-bottom: none; }
.usage-bar-wrap {
    flex: 1;
    margin: 0 12px;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 999px;
    overflow: hidden;
}
.usage-bar-wrap span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.quickstart-steps { display: flex; flex-direction: column; gap: 16px; }
.quickstart-step { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8125rem;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.quickstart-step strong { display: block; font-size: 0.875rem; margin-bottom: 2px; }
.quickstart-step p { font-size: 0.8125rem; color: var(--text-secondary); }
.quickstart-step code {
    font-size: 0.78rem;
    background: var(--bg-subtle);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Keys */
.keys-list { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

.key-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition);
}
.key-card:hover { border-color: var(--border-strong); }

.key-card-main { min-width: 0; flex: 1; }
.key-card-actions {
    display: flex;
    flex-shrink: 0;
    align-items: flex-start;
    gap: var(--space-2);
}
.btn-delete-key { color: var(--danger); }
.btn-delete-key:hover { background: var(--danger-bg); color: var(--danger); }
.key-card-name { font-weight: 600; font-size: 0.9375rem; margin-bottom: 4px; }
.key-card-mask { font-family: ui-monospace, monospace; font-size: 0.8125rem; color: var(--text-secondary); }
.key-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.scope-tag {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 500;
}

/* Scope picker (create key modal) */
.form-group--scopes {
    gap: 8px;
    margin-top: var(--space-3);
}

.scope-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.scope-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.scope-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--bg-subtle);
    letter-spacing: 0.01em;
    transition: color var(--transition), background var(--transition);
}

.scope-count.is-active {
    color: var(--primary);
    background: var(--primary-subtle);
}

.scope-field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.scope-panel {
    margin-top: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-muted);
    overflow: hidden;
}

.scope-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.scope-tool-btn {
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.scope-tool-btn:hover:not(:disabled) {
    background: var(--primary-subtle);
}

.scope-tool-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.scope-toolbar-divider {
    width: 1px;
    height: 12px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

.scope-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    min-height: 48px;
    max-height: 280px;
    overflow-y: auto;
}

.scope-grid::-webkit-scrollbar { width: 6px; }
.scope-grid::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

.scope-group-label {
    padding: 6px 10px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.scope-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition), box-shadow var(--transition);
    position: relative;
}

.scope-item:hover:not(.scope-item--disabled) {
    background: var(--surface);
}

.scope-item--checked {
    background: var(--surface);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.28);
}

.scope-item--disabled {
    opacity: 0.52;
    cursor: not-allowed;
}

.scope-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.scope-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}

.scope-item-icon .ui-icon {
    width: 18px;
    height: 18px;
}

.scope-item--checked .scope-item-icon {
    background: var(--primary-subtle);
    color: var(--primary);
}

.scope-item-body {
    flex: 1;
    min-width: 0;
}

.scope-item-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.scope-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.scope-item-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--bg-subtle);
    letter-spacing: 0.02em;
}

.scope-item-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
}

.scope-item-badge {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    flex-shrink: 0;
}

.scope-toggle {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--surface);
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.scope-item--checked .scope-toggle {
    background: var(--primary);
    border-color: var(--primary);
}

.scope-toggle svg {
    width: 11px;
    height: 11px;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity var(--transition), transform var(--transition);
}

.scope-item--checked .scope-toggle svg {
    opacity: 1;
    transform: scale(1);
}

.scope-loading,
.scope-empty {
    padding: 28px 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.scope-empty {
    color: var(--danger);
}

.scope-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 6px;
}

.scope-skeleton-row {
    height: 52px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-subtle) 25%, #e8edf3 50%, var(--bg-subtle) 75%);
    background-size: 200% 100%;
    animation: scope-shimmer 1.2s ease-in-out infinite;
}

@keyframes scope-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.modal-panel--keys {
    width: min(520px, 100%);
}

.key-reveal-banner {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--warning-bg);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--warning);
}
.key-reveal-banner svg { width: 20px; height: 20px; flex-shrink: 0; }

.key-reveal-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.key-reveal-box code {
    flex: 1;
    font-size: 0.75rem;
    word-break: break-all;
    font-family: ui-monospace, monospace;
}

.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--primary-subtle);
    color: var(--primary);
}

.empty-state p { color: var(--text-secondary); margin-bottom: 16px; }

/* Docs */
.docs-page { max-width: 1200px; }

.docs-hero { padding: var(--space-6); }
.docs-hero-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
    flex-wrap: wrap;
}
.docs-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-subtle);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.docs-hero h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.docs-hero p { color: var(--text-secondary); max-width: 520px; font-size: 0.9375rem; }

.docs-base-url .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.code-inline-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.code-inline-wrap code { font-family: ui-monospace, monospace; font-size: 0.8125rem; }

.docs-grid {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
}

.docs-nav-shell {
    min-width: 0;
}

.docs-nav-label {
    display: none;
}

.docs-nav {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.docs-nav a {
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.docs-nav a:hover { background: var(--bg-subtle); color: var(--text); }
.docs-nav a.active {
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 600;
}

.docs-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}
.docs-section { padding: var(--space-5) var(--space-6); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.docs-section h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 12px; }
.docs-section h3 { font-size: 0.9375rem; font-weight: 600; margin: 16px 0 8px; }
.docs-section p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 12px; }
.docs-list { margin: 0 0 12px 20px; color: var(--text-secondary); font-size: 0.875rem; }
.docs-list li { margin-bottom: 6px; }
.docs-list code { font-size: 0.8125rem; background: var(--bg-subtle); padding: 1px 6px; border-radius: 4px; }

.method-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    margin-right: 6px;
}
.method-get { background: #dbeafe; color: #1d4ed8; }
.method-post { background: #dcfce7; color: #15803d; }

.code-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 12px 0;
    max-width: 100%;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.code-block-header .btn {
    flex-shrink: 0;
}
.code-block pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.8125rem;
    line-height: 1.55;
    background: #0f172a;
    color: #e2e8f0;
    max-width: 100%;
}
.code-block code {
    font-family: ui-monospace, "SF Mono", Monaco, monospace;
    display: block;
    white-space: pre;
}

.data-table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-muted);
}
.data-table tbody tr:hover { background: var(--bg-subtle); }

/* Modal (shared) */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
.modal-panel {
    position: relative;
    width: min(480px, 100%);
    max-height: min(90vh, 680px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.modal-panel--sm { width: min(440px, 100%); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-5) var(--space-3);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 0 var(--space-5) var(--space-5); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding-top: var(--space-4);
}
.modal-close { font-size: 1.25rem; line-height: 1; }

.status-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
}
.status-badge--active { background: var(--success-bg); color: var(--success); }
.status-badge--revoked,
.status-badge--disabled { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 900px) {
    .docs-page { max-width: none; }

    .docs-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .docs-nav-shell.content-card {
        position: sticky;
        top: var(--topbar-h);
        z-index: 25;
        padding: 0;
        overflow: hidden;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-xs);
    }

    .docs-nav-label {
        display: block;
        padding: 10px 12px 0;
        font-size: 0.6875rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .docs-nav {
        position: static;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 10px 12px 12px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .docs-nav::-webkit-scrollbar {
        display: none;
    }

    .docs-nav a {
        flex: 0 0 auto;
        scroll-snap-align: start;
        white-space: nowrap;
        padding: 8px 14px;
        border: 1px solid var(--border);
        background: var(--surface);
        font-size: 0.8125rem;
    }

    .docs-nav a.active {
        border-color: rgba(79, 70, 229, 0.35);
        box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.12);
    }

    .docs-section {
        scroll-margin-top: calc(var(--topbar-h) + 88px);
    }
}

@media (max-width: 640px) {
    .docs-hero {
        padding: var(--space-4);
    }

    .docs-hero-inner {
        flex-direction: column;
        gap: var(--space-4);
    }

    .docs-hero h1 {
        font-size: 1.25rem;
    }

    .docs-base-url {
        width: 100%;
    }

    .code-inline-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .code-inline-wrap code {
        word-break: break-all;
        overflow-wrap: anywhere;
        font-size: 0.75rem;
        line-height: 1.5;
    }

    .code-inline-wrap .btn {
        align-self: flex-end;
    }

    .docs-section {
        padding: var(--space-4);
        scroll-margin-top: calc(var(--topbar-h) + 96px);
    }

    .docs-section h2 {
        font-size: 1rem;
    }

    .code-block {
        margin: 10px 0;
        border-radius: var(--radius);
    }

    .code-block-header {
        padding: 8px 10px;
    }

    .code-block-header .btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .code-block pre {
        padding: 12px;
        font-size: 0.6875rem;
        line-height: 1.45;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .method-badge {
        margin-bottom: 4px;
    }
}

@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .menu-toggle { display: block; }
    .topbar { padding: 0 var(--space-4); }
    .topbar-user-name { display: none; }
    .topbar-user-identity { padding-right: 6px; }
}

@media (max-width: 480px) {
    .topbar-logout-btn span { display: none; }
    .topbar-logout-btn { padding: 0 10px; }
}

@media (max-width: 560px) {
    .content { padding: var(--space-4); }
    .key-card { flex-direction: column; }
    .modal-panel--keys { width: 100%; }
    .scope-item { padding: 9px 10px; gap: 10px; }
    .scope-item-icon { width: 32px; height: 32px; border-radius: 8px; }
    .scope-item-icon svg { width: 16px; height: 16px; }
    .scope-grid { max-height: 240px; }
}
