/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-dark: #0a0a0f;
    --bg-card: #131318;
    --bg-input: #1a1a24;
    --bg-hover: #1e1e2e;
    --border: #2a2a3a;
    --text: #e4e4ed;
    --text-dim: #8888a0;
    --text-muted: #5a5a70;
    --primary: #6366f1;
    --primary-glow: rgba(99,102,241,0.15);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-bg: #0d0d12;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { text-decoration: none; color: var(--primary); transition: color 0.2s; }
a:hover { color: #818cf8; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-primary { color: var(--primary); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a4a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a4a5a; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s;
    color: #fff;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: #7c7af5; box-shadow: 0 4px 16px var(--primary-glow); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #34d399; box-shadow: 0 4px 16px rgba(16,185,129,0.2); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #f87171; box-shadow: 0 4px 16px rgba(239,68,68,0.2); }
.btn-warning { background: var(--warning); }
.btn-secondary { background: #2a2a3a; color: var(--text-dim); border: 1px solid var(--border); }
.btn-secondary:hover { background: #34344a; color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 14px; font-size: 12px; border-radius: 6px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; margin-bottom: 8px;
    font-weight: 500; font-size: 14px;
    color: var(--text-dim);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    transition: all 0.25s;
    font-family: inherit;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #1e1e2c;
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2388a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
select.form-control option { background: var(--bg-card); color: var(--text); }
.form-footer { margin-top: 20px; text-align: center; font-size: 14px; }
.form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-form .form-row { flex-wrap: wrap; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ===== 提示框 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-error { background: rgba(239,68,68,0.1); color: #f87171; border-color: rgba(239,68,68,0.3); }
.alert-success { background: rgba(16,185,129,0.1); color: #34d399; border-color: rgba(16,185,129,0.3); }
.alert-warning { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.3); }

/* ===== 登录/注册/激活页 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
    padding: 20px;
}
/* 背景光效 */
.login-page::before {
    content: '';
    position: absolute;
    top: -50%; left: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: float1 8s ease-in-out infinite;
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%; right: -20%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(217,70,239,0.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: float2 10s ease-in-out infinite;
}
@keyframes float1 {
    0%,100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(30px,20px) scale(1.1); }
}
@keyframes float2 {
    0%,100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(-20px,-30px) scale(1.15); }
}
.login-container { width: 100%; max-width: 440px; position: relative; z-index: 1; }
.login-card {
    background: rgba(19,19,24,0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.login-card h2 {
    text-align: center;
    margin-bottom: 28px;
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-card .form-control {
    padding: 14px 24px;
    border-radius: 999px;
    background: rgba(26,26,36,0.8);
    border: 1px solid rgba(99,102,241,0.15);
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow), 0 0 20px rgba(99,102,241,0.1);
    background: rgba(30,30,44,0.9);
}
.login-card .btn {
    border-radius: 999px;
    padding: 13px 24px;
}
.login-card .activate-row .form-control {
    border-radius: 999px;
}
.activate-form { margin-top: 8px; }
.activate-row { display: flex; gap: 10px; flex-wrap: nowrap; }
.activate-input { flex: 1; }

/* ===== 底部备案 ===== */
.icp-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 14px 16px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
    z-index: 1;
}
.icp-footer a { color: var(--text-muted); }
.icp-footer a:hover { color: var(--text-dim); }
.icp-footer span { margin: 0 6px; }

/* ===== 管理员布局 ===== */
.admin-page { display: flex; min-height: 100vh; background: var(--bg-dark); }
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 10;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
    font-size: 17px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-menu { list-style: none; padding: 12px 8px; }
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dim);
    font-size: 14px;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.sidebar-menu li a:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-menu li.active a {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.content {
    flex: 1;
    margin-left: 240px;
    padding: 28px;
    min-height: 100vh;
}
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}
.card h3 {
    font-size: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* ===== 表格 ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-dim);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table tr:hover td { background: var(--bg-hover); }
.code-cell {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1.5px;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-info { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* ===== 分页 ===== */
.pagination { margin-top: 20px; text-align: center; }
.pagination a {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 13px;
    background: var(--bg-card);
    transition: all 0.2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--text); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal h3 { margin-bottom: 20px; font-size: 18px; }

/* ===== 对话页面 ===== */
.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.chat-msg {
    margin-bottom: 18px;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.bot-msg { text-align: left; }
.user-msg { margin-left: auto; text-align: right; }
.msg-content {
    display: inline-block;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}
.bot-msg .msg-content {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text);
}
.user-msg .msg-content {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px var(--primary-glow);
}
.confirm-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}
.chat-input-area {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: var(--bg-card);
}
.chat-input-area textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: all 0.25s;
    max-height: 120px;
}
.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.chat-input-area textarea::placeholder { color: var(--text-muted); }
.loading-dot::after {
    content: '...';
    animation: dots 1.5s infinite;
    color: var(--primary);
}
@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===== 用户福利页 ===== */
.user-page {
    max-width: 820px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-dark);
}
.user-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    color: #fff;
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 32px rgba(99,102,241,0.3);
}
.user-header h2 { font-size: 22px; font-weight: 700; }
.user-header p { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.user-header .btn { border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.1); backdrop-filter: blur(8px); }

.total-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
    margin: 20px 16px;
    position: relative;
    overflow: hidden;
}
.total-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    border-radius: 50%;
}
.total-label { font-size: 14px; color: var(--text-dim); position: relative; }
.total-amount {
    font-size: 42px;
    font-weight: 800;
    margin: 10px 0;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}
