* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    background: #f3f5f9;
    color: #273142;
    font-size: 14px;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #8a94a6; font-size: 12px; }
.empty { text-align: center; color: #9aa4b5; padding: 24px 0 !important; }

/* ---------- 登录/初始化 ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    padding: 16px;
}
.auth-card {
    width: 380px;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
}
.auth-card.wide { width: 560px; }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.auth-sub { text-align: center; color: #8a94a6; margin: 0 0 20px; }
.setup-steps { margin: 16px 0 20px; padding-left: 20px; line-height: 2; }
.setup-steps code { background: #eef2ff; border-radius: 4px; padding: 1px 6px; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 216px;
    background: #152238;
    color: #cdd7e6;
    flex: none;
    padding: 0 0 20px;
}
.brand { padding: 18px 20px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a,
.sidebar nav .nav-coming {
    display: block;
    padding: 9px 14px;
    border-radius: 7px;
    color: #cdd7e6;
    font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: #2563eb; color: #fff; }
.sidebar nav .nav-coming { color: #7e8ca6; cursor: default; display: flex; justify-content: space-between; }
.sidebar nav .nav-coming i { font-style: normal; font-size: 11px; background: #2a3b57; padding: 1px 6px; border-radius: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff;
    border-bottom: 1px solid #e6eaf0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.page-title { font-size: 16px; font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 500; }
.content { padding: 20px; flex: 1; }

/* ---------- 角色与状态徽标 ---------- */
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.role-super { background: #fef3c7; color: #92400e; }
.role-agent { background: #e0e7ff; color: #3730a3; }
.role-merchant { background: #d1fae5; color: #065f46; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.tag-1 { background: #d1fae5; color: #065f46; }
.tag-2 { background: #e0e7ff; color: #3730a3; }
.tag-0 { background: #fee2e2; color: #991b1b; }

/* ---------- 提示条 ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; word-break: break-all; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #e0e7ff; color: #3730a3; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 18px;
    border: 1px solid #e6eaf0;
}
.stat-label { color: #8a94a6; font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #152238; }
.stat-ok .stat-value { color: #059669; }
.stat-sub { color: #8a94a6; font-size: 12px; margin-top: 4px; }

/* ---------- 面板/表格 ---------- */
.panel {
    background: #fff;
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #eef1f6; vertical-align: top; }
.table th { color: #8a94a6; font-weight: 500; font-size: 12px; background: #fafbfd; }
.table tr:last-child td { border-bottom: none; }
.table td .muted { margin-top: 2px; }

/* ---------- 工具条/按钮/表单 ---------- */
.toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
    display: inline-block;
    border: 1px solid #d3dae5;
    background: #fff;
    color: #273142;
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.2;
}
.btn:hover { background: #f3f5f9; text-decoration: none; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-warning { border-color: #f59e0b; color: #92400e; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn-outline { border-color: #d3dae5; }

input, select, textarea {
    width: 100%;
    border: 1px solid #d3dae5;
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    color: #273142;
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input:disabled, input[readonly] { background: #f3f5f9; color: #667085; }
.form-panel { max-width: 760px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .row2 { grid-template-columns: 1fr; } }
.form-static { margin: 8px 0 0; color: #4b5563; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- 柱状图 ---------- */
.bars { display: flex; align-items: flex-end; gap: 18px; min-height: 160px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.bar { width: 34px; background: linear-gradient(180deg, #60a5fa, #2563eb); border-radius: 5px 5px 0 0; min-height: 4px; }
.bar-num { font-size: 11px; color: #64748b; }
.bar-day { font-size: 12px; color: #8a94a6; }

@media (max-width: 900px) {
    .sidebar { width: 72px; }
    .brand { font-size: 12px; padding: 16px 8px; text-align: center; }
    .sidebar nav a, .sidebar nav .nav-coming { padding: 9px 6px; font-size: 12px; justify-content: center; }
    .sidebar nav .nav-coming i { display: none; }
    .user-name { display: none; }
}
