/* ============================================
   农土地 - 通用样式（全站共用）
   设计系统参考 591886.cn
   页面独有样式已拆分至：
     materials.css（资料管理页） / purchase.css（采购单页） / profile.css（个人资料页）
   ============================================ */

:root {
    /* 主色 */
    --accent: #0d8ba1;
    --accent-dark: #095a6b;
    --accent-light: #0599c2;
    --accent-soft: rgba(13, 139, 161, 0.06);
    --accent-soft-2: rgba(13, 139, 161, 0.1);

    /* 语义色 */
    --success: #49968e;
    --danger: #F53F3F;
    --warning: #FF7D00;
    --info: #0d8ba1;

    /* 状态文字色(仅用于文字提示，背景色不动) */
    --success-text: #357A6F;
    --warning-text: #C05E00;
    --danger-text: #C33E3E;

    /* 中性色 */
    --bg: #edf4f0;
    --bg2: #FFFFFF;
    --ink: #325050;
    --muted: #607476;
    --faint: #98a2a4;
    --rule: #d9e3dc;
    --gray-50: #f0f4f1;
    --gray-100: #e8ede9;
    --gray-200: #d9e3dc;
    --gray-300: #c0cac3;
    --gray-400: #98a2a4;
    --gray-500: #607476;
    --gray-600: #445456;

    /* 遮罩 */
    --overlay: rgba(0, 0, 0, 0.5);

    /* 圆角 */
    --radius: 4px;
    --radius-lg: 3px;
    --radius-pill: 999px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);

    /* 字号(rem) */
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.875rem;
    --fs-md: 0.9375rem;
    --fs-lg: 1rem;
    --fs-xl: 1.0625rem;
    --fs-2xl: 1.125rem;
    --fs-3xl: 1.25rem;

    /* 布局 */
    --nav-h: 56px;
    --sidebar-w: 220px;
    --tabbar-h: 56px;

    /* 兼容旧变量名(供其他CSS文件使用) */
    --color-primary: var(--accent);
    --color-primary-dark: var(--accent-dark);
    --color-primary-light: var(--accent-light);
    --color-primary-bg: var(--accent-soft);
    --color-primary-border: var(--accent);
    --color-danger: var(--danger);
    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-bg: var(--bg);
    --color-card: var(--bg2);
    --color-text: var(--ink);
    --color-text-secondary: var(--muted);
    --color-text-muted: var(--faint);
    --color-border: var(--rule);
    --color-border-light: var(--gray-100);
    --color-overlay: var(--overlay);
}

