/** CollectX design system — bundled; edit partials then run this script */

/* === collectx-tokens.css === */
/**
 * CollectX design tokens & base reset (commercial SaaS)
 */
:root {
    --color-bg: #0b0e14;
    --color-surface-1: #111520;
    --color-surface-2: #171c29;
    --color-surface-3: #1e2433;
    --color-border: rgba(148, 163, 184, 0.12);
    --color-border-strong: rgba(148, 163, 184, 0.22);

    --color-text-1: #f1f5f9;
    --color-text-2: #cbd5e1;
    --color-text-3: #94a3b8;

    --color-brand: #22b8e6;
    --color-brand-hover: #38c6f0;
    --color-brand-soft: rgba(34, 184, 230, 0.12);
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    /* Legacy aliases (existing pages) */
    --bg-primary: var(--color-bg);
    --bg-secondary: var(--color-surface-1);
    --bg-card: var(--color-surface-2);
    --bg-card-hover: var(--color-surface-3);
    --accent-cyan: var(--color-brand);
    --accent-blue: #2563eb;
    --accent-purple: #7c3aed;
    --accent-green: var(--color-success);
    --accent-orange: var(--color-warning);
    --accent-red: var(--color-danger);
    --text-primary: var(--color-text-1);
    --text-secondary: var(--color-text-2);
    --text-muted: var(--color-text-3);
    --border-color: var(--color-border);
    --border-hover: var(--color-border-strong);
    --glow-cyan: var(--color-brand-soft);
    --glow-purple: rgba(124, 58, 237, 0.12);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    --font-sans: "Segoe UI", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-nav: 0 1px 0 var(--color-border);
    --input-height: 40px;
    --nav-height: 60px;
    --content-max: 1200px;

    --motion-fast: 120ms ease;
    --motion-base: 180ms ease;
}

[data-theme="light"] {
    --color-bg: #f8fafc;
    --color-surface-1: #ffffff;
    --color-surface-2: #f1f5f9;
    --color-surface-3: #e2e8f0;
    --color-border: rgba(15, 23, 42, 0.08);
    --color-border-strong: rgba(15, 23, 42, 0.16);
    --color-text-1: #0f172a;
    --color-text-2: #334155;
    --color-text-3: #64748b;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text-1);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
}

code {
    font-family: var(--font-mono);
}

:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface-1);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-3);
}

/* === collectx-layout.css === */
/**
 * App shell: nav + page shell + card
 */
.page-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-5);
    box-sizing: border-box;
}

.page-shell--wide {
    max-width: min(1400px, 100%);
}

/** 接口市场 / AI 助手 / 控制台等：占满导航下方区域，无左右外边距 */
.page-shell--full {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0;
}

.page-shell--full > .container,
.page-shell--full > .main-container {
    flex: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 0;
    box-sizing: border-box;
}

.page-card,
.container.app-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--color-surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.page-card--padded {
    padding: var(--space-5);
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    overflow: auto;
    border: 1px solid var(--color-border);
}

.page-header-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-1);
}

.page-header-compact .page-title {
    font-family: var(--font-sans);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-header-compact .page-subtitle {
    margin: var(--space-2) 0 0;
    color: var(--color-text-3);
    font-size: 0.9rem;
}

.page-body {
    flex: 1;
    padding: var(--space-6);
}

@media (max-width: 768px) {
    .page-shell:not(.page-shell--full) {
        padding: var(--space-3);
    }

    .page-header-compact,
    .page-body,
    .content-area {
        padding: var(--space-4);
    }
}

/* === collectx-components.css === */
/**
 * Shared UI components
 */

/* Buttons */
.cx-btn,
.save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--input-height);
    padding: 0 var(--space-5);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}

.save-btn,
.cx-btn-primary {
    background: var(--color-brand);
    color: #0b1220;
    box-shadow: none;
}

.save-btn:hover:not(:disabled),
.cx-btn-primary:hover:not(:disabled) {
    background: var(--color-brand-hover);
    transform: none;
    box-shadow: none;
}

