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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* 登录 */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 1.5rem;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 90%;
}

.login-card h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-card h1 i {
    margin-right: 0.5rem;
}

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

.qrcode-box img {
    width: 200px;
    height: 200px;
    border: 3px solid var(--primary-light);
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.loading i {
    font-size: 3rem;
    color: var(--primary);
    display: block;
    margin-bottom: 1rem;
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* 主界面 */
.main-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.logo i {
    font-size: 1.75rem;
}

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

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.sidebar nav a:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.sidebar nav a i {
    font-size: 1.25rem;
}

.logout {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    border-top: 1px solid var(--border);
    transition: color 0.2s;
}

.logout:hover {
    color: var(--danger);
}

.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: 1200px;
}

.content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content h2 i {
    color: var(--primary);
}

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

.index-card {
    background: white;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.index-name {
    font-size: 0.875rem;
    color: var(--text-light);
}

.index-price {
    font-size: 1.5rem;
    font-weight: 700;
}

.index-change {
    font-size: 0.875rem;
    font-weight: 600;
}

.index-change.up { color: var(--danger); }
.index-change.down { color: var(--success); }
.index-change.flat { color: var(--text-light); }

.income-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.income-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.income-card > i {
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.8;
}

.income-card .label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.income-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.income-card .value.up { color: var(--danger); }
.income-card .value.down { color: var(--success); }
.income-card .value.flat { color: var(--text); }

/* 账户 */
.account-list {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.account-card {
    background: white;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.account-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.account-info {
    flex: 1;
}

.account-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.account-count {
    font-size: 0.875rem;
    color: var(--text-light);
}

.account-income {
    text-align: right;
}

.account-income .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.account-income span:last-child {
    font-weight: 700;
    font-size: 1.125rem;
}

.account-income span:last-child.up { color: var(--danger); }
.account-income span:last-child.down { color: var(--success); }

.account-card > i {
    font-size: 1.5rem;
    color: var(--text-light);
}

/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
}

td {
    font-size: 0.9375rem;
}

td.up { color: var(--danger); font-weight: 600; }
td.down { color: var(--success); font-weight: 600; }
td.flat { color: var(--text-light); }

/* 搜索 */
.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box button {
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--primary-light);
}

/* 公告 */
.notice-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.notice-card h3 {
    margin-bottom: 0.5rem;
}

.notice-card .time {
    font-size: 0.875rem;
    color: var(--text-light);
    display: block;
    margin-bottom: 0.75rem;
}

.notice-card p {
    line-height: 1.6;
    color: var(--text);
}

/* 图表 */
.chart-container canvas {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    max-height: 400px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        padding: 1rem;
        align-items: center;
    }
    
    .sidebar nav {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 0;
    }
    
    .sidebar nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .sidebar nav a span {
        display: none;
    }
    
    .logo {
        border: none;
        margin: 0;
        padding: 0 1rem 0 0;
    }
    
    .logout {
        border: none;
        padding: 0.5rem;
    }
    
    .logout span {
        display: none;
    }
    
    .content {
        margin-left: 0;
        padding: 1rem;
    }
}
