/* =====================
   Modern CSS Variables & Design Tokens
   ===================== */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #34d399;
    --success-bg: rgba(16, 185, 129, 0.08);
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);

    /* Category Colors */
    --ai: #7c3aed;
    --ai-light: #a78bfa;
    --ai-bg: rgba(124, 58, 237, 0.08);
    --ai-gradient: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    --proxy: #0891b2;
    --proxy-light: #22d3ee;
    --proxy-bg: rgba(8, 145, 178, 0.08);
    --proxy-gradient: linear-gradient(135deg, #0891b2 0%, #22d3ee 100%);

    /* Background Colors */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --bg-input: #f1f5f9;
    --bg-elevated: rgba(255, 255, 255, 0.7);

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Borders */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: var(--primary);

    /* Shadows - Multiple Levels */
    --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.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #eef2ff 30%, #f5f3ff 60%, #faf5ff 100%);
    --gradient-card: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =====================
   Modern Layout
   ===================== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* =====================
   Glassmorphism Header
   ===================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 20px 28px;
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    object-fit: cover;
}

.header-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =====================
   Modern Buttons
   ===================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 8px 25px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-outline:hover {
    background: var(--bg-input);
    border-color: var(--primary-light);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* =====================
   Glassmorphism Search Card
   ===================== */
.search-card {
    background: var(--gradient-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-2xl);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-xl);
    position: relative;
}

.search-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.search-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    margin: 0;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-base);
}

.form-control:focus {
    border-color: var(--primary-light);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-sm);
}

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

.btn-search {
    padding: 16px 32px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 4px 15px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-search::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    pointer-events: none;
}

.btn-search:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), 0 8px 30px rgba(99, 102, 241, 0.5);
}

.btn-search:active {
    transform: translateY(-1px);
}

/* =====================
   Modern Server Cards
   ===================== */
.servers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.server-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 24px 28px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-slow);
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.server-card.ai::before {
    background: var(--ai-gradient);
}

.server-card.proxy::before {
    background: var(--proxy-gradient);
}

.server-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.server-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-2xl);
}

.server-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    position: relative;
}

.server-card.ai .server-icon {
    background: var(--ai-bg);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
}

.server-card.proxy .server-icon {
    background: var(--proxy-bg);
    box-shadow: 0 0 20px rgba(8, 145, 178, 0.2);
}

.server-info {
    flex: 1;
    min-width: 0;
}

.server-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.server-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.server-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* =====================
   Modern Nodes Section
   ===================== */
.nodes-section {
    background: var(--gradient-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin-bottom: 24px;
}

.nodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-base);
}

.nodes-header:hover {
    background: rgba(248, 250, 252, 1);
}

.nodes-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nodes-header-left h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nodes-count-badge {
    padding: 6px 14px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nodes-stats {
    display: flex;
    gap: 20px;
}

.nodes-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.nodes-stat .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.nodes-stat .dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.nodes-stat .dot.offline {
    background: var(--danger);
}

.nodes-stat .count {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.nodes-stat .label {
    color: var(--text-muted);
    font-weight: 500;
}

.nodes-body {
    padding: 24px 28px;
}

/* Region Groups */
.region-group {
    margin-bottom: 28px;
}

.region-group:last-child {
    margin-bottom: 0;
}

.region-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.region-title span:first-child {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.region-title .count {
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.region-nodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.node-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: default;
    border: 1px solid transparent;
}

.node-item:hover {
    background: var(--bg-card);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.node-item .flag {
    font-size: 1.3rem;
    line-height: 1;
}

.node-item .name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.node-item .status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    animation: pulse-dot 2.5s ease-in-out infinite;
}

/* =====================
   Content Area
   ===================== */
.content-area {
    display: none;
}

.content-area.show {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

/* =====================
   Modern Cards
   ===================== */
.card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 28px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-sm), 0 2px 10px rgba(99, 102, 241, 0.25);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* User Info Bar */
.user-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--bg-input) 0%, var(--bg-card) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.user-info-content {
    flex: 1;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.user-id {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-recharge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Balance Grid */
.balance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.balance-card {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-input) 100%);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.balance-card.ai::before {
    background: var(--ai-gradient);
}

.balance-card.proxy::before {
    background: var(--proxy-gradient);
}

.balance-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.balance-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.balance-card.ai .balance-icon {
    background: var(--ai-bg);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.balance-card.proxy .balance-icon {
    background: var(--proxy-bg);
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.2);
}

.balance-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.balance-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.balance-card.ai .balance-value {
    color: var(--ai);
}

.balance-card.proxy .balance-value {
    color: var(--proxy);
}

/* Record Tabs */
.record-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.record-tab {
    padding: 10px 18px;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
}

.record-tab.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm), 0 2px 10px rgba(99, 102, 241, 0.3);
}

.record-tab:hover:not(.active) {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Auto Refresh Toggle */
.auto-refresh {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auto-refresh-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-bounce);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Date Filter */
.date-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px 18px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.date-input {
    width: 140px;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
}

.date-separator {
    color: var(--text-muted);
    font-weight: 500;
}

/* Record List */
.record-list {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.record-list::-webkit-scrollbar {
    width: 6px;
}

.record-list::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 3px;
}

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

.record-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.record-item {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.record-item:hover {
    transform: translateX(6px);
    background: var(--bg-card-hover);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.record-item:last-child {
    margin-bottom: 0;
}

.record-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 16px;
    flex-shrink: 0;
}

.record-icon.ai {
    background: var(--ai-bg);
}

.record-icon.proxy {
    background: var(--proxy-bg);
}

.record-icon.add {
    background: var(--success-bg);
}

.record-icon.deduct {
    background: var(--danger-bg);
}

.record-details {
    flex: 1;
    min-width: 0;
}

.record-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.record-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 500;
}

.record-amount {
    font-weight: 800;
    font-size: 1.1rem;
    margin-right: 18px;
    letter-spacing: -0.01em;
}

.record-amount.add {
    color: var(--success);
}

.record-amount.deduct {
    color: var(--danger);
}

.record-time {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    font-weight: 500;
}

.record-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.record-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.page-btn {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
}

.page-btn:hover:not(:disabled) {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0 16px;
    font-weight: 600;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 16px;
}

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

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.95rem;
    transform: translateX(450px);
    transition: transform var(--transition-slow);
    z-index: 1001;
    box-shadow: var(--shadow-xl);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: var(--gradient-success);
    color: white;
}

.toast.error {
    background: var(--gradient-danger);
    color: white;
}

/* Recharge Modal */
.recharge-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.recharge-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: 36px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-2xl);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.recharge-modal-icon {
    font-size: 56px;
    margin-bottom: 18px;
}

