/* ============================================================
 * components.css — 可复用组件样式（按钮、表格、弹窗、分页、Toast 等）
 * 依赖：base.css
 * ============================================================ */

/* --- 按钮 --- */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #00838f;
    color: white;
}

.btn-primary:hover {
    background: #006064;
}

.btn-secondary {
    background: white;
    color: #333;
    border: 1px solid #d9d9d9;
}

.btn-secondary:hover {
    color: #00838f;
    border-color: #00838f;
}

.btn-danger {
    background: #ff4d4f;
    color: white;
}

.btn-danger:hover {
    background: #d9363e;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.danger-btn {
    background: #ff4d4f;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.danger-btn:hover {
    background: #d9363e;
}

/* --- 工具栏 --- */
.toolbar {
    background: white;
    padding: 16px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e8e8e8;
    border-bottom: none;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    width: 240px;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #00838f;
    box-shadow: 0 0 0 2px rgba(0, 131, 143, 0.1);
}

/* --- 表格 --- */
.table-wrapper {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #fafafa;
}

th {
    padding: 12px 12px;
    text-align: left;
    font-weight: 600;
    color: #595959;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
}

td {
    padding: 12px 12px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

tbody tr:hover {
    background: #e6f7f9;
}

.empty-row {
    text-align: center;
    color: #999;
    padding: 40px;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.gender-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.gender-male {
    background: #e6f7ff;
    color: #1890ff;
}

.gender-female {
    background: #fff0f6;
    color: #eb2f96;
}

/* --- 统计卡片 --- */
.stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.total {
    background: #e6f7f9;
    color: #00838f;
}

.stat-icon.male {
    background: #e6f7ff;
    color: #1890ff;
}

.stat-icon.female {
    background: #fff0f6;
    color: #eb2f96;
}

.stat-info .num {
    font-size: 24px;
    font-weight: 600;
    color: #262626;
}

.stat-info .label {
    font-size: 12px;
    color: #8c8c8c;
    margin-top: 2px;
}

/* --- 弹窗 --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    width: 560px;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #fff;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: #fff;
}

/* --- 表单 --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    color: #595959;
}

.form-group label .required {
    color: #ff4d4f;
    margin-left: 2px;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00838f;
    box-shadow: 0 0 0 2px rgba(0, 131, 143, 0.1);
}

/* 短选项（如性别）：单选按钮组，取值统一落在隐藏输入框 #gender 上 */
.radio-group {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 38px;
}

.form-group .radio-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #262626;
    cursor: pointer;
}

.form-group .radio-item input[type="radio"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    accent-color: #00838f;
    cursor: pointer;
}

/* 客户表单：文本框与单选按钮组统一高度，保证同一行左右控件基线对齐 */
#customerForm .form-group input[type="text"],
#customerForm .form-group input[type="tel"],
#customerForm .radio-group {
    height: 38px;
}

.error-msg {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.error-msg.show {
    display: block;
}

/* --- 日期 / 时间输入：单框 + 右侧日历图标 --- */
.date-input {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group .date-input>input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 40px 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group .date-input>input[type="text"]:focus {
    outline: none;
    border-color: #00838f;
    box-shadow: 0 0 0 2px rgba(0, 131, 143, 0.1);
}

.date-icon-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.date-icon-btn:hover {
    background: #e6f7f9;
}

/* 原生选择器：铺满输入框但透明且不响应指针，仅用于 showPicker() 定位日期弹层 */
.form-group .date-picker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* --- 分页 --- */
.pagination {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #595959;
}

.pagination-btns {
    display: flex;
    gap: 4px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    color: #00838f;
    border-color: #00838f;
}

.page-btn.active {
    background: #00838f;
    color: white;
    border-color: #00838f;
}

.page-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #f5f5f5;
}

/* --- Toast --- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 2000;
    transition: transform 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #ff4d4f;
}

/* ============================================================
 * 用户下拉菜单（顶栏右上角）
 * 可扩展：往 .user-dropdown-menu 里加新的 .user-menu-item 即可
 * ============================================================ */
.user-dropdown {
    position: relative;
    display: inline-block;
}

/* 触发器按钮 */
.user-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 22px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1;
}

.user-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
}