.total-breakdown {
    font-size: 13px;
    color: var(--text-muted);
    position: relative;
}
.total-breakdown span { margin: 0 12px; }
.total-breakdown span::before { content: '•'; margin-right: 6px; color: var(--primary); }

.user-page .card { margin: 0 16px 20px; }

.day-record {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
    background: var(--bg-input);
    transition: border-color 0.2s;
}
.day-record:hover { border-color: var(--primary); }
.day-header {
    background: var(--bg-card);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.day-date { font-weight: 600; font-size: 15px; color: var(--text); }
.day-total { color: var(--success); font-weight: 700; font-size: 15px; }
.day-body { padding: 10px 0; }
.benefit-item {
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}
.benefit-item:hover { background: rgba(255,255,255,0.02); }
.benefit-item:last-child { border-bottom: none; }
.benefit-type {
    background: rgba(99,102,241,0.15);
    color: #818cf8;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid rgba(99,102,241,0.2);
}
.benefit-detail { flex: 1; color: var(--text-dim); }
.benefit-amount { font-weight: 700; color: var(--text); font-size: 14px; }

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
    html { font-size: 15px; }
    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        z-index: 100;
    }
    .sidebar-header { padding: 16px 20px; }
    .sidebar-header h3 { font-size: 16px; }
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 4px;
    }
    .sidebar-menu li { flex-shrink: 0; }
    .sidebar-menu li a {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 8px;
        white-space: nowrap;
    }
    .content {
        margin-left: 0;
        padding: 16px;
    }
    .login-card { padding: 32px 24px; }
    .activate-row { flex-direction: column; }
    .activate-row .btn { width: 100%; }
    .total-amount { font-size: 32px; }
    .total-card { padding: 24px 20px; }
    .benefit-item { flex-wrap: wrap; gap: 8px; }
    .chat-container { height: calc(100vh - 160px); }
    .chat-msg { max-width: 90%; }
    .chat-input-area { padding: 12px 16px; }
    .card { padding: 18px; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .user-header { padding: 20px; flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 480px) {
    .login-card h2 { font-size: 20px; }
    .total-amount { font-size: 28px; }
    .sidebar-menu li a { font-size: 12px; padding: 8px 10px; }
    .btn { padding: 8px 16px; font-size: 13px; }
    .form-control { font-size: 14px; padding: 12px 14px; }
}

/* ===== 过渡动画 ===== */
.card, .day-record, .modal {
    transition: box-shadow 0.25s, border-color 0.25s;
}
