/* ============================================================
   OA 系统样式
   设计取舍：不引入 UI 框架（体积 + 构建），手写 CSS。
   适配企业微信内置浏览器（Chromium 内核，支持 CSS 变量与 Grid）。
   ============================================================ */

:root {
    --c-primary: #2563eb;
    --c-primary-hover: #1d4ed8;
    --c-primary-light: #eff6ff;
    --c-success: #16a34a;
    --c-success-light: #f0fdf4;
    --c-warning: #ea580c;
    --c-warning-light: #fff7ed;
    --c-danger: #dc2626;
    --c-danger-light: #fef2f2;
    --c-info: #0891b2;
    --c-info-light: #ecfeff;

    --c-text: #1f2937;
    --c-text-secondary: #6b7280;
    --c-text-muted: #9ca3af;
    --c-border: #e5e7eb;
    --c-border-light: #f3f4f6;
    --c-bg: #f5f6f8;
    --c-white: #fff;

    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, .1);

    --header-h: 56px;
    --sidebar-w: 220px;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============================================================
   登录页
   ============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--c-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 6px;
}

.login-logo p {
    font-size: 13px;
    color: var(--c-text-secondary);
}

.login-form .form-item { margin-bottom: 18px; }

.login-form label {
    display: block;
    font-size: 13px;
    color: var(--c-text-secondary);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: border-color .15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.login-tip {
    margin-top: 16px;
    font-size: 12px;
    color: var(--c-text-muted);
    text-align: center;
}

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

.sidebar {
    width: var(--sidebar-w);
    background: #1f2937;
    color: #d1d5db;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .25s;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.menu-group-title {
    padding: 12px 18px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 14px;
    color: #d1d5db;
    cursor: pointer;
    transition: background .15s, color .15s;
    position: relative;
}

.menu-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.menu-item.active {
    background: var(--c-primary);
    color: #fff;
    font-weight: 500;
}

.menu-item .menu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: .8;
}

.menu-item .badge {
    margin-left: auto;
    background: var(--c-danger);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    height: var(--header-h);
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--c-text-secondary);
    transition: background .15s;
}

.header-icon-btn:hover { background: var(--c-border-light); }

.header-icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-danger);
    border: 1.5px solid var(--c-white);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s;
}

.user-chip:hover { background: var(--c-border-light); }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }

.user-name { font-size: 13px; font-weight: 500; }
.user-dept { font-size: 11px; color: var(--c-text-muted); }

.content {
    flex: 1;
    padding: 20px;
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--c-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
}

.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

.card-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   统计卡片
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--c-white);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--c-primary);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-card.green { border-left-color: var(--c-success); }
.stat-card.orange { border-left-color: var(--c-warning); }
.stat-card.red { border-left-color: var(--c-danger); }
.stat-card.cyan { border-left-color: var(--c-info); }

.stat-label {
    font-size: 13px;
    color: var(--c-text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
}

.stat-sub {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 4px;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: var(--c-white);
    color: var(--c-text);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--c-primary-hover);
    border-color: var(--c-primary-hover);
}

.btn-success {
    background: var(--c-success);
    border-color: var(--c-success);
    color: #fff;
}

.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-danger {
    background: var(--c-danger);
    border-color: var(--c-danger);
    color: #fff;
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--c-text-secondary);
}

.btn-ghost:hover { background: var(--c-border-light); }

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-lg {
    height: 42px;
    padding: 0 20px;
    font-size: 15px;
}

.btn-block { width: 100%; }

/* ============================================================
   表单
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-item { min-width: 0; }

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

.form-item label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-secondary);
    margin-bottom: 6px;
}

.form-item label .req {
    color: var(--c-danger);
    margin-left: 2px;
}

.form-item input,
.form-item select,
.form-item textarea {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    transition: border-color .15s, box-shadow .15s;
}

.form-item textarea {
    height: auto;
    min-height: 80px;
    padding: 8px 10px;
    resize: vertical;
    line-height: 1.6;
}

.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.form-item input:disabled,
.form-item select:disabled,
.form-item textarea:disabled {
    background: var(--c-border-light);
    color: var(--c-text-muted);
    cursor: not-allowed;
}

.form-item .hint {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 4px;
}

.form-item .error {
    font-size: 12px;
    color: var(--c-danger);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--c-border-light);
    margin-top: 20px;
    padding-top: 16px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.search-bar input,
.search-bar select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    min-width: 140px;
}

.search-bar input[type="text"] { min-width: 200px; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    background: #fafbfc;
    padding: 11px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--c-text-secondary);
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
    font-size: 12px;
    text-transform: none;
}

table.data td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--c-border-light);
    vertical-align: middle;
}

table.data tbody tr:hover { background: #fafbfc; }

table.data tbody tr:last-child td { border-bottom: none; }

table.data td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.data td.actions {
    white-space: nowrap;
    text-align: right;
}

table.data .empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--c-text-muted);
}

table.data .empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .4;
}

/* ============================================================
   标签与状态
   ============================================================ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}

.tag.gray   { background: #f3f4f6; color: #4b5563; }
.tag.blue   { background: #eff6ff; color: #1d4ed8; }
.tag.green  { background: #f0fdf4; color: #15803d; }
.tag.orange { background: #fff7ed; color: #c2410c; }
.tag.red    { background: #fef2f2; color: #b91c1c; }
.tag.purple { background: #faf5ff; color: #7e22ce; }
.tag.cyan   { background: #ecfeff; color: #0e7490; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--c-border-light);
    font-size: 13px;
    color: var(--c-text-secondary);
    flex-wrap: wrap;
}

.pagination .spacer { margin-left: auto; }

.page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    color: var(--c-text);
    font-size: 13px;
    transition: all .15s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

.page-btn.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}

.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   弹窗
   ============================================================ */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn .15s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--c-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp .2s;
}