.user-dropdown-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.user-dropdown-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #26c6da, #00838f);
    color: white;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-dropdown .user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-caret {
    font-size: 11px;
    opacity: 0.8;
    transition: transform 0.2s;
}

.user-dropdown-btn[aria-expanded="true"] .user-caret {
    transform: rotate(180deg);
}

/* 下拉面板 */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* 面板头部：用户信息卡 */
.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 12px;
}

.user-menu-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #26c6da, #00838f);
    color: white;
    font-weight: 600;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-menu-header-info {
    min-width: 0;
    flex: 1;
}

.user-menu-header-name {
    color: #222;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-header-sub {
    color: #888;
    font-size: 12px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 分隔线 */
.user-menu-separator {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 10px;
}

/* 菜单项 */
.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: none;
    background: none;
    color: #333;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.user-menu-item:hover {
    background: #f5f5f5;
    color: #00838f;
}

.user-menu-item:focus-visible {
    outline: none;
    background: #e8f6f8;
    color: #006064;
}

.user-menu-item:active {
    background: #e8e8e8;
}

.user-menu-item .mi {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-menu-item.user-menu-item-danger {
    color: #cf1322;
}

.user-menu-item.user-menu-item-danger:hover {
    background: #fff1f0;
    color: #a8071a;
}

/* 非 admin 隐藏的项（JS 控制添加 .hidden） */
.user-menu-item.hidden {
    display: none;
}

/* ============================================================
 * 简易模态框（配合 Utils.showModal 使用）
 * 原有 .modal-overlay / .modal / .modal-header 等样式已在 230 行定义，
 * 静态弹窗（#modalOverlay / #deleteModalOverlay）默认 display:none，加 .show 才显示。
 * Utils.showModal 动态 appendChild 到 <body> 的 overlay 带 .modal-overlay-dynamic 类，
 * 直接 display:flex 无需 .show，z-index 提到 2000 以免被业务弹窗遮挡。
 * ============================================================ */
.modal-overlay-dynamic {
    display: flex;
    z-index: 2000;
}

/* ============================================================
 * RBAC 权限界面
 * ============================================================ */

/* 无权限元素统一隐藏（由 Permission.applyDom 添加） */
.perm-hidden {
    display: none !important;
}

/* 身份标识标签 */
.role-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 11px;
    color: #8c8c8c;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
}

/* 身份弹窗稍宽，容纳权限勾选矩阵 */
.role-modal {
    width: 680px;
    max-width: 92vw;
}

.perm-groups {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 8px 12px;
    background: #fafafa;
}

.perm-group {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.perm-group:last-child {
    border-bottom: none;
}

.perm-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 6px;
}

.perm-group-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 16px;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #434343;
    cursor: pointer;
}

.perm-item input[type="checkbox"] {
    cursor: pointer;
}

.perm-code {
    margin-left: auto;
    font-size: 11px;
    color: #bfbfbf;
}

/* ============================================================
 * 项目收费模块
 * ============================================================ */

/* 工具栏右侧按钮组 */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- 开单弹窗 --- */
.charge-modal {
    width: 860px;
    max-width: 94vw;
}

.charge-item-modal {
    width: 760px;
    max-width: 94vw;
}

.charge-receipt-modal {
    width: 780px;
    max-width: 94vw;
}

/* 患者检索（下拉选择） */
.picker {
    position: relative;
}

.picker input {
    width: 100%;
    box-sizing: border-box;
}

.picker-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 10;
    max-height: 220px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.picker-item {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.picker-item:hover {
    background: #e6f7f9;
}

.picker-item-sub {
    font-size: 12px;
    color: #8c8c8c;
}

.picker-empty {
    padding: 12px;
    font-size: 13px;
    color: #999;
    text-align: center;
}

.picker-picked {
    margin-top: 4px;
    font-size: 13px;
    color: #00838f;
}

/* 明细区标题 */
.charge-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #262626;
}

.charge-detail-wrapper {
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    overflow-x: auto;
}

.charge-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.charge-detail-table th {
    padding: 8px 10px;
    background: #fafafa;
    font-size: 13px;
}

.charge-detail-table td {
    padding: 6px 8px;
    white-space: normal;
}

.charge-detail-table select,
.charge-detail-table input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
}

.charge-detail-table select:focus,
.charge-detail-table input:focus {
    outline: none;
    border-color: #00838f;
}

