/* ============================================================
   多租户 SaaS 底座框架 - 公共样式
   青瓷色主题 + 本地开源字体（SIL Open Font License，可商用）
   ============================================================ */

/* Work Sans（拉丁文，SIL OFL） */
@font-face {
    font-family: 'WorkSans';
    src: url('/static/fonts/WorkSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'WorkSans';
    src: url('/static/fonts/WorkSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'WorkSans';
    src: url('/static/fonts/WorkSans-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'WorkSans';
    src: url('/static/fonts/WorkSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

/* JetBrains Mono（等宽，SIL OFL） */
@font-face {
    font-family: 'JetBrainsMono';
    src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrainsMono';
    src: url('/static/fonts/JetBrainsMono-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

/* 思源黑体 / Noto Sans SC（中文，SIL OFL） */
@font-face {
    font-family: 'NotoSansSC';
    src: url('/static/fonts/NotoSansSC-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'NotoSansSC';
    src: url('/static/fonts/NotoSansSC-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'NotoSansSC';
    src: url('/static/fonts/NotoSansSC-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

/* 阿里巴巴普惠体（中文，阿里巴巴官方免费商用授权）— 对齐底层框架参考项目 */
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/static/fonts/AlibabaPuHuiTi-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/static/fonts/AlibabaPuHuiTi-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/static/fonts/AlibabaPuHuiTi-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

/* === 历史变量（--celadon-*，值已统一映射为松石绿 teal 系，仅供旧代码兼容引用；新代码请使用 --primary-color / --primary-dark） === */
:root {
    /* 历史色板（映射松石绿，与租户主色 --primary-color #0d9488 统一） */
    --celadon-50:  #F0FDFA;
    --celadon-100: #CCFBF1;
    --celadon-200: #99F6E4;
    --celadon-300: #5EEAD4;
    --celadon-400: #2DD4BF;
    --celadon-500: #0d9488;  /* 与 --primary-color 统一 */
    --celadon-600: #0f766e;
    --celadon-700: #0b5d55;
    --celadon-800: #115e59;
    --celadon-900: #134e4a;
    --celadon-rgb: 13, 148, 136;

    /* 中性色 */
    --bg-page:    #F5F7F6;
    --bg-card:    #FFFFFF;
    --bg-hover:   #F0F7F5;
    --text-primary:   #2C3338;
    --text-secondary: #6B7785;
    --text-muted:    #9CA8B5;
    --border-color:  #E4E9ED;

    /* 功能色 */
    --color-success: #10B981;
    --color-warning: #E6A817;
    --color-danger:  #C0392B;
    --color-info:    #6B7280;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(44,51,56,0.06);
    --shadow-md: 0 2px 8px rgba(44,51,56,0.08);
    --shadow-lg: 0 4px 16px rgba(44,51,56,0.12);
}

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

html, body {
    font-family: 'AlibabaPuHuiTi', 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100%;
}

a { text-decoration: none; color: var(--primary-color); }
a:hover { color: var(--primary-dark); }

/* === 搜索输入框 X 清除按钮 === */
.search-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.search-input-wrap .layui-input {
    padding-right: 24px;
}
.search-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    color: #9CA8B5;
    font-size: 15px;
    font-family: Arial, sans-serif;
    border-radius: 50%;
    display: none;
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.15s, background 0.15s;
}
.search-clear-btn:hover {
    color: #6B7785;
    background: rgba(0, 0, 0, 0.08);
}
.search-input-wrap.has-value .search-clear-btn {
    display: block;
}

/* ============================================================
   注：UI 组件样式（弹窗/卡片/表单/搜索栏/表格覆盖/登录页/工作台等）
   已拆分到 tenant.css 与 platform.css，实现两端 UI 完全独立。
   本文件仅保留全局共享的字体、CSS 变量与 reset。
   ============================================================ */


/* ==========================================================================
   PC 端核心组件类（CSS 缺失导致 UI 渲染异常）
   - .content-card: 白底圆角阴影容器（290次）
   - .page-container: 页面布局容器（277次）
   - .bh-cell/bh-label/bh-ctn: 单据头部单元格（259次/259次/262次）
   - .card-header/card-title: 卡片头（157次/154次）
   - .btn-gray: 灰色次要按钮（376次）
   - .input-sm/input-md/input-lg: 输入框尺寸（343+114+36次）
   - .toolbar: 列表工具栏（226次）
   - .modal-footer: 弹窗底部（177次）
   - .in-modal-iframe: 弹窗iframe 内 body（166次）
   - .page-header/page-title: 页面头（118+118次）
   - .plat-search-bar: 顶部搜索栏（107次）
   - .stat-card/stat-icon/stat-info/stat-value/stat-label: 仪表盘（26+9+9+38+31次）
   - .dashboard-grid: 仪表盘网格（3次）
   - .td-label: 表格标签（14次）
   - .paper/print-area: 打印（17+3次）
   - .saas-modal-form: 模态表单（140次）
   - .btn-print/.btn-close: 按钮（3+3次）
   ========================================================================== */

/* 页面容器 */
.page-container {
    padding: 16px;
    background-color: var(--bg-body, #f4f6f9);
    min-height: calc(100vh - 60px);
}
.in-modal-iframe .page-container {
    padding: 0;
    margin: 0;
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: transparent;
    display: flex;
    flex-direction: column;
    /* 对齐参考项目：flex 链约束高度（drawer-body > page-container > content-card > form），
       由 form 内部承载滚动，避免双滚动条且能滚到底 */
}

/* 内容卡片（白底圆角阴影） */
.content-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 6px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin-bottom: 16px;
}
.in-modal-iframe .content-card {
    box-shadow: none;
    border-radius: 0;
    border: none;
    margin: 0;
    padding: 0;
}

/* 卡片头 */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    margin: -20px -24px 20px -24px;
    border-bottom: 1px solid #f0f2f5;
}
.in-modal-iframe .card-header {
    margin: 0 0 16px 0;
    padding: 12px 16px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

/* 按钮 */
.btn-gray {
    display: inline-block;
    height: 38px;
    line-height: 36px;
    padding: 0 16px;
    background-color: #f4f6f9;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
    user-select: none;
    text-decoration: none;
}
.btn-gray:hover { background-color: #e5e7eb; color: #1f2937; }
.btn-gray:active { background-color: #d1d5db; }
.btn-gray[disabled], .btn-gray.btn-disabled { opacity: .5; cursor: not-allowed; }

.btn-print, .btn-close {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    background-color: #fff;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}
.btn-print:hover, .btn-close:hover { color: var(--primary, var(--primary-color, #0d9488)); border-color: var(--primary, var(--primary-color, #0d9488)); }

/* 输入框尺寸 */
.input-sm { height: 32px !important; padding: 0 10px !important; font-size: 13px !important; }
.input-md { height: 38px !important; padding: 0 12px !important; font-size: 14px !important; }
.input-lg { height: 44px !important; padding: 0 14px !important; font-size: 15px !important; }

/* 单据头部 (bill-head + bh-cell + bh-label + bh-ctn) */
.bill-head {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f2f5;
    margin: -20px -24px 20px -24px;
    background-color: #fafbfc;
}
.bh-cell { display: flex; align-items: center; gap: 8px; min-width: 200px; }
.bh-label { color: #6b7280; font-size: 13px; flex-shrink: 0; min-width: 70px; }
.bh-ctn { color: #1f2937; font-size: 14px; flex: 1; min-width: 0; word-break: break-all; }

/* 列表工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.toolbar > .layui-btn-group { display: flex; gap: 4px; }

/* 模态表单 */
.saas-modal-form { padding: 20px 24px; }
.saas-modal-form .layui-form-label { width: 100px; }
.saas-modal-form .layui-input-block { margin-left: 130px; }

/* 模态弹窗底部 */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid #f0f2f5;
    margin: 16px -24px -20px -24px;
    background-color: #fafbfc;
    border-radius: 0 0 8px 8px;
}

/* 页面头 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.page-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

/* 平台顶部搜索栏 */
.plat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.plat-search-bar > .layui-input { width: 240px; }

/* 仪表盘统计卡片 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 6px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: #e8f4fd;
    color: var(--primary, var(--primary-color, #0d9488));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.stat-card.green .stat-icon { background-color: #e8f8ee; color: #07c160; }
.stat-card.blue .stat-icon { background-color: #e8f4fd; color: #1677ff; }
.stat-card.orange .stat-icon { background-color: #fff4e6; color: #fa8c16; }
.stat-card.red .stat-icon { background-color: #fef0f0; color: #f5222d; }
.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 22px; font-weight: 600; color: #1f2937; line-height: 1.2; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* 详情表格 label */
.td-label {
    background-color: #fafbfc !important;
    color: #6b7280 !important;
    font-weight: 500 !important;
    text-align: right;
    width: 110px;
}

/* 打印 */
.paper { background: #fff; padding: 24px; min-height: 100%; }
.print-area { padding: 20px; }
@media print {
    .page-container, .layui-layout-admin .layui-side, .layui-header,
    .toolbar, .page-header, .plat-search-bar { display: none !important; }
    .paper, .print-area { box-shadow: none; padding: 0; }
}

/* iframe 内 body 微调 */
.in-modal-iframe body { background-color: #fff; }


/* ==========================================================================
   PC 端第二批组件类（导入向导/商品SKU表单/商品选择弹窗/金额汇总等）
   ========================================================================== */

/* ---- 批量导入向导 ---- */
.import-page { background-color: var(--bg-body, #f4f6f9); }
.import-body { padding: 4px 0; }
.import-row {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px dashed #eef0f3;
}
.import-row:last-child { border-bottom: none; }
.import-row__label {
    flex-shrink: 0;
    width: 88px;
    padding-top: 7px;
    color: #6b7280;
    font-size: 14px;
}
.import-row__content { flex: 1; min-width: 0; }
.import-btn-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-hint { color: #9ca3af; font-size: 12px; }
.import-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 14px;
    background-color: var(--primary, var(--primary-color, #0d9488));
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}
.import-upload-btn:hover { opacity: .9; }
.import-filename { color: var(--success, #07c160); font-size: 13px; }
.import-tips {
    background-color: #f8fafc;
    border: 1px solid #eef0f3;
    border-radius: 6px;
    padding: 12px 16px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.9;
}
.import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #f0f2f5;
    margin-top: 16px;
}

/* ---- 商品 SKU 表单单元格 ---- */
.sku-image { width: 56px; }
.sku-code { width: 90px; }
.sku-barcode { width: 110px; }
.sku-spec { width: 100px; }
.sku-spec-json { width: 0; height: 0; border: none; padding: 0; opacity: 0; }
.sku-purchase, .sku-sale, .sku-retail, .sku-min-sale, .sku-weight { width: 96px; }
.sku-id { display: none; }

/* ---- 商品搜索/选择弹窗 ---- */
.search-input { width: 100%; }
.mat-check { cursor: pointer; }
.stk { cursor: pointer; color: var(--primary, var(--primary-color, #0d9488)); }
.stk:hover { opacity: .8; }

/* ---- 商品明细表格行（d-* 由模板生成，这里补表格结构）---- */
.table-detail thead th {
    background-color: #fafbfc;
    font-weight: 600;
    color: #4b5563;
    white-space: nowrap;
}
.table-detail tbody td { vertical-align: middle; }
.table-detail input.layui-input { height: 32px; }
.col-batch { width: 120px; }
.col-production { width: 130px; }

/* ---- 金额汇总 ---- */
.amount-summary-row { margin-top: 8px; }
.amount-summary-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px 24px;
    background-color: #fafbfc;
    border: 1px solid #eef0f3;
    border-radius: 6px;
    padding: 12px 16px;
}
.amount-summary-grid .am-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4b5563;
}
.amount-summary-grid .am-cell > label { flex-shrink: 0; }
.amount-summary-grid .am-cell .layui-input { width: 120px; height: 32px; }
.amount-summary-grid .am-cell--total { color: var(--danger, #f5222d); font-weight: 600; font-size: 15px; }
.amount-val { color: var(--danger, #f5222d); font-weight: 600; }
.amount-warn { color: #fa8c16 !important; }
.amt { color: var(--danger, #f5222d); font-weight: 600; }

/* ---- 自定义报表/设计器 ---- */
.type-fields { padding: 12px 0; }
.view-tab { margin-bottom: 12px; }

/* ---- 筛选/排序构造器 ---- */
.f-field, .f-op, .f-value { display: inline-block; margin-right: 6px; }
.f-field select, .f-op select, .f-value input { height: 32px; }
.btn-del-filter, .btn-del-sort, .btn-del-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #f5222d;
    background: #fef0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.s-field, .s-dir { display: inline-block; margin-right: 6px; }
.opt-row, .opt-input { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.refund-input { width: 120px; }

/* ---- 图片预览 ---- */
.img-preview {
    display: inline-block;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    border: 1px solid #eef0f3;
    object-fit: cover;
    vertical-align: middle;
}

/* ---- 其他通用 ---- */
.toggle-icon { cursor: pointer; color: #6b7280; transition: transform .2s; }
.toggle-icon.is-open { transform: rotate(90deg); }
.js-go-link { cursor: pointer; color: var(--primary, var(--primary-color, #0d9488)); }
.ok { color: var(--success, #07c160); }
.v-row { display: flex; align-items: center; gap: 8px; }
.pk-btn-upgrade {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    background: linear-gradient(135deg, #fa8c16, #f5222d);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.pk-btn-upgrade:hover { opacity: .9; }





/* ==========================================================================
   居中抽屉（saasui-drawer）：参考 deepseek_html_20260804_b54e76.html
   纯 DOM 实现：CSS transition + JS transform 动画
   - 打开：从指定方向（默认右侧）滑入中间
   - 关闭：滑回原方向
   - 宽高自适应内容（max-width 96% / max-height 94%）
   ========================================================================== */
.saasui-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    z-index: 998;
}
.saasui-drawer-overlay.open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s 0s;
}

.saasui-drawer {
    position: fixed;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #c8d0d9;
    border-radius: 16px;
    /* 字体：中文阿里巴巴普惠体 + 拉丁 WorkSans + 数字等宽 JetBrainsMono（全 OFL 可商用，本地 woff2） */
    font-family: 'AlibabaPuHuiTi', 'WorkSans', 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    font-size: 14px;
    color: #2C3338;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 96%;
    max-height: 94%;
    width: auto;
    height: auto;
    min-width: 420px;
    min-height: 200px;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    left: 50%;
    top: 50%;
    /* 初始：屏幕右侧外（由 JS 动态设置 transform） */
    transform: translate(calc(-50% + 120%), -50%) scale(0.92);
}
.saasui-drawer.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.saasui-drawer.maximized {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

/* 抽屉内容区：只做滚动容器，内容原样显示（in-modal-iframe 由 JS 添加，套用弹窗样式） */
.saasui-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

/* 底部按钮区 */
.saasui-drawer-footer {
    padding: 12px 28px 18px;
    border-top: 1px solid #eff1f4;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: #fafcfe;
}
.saasui-drawer-footer .btn {
    padding: 8px 28px;
    border-radius: 30px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.saasui-drawer-footer .btn-secondary { background: #f2f4f8; color: #2c3e4f; }
.saasui-drawer-footer .btn-secondary:hover { background: #e4e8ef; }
.saasui-drawer-footer .btn-primary { background: #0d9488; color: #fff; box-shadow: 0 4px 8px rgba(13, 148, 136, 0.2); }
.saasui-drawer-footer .btn-primary:hover { background: #0b8378; }

/* 抽屉内表单页通用调整：去掉页面自身的 page-container 外边距，内容原样完整显示 */

/* 右上角浮动操作按钮（关闭 + 最大化） */
.saasui-drawer-float-btns {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.saasui-drawer-float-btns button {
    background: rgba(242, 244, 248, 0.95);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4d5f72;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    padding: 0;
}
.saasui-drawer-float-btns button:hover { background: #e4e8ef; color: #1f2a3a; }

/* ============================================================
   抽屉式滑入动画（参考 youce.html）：复用原 layui 弹窗，
   标题/圆角/内容样式零改动，仅弹窗整体从右侧滑入中间、关闭滑回右侧
   ============================================================ */
/* 禁用 layui 默认 anim 动画；用 keyframes 实现右侧滑入/滑出（最可靠，不依赖 transition 时序） */
.layui-layer-page.saasui-drawer-slide {
    animation: none !important;
    transform: translateX(0);
}
.layui-layer-page.saasui-drawer-slide.saasui-drawer-opening {
    animation: saasuiDrawerIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}
.layui-layer-page.saasui-drawer-slide.saasui-drawer-closing {
    animation: saasuiDrawerOut 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}
@keyframes saasuiDrawerIn {
    from { transform: translateX(115%); }
    to { transform: translateX(0); }
}
@keyframes saasuiDrawerOut {
    from { transform: translateX(0); }
    to { transform: translateX(115%); }
}

/* ============================================================
   content-drawer 抽屉（参考 youce.html，用户指定规格）：
   - 作用域在内容区：absolute 定位在 #lsTabsContent（右侧主体）内，
     左侧菜单不受影响，遮罩只盖右侧内容区
   - 居中 + 右滑入：left/top 50%，初始藏右侧外，.open 滑入居中
   - 宽高自适应内容：width/height auto + max 96%/94%
   - 三段式 flex：header → body(滚动) → footer(贴底)
   - 最大化：.maximized 100% 去圆角；ESC 关闭
   ============================================================ */
#lsTabsContent { position: relative; }

.content-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    z-index: 10;
}
.content-drawer-overlay.open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s 0s;
}

/* 切 tab 时隐藏非当前选项卡的抽屉（平台端 data-tab 跟随机制，对齐参考项目 ls-drawer-tab-hidden） */
.content-drawer-tab-hidden,
.ls-drawer-tab-hidden {
    display: none !important;
}

.content-drawer {
    position: absolute;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #c8d0d9;
    border-radius: 10px;   /* 对齐采购入库弹窗（saas-modal.layui-layer 圆角 10px） */
    z-index: 15;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 96%;
    max-height: 94%;
    width: auto;
    height: auto;
    min-width: 420px;
    min-height: 200px;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    left: 50%;
    top: 50%;
    /* 初始：屏幕右侧外（隐藏），.open 时滑入居中 */
    transform: translate(calc(-50% + 120%), -50%) scale(0.92);
}
.content-drawer.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.content-drawer.maximized {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    transform: translate(-50%, -50%) scale(1) !important;
    left: 50% !important;
    top: 50% !important;
}

.drawer-header {
    padding: 12px 20px;
    border-bottom: 1px solid #eff1f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #fafcfe;
    border-radius: 10px 10px 0 0;   /* 对齐弹窗标题栏圆角 */
}
.drawer-header h2 {
    font-size: 16px;               /* 对齐弹窗 card-title（16px/600） */
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.drawer-header h2 i { color: #0d9488; font-size: 15px; }
.drawer-header-actions { display: flex; gap: 6px; }
.drawer-header-actions button {
    background: #f2f4f8;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4d5f72;
    padding: 0;
}
.drawer-header-actions button:hover { background: #e4e8ef; }

.drawer-body {
    padding: 0;
    flex: 1;
    overflow: hidden;           /* 外层不滚：内容 form 内部滚动（对齐参考项目 ls-drawer-body，避免双滚动条）*/
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-height: 0;
}
/* 单列窄抽屉（drawer-single-col，measureAndAdjust 按内容类型标记）：
   layui-inline 双字段堆叠成单列（每行一个字段），避免窄容器里并排换行错乱 */
.content-drawer.drawer-single-col .layui-form-item .layui-inline {
    display: block;
    margin-right: 0;
    margin-bottom: 6px;
}
.content-drawer.drawer-single-col .layui-form-item .layui-inline .layui-input-inline {
    width: calc(100% - 130px);
}
.content-drawer.drawer-single-col .layui-form-item .layui-inline:last-child { margin-bottom: 0; }
/* 抽屉内明细表格撑满容器（组合商品组合明细等），列宽按 th 正常渲染，不再被压缩 */
.drawer-body table.layui-table { width: 100% !important; }
.drawer-body .content-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;          /* 内容超高时撑开 body，触发 drawer-body 滚动（修复长表单截断） */
}

.drawer-footer {
    padding: 12px 24px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    background: #fafbfc;   /* 对齐弹窗 modal-footer 背景 */
    border-radius: 0 0 10px 10px;
}
/* 底部按钮：对齐弹窗 modal-footer 的 layui-btn 风格（返回灰、保存蓝） */
.drawer-footer .btn {
    height: 32px;
    padding: 0 18px;
    border-radius: 6px;
    font-weight: 400;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 32px;
}
.drawer-footer .btn-secondary { background: #fff; color: #4b5563; border: 1px solid #d8dee6; }
.drawer-footer .btn-secondary:hover { background: #f5f7fa; }
.drawer-footer .btn-primary { background: #0d9488; color: #fff; }
.drawer-footer .btn-primary:hover { background: #0b8378; }

/* 抽屉内内容：隐藏内容自身重复的标题栏和底部按钮（抽屉自带 header/footer） */
.drawer-body .card-header,
.drawer-body .modal-footer,
.drawer-body .page-header { display: none !important; }
/* 内容表单主体铺满滚动区 */
.drawer-body .page-container { padding: 0; background: transparent; }
.drawer-body .content-card { box-shadow: none; border: none; margin: 0; }
.drawer-body .saas-modal-form { padding: 20px 28px; }

/* ============================================================
   form 多列布局体系（对齐参考项目：form-2col 双列 / form-multi-cols 自适应多列）
   用于抽屉与弹窗内表单的克隆测量自适应
   ============================================================ */
/* JS 切换多列布局时添加 .form-multi-cols，列数按弹窗宽度自适应 */
.in-modal-iframe form[data-layout="form"].form-multi-cols, .in-modal-inline form[data-layout="form"].form-multi-cols {
    display: grid;
    /* 每列最小360px（label100+输入240+间距），自动排列2/3/4列 */
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 0 32px;       /* 列间距 32px，行间距 0（由 form-item margin 控制） */
    align-items: start;
}
/* 整行字段（textarea、选项区、说明文字等）占满整行 */
.in-modal-iframe form[data-layout="form"] .layui-form-item.full-row,
.in-modal-inline form[data-layout="form"] .layui-form-item.full-row,
.in-modal-iframe form[data-layout="form"] .layui-form-item[style*="display:none"], .in-modal-inline form[data-layout="form"] .layui-form-item[style*="display:none"] {
    grid-column: 1 / -1;
}
/* 兼容租户端旧版 layui-form-item 弹窗表单 */
.in-modal-iframe form[data-layout="form"] .layui-form-item, .in-modal-inline form[data-layout="form"] .layui-form-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;   /* 行间距 16px */
}
.in-modal-iframe form[data-layout="form"] .layui-form-label, .in-modal-inline form[data-layout="form"] .layui-form-label {
    flex: 0 0 auto;
    width: 100px;
    padding-right: 12px;
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 32px;
    height: 32px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.in-modal-iframe form[data-layout="form"] .layui-input-block, .in-modal-inline form[data-layout="form"] .layui-input-block {
    flex: 0 0 auto;
    margin-left: 0;
    min-height: auto;
}
/* 输入框按类型设置合理固定宽度（内联 style 优先级更高，可覆盖） */
.in-modal-iframe form[data-layout="form"] .layui-input-block .layui-input,
.in-modal-inline form[data-layout="form"] .layui-input-block .layui-input,
.in-modal-iframe form[data-layout="form"] .layui-input-block select, .in-modal-inline form[data-layout="form"] .layui-input-block select {
    width: 100%;
    max-width: 240px;       /* 普通文本 240px */
}
.in-modal-iframe form[data-layout="form"] .layui-input-block input[type="number"], .in-modal-inline form[data-layout="form"] .layui-input-block input[type="number"] {
    width: 100%;
    max-width: 160px;       /* 短数字 160px */
}
.in-modal-iframe form[data-layout="form"] .layui-input-block textarea, .in-modal-inline form[data-layout="form"] .layui-input-block textarea {
    width: 100%;
    max-width: 480px;       /* 长文本 textarea 480px */
    min-height: 80px;
    padding: 8px 11px;
    line-height: 1.5;
}
.in-modal-iframe form[data-layout="form"] .layui-input-block .layui-form-select, .in-modal-inline form[data-layout="form"] .layui-input-block .layui-form-select {
    width: 100%;
    max-width: 240px;
}
.in-modal-iframe form[data-layout="form"] .layui-form-item .layui-input,
.in-modal-inline form[data-layout="form"] .layui-form-item .layui-input,
.in-modal-iframe form[data-layout="form"] .layui-form-item select, .in-modal-inline form[data-layout="form"] .layui-form-item select {
    height: 32px;
    padding: 0 11px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}
.in-modal-iframe form[data-layout="form"] .layui-form-item .layui-input:focus,
.in-modal-inline form[data-layout="form"] .layui-form-item .layui-input:focus,
.in-modal-iframe form[data-layout="form"] .layui-form-item select:focus, .in-modal-inline form[data-layout="form"] .layui-form-item select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-softer);
    outline: none;
}
.in-modal-iframe form[data-layout="form"] .layui-form-item .layui-form-mid, .in-modal-inline form[data-layout="form"] .layui-form-item .layui-form-mid {
    line-height: 32px;
    padding: 0 0 0 10px;
}
.in-modal-iframe form[data-layout="form"] .layui-form-item .layui-btn + .layui-btn, .in-modal-inline form[data-layout="form"] .layui-form-item .layui-btn + .layui-btn {
    margin-left: 8px;
}
.in-modal-iframe form[data-layout="form"] .layui-form-item:last-child, .in-modal-inline form[data-layout="form"] .layui-form-item:last-child {
    margin-bottom: 0;
    margin-top: 8px;
}

/* === 双列表单布局（字段较多的基础资料弹窗） ===
   用法：在 form 上加 class="form-2col"，字段自动两列排列
   需要跨整行的 item（地址/备注）加 class="full-row" */
.in-modal-iframe form[data-layout="form"].form-2col, .in-modal-inline form[data-layout="form"].form-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 32px;       /* 列间距 32px */
    row-gap: 16px;          /* 行间距 16px */
    padding: 20px 24px;
}
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item, .in-modal-inline form[data-layout="form"].form-2col .layui-form-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0;  /* grid 的 row-gap 已控制行距 */
}
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item.full-row, .in-modal-inline form[data-layout="form"].form-2col .layui-form-item.full-row {
    grid-column: 1 / -1;  /* 跨整行 */
}
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-block,
.in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-block,
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-inline, .in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-inline {
    flex: 1 1 auto;       /* 输入框占满剩余宽度 */
    margin-left: 0;
    min-height: auto;
}
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-block .layui-input,
.in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-block .layui-input,
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-inline .layui-input,
.in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-inline .layui-input,
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-block select,
.in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-block select,
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-inline select, .in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-inline select {
    width: 100%;
    max-width: 100%;     /* 双列下输入框占满 cell，不再固定 240px */
}
.in-modal-iframe form[data-layout="form"].form-2col .layui-form-item .layui-input-block textarea, .in-modal-inline form[data-layout="form"].form-2col .layui-form-item .layui-input-block textarea {
    width: 100%;
    max-width: 100%;
    min-height: 60px;
}