/* ========== 重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: var(--fs-base);
    color: var(--ink);
    background-color: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, button, textarea, select { font-family: inherit; font-size: inherit; outline: none; border: none; }
button { cursor: pointer; background: none; }
ul, ol { list-style: none; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    font-size: var(--fs-base);
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: all 0.18s;
    white-space: nowrap;
    user-select: none;
    line-height: 1.5;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: var(--bg2); color: var(--accent); border-color: var(--rule); }
.btn-secondary:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #d93636; border-color: #d93636; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--ink); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #3a7d76; border-color: #3a7d76; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-lg { padding: 14px 24px; font-size: var(--fs-lg); }
.btn-loading { pointer-events: none; opacity: 0.7; }

/* ========== 卡片 ========== */
.card {
    background: var(--bg2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
}
.card-title { font-size: var(--fs-xl); font-weight: 700; color: var(--ink); }
.card-body { color: var(--ink); }

/* ========== 输入框 ========== */
.input, .textarea, .select {
    width: 100%;
    padding: 10px 14px;
    font-size: var(--fs-md);
    color: var(--ink);
    background: var(--bg2);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea { min-height: 80px; padding: 10px 14px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.error, .textarea.error, .select.error { border-color: var(--danger); }
.input.error:focus, .textarea.error:focus, .select.error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(245, 63, 63, 0.12);
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.form-label { font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.req-star { color: var(--danger); margin-left: 2px; font-weight: 600; }
.form-hint { font-size: var(--fs-xs); color: var(--faint); font-weight: normal; margin-left: 6px; }
.form-error { font-size: var(--fs-sm); color: var(--danger); }

/* 弹窗表单组件（ListPage 新增/编辑弹窗、采购单新增供应商弹窗等共用） */
.checkbox-group { display: flex; gap: 12px; flex-wrap: wrap; }
.checkbox-item {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: var(--fs-base); color: var(--ink);
    padding: 8px 16px; border: 1px solid var(--rule); border-radius: var(--radius); transition: all 0.2s;
}
.checkbox-item.checked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.checkbox-item input { accent-color: var(--accent); width: 16px; height: 16px; }
/* 单选组（如：是否启用叉板、司机类型） */
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-item {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: var(--fs-base); color: var(--ink);
    padding: 8px 16px; border: 1px solid var(--rule); border-radius: var(--radius); transition: all 0.2s;
}
.radio-item.checked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.radio-item input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 自增行区域 */
.specs-area { display: none; margin-top: 12px; }
.specs-area.show { display: block; }
.specs-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.spec-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px; border-radius: var(--radius); margin-bottom: 8px;
    background: #ffffff;
}
.spec-row:nth-child(odd) { background: var(--gray-50); }   /* 第1、3、5行浅色 */
.spec-row:nth-child(even) { background: #ffffff; }  /* 第2、4、6行白色 */
.spec-input {
    flex: 1; height: 32px; border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 0 10px; font-size: var(--fs-base); color: var(--ink); outline: none; min-width: 0;
}
.spec-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.spec-input.error { border-color: var(--danger); }
.spec-del {
    width: 28px; height: 28px; border: none; background: transparent; border-radius: 50%;
    color: #f08383; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.18s;
}
.spec-del svg { width: 16px; height: 16px; }
.spec-del:hover { background: transparent; color: #e05b5b; }
.spec-add {
    width: 100%; height: 40px; border: 1px solid var(--accent); border-radius: var(--radius);
    background: var(--accent-soft); color: var(--accent); font-size: var(--fs-base); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.18s;
}
.spec-add:hover { background: var(--accent-soft-2); }

/* 多字段重复器行（如供应材料 / 叉板规格：名称 + 计重开关 + 重量） */
.spec-field {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; min-width: 0;
}
.spec-field-grow { flex: 1 1 auto; }
.spec-field-grow .spec-input { width: 100%; }
.spec-field-label { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.spec-radio { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.spec-radio-item { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--ink); cursor: pointer; white-space: nowrap; }
.spec-radio-item input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.spec-input-sm { flex: 0 0 64px; width: 64px; text-align: center; }
.spec-unit { font-size: var(--fs-sm); color: var(--muted); flex-shrink: 0; }

/* ========== 共用浮框基座（浮框样式统一入口，其它页调用浮框请使用这套样式，无需逐页改样式） ========== */
/* 覆盖 App.PopForm（.pb-pop-form）及采购页日期浮框（.pb-date-pop），共用同一视觉基座 */
.pb-pop-form, .pb-date-pop {
    position: fixed; z-index: 3000;
    background: var(--bg2); border: 1px solid var(--rule); border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}
.pb-pop-form {
    width: auto; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px);
    display: flex; flex-direction: column;
    animation: pb-pop-in 0.15s ease-out;
}
@keyframes pb-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pb-pop-head, .pb-date-pop-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink);
    border-bottom: 1px solid var(--rule); flex-shrink: 0;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(13, 139, 161, 0.16) 100%);
}
.pb-pop-title { font-size: var(--fs-xs); font-weight: 600; color: var(--ink); }
.pb-pop-close {
    border: none; background: transparent; color: var(--muted);
    font-size: var(--fs-base); line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.pb-pop-close:hover { background: var(--gray-100); color: var(--ink); }
.pb-pop-body { padding: 10px 12px 4px; overflow-y: auto; flex: 1; }
.pb-pop-body .form-group { margin-bottom: 8px; }
/* 紧凑输入项 */
.pb-pop-body .form-label-row { margin-bottom: 4px; }
.pb-pop-body .form-label { font-size: var(--fs-xs); }
.pb-pop-body .input { padding: 5px 10px; font-size: var(--fs-xs); }
.pb-pop-body .radio-item { padding: 4px 12px; font-size: var(--fs-xs); }
.pb-pop-body .spec-row {
    gap: 8px; padding: 3px 0; margin-bottom: 5px;
    background: transparent;
}
.pb-pop-body .spec-input { height: 28px; font-size: var(--fs-xs); padding: 0 8px; }
.pb-pop-body .spec-input-sm { flex: 0 0 40px; width: 40px; }
.pb-pop-body .spec-field-label { font-size: var(--fs-xs); }
.pb-pop-body .spec-add { height: 32px; font-size: var(--fs-xs); }
/* 更小的滑动开关（浮框内） */
.pb-pop-body .spec-switch .switch-slider { width: 32px; height: 18px; }
.pb-pop-body .spec-switch .switch-slider:before { width: 14px; height: 14px; left: 2px; top: 2px; }
.pb-pop-body .spec-switch input:checked + .switch-slider:before { transform: translateX(14px); }
/* 轻量浮框字段错误：紧贴 label 右侧、靠右对齐、不换行 */
.pb-pop-body .form-error { font-size: var(--fs-xs); margin-left: auto; text-align: right; white-space: nowrap; }
.pb-pop-more-wrap { border-top: 1px dashed var(--rule); margin-top: 2px; padding-top: 6px; min-height: 0; }
.pb-pop-toggle {
    width: 100%; border: none; background: transparent; cursor: pointer;
    font-size: var(--fs-xs); color: var(--muted);
    display: flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 0;
}
.pb-pop-toggle:hover { color: var(--accent-dark); }
.pb-pop-toggle-chev { display: inline-flex; margin-left: 4px; width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; transition: transform 0.25s ease; }
.pb-pop-toggle-chev svg { width: 100%; height: 100%; }
.pb-pop-toggle.open .pb-pop-toggle-chev { transform: rotate(180deg); color: var(--accent); }
.pb-pop-more { display: none; min-height: 0; }
.pb-pop-more.open { display: block; }
/* 更多设置内容超限时上下滚动（矮视口下按剩余空间收缩，展开不跳出浏览器） */
.pb-pop-more-inner { overflow-y: auto; max-height: min(220px, calc(100vh - 160px)); min-height: 0; padding-top: 8px; }
.pb-pop-err {
    font-size: var(--fs-xs); font-weight: 500; color: var(--danger);
    margin-left: 10px; white-space: nowrap; flex-shrink: 0;
}
.pb-pop-foot { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--rule); flex-shrink: 0; }
.pb-pop-foot .btn { flex: 1; height: 27px; padding: 0 14px; font-size: var(--fs-xs); }

/* 浮框内控件统一蓝青（与全局主题一致，仅作用于浮框内部） */
.pb-pop-body .radio-item.checked { border-color: var(--accent); background: rgba(13, 139, 161, 0.12); color: var(--accent-dark); }
.pb-pop-body .radio-item input { accent-color: var(--accent); }
.pb-pop-body .input:focus,
.pb-pop-body .spec-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 139, 161, 0.12); }
.pb-pop-body .spec-add { border-color: var(--accent); background: rgba(13, 139, 161, 0.12); color: var(--accent-dark); }
.pb-pop-body .spec-add:hover { background: rgba(13, 139, 161, 0.2); }
.pb-pop-body .spec-switch input:checked + .switch-slider { background: var(--accent); }
.pb-pop-foot .btn-primary { background: var(--accent); border-color: var(--accent); }
.pb-pop-foot .btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* 自增行滑动开关（如叉板/材料计重） */
.spec-switch { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: var(--fs-sm); color: var(--ink); cursor: pointer; }
.spec-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.spec-switch .switch-slider { position: relative; display: inline-block; width: 38px; height: 20px; background: var(--gray-300); border-radius: 20px; transition: .2s; flex-shrink: 0; }
.spec-switch .switch-slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.spec-switch input:checked + .switch-slider { background: var(--accent); }
.spec-switch input:checked + .switch-slider:before { transform: translateX(18px); }