.charge-detail-table .ci-amount {
    text-align: right;
    font-size: 13px;
    color: #262626;
}

/* 合计区 */
.charge-summary {
    margin-top: 16px;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
}

.charge-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #595959;
}

.charge-summary-row strong {
    font-size: 18px;
    color: #00838f;
}

/* readonly 输入框观感 */
.form-group input[readonly] {
    background: #f5f5f5;
    color: #595959;
}

/* --- 收据单（预览 + 打印共用）--- */
.receipt {
    background: white;
    padding: 24px 28px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    color: #262626;
    font-size: 13px;
}

.receipt-head {
    text-align: center;
    margin-bottom: 14px;
}

.receipt-hospital {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
}

.receipt-title {
    margin-top: 6px;
    font-size: 15px;
    letter-spacing: 6px;
    color: #595959;
}

.receipt-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 2px solid #262626;
}

.receipt-meta-bottom {
    border-top: none;
    border-bottom: 1px dashed #d9d9d9;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.receipt-table th,
.receipt-table td {
    border: 1px solid #bfbfbf;
    padding: 6px 10px;
    font-size: 13px;
}

.receipt-table thead th {
    background: #fafafa;
    text-align: center;
    font-weight: 600;
}

.receipt-table tfoot td {
    background: #fafafa;
    font-weight: 600;
}

.ra {
    text-align: right;
}

.receipt-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 12px;
    padding: 10px 0;
    border-top: 1px dashed #d9d9d9;
}

.rs-item {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.rs-item span {
    color: #8c8c8c;
}

.rs-item strong {
    color: #262626;
}

.rs-wide {
    flex-basis: 100%;
}

.receipt-foot {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 2px solid #262626;
    font-size: 12px;
    color: #8c8c8c;
}

/* ============================================================
 * 操作日志页
 * ============================================================ */

/* 筛选栏 */
.log-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.log-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-filter-item label {
    font-size: 12px;
    color: #8c8c8c;
}

.log-filter-item input,
.log-filter-item select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.log-filter-item input:focus,
.log-filter-item select:focus {
    outline: none;
    border-color: #00838f;
}

.log-filter-keyword {
    flex: 1;
    min-width: 180px;
}

.log-filter-keyword input {
    width: 100%;
}

.log-filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* 列表单元格 */
.log-content-cell {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 操作类型 / 结果 标签 */
.log-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 18px;
    border: 1px solid transparent;
}

.log-tag-create {
    color: #389e0d;
    background: #f6ffed;
    border-color: #b7eb8f;
}

.log-tag-update {
    color: #096dd9;
    background: #e6f7ff;
    border-color: #91d5ff;
}

.log-tag-delete {
    color: #cf1322;
    background: #fff1f0;
    border-color: #ffa39e;
}

.log-tag-query {
    color: #595959;
    background: #fafafa;
    border-color: #e8e8e8;
}

.log-tag-login {
    color: #d46b08;
    background: #fff7e6;
    border-color: #ffd591;
}

.log-tag-other {
    color: #595959;
    background: #fafafa;
    border-color: #e8e8e8;
}

.log-tag-success {
    color: #389e0d;
    background: #f6ffed;
    border-color: #b7eb8f;
}

.log-tag-fail {
    color: #cf1322;
    background: #fff1f0;
    border-color: #ffa39e;
}

/* 分页省略号 */
.page-ellipsis {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    color: #8c8c8c;
    line-height: 32px;
}

/* 详情弹窗 */
.log-detail-modal {
    width: 760px;
    max-width: 94vw;
}

.log-detail-section {
    margin-bottom: 20px;
}

.log-detail-section:last-child {
    margin-bottom: 0;
}

.log-detail-section h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #262626;
    padding-left: 8px;
    border-left: 3px solid #00838f;
}

.log-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 20px;
}

.log-detail-item {
    display: flex;
    gap: 8px;
    font-size: 13px;
    line-height: 1.9;
    min-width: 0;
}

.log-detail-full {
    grid-column: 1 / -1;
}

.log-detail-label {
    flex: 0 0 76px;
    color: #8c8c8c;
}

.log-detail-value {
    color: #262626;
    word-break: break-all;
}

/* 前后数据对比表 */
.log-diff-table {
    width: 100%;
    border-collapse: collapse;
}