@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal.wide { max-width: 900px; }

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--c-text-muted);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: var(--c-border-light); color: var(--c-text); }

.modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--c-border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ============================================================
   提示与消息
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 10px 18px;
    border-radius: var(--radius);
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .2s;
    max-width: 90vw;
}

.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }
.toast.warning { background: var(--c-warning); }

@keyframes toastIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.alert.info { background: var(--c-info-light); color: #0e7490; border: 1px solid #a5f3fc; }
.alert.warning { background: var(--c-warning-light); color: #c2410c; border: 1px solid #fed7aa; }
.alert.danger { background: var(--c-danger-light); color: #b91c1c; border: 1px solid #fecaca; }
.alert.success { background: var(--c-success-light); color: #15803d; border: 1px solid #bbf7d0; }

/* ============================================================
   加载
   ============================================================ */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
    padding: 48px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13px;
}

.loading-block .spinner { margin-bottom: 10px; }

/* ============================================================
   时间轴（审批记录）
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--c-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-white);
    border: 2px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--c-text-muted);
}

.timeline-dot.done { border-color: var(--c-success); background: var(--c-success); color: #fff; }
.timeline-dot.reject { border-color: var(--c-danger); background: var(--c-danger); color: #fff; }
.timeline-dot.current { border-color: var(--c-primary); background: var(--c-primary); color: #fff; }

.timeline-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.timeline-node {
    font-size: 13px;
    font-weight: 600;
}

.timeline-time {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-left: auto;
}

.timeline-body {
    font-size: 13px;
    color: var(--c-text-secondary);
    line-height: 1.6;
}

.timeline-comment {
    background: var(--c-border-light);
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-top: 6px;
    font-size: 13px;
}

/* ============================================================
   详情描述列表
   ============================================================ */
.desc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 24px;
}

.desc-item { min-width: 0; }

.desc-label {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-bottom: 3px;
}

.desc-value {
    font-size: 14px;
    word-break: break-word;
}

.desc-value.money {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.desc-value.amount-big {
    font-size: 22px;
    font-weight: 600;
    color: var(--c-danger);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   进度条
   ============================================================ */
.progress {
    height: 6px;
    background: var(--c-border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar {
    height: 100%;
    background: var(--c-primary);
    border-radius: 3px;
    transition: width .3s;
}

.progress-bar.warning { background: var(--c-warning); }
.progress-bar.danger { background: var(--c-danger); }

/* ============================================================
   空状态
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-muted);
}

.empty-state .icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: .35;
}

.empty-state .text {
    font-size: 14px;
    margin-bottom: 6px;
}

.empty-state .hint {
    font-size: 12px;
    color: var(--c-text-muted);
}

/* ============================================================
   工具类
   ============================================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--c-text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.divider {
    height: 1px;
    background: var(--c-border-light);
    margin: 16px 0;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c-border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   响应式（企微手机端）
   ============================================================ */
.mobile-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    align-items: center;
    justify-content: center;
    color: var(--c-text-secondary);
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main { margin-left: 0; }

    .mobile-toggle { display: flex; }

    .content { padding: 12px; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .stat-value { font-size: 20px; }

    .form-row { grid-template-columns: 1fr; }

    .modal { max-height: 94vh; }

    .modal-body { padding: 16px; }

    .search-bar { gap: 8px; }

    .search-bar input[type="text"] { min-width: 120px; flex: 1; }

    .user-dept { display: none; }

    .desc-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .header { padding: 0 12px; gap: 10px; }
    .header-title { font-size: 15px; }
    /* 统计卡片保持两列：手机上单列会让一屏只看得到 1.5 个卡片，
       两列既看得全又不必滚动（企微内置浏览器高度更小） */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
    .stat-card { padding: 12px 10px; border-left-width: 3px; }
    .stat-label { font-size: 12px; }
    .stat-value { font-size: 22px; margin: 6px 0 2px; }
    .stat-sub { font-size: 11px; }
    .desc-grid { grid-template-columns: 1fr; }
    table.data { font-size: 12px; }
    table.data th, table.data td { padding: 8px 10px; }
    .pagination { padding: 12px; }
}

@media (max-width: 360px) {
    /* 极窄屏（iPhone SE 等）才退回单列 */
    .stat-grid { grid-template-columns: 1fr; }
}

/* 遮罩（移动端侧栏） */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 99;
}

.sidebar-backdrop.show { display: block; }

/* ============================================================
   打印（单据打印）
   ============================================================ */
@media print {
    .sidebar, .header, .btn, .search-bar, .pagination, .modal-footer {
        display: none !important;
    }

    .main { margin-left: 0; }

    .content { padding: 0; }

    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}
/* ============================================================
   附件上传组件
   ============================================================ */
.attach-field { width: 100%; }

.attach-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.attach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    transition: border-color .15s;
}

.attach-item:hover { border-color: var(--c-primary); }

.attach-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: var(--c-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.attach-meta { flex: 1; min-width: 0; }

.attach-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attach-size {
    font-size: 11px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

.attach-del {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--c-text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.attach-del:hover { background: var(--c-danger-light); color: var(--c-danger); }

.attach-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--c-text-muted);
    border: 1px dashed var(--c-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.attach-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attach-hint { font-size: 11px; color: var(--c-text-muted); }

.attach-progress {
    height: 3px;
    background: var(--c-border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.attach-progress-bar {
    height: 100%;
    width: 0;
    background: var(--c-primary);
    border-radius: 2px;
    transition: width .2s;
}

@media (max-width: 560px) {
    .attach-item { padding: 7px 8px; }
    .attach-thumb { flex-basis: 40px; width: 40px; height: 40px; }
    .attach-name { font-size: 12px; }
}
