/* ====== 基础 ====== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --c-bg: #f5f7fa;
    --c-card: #ffffff;
    --c-text: #2c3e50;
    --c-muted: #90a4ae;
    --c-primary: #2c7be5;
    --c-primary-d: #1a68d4;
    --c-danger: #e74c3c;
    --c-success: #27ae60;
    --c-warn: #f39c12;
    --c-border: #e3e8ef;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-d); text-decoration: underline; }

/* ====== 顶栏 ====== */
.topbar {
    background: linear-gradient(90deg, #1a68d4 0%, #2c7be5 100%);
    color: #fff;
    box-shadow: var(--shadow);
}
.topbar-inner {
    max-width: 1280px; margin: 0 auto;
    padding: 0 20px; height: 56px;
    display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.brand-mark {
    width: 28px; height: 28px;
    background: #fff; color: var(--c-primary);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.menu { display: flex; gap: 4px; flex: 1; }
.menu a {
    color: rgba(255,255,255,0.85);
    padding: 6px 12px; border-radius: 6px;
    font-size: 14px; transition: all .15s;
}
.menu a:hover { background: rgba(255,255,255,0.15); color: #fff; text-decoration: none; }
.menu a.active { background: rgba(255,255,255,0.22); color: #fff; font-weight: 500; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-name { color: #fff; }
.user-role { font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.role-admin { background: #fff3cd; color: #856404; }
.role-user  { background: #d4edda; color: #155724; }
.btn-logout {
    color: #fff; padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px; font-size: 12px;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); text-decoration: none; }

/* ====== 容器 ====== */
.container { max-width: 1280px; margin: 20px auto; padding: 0 20px; }
.footer {
    max-width: 1280px; margin: 30px auto; padding: 16px 20px;
    border-top: 1px solid var(--c-border);
    color: var(--c-muted); font-size: 12px;
    display: flex; justify-content: space-between;
}

/* ====== 卡片 ====== */
.card {
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 16px; font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-border);
    display: flex; justify-content: space-between; align-items: center;
}

/* ====== 表格 ====== */
.table {
    width: 100%; border-collapse: collapse;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
    font-size: 14px;
}
.table th { background: #f8fafc; font-weight: 600; color: #5a6877; }
.table tr:hover td { background: #fafbfc; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--c-muted); }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; color: #d9534f; }

/* ====== 按钮 ====== */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    background: #fff;
    color: var(--c-text);
    font-size: 13px;
    cursor: pointer;
    line-height: 1.5;
    transition: all .15s;
}
.btn:hover { text-decoration: none; border-color: var(--c-primary); color: var(--c-primary); }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-d); color: #fff; }
.btn-danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-ghost { background: transparent; }

/* ====== 表单 ====== */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 500; color: #5a6877; }
.form-row .required { color: var(--c-danger); }
.input, .select, .textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: 6px; font-size: 14px;
    background: #fff; color: var(--c-text);
    transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,0.1);
}
.textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; display: flex; gap: 8px; }

/* ====== 提示 ====== */
.alert {
    padding: 10px 14px; border-radius: 6px;
    margin-bottom: 16px; font-size: 13px;
}
.alert-info { background: #d9ecff; color: #1a68d4; border: 1px solid #b3d7ff; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warn { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* ====== 统计卡 ====== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
    background: var(--c-card);
    border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--c-muted); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--c-text); }
.stat-value.danger { color: var(--c-danger); }

/* ====== 标签 ====== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-active { background: #d4edda; color: #155724; }
.tag-void   { background: #f8d7da; color: #721c24; }
.tag-admin  { background: #fff3cd; color: #856404; }
.tag-user   { background: #d1ecf1; color: #0c5460; }
.tag-on     { background: #d4edda; color: #155724; }
.tag-off    { background: #f8d7da; color: #721c24; }

/* ====== 工具栏 ====== */
.toolbar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; }

/* ====== 分页 ====== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 5px 10px; border: 1px solid var(--c-border);
    border-radius: 4px; font-size: 13px; background: #fff;
}
.pagination a:hover { background: #f0f4f8; text-decoration: none; }
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ====== 收据预览/打印 ====== */
.receipt-preview-wrap { background: #ececec; padding: 24px 0; }
.receipt {
    width: 210mm; min-height: 130mm;
    background: #fff; margin: 0 auto;
    padding: 18mm 16mm;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    font-family: "SimSun", "宋体", serif;
    color: #000;
    position: relative;
}
.receipt .r-title {
    text-align: center; font-size: 28px; font-weight: 700;
    letter-spacing: 6px; margin-bottom: 6px;
    font-family: "SimHei", "黑体", sans-serif;
}
.receipt .r-subtitle {
    text-align: center; font-size: 13px; color: #555;
    margin-bottom: 16px;
}
.receipt .r-no {
    text-align: right; font-size: 13px; margin-bottom: 8px;
}
.receipt .r-line {
    height: 1px; background: #000; margin: 4px 0 12px;
}
.receipt table.r-table {
    width: 100%; border-collapse: collapse;
    font-size: 14px;
}
.receipt table.r-table th, .receipt table.r-table td {
    border: 1px solid #000;
    padding: 10px 12px;
    vertical-align: middle;
}
.receipt table.r-table th {
    background: #f5f5f5; font-weight: 700; text-align: center;
    font-family: "SimHei", "黑体", sans-serif;
}
.receipt .r-amount-cn {
    font-size: 16px; font-weight: 700; padding: 14px 12px;
}
.receipt .r-foot {
    margin-top: 24px;
    display: flex; justify-content: space-between;
    font-size: 14px;
}
.receipt .r-foot div { line-height: 2; }
.receipt .r-seal {
    position: absolute; right: 30mm; bottom: 28mm;
    width: 100px; height: 100px;
    border: 3px solid #c0392b; border-radius: 50%;
    color: #c0392b; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    text-align: center; opacity: 0.85;
    transform: rotate(-12deg);
    font-family: "SimHei", "黑体", sans-serif;
    line-height: 1.3;
}
.receipt .r-note {
    margin-top: 20px; font-size: 12px; color: #666;
    border-top: 1px dashed #999; padding-top: 8px;
}
.btn-print-bar {
    text-align: center; margin: 20px 0;
}

/* ====== 登录页 ====== */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a68d4 0%, #4a90e2 50%, #6fb1e8 100%);
}
.login-card {
    width: 360px; background: #fff;
    border-radius: 10px; padding: 32px 28px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-title { text-align: center; font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--c-muted); font-size: 13px; margin-bottom: 24px; }
.login-card .btn-primary { width: 100%; padding: 10px; font-size: 15px; }
.login-tip { text-align: center; margin-top: 16px; font-size: 12px; color: var(--c-muted); }

@media (max-width: 768px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
    .menu { order: 3; width: 100%; overflow-x: auto; }
    .receipt { width: 100%; padding: 12mm 8mm; }
}