/* ========== 标签 ========== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius);
    font-size: var(--fs-xs);
    line-height: 1.5;
}
.tag-primary { background: var(--accent-soft); color: var(--accent-dark); }
.tag-danger { background: rgba(245, 63, 63, 0.1); color: var(--danger); }
.tag-success { background: rgba(73, 150, 142, 0.12); color: var(--success); }
.tag-warning { background: rgba(255, 125, 0, 0.12); color: var(--warning); }
.tag-gray { background: var(--gray-100); color: var(--muted); }

/* ========== 开关 ========== */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--gray-300); border-radius: 24px; transition: 0.3s;
}
.switch-slider:before {
    content: ""; position: absolute;
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider:before { transform: translateX(20px); }

/* ========== 公用控件：小按钮（隐藏选框） + 滑动开关（大/小） ==========
   供各页面直接引用（后续新增交互优先用这两类，避免每处各写一套）。
   小按钮：   <label class="ui-chip"><input type="radio|checkbox"><span>文字</span></label>  选中时给 .checked
   滑动开关： <label class="ui-switch ui-switch--sm"><input type="checkbox" checked><span class="switch-slider"></span></label>
              不加 --sm 即大号（启用类总控开关），加 --sm 即小号（计件数/单位等） */
.ui-chip {
    position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: var(--fs-xs); color: var(--ink);
    padding: 4px 12px; border: 1px solid var(--rule); border-radius: var(--radius);
    background: var(--bg2); transition: all 0.18s;
}
/* 隐藏原生选框：保留在文档流之外，label 点击即可选中 */
.ui-chip > input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.ui-chip.checked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
/* 只读展示（如锁定供应商）：不可点、保持常规配色 */
.ui-chip.is-static { cursor: default; }
.ui-chip.is-static.checked { color: var(--ink); }
/* 不可编辑（如编辑态锁定产品）：保留原配色，仅取消点击 */
.ui-chip.is-locked { cursor: not-allowed; }

.ui-switch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink); cursor: pointer; flex-shrink: 0; }
.ui-switch > input { position: absolute; opacity: 0; width: 0; height: 0; }
.ui-switch .switch-slider { position: relative; display: inline-block; width: 38px; height: 20px; background: var(--gray-300); border-radius: 20px; transition: .2s; flex-shrink: 0; }
.ui-switch .switch-slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.ui-switch input:checked + .switch-slider { background: var(--accent); }
.ui-switch input:checked + .switch-slider:before { transform: translateX(18px); }
/* 小号滑动开关 */
.ui-switch--sm .switch-slider { width: 30px; height: 16px; border-radius: 16px; }
.ui-switch--sm .switch-slider:before { width: 12px; height: 12px; left: 2px; top: 2px; }
.ui-switch--sm input:checked + .switch-slider:before { transform: translateX(14px); }

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--overlay);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: none;
    width: 100%; max-width: 500px;
    max-height: calc(100vh - 80px);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.modal-title-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.modal-title { font-size: var(--fs-2xl); font-weight: 700; color: var(--ink); }