.save-btn:disabled,
.cx-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.cx-btn-secondary,
.stats-secondary-btn {
    min-height: 36px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.cx-btn-secondary:hover,
.stats-secondary-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.cx-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    box-sizing: border-box;
}

.cx-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

/* Forms */
.cx-input,
.search-box input,
.call-stats-date,
.stats-filter-field input,
.stats-filter-field select {
    width: 100%;
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
}

.cx-input:focus,
.search-box input:focus,
.call-stats-date:focus,
.stats-filter-field input:focus,
.stats-filter-field select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--glow-cyan);
}

.search-box {
    display: flex;
    flex: 1;
    min-width: 200px;
    position: relative;
    align-items: center;
}

.search-box .search-box-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    width: 1rem;
    height: 1rem;
}

.search-box:has(.search-box-icon) input {
    padding-left: 2.25rem;
}

.form-control-dark,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: var(--input-height);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.form-group {
    margin-bottom: var(--space-4);
}

/* Tables */
.cx-table-wrap,
.stats-table-wrap {
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

tr:hover td {
    background: var(--bg-card-hover);
}

td.num,
th.num {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

td code {
    background: var(--bg-primary);
    color: var(--accent-cyan);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.cx-table-wrap thead th,
.stats-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Tabs */
.tab-nav,
.cx-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn,
.cx-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab-btn.active,
.cx-tab-btn.active {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.15), rgba(139, 92, 246, 0.15));
    border-color: rgba(0, 217, 255, 0.4);
    color: var(--accent-cyan);
}

.tab-icon {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Badges */
.cx-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.cx-badge-admin {
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.12);
}

.cx-badge-success {
    border-color: rgba(16, 185, 129, 0.5);
    color: var(--accent-green);
}

.cx-badge-danger {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--accent-red);
}

/* Toolbar */
.cx-toolbar,
.api-toolbar,
.stats-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
    margin-bottom: var(--space-4);
}

/* Empty / loading */
.cx-empty-state,
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--text-secondary);
}

.cx-empty-state::before,
.empty-state::before {
    content: '—';
    display: block;
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.loading {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    top: calc(var(--nav-height) + 12px);
    right: var(--space-5);
    z-index: 2000;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    font-size: 0.9rem;
}

/* Rates */
.stats-rate-good { color: var(--accent-green); font-weight: 500; }
.stats-rate-warning { color: var(--accent-orange); font-weight: 500; }
.stats-rate-bad { color: var(--accent-red); font-weight: 500; }

/* Detail panel (logs / stats) */
.cx-detail-panel,
.log-detail-panel {
    padding: var(--space-4);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.stats-api-cell {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    max-width: 100%;
    vertical-align: middle;
}

.stats-expand-row > td:first-child {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}

.stats-api-cell .stats-api-platform {
    display: inline;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.stats-api-sep {
    color: var(--text-muted);
    opacity: 0.55;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.stats-api-cell .stats-api-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ── Layout helpers ── */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.search-box--composite {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-card);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    flex: 1;
    max-width: 400px;
}

.search-box--composite input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    min-height: auto;
    padding: 0;
    box-shadow: none;
}

/* ── Buttons (legacy .btn-* class names) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    gap: var(--space-2);
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--color-brand);
    color: #0b1220;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: #fff;
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn:hover,
.btn-primary:hover {
    filter: brightness(1.05);
    transform: none;
}

.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover {
    filter: brightness(1.05);
    transform: none;
}

/* ── Stats cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--color-border-strong);
    transform: none;
}

.stat-card .stat-icon {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.status-badge,
.role-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-disabled {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-admin {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.role-user {
    background: rgba(0, 217, 255, 0.2);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 217, 255, 0.3);
}

.action-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: var(--space-4);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: min(500px, 100%);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.modal-header {
    background: var(--color-surface-2);
    color: var(--color-text-1);
    padding: var(--space-4) var(--space-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-family: var(--font-sans);
    font-weight: 600;
}

.close-btn {
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    font-size: 1.25rem;
    line-height: 1;
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
}

/* ── Toast variants ── */
.toast-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: #fff;
}

.toast-error {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: #fff;
}

.toast-warning {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: #fff;
}

/* ── Loading spinner (no emoji) ── */
.cx-spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto var(--space-3);
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: cx-spin 0.8s linear infinite;
}