.log-diff-table th,
.log-diff-table td {
    border: 1px solid #e8e8e8;
    padding: 6px 10px;
    font-size: 13px;
    text-align: left;
    word-break: break-all;
}

.log-diff-table thead th {
    background: #fafafa;
    font-weight: 600;
}

.log-diff-key {
    width: 180px;
    color: #595959;
    background: #fafafa;
}

.log-diff-changed {
    background: #fffbe6;
}

.log-diff-changed td:last-child {
    color: #d4380d;
    font-weight: 600;
}

.log-diff-title {
    font-size: 13px;
    color: #595959;
    margin-bottom: 8px;
}

.log-diff-empty {
    font-size: 13px;
    color: #8c8c8c;
    padding: 12px;
    background: #fafafa;
    border-radius: 4px;
}

.log-json {
    margin: 0;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
    color: #262626;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-json-before {
    border-color: #ffccc7;
    background: #fff2f0;
}

.log-json-after {
    border-color: #b7eb8f;
    background: #f6ffed;
}

/* ============ CSP 内联样式外置新增类 ============ */
/* 以下类用于替换前端 HTML 标记中的 style="" 属性，声明逐字搬自原内联样式 */

/* --- 通用工具类 --- */
.hidden {
    display: none;
}

.text-gray {
    color: #bfbfbf;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-4 {
    margin-bottom: 4px;
}