.modal-err { font-size: var(--fs-sm); color: var(--danger); font-weight: 400; }
.modal-close {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--gray-400); font-size: 22px; flex-shrink: 0;
    border: none; background: none; border-radius: var(--radius); transition: all 0.18s;
}
.modal-close:hover { background: var(--gray-100); color: var(--ink); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer {
    flex-shrink: 0;
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 20px; border-top: 1px solid var(--rule);
}
.modal.shake { animation: shakeX 0.4s ease; }
@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
/* 宽模态框（如员工号设置弹窗） */
.modal-lg { max-width: 860px; }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 24px; left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px; border-radius: var(--radius);
    color: #fff; font-size: var(--fs-lg); font-weight: 500;
    z-index: 2000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    animation: toastIn 0.25s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--accent); }

/* 独立登录页局部 toast（login.js 使用，与 .toast 并存） */
.global-toast {
    position: fixed; top: 24px; left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px; border-radius: var(--radius);
    color: #fff; font-size: var(--fs-lg); font-weight: 500;
    z-index: 10000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    animation: toastIn 0.25s ease;
    max-width: 80%;
}
.global-toast.success { background: var(--success); }
.global-toast.error { background: var(--danger); }
.global-toast.warning { background: var(--warning); }
.global-toast.info { background: var(--accent); }
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ========== 分页 ========== */
.pagination {
    display: flex; gap: 8px; align-items: center; justify-content: center;
    margin-top: 20px; flex-wrap: wrap;
}
.page-btn {
    min-width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--rule); border-radius: var(--radius);
    background: var(--bg2); cursor: pointer; font-size: var(--fs-sm); padding: 0 8px;
    color: var(--muted);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== 空状态 ========== */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

/* ========== 工具类 ========== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.text-secondary { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.font-bold { font-weight: 600; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ========== 布局框架 ========== */
.app-layout { display: flex; min-height: 100vh; background: var(--bg); }