.recharge-modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.recharge-modal-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.recharge-modal-timer {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 24px;
}

.recharge-modal-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 4px 15px rgba(99, 102, 241, 0.35);
}

.recharge-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 8px 25px rgba(99, 102, 241, 0.45);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px 18px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

/* =====================
   Software Section
   ===================== */
.software-section {
    margin-top: 20px;
}

.software-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.software-section-icon {
    font-size: 22px;
}

.software-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.software-section-count {
    margin-left: auto;
    padding: 6px 14px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.software-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.software-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.software-item:hover {
    transform: translateX(6px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.software-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.software-info {
    flex: 1;
    min-width: 0;
}

.software-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.software-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.software-version {
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.software-expired {
    color: var(--danger);
    font-weight: 600;
}

.software-actions {
    flex-shrink: 0;
}

.software-download {
    padding: 10px 18px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm), 0 2px 10px rgba(99, 102, 241, 0.3);
}

.software-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 4px 15px rgba(99, 102, 241, 0.4);
}

.software-empty {
    text-align: center;
    padding: 36px;
    color: var(--text-muted);
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
}

/* =====================
   Footer
   ===================== */
.site-footer {
    text-align: center;
    padding: 32px 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 40px;
}

.footer-sep {
    margin: 0 10px;
}

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

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

/* =====================
   Header Time & Badge
   ===================== */
.header-time {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--gradient-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
}

.time-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--success-bg);
    color: var(--success);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* =====================
   Responsive - Tablet
   ===================== */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

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

    .header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 20px;
    }

    .header-left {
        justify-content: center;
    }

    .header-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }

    .header-actions .btn,
    .header-actions #backBtn,
    .header-actions #cardRedeemBtn {
        justify-content: center;
        font-size: 0.75rem;
        padding: 8px 6px;
    }

    .header-time,
    .live-badge {
        display: none;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .nodes-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .nodes-header-left {
        flex-wrap: wrap;
    }

    .nodes-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .nodes-body {
        padding: 16px;
    }

    .region-nodes {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .user-info-bar {
        flex-wrap: wrap;
    }

    .record-list {
        max-height: 300px;
    }

    .date-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input {
        width: 100%;
    }

    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* =====================
   Responsive - Mobile
   ===================== */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .header {
        padding: 16px;
        border-radius: var(--radius-lg);
        gap: 12px;
    }

    .header-left {
        gap: 12px;
    }

    .header-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .header-left > div {
        min-width: 0;
    }

    .header h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-subtitle {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .header-actions .btn,
    .header-actions #backBtn,
    .header-actions #cardRedeemBtn {
        font-size: 0.7rem;
        padding: 6px 4px;
    }

    .header-actions .btn svg,
    .header-actions #backBtn svg {
        display: none;
    }

    .search-card {
        padding: 20px 16px;
        border-radius: var(--radius-lg);
    }

    .search-form {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    .btn-search {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .servers-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .nodes-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .nodes-header-left {
        flex-wrap: wrap;
    }

    .nodes-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .nodes-body {
        padding: 20px;
    }

    .region-nodes {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .card {
        padding: 20px;
        border-radius: var(--radius-lg);
    }

    .balance-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .balance-card {
        padding: 24px 20px;
    }

    .balance-value {
        font-size: 1.8rem;
    }

    .user-info-bar {
        flex-wrap: wrap;
        padding: 16px;
    }

    .record-list {
        max-height: 320px;
    }

    .date-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input {
        width: 100%;
    }

    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .toast {
        top: 16px;
        right: 16px;
        left: 16px;
        padding: 14px 20px;
        font-size: 0.9rem;
    }

    .recharge-modal-content {
        padding: 28px 24px;
        width: 92%;
    }

    .recharge-modal-icon {
        font-size: 44px;
    }

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

    .recharge-modal-desc {
        font-size: 0.9rem;
    }

    .software-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

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

    .site-footer {
        padding: 24px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px 10px;
    }

    .header {
        padding: 14px 12px;
    }

    .header-icon {
        width: 36px;
        height: 36px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .header-subtitle {
        font-size: 0.65rem;
    }

    .header-actions {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .header-actions .btn,
    .header-actions #backBtn,
    .header-actions #cardRedeemBtn {
        font-size: 0.65rem;
        padding: 6px 2px;
    }

    .search-card {
        padding: 16px 14px;
    }

    .btn-search {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .record-tabs {
        gap: 6px;
        flex-wrap: wrap;
    }

    .record-tab {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .record-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .record-details {
        order: 1;
        width: calc(100% - 60px);
    }

    .record-amount {
        order: 2;
        margin-right: 0;
    }

    .record-time {
        order: 3;
        width: 100%;
        margin-top: 8px;
        padding-left: 60px;
    }
}