@keyframes cx-spin {
    to { transform: rotate(360deg); }
}

.loading.cx-loading-block {
    padding: var(--space-8);
}

.loading.cx-loading-block::before {
    content: none;
}

/* Toast stack (CollectXUI) */
.cx-toast-host {
    position: fixed;
    top: calc(var(--nav-height) + 12px);
    right: var(--space-5);
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.cx-toast-host .toast {
    position: static;
    pointer-events: auto;
    min-width: 240px;
    border-left: 3px solid var(--color-brand);
}

.cx-toast-host .toast-success {
    border-left-color: var(--color-success);
}

.cx-toast-host .toast-error {
    border-left-color: var(--color-danger);
}

.cx-toast-host .toast-warning {
    border-left-color: var(--color-warning);
}

/* === collectx-nav.css === */
/**
 * Global top navigation (auth.js)
 */
.cx-nav-bar,
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    min-height: var(--nav-height);
    background: rgba(10, 10, 15, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-nav);
    font-family: var(--font-sans);
}

.cx-nav-bar .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.cx-nav-bar .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--color-brand);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1rem;
    color: #0b1220;
    box-shadow: none;
}

.cx-nav-bar .logo-text {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text-1);
}

.cx-nav-main {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.cx-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.cx-nav-link:hover,
.cx-nav-link.is-active {
    color: var(--text-primary);
}

.cx-nav-link .nav-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--accent-cyan);
    transition: width 0.2s;
}

.cx-nav-link.is-active .nav-underline,
.cx-nav-link:hover .nav-underline {
    width: 100%;
}

.cx-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cx-nav-link.is-active .cx-nav-badge {
    background: rgba(0, 217, 255, 0.12);
    border-color: rgba(0, 217, 255, 0.25);
    color: var(--accent-cyan);
}

.cx-nav-dropdown.is-ops-active .cx-nav-dropdown-toggle .cx-nav-badge {
    background: rgba(0, 217, 255, 0.12);
    border-color: rgba(0, 217, 255, 0.25);
    color: var(--accent-cyan);
}

.cx-nav-dropdown {
    position: relative;
}

.cx-nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    box-shadow: none;
    transform: none;
}

/* 页面级 button {} 勿影响顶栏 */
.cx-nav-bar .cx-nav-dropdown-toggle,
.cx-nav-bar .cx-nav-toggle {
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: none;
}

.cx-nav-dropdown-toggle:hover,
.cx-nav-dropdown.open .cx-nav-dropdown-toggle {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.cx-nav-dropdown.is-ops-active .cx-nav-dropdown-toggle {
    border-color: rgba(0, 217, 255, 0.35);
    color: var(--text-primary);
}

.cx-nav-dropdown.is-ops-active .cx-nav-dropdown-toggle:hover,
.cx-nav-dropdown.open .cx-nav-dropdown-toggle {
    border-color: var(--accent-cyan);
}

.cx-nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    z-index: 1100;
}

.cx-nav-dropdown.open .cx-nav-dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cx-nav-dropdown-menu .cx-nav-link {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
}

.cx-nav-dropdown-menu .cx-nav-link:hover {
    background: var(--bg-card-hover);
}

.cx-nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.cx-nav-actions .cx-btn-ghost {
    min-width: 4.5rem;
}

.cx-nav-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.cx-nav-user-chip:hover {
    border-color: var(--accent-cyan);
}

.cx-nav-user-chip .cx-nav-badge {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.35);
    color: var(--accent-purple);
}

.cx-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.cx-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
}

@media (max-width: 960px) {
    .cx-nav-toggle {
        display: flex;
    }

    .cx-nav-bar.cx-nav-open .cx-nav-main,
    .cx-nav-bar.cx-nav-open .cx-nav-actions {
        display: flex;
    }

    .cx-nav-main,
    .cx-nav-actions {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: var(--nav-height);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-4);
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
    }

    .cx-nav-bar {
        flex-wrap: wrap;
        position: sticky;
    }

    .cx-nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: var(--space-4);
    }

    .cx-nav-dropdown.open .cx-nav-dropdown-menu {
        display: flex;
    }
}