/* 侧边栏 */
.app-sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--rule);
    position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 90; display: flex; flex-direction: column;
}
.sidebar-logo {
    height: var(--nav-h);
    display: flex; align-items: center; gap: 8px;
    padding: 0 24px;
    font-size: 1.2rem; font-weight: 700; color: var(--accent);
    border-bottom: 1px solid var(--rule);
    flex-shrink: 0;
}
.sidebar-menu {
    flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
}
.sidebar-item {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; border-radius: var(--radius-lg);
    font-size: var(--fs-base); font-weight: 500; color: var(--ink);
    cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.sidebar-item:hover { background: var(--gray-100); color: var(--ink); }
.sidebar-item.active { background: var(--accent); color: #fff; }
.sidebar-item.active .sidebar-icon { color: #fff; }
.sidebar-item-disabled { opacity: 0.55; }
.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.sidebar-icon svg { width: 18px; height: 18px; }
.sidebar-label { flex: 1; }
.sidebar-badge { position: absolute; top: 11px; right: 16px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }

/* 主内容区 */
.app-main {
    flex: 1; margin-left: var(--sidebar-w); min-width: 0;
    display: flex; flex-direction: column; min-height: 100vh;
}
.app-header {
    height: var(--nav-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--rule);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 80;
    flex-shrink: 0;
}
.app-header-left { display: flex; align-items: center; gap: 12px; }
.app-header-title { font-size: var(--fs-lg); font-weight: 500; color: var(--ink); }
.app-header-right { display: flex; align-items: center; gap: 16px; }
.header-icon {
    position: relative; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); cursor: pointer; border-radius: var(--radius);
    transition: all 0.18s;
}
.header-icon:hover { background: var(--gray-100); color: var(--ink); }
.header-icon svg { width: 20px; height: 20px; }
.header-badge { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }
.header-user { display: flex; align-items: center; gap: 8px; }
.header-name { font-size: var(--fs-base); color: var(--muted); font-weight: 500; }
.header-logout {
    color: var(--muted); font-size: var(--fs-base); cursor: pointer;
    padding: 6px 12px; border-radius: var(--radius); transition: all 0.18s;
}
.header-logout:hover { color: var(--danger); background: rgba(245, 63, 63, 0.08); }

/* 页面内容 */
.app-page { flex: 1; padding: 24px 0; }
.app-page-inner { padding: 0 24px; }

/* ========== 工具栏/搜索框（前端页面统一：操作按钮居左，搜索栏居右） ========== */
.toolbar { background: transparent; padding: 0; margin-bottom: 16px; }
.toolbar-row { display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.toolbar-left { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar-middle { flex: 0 0 auto; display: flex; align-items: center; }
.toolbar-right { display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
.search-box {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
    background: var(--bg2); border: 1px solid var(--rule); border-radius: var(--radius);
    height: 40px; padding: 0 12px; transition: all 0.2s;
}
.search-box:focus-within { border-color: var(--accent); background: var(--bg2); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { flex: 1; border: none; background: none; outline: none; font-size: var(--fs-base); color: var(--ink); min-width: 0; }
.search-icon { color: var(--faint); flex-shrink: 0; }
.search-icon svg { width: 18px; height: 18px; }
/* 工具栏内搜索框与操作按钮等高（与往来报表状态分组按钮外框一致） */
.toolbar .search-box { height: 36px; }
.toolbar .btn { height: 36px; }

/* ========== 移动端底部 Tab ========== */
.bottom-tab { display: none; }
@media (max-width: 767px) {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; }
    .app-header { padding: 0 16px; }
    .app-page-inner { padding: 0 16px; }
    .header-name { display: none; }
    .bottom-tab {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0;
        height: var(--tabbar-h); background: var(--bg2);
        border-top: 1px solid var(--rule); z-index: 100;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .app-page { padding-bottom: calc(var(--tabbar-h) + 24px); }
}
.bottom-tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--muted); font-size: var(--fs-xs); text-decoration: none; transition: color 0.18s;
}
.bottom-tab-item.active { color: var(--accent); }
.bottom-tab-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.bottom-tab-icon svg { width: 100%; height: 100%; }

/* ========== 列表表格统一最小字号 ==========
   往来报表 / 采购单 / 人员管理 / 产品管理 的列表表格
   表头、数据、数值强调统一使用 --fs-xs，避免字号不一致撑破列宽 */
#batchTable .ft-table .ft-col,
#reportTable .ft-table .ft-col,
.person-table .ft-table .ft-col {
    font-size: var(--fs-xs);
}
#batchTable .ft-table .ft-strong,
#reportTable .ft-table .ft-strong,
.person-table .ft-table .ft-strong {
    font-size: 1em;
}