.mb-6 {
    margin-bottom: 6px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-14 {
    margin-bottom: 14px;
}

.mb-16 {
    margin-bottom: 16px;
}

.w-60 {
    width: 60px;
}

.w-70 {
    width: 70px;
}

.w-80 {
    width: 80px;
}

.w-90 {
    width: 90px;
}

.w-110 {
    width: 110px;
}

.w-130 {
    width: 130px;
}

.w-160 {
    width: 160px;
}

.th-min-200 {
    min-width: 200px;
}

.flex-row {
    display: flex;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

/* --- 登录遮罩初始隐藏（JS 通过内联 display 切换显隐） --- */
.login-overlay.login-overlay-hidden {
    display: none;
}

/* --- 饼图图例色点 --- */
.legend-dot-male {
    background: #1890ff;
}

.legend-dot-female {
    background: #eb2f96;
}

/* --- 图表 / 弹窗尺寸 --- */
.chart-placeholder-tall {
    height: 260px;
}

.modal-narrow {
    width: 400px;
}

/* --- 系统设置说明文字 / 数据备份操作区 --- */
.settings-note {
    font-size: 13px;
    color: #8c8c8c;
}

.backup-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-file-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

/* --- 表单行内操作按钮组 --- */
.form-group.inline-actions {
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
}

/* --- 确认文案 --- */
.confirm-text {
    font-size: 14px;
    color: #595959;
}

.confirm-inline {
    padding: 8px 2px;
}

/* --- 分页跳转 --- */
.pager-gap {
    padding: 0 6px;
    color: #999;
}

.page-jump {
    margin-left: 10px;
    color: #666;
    font-size: 13px;
}

.page-jump-input {
    width: 56px;
    padding: 2px 4px;
    margin: 0 4px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}

/* --- 弹窗表单通用（users.js / auth.js） --- */
.modal-form-pad {
    padding: 16px 18px 4px;
}

.field-input {
    flex: 1;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
}

.field-input.is-readonly {
    border-color: #e5e7eb;
    background: #f5f6f8;
    color: #888;
    cursor: not-allowed;
}

.form-label-72 {
    width: 72px;
    flex: none;
    font-size: 13px;
    color: #666;
}

.form-label-84 {
    width: 84px;
    flex: none;
    font-size: 13px;
    color: #666;
}

.checkbox-inline {
    font-size: 13px;
    color: #333;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-tip {
    font-size: 13px;
    color: #555;
    margin-bottom: 14px;
}

.field-hint-84-top {
    font-size: 12px;
    color: #9aa0a6;
    margin: 0 0 14px 84px;
}

.field-hint-84-top12 {
    font-size: 12px;
    color: #9aa0a6;
    margin: 0 0 12px 84px;
}

.field-hint-84 {
    font-size: 12px;
    color: #9aa0a6;
    margin-left: 84px;
}

.field-hint-72 {
    font-size: 12px;
    color: #9aa0a6;
    margin-left: 72px;
}

/* --- 个人资料弹窗（auth.js） --- */
.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.profile-name {
    font-weight: 600;
}

.profile-role {
    font-size: 12px;
    color: #888;
}

.profile-hint {
    font-size: 12px;
    color: #9aa0a6;
    margin: -6px 0 12px 72px;
}

.profile-email-box {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f5f6f8;
}

.profile-email-text {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-email-text.is-empty {
    color: #9aa0a6;
}

.profile-email-badge {
    flex: none;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 10px;
    color: #1a7f37;
    background: #e7f6ec;
}

.profile-email-badge.is-empty {
    color: #d93025;
    background: #fdecec;
}

.profile-btn-outline {
    flex: none;
    margin-left: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #0d6efd;
    border-radius: 6px;
    background: #fff;
    color: #0d6efd;
    font-size: 13px;
    cursor: pointer;
}

.profile-btn-primary {
    flex: none;
    margin-left: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #0d6efd;
    border-radius: 6px;
    background: #0d6efd;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

/* --- 用户管理（users.js） --- */
.email-verified {
    color: #16a34a;
    font-size: 12px;
}

.email-unverified {
    color: #d48806;
    font-size: 12px;
}

.status-enabled {
    color: #16a34a;
}

.status-disabled {
    color: #dc2626;
}

/* --- 日志记录项（logs.js） --- */
.log-rule-group {
    margin-bottom: 14px;
}

.log-rule-title {
    font-weight: 600;
    color: #262626;
    margin-bottom: 8px;
}

.log-rule-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.log-rule-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* --- 空态 --- */
.recorder-empty {
    color: #bfbfbf;
    font-size: 13px;
    padding: 12px;
}

.recent-empty {
    text-align: center;
    color: #bfbfbf;
    padding: 30px;
}

.receipt-empty {
    text-align: center;
    color: #999;
}

/* --- 模式提示条（main.js） --- */
.mode-banner {
    background: #fff7e6;
    color: #d48806;
    padding: 6px 16px;
    font-size: 12px;
    text-align: center;
    border-bottom: 1px solid #ffe58f;
}

.mode-banner.is-ok {
    background: #f6ffed;
    color: #389e0d;
    border-color: #b7eb8f;
}

/* ============ 表单拍照识别（ocr.js） ============ */

.ocr-overlay {
    z-index: 1100;
    /* 盖住客户弹窗（1000） */
}

/* 功能开关：未启用的功能元素统一隐藏（配合 js/features.js 添加的 .feature-off） */
.feature-off {
    display: none !important;
}

.ocr-modal {
    width: 620px;
}

/* 客户表单内的触发行：与上方字段用细线分隔，层次更清晰 */
.ocr-trigger-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.ocr-trigger-hint {
    color: #8c8c8c;
    font-size: 12px;
}

/* 取景舞台：固定 4:3，视频 cover 填满，取景框按纸样比例居中 */
.ocr-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.ocr-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ocr-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.ocr-viewfinder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 88%;
    aspect-ratio: 210 / 297;
    /* 与后端模板 aspectRatio 一致 */
    border: 2px dashed rgba(255, 255, 255, 0.85);
    border-radius: 4px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    /* 取景框外压暗 */
    pointer-events: none;
}

.ocr-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    padding: 0 12px;
    text-align: center;
    color: #fff;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.ocr-hidden {
    display: none !important;
}

/* 识别结果面板 */
.ocr-result {
    margin-top: 12px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 8px 12px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 13px;
}

.ocr-res-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dashed #f0f0f0;
    flex-wrap: wrap;
}

.ocr-res-row:last-child {
    border-bottom: none;
}

.ocr-res-label {
    color: #8c8c8c;
    min-width: 60px;
}

.ocr-res-val {
    color: #262626;
    font-weight: 500;
}

.ocr-res-conf {
    color: #8c8c8c;
    font-size: 12px;
    margin-left: auto;
}

.ocr-raw {
    width: 100%;
    color: #bfbfbf;
    font-size: 12px;
}

.ocr-muted {
    color: #bfbfbf;
}

.ocr-warn {
    width: 100%;
    color: #d48806;
    font-size: 12px;
}

/* 低置信度回填：黄色高亮提醒人工核对 */
.ocr-low {
    border-color: #faad14 !important;
    background: #fffbe6;
}