/* ========================================
   WxTool - Premium Light Theme
   Design System: Clean Professional SaaS
   Font: Inter | Palette: Blue-Violet
   ======================================== */

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

:root {
    /* Primary Palette */
    --primary: #4f6ef7;
    --primary-dark: #3b5de7;
    --primary-light: #e8edfe;
    --primary-hover: #3b5de7;

    /* Secondary Palette */
    --secondary: #7c5cfc;
    --secondary-light: #f0ecff;

    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #4f6ef7 0%, #7c5cfc 100%);
    --secondary-gradient: linear-gradient(135deg, #f78da7 0%, #f56565 100%);
    --header-gradient: linear-gradient(135deg, #f8faff 0%, #eef2ff 100%);
    --page-gradient: linear-gradient(180deg, #f5f7ff 0%, #f0f2f8 50%, #fafbff 100%);

    /* Semantic Colors */
    --success-color: #10b981;
    --success-light: #ecfdf5;
    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --error-color: #ef4444;
    --error-light: #fef2f2;
    --info-color: #3b82f6;
    --info-light: #eff6ff;

    /* Surfaces */
    --bg-page: #f5f7ff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbff;
    --bg-subtle: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-overlay: rgba(15, 23, 42, 0.4);

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-on-primary: #ffffff;

    /* Borders */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-focus: var(--primary);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
    --shadow-primary: 0 4px 14px rgba(79, 110, 247, 0.25);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(at 10% 0%, rgba(79, 110, 247, 0.06) 0px, transparent 50%),
        radial-gradient(at 90% 100%, rgba(124, 92, 252, 0.05) 0px, transparent 50%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Header ========== */
.header {
    background: var(--header-gradient);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

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

.logo-icon {
    font-size: 1.75rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    color: white;
    box-shadow: var(--shadow-primary);
}

.logo h1 {
    font-size: 1.375rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 0.375rem 0.875rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-base);
}

.stat-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========== Navigation Tabs ========== */
.nav-tabs {
    display: flex;
    gap: 0.375rem;
    padding: 1.25rem 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.625rem 1.125rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition-base);
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    letter-spacing: 0.01em;
}

.tab-btn:hover {
    background: var(--primary-light);
    border-color: rgba(79, 110, 247, 0.3);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
    font-weight: 600;
}

/* ========== Main Content ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem 2rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
    min-width: 200px;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-base);
    font-family: inherit;
}

.form-select {
    cursor: pointer;
    background-color: var(--bg-input);
    appearance: auto;
}

.form-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.form-select:focus {
    background-color: var(--bg-card);
}

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

.form-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* ========== Buttons ========== */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(79, 110, 247, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: var(--text-on-primary);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: var(--text-on-primary);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: var(--text-on-primary);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: var(--text-on-primary);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.btn-info:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ========== Download Result Items ========== */
.download-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
}

.download-result-item:last-child {
    border-bottom: none;
}

.download-result-item .result-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
    color: var(--text-primary);
}

.download-result-item .result-status {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.download-result-item .result-success {
    background: var(--success-light);
    color: var(--success-color);
}

.download-result-item .result-fail {
    background: var(--error-light);
    color: var(--error-color);
}

/* Downloaded badge in article table */
.downloaded-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
    margin-left: 0.4rem;
    vertical-align: middle;
    font-weight: 500;
}

/* ========== Divider ========== */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

/* ========== Tokens Grid ========== */
.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.875rem;
}

.token-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.token-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.token-card.expired {
    opacity: 0.55;
    background: var(--bg-subtle);
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.token-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.token-status {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.token-status.active {
    background: var(--success-light);
    color: var(--success-color);
}

.token-status.inactive {
    background: var(--bg-subtle);
    color: var(--text-tertiary);
}

.token-status.rate-limited {
    background: var(--warning-light);
    color: var(--warning-color);
}

.token-card.rate-limited {
    border-color: rgba(245, 158, 11, 0.3);
}

.token-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.token-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========== Account Grid ========== */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.875rem;
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
}

.account-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.account-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.account-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-info h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
    color: var(--text-primary);
    font-weight: 600;
}

.account-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.account-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ========== Groups List ========== */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.group-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.group-card.inactive {
    opacity: 0.6;
    background: var(--bg-subtle);
}

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

.group-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.group-badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.group-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.group-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.group-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ========== Cron Helper ========== */
.cron-helper {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.cron-example {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.75rem;
}

.cron-example:hover {
    background: rgba(79, 110, 247, 0.2);
    transform: translateY(-1px);
}

/* ========== Progress Bar ========== */
.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ========== Checkbox Group ========== */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.checkbox-item:hover {
    background: var(--primary-light);
    border-color: rgba(79, 110, 247, 0.2);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ========== Filter Row ========== */
.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.filter-row .form-group {
    margin-bottom: 0;
    min-width: 150px;
}

/* ========== Batch Actions ========== */
.batch-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* ========== Table ========== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: var(--bg-subtle);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:hover {
    background: rgba(79, 110, 247, 0.03);
}

.article-title {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-link {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: 500;
}

.article-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ========== Sortable Table Headers ========== */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.sortable-header:hover {
    background: rgba(79, 110, 247, 0.08);
}

.sortable-header.active {
    background: rgba(79, 110, 247, 0.06);
    color: var(--primary);
}

.sort-indicator {
    display: inline-block;
    margin-left: 0.25rem;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.sortable-header.active .sort-indicator {
    opacity: 1;
    color: var(--primary);
}

/* ========== Status Badge ========== */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-new {
    background: var(--info-light);
    color: var(--info-color);
}

.status-processed {
    background: var(--success-light);
    color: var(--success-color);
}

.status-running {
    background: var(--warning-light);
    color: var(--warning-color);
}

.status-error {
    background: var(--error-light);
    color: var(--error-color);
}

/* ========== Article Type Badge ========== */
.type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.type-image_text {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.type-article {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#paginationInfo {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== Alert ========== */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.alert-info {
    background: var(--info-light);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

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

.alert-warning {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.15);
    color: #d97706;
}

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

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.modal-body {
    padding: 1.5rem;
}

/* ========== Settings Section ========== */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* ========== Loading Spinner ========== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(79, 110, 247, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .stats {
        width: 100%;
        justify-content: center;
    }

    .nav-tabs {
        padding: 0.75rem 1rem 0;
        gap: 0.375rem;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .container {
        padding: 0.75rem 1rem;
    }

    .card {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }

    .form-row {
        flex-direction: column;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-row .form-group {
        width: 100%;
    }

    .accounts-grid,
    .tokens-grid {
        grid-template-columns: 1fr;
    }

    .batch-actions {
        flex-wrap: wrap;
    }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ========== Multi-Group Fetch Styles ========== */
.fetch-groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.fetch-group-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.fetch-group-item:hover {
    background: var(--primary-light);
    border-color: rgba(79, 110, 247, 0.3);
}

.fetch-group-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.fetch-group-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.fetch-group-item .group-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.fetch-group-item .account-count {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

/* ========== Selected Groups List (Sortable) ========== */
.selected-groups-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 60px;
}

.selected-group-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.selected-group-item:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

.selected-group-item.dragging {
    opacity: 0.5;
    background: var(--primary-light);
    border-color: var(--primary);
}

.selected-group-item.drag-over {
    border: 2px dashed var(--primary);
    background: var(--primary-light);
}

.selected-group-item .drag-handle {
    cursor: grab;
    color: var(--text-tertiary);
    font-size: 1.25rem;
    padding: 0 0.25rem;
    user-select: none;
    transition: color var(--transition-fast);
}

.selected-group-item .drag-handle:hover {
    color: var(--text-secondary);
}

.selected-group-item .drag-handle:active {
    cursor: grabbing;
}

.selected-group-item .order-number {
    width: 24px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
}

.selected-group-item .group-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.selected-group-item .group-name {
    font-weight: 500;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.selected-group-item .group-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.selected-group-item .interval-setting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.selected-group-item .interval-setting input {
    width: 65px;
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-align: center;
    font-family: inherit;
}

.selected-group-item .interval-setting input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 110, 247, 0.1);
}

.selected-group-item .interval-setting input::placeholder {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

.selected-group-item .interval-setting label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.selected-group-item .remove-btn {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.selected-group-item .remove-btn:hover {
    background: var(--error-light);
    border-color: var(--error-color);
}

/* ========== Drop placeholder ========== */
.drop-placeholder {
    height: 50px;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    background: var(--primary-light);
    margin: 0.25rem 0;
}

/* ========== Toast / Notification ========== */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

/* ========== Selection Highlight ========== */
::selection {
    background: rgba(79, 110, 247, 0.15);
    color: var(--text-primary);
}

/* ========== Focus Visible (Accessibility) ========== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 首页快捷导航样式 ========== */
.quick-nav-container {
    margin-top: 2.5rem;
}

.quick-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.quick-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.quick-card-icon {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.875rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.quick-card:hover .quick-card-icon {
    background: var(--primary);
    color: var(--text-on-primary);
}

.quick-card-info h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.quick-card-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}