/* === collectx-marketing.css === */
/**
 * Landing / login / tools — shared CTA & section tokens (layout stays page-specific)
 */

body.cx-page-marketing {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.cx-page-marketing .bg-gradient {
    flex-shrink: 0;
}
.marketing-cta,
.hero-cta,
.btn-hero-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--input-height);
    padding: 0 var(--space-6);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    font-family: var(--font-sans);
    background: var(--color-brand);
    color: #0b1220;
    box-shadow: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.marketing-cta:hover,
.hero-cta:hover,
.btn-hero-primary:hover {
    background: var(--color-brand-hover);
    transform: none;
    box-shadow: none;
}

.marketing-cta-secondary,
.btn-hero-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--input-height);
    padding: 0 var(--space-5);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: transparent;
    transition: border-color 0.2s, color 0.2s;
}

.marketing-cta-secondary:hover,
.btn-hero-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.marketing-section-title {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

.info-label-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0 6px;
    height: 1.25rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(0, 217, 255, 0.12);
    border: 1px solid rgba(0, 217, 255, 0.25);
    color: var(--accent-cyan);
    margin-right: var(--space-2);
}

/* === collectx-footer.css === */
/**
 * Site footer (marketing & docs)
 */
.cx-site-footer {
    margin-top: auto;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-1);
    padding: var(--space-8) var(--space-5) var(--space-6);
}

.cx-site-footer__inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-6);
}

.cx-site-footer__brand p {
    margin-top: var(--space-3);
    color: var(--color-text-3);
    font-size: 0.9rem;
    max-width: 320px;
}

.cx-site-footer h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-2);
    margin-bottom: var(--space-3);
}

.cx-site-footer ul {
    list-style: none;
}

.cx-site-footer li {
    margin-bottom: var(--space-2);
}

.cx-site-footer a {
    color: var(--color-text-3);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--motion-fast);
}

.cx-site-footer a:hover {
    color: var(--color-brand);
}

.cx-site-footer__bottom {
    max-width: var(--content-max);
    margin: var(--space-6) auto 0;
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: space-between;
    color: var(--color-text-3);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .cx-site-footer__inner {
        grid-template-columns: 1fr 1fr;
    }
}

/* === collectx-icons.css === */
/** CollectX UI icons — SVG sprite: /static/img/collectx-icons.svg */

svg.cx-ico {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    vertical-align: middle;
    overflow: visible;
    color: inherit;
}

svg.cx-ico use {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cx-ico-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cx-ico-wrap--heading {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.14), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(0, 217, 255, 0.22);
    color: var(--accent-cyan);
}

.cx-ico-wrap--heading .cx-ico {
    width: 18px;
    height: 18px;
}

.cx-ico-wrap--sm {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.cx-ico-wrap--sm .cx-ico {
    width: 15px;
    height: 15px;
}

.cx-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cx-card-title--sm {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.info-label .cx-ico {
    width: 1rem;
    height: 1rem;
    color: var(--accent-cyan);
    opacity: 0.9;
}

.stat-icon-wrap {
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.stat-icon-wrap .cx-ico {
    width: 22px;
    height: 22px;
}

.stat-icon-wrap--cyan {
    background: rgba(0, 217, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.22);
    color: var(--accent-cyan);
}

.stat-icon-wrap--purple {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.28);
    color: var(--accent-purple);
}

.stat-icon-wrap--green {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.28);
    color: var(--accent-green);
}

.stat-icon-wrap--orange {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
    color: var(--accent-orange);
}

.page-title-badge--icon {
    padding: 0;
    min-width: 2rem;
}

.page-title-badge--icon .cx-ico {
    width: 1.1rem;
    height: 1.1rem;
}

.confirm-modal-icon-wrap {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--accent-orange);
}

.confirm-modal-icon-wrap .cx-ico {
    width: 26px;
    height: 26px;
}

.avatar-icon .cx-ico {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--bg-primary);
}

.app-name-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.file-row-title .cx-ico {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

