/* ========== 梦幻记账本 样式表 ========== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --green: #10b981;
    --green-bg: #ecfdf5;
    --red: #ef4444;
    --amber: #f59e0b;
    --amber-bg: #fffbeb;
    --radius: 12px;
    --sidebar-w: 230px;
}

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

body {
    font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ===== 布局 ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    padding: 24px 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 16px;
}

.nav { flex: 1; padding: 0 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.2); color: #fff; font-weight: 600; }

.nav-icon {
    width: 18px; height: 18px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}
.nav-home { background: #818cf8; }
.nav-coin { background: #fbbf24; }
.nav-sale { background: #34d399; }
.nav-card { background: #f472b6; }
.nav-other { background: #60a5fa; }
.nav-list { background: #a78bfa; }
.nav-summary { background: #facc15; }
.nav-import { background: #5eead4; }
.nav-export { background: #fb923c; }
.nav-admin { background: #f87171; }

.sidebar-bottom { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.15); }

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 600; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.6); }

.logout-link { color: rgba(255,255,255,0.6); font-size: 13px; }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 40px;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== 页面标题 ===== */
.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    margin-top: -16px;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}

.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.2;
}
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.red { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ===== 游戏币颜色（梦幻西游 4 档配色） ===== */
.coin {
    display: inline-block;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.coin-default { color: var(--text); }
.coin-green   { color: #10b981; }   /* 10万 ~ 100万 */
.coin-red     { color: #ef4444; }   /* 100万 ~ 1000万 */
.coin-purple  { color: #a855f7; }   /* 1000万 ~ 1亿 */
.coin-pink    { color: #ec4899; }   /* 1亿以上 */

.stat-row {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.stat-row b { color: var(--text); font-weight: 600; }

/* ===== 卡片容器 ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.card-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.card-subtitle { font-size: 13px; color: var(--text-muted); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group .hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ===== 编辑链接/危险区 ===== */
.edit-link {
    font-size: 13px;
    font-weight: 400;
    color: var(--primary);
    margin-left: 12px;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.danger-zone {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.danger-hint { font-size: 12px; color: #b91c1c; }

/* ===== 用户元数据行 ===== */
.user-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.meta-pill {
    display: inline-flex;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 12px;
    font-size: 13px;
}
.meta-pill.pill-admin { background: #fef2f2; color: var(--red); }
.meta-hint { font-size: 12px; color: var(--text-muted); }

/* ===== 数据条数 ===== */
.data-counts {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.count-item {
    font-size: 13px;
    color: var(--text-muted);
}
.count-item b {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    margin: 0 4px;
}

/* ===== 快捷入口 ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.quick-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.15s;
}
.quick-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(99,102,241,0.1); transform: translateY(-2px); }
.quick-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}
.quick-label { font-size: 14px; font-weight: 600; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: #f8fafc; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .green { color: var(--green); font-weight: 600; }
.data-table .red { color: var(--red); font-weight: 600; }

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

/* ===== Flash 消息 ===== */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}
.flash-ok { background: var(--green-bg); color: #065f46; border: 1px solid #6ee7b7; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 登录/注册/安装 页面 ===== */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-logo {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}
.auth-card .form-group { margin-bottom: 16px; }
.auth-card .btn { margin-top: 8px; }
.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-link a { color: var(--primary); font-weight: 600; }

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }
.badge-red { background: #fef2f2; color: var(--red); }

/* ===== 邀请码列表 ===== */
.code-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.code-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: monospace;
    background: var(--bg);
}
.code-item.used { opacity: 0.5; text-decoration: line-through; }

/* ===== 计算预览 ===== */
.calc-preview {
    background: var(--amber-bg);
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 14px 16px;
    margin: -8px 0 20px;
    font-size: 14px;
    color: #92400e;
}
.calc-preview b { color: #78350f; }

/* ===== 空状态 ===== */
.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 20px; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 0; }
    .menu-toggle { display: block; }
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px; height: 40px;
    font-size: 20px;
    cursor: pointer;
}
@media (max-width: 900px) { .menu-toggle { display: block; } }

/* ===== 五开汇总表（首页）===== */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.summary-table td {
    padding: 12px 16px;
    border: 1px solid var(--border);
}
.summary-table .label-cell {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    width: 18%;
    text-align: right;
    white-space: nowrap;
}
.summary-table .value-cell {
    background: var(--surface);
    color: var(--text);
    width: 32%;
    font-size: 15px;
    font-weight: 600;
}
.summary-table .value-cell.value-date { font-variant-numeric: tabular-nums; }
.summary-table .value-cell.green { color: var(--green); }
.summary-table .value-cell.red { color: var(--red); }
.summary-table .tr-strong .label-cell { background: #fff7ed; color: #c2410c; }
.summary-table .tr-strong .value-cell { background: #fffaf2; }
.summary-table .tr-highlight .label-cell {
    background: var(--amber-bg);
    color: #92400e;
    font-size: 16px;
}
.summary-table .tr-highlight .value-cell {
    background: #fef3c7;
    color: #78350f;
    font-size: 22px;
    font-weight: 700;
}
.summary-formula {
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}
.summary-formula b { color: var(--text); font-weight: 600; }

/* ===== KPI 网格（首页）===== */
.kpi-grid .stat-value.green { color: var(--green); }
.kpi-grid .stat-value.red { color: var(--red); }
.kpi-grid .stat-value.amber { color: var(--amber); }

/* ===== 五开收支汇总 Dashboard（汇总统计页）===== */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.dash-tile {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.dash-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.dash-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.dash-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.2;
}
.dash-value .unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

/* 五开时间 → 紫色渐变 */
.dash-tile-primary {
    background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
    border-color: #c7d2fe;
}
.dash-tile-primary .dash-value { color: var(--primary-dark); }

/* 日均/月均/年均 → 绿色 */
.dash-tile-green .dash-value { color: var(--green); }

/* 实际到手收益 → 橙色高亮 */
.dash-tile-strong {
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
    border-color: #fed7aa;
}
.dash-tile-strong .dash-value {
    color: #c2410c;
    font-size: 26px;
}

/* 总收益 → 金色最高亮 */
.dash-tile-gold {
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    border-color: #fde68a;
}
.dash-tile-gold .dash-value {
    color: #b45309;
    font-size: 26px;
}

/* 卖号金额（暂时未启用）→ 灰色 */
.dash-tile-muted {
    background: #f8fafc;
    border-style: dashed;
}
.dash-tile-muted .dash-value { color: var(--text-light); font-size: 18px; }
.dash-sub { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.summary-formula {
    margin-top: 18px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}
.summary-formula b { color: var(--primary-dark); font-weight: 600; }

/* 梦幻西游游戏币配色预览条 */
.coin-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    font-size: 12px;
}
.coin-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.coin-chip .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

