        html {
            height: 100%;
            /* overflow: hidden; */
            background: #f2f3f5;
        }

        body {
            height: 100%;
            /* 只允许纵向滚动，禁止横向滚动（兜底防止个别控件溢出导致整页能左右拖动） */
            overflow-x: hidden;
            overflow-y: auto;
            /* 只允许纵向拖动手势 + 双指缩放，禁止左右拖动整页；
               不能用 touch-action: none/pan-y 单独限制，那样连缩放手势也会被禁掉 */
            touch-action: pan-y pinch-zoom;
            /* 去掉浏览器默认的 8px 外边距，让表格铺满屏幕宽度 */
            margin: 0;
        }

        /* table横向居中显示 */
        .table-wrapper {
            max-width: 500px;
        }

        table {
            border-collapse: separate;
            border-spacing: 0;
            border: 1px solid #e5e6eb;
            text-align: center;
            border-radius: 0px;
            color: #1e2128;
            background-color: #ffffff;
            margin-top: 0px;
            /* height: 1000px; */
            /* margin-bottom: 80px; */
            /* max-width: 500px; */
            width: 100%;
            table-layout: fixed;
        }

        .table-detail {
            /* padding-bottom: 80px; */
            display: flex;
            /* 两张表数据行数不同，默认的 align-items:stretch 会把两表拉成等高，
               行数少的一侧每行（含表头）被撑高。改为 flex-start 让两表各自按
               自然行高渲染、顶部对齐，每一行高度一致。 */
            align-items: flex-start;
        }

        /* 给所有单元格设置右边及下边的边框 */
        table td,
        table th {
            border-right: 1px solid #e5e6eb;
            border-bottom: 1px solid #e5e6eb;
        }

        /* 最右侧的单元格不显示边框 */
        table td:last-child,
        table th:last-child {
            border-right: none;
        }

        /* 最下方的单元格不显示边框 */
        table tr:last-child td,
        table tr:last-child th {
            border-bottom: none;
        }

        /* 最下方左侧的单元格左下角设置为圆角 */
        table tr:last-child td:first-child {
            border-bottom-left-radius: 0px;
        }

        /* 最下方右侧的单元格右下角设置为圆角 */
        table tr:last-child td:last-child {
            border-bottom-right-radius: 0px;
        }

        table .title {
            background-color: #f2f3f5;
        }

        table .light {
            background-color: #f7f8fa;
        }

        table input {
            box-sizing: border-box;
            width: 100%;
            /* input（尤其 type=date/number）默认有原生最小宽度，在 iOS Safari/微信 等
               WebKit 里会撑破固定宽的单元格、导致整页横向滚动。min-width:0 让它可被
               压缩到列宽内。 */
            min-width: 0;
            border: none;
            text-align: center
        }

        /* 输入框右侧的历史记录按钮（公司名/项目名/备注/装车须知） */
        .history-btn {
            position: absolute;
            right: 2px;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            background: transparent;
            color: #86909c;
            padding: 2px 4px;
            font-size: 15px;
            line-height: 1;
            cursor: pointer;
        }

        /* 历史选择弹窗的列表 */
        #history-pop .history-list {
            max-height: 50vh;
            overflow-y: auto;
        }

        #history-pop .history-item {
            display: flex;
            align-items: center;
            padding: 11px 6px;
            border-bottom: 1px solid #e5e6eb;
            font-size: 14px;
            color: #1e2128;
            cursor: pointer;
        }

        /* 最后一项不画分割线，避免列表尾部多出一条与弹窗底边重叠的线 */
        #history-pop .history-item:last-child {
            border-bottom: none;
        }

        #history-pop .history-item:active {
            background: #f2f3f5;
        }

        #history-pop .history-text {
            flex: 1;
            min-width: 0;
            word-break: break-all;
        }

        #history-pop .history-del {
            flex-shrink: 0;
            border: none;
            background: transparent;
            color: #c9cdd4;
            font-size: 16px;
            padding: 6px 8px;
            margin-left: 8px;
            cursor: pointer;
        }

        #history-pop .history-del:active {
            color: #ea3324;
        }

        /* 整表单历史列表项：左侧摘要（公司·项目 + 时间），右侧删除按钮 */
        #form-history-pop .form-history-item {
            display: flex;
            align-items: center;
            padding: 10px 4px 10px 6px;
            border-bottom: 1px solid #e5e6eb;
            cursor: pointer;
        }

        #form-history-pop .form-history-item:active {
            background: #f2f3f5;
        }

        /* 历史单据弹窗：标题/说明/底部按钮固定，只有中间列表滚动 */
        #form-history-pop .pop-card {
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        #form-history-pop .pop-header,
        #form-history-pop .pop-desc,
        #form-history-pop .pop-actions {
            flex-shrink: 0;
        }

        #form-history-pop .history-list {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
        }

        #form-history-pop .fh-main {
            flex: 1;
            min-width: 0;
        }

        #form-history-pop .fh-label {
            font-size: 14px;
            font-weight: bold;
            color: #1e2128;
            word-break: break-all;
        }

        #form-history-pop .fh-line {
            font-size: 12px;
            color: #4e5969;
            margin-top: 3px;
            word-break: break-all;
        }

        #form-history-pop .fh-time {
            font-size: 12px;
            color: #86909c;
            margin-top: 3px;
        }

        #form-history-pop .fh-del {
            flex-shrink: 0;
            border: none;
            background: transparent;
            color: #c9cdd4;
            font-size: 16px;
            padding: 6px 8px;
            margin-left: 8px;
            cursor: pointer;
        }

        #form-history-pop .fh-del:active {
            color: #ea3324;
        }

        /* 单位/重量列始终不展示。注意：这里故意不用 display:none ——
           table-layout:fixed 下，某一列的单元格若 display:none，紧跟其后
           那一列的 colgroup 宽度会错位归零（浏览器的列宽分配bug）。
           改用宽度收缩为0+溢出隐藏，视觉效果一致，且不影响相邻列宽度。 */
        table .unitName,
        table .weight {
            overflow: hidden;
            padding: 0 !important;
            border: none !important;
        }

        /* 品名列内容溢出时裁切，保持表格行高稳定 */
        table .name {
            overflow: hidden;
        }

        /* 生成图片时：改用内容自适应列宽 + 禁止换行，让每个格子完整显示内容。 */
        .table-wrapper.generating table {
            table-layout: auto;
        }
        .table-wrapper.generating table td {
            white-space: nowrap;
        }
        .table-wrapper.generating table .unitName {
            display: none;
        }

        /* 外层容器原本被 max-width:500px 限死，表格撑宽后会直接溢出被裁切。
           生成图片时解除这个限制，让容器跟着内容一起长大，html2canvas
           才能截到完整宽度。table-detail的两张表也不允许被flex压缩。 */
        .table-wrapper.generating {
            max-width: none;
            width: max-content;
        }
        .table-wrapper.generating .table-detail {
            width: max-content;
        }
        .table-wrapper.generating .table-detail>table {
            flex-shrink: 0;
            width: auto;
        }

        table .spec {
            font-size: 12px;
        }

        table .unit {
            color: #ea3324;
            font-weight: bold;
        }

        table .weight {
            background-color: #ffff00;
        }

        table tr {
            height: 25px;
        }

        /* 遮罩层 */
        #result-pop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            box-sizing: border-box;
            padding: 24px 16px;
            overflow: auto;
        }

        #result-pop .result-preview {
            display: flex;
            flex-direction: column;
            align-items: center;
            max-width: 92vw;
            max-height: calc(100vh - 80px);
            box-sizing: border-box;
        }

        #result-pop img {
            display: block;
            max-height: calc(100vh - 164px);
            max-width: 100%;
            background-color: #fff;
            border-radius: 6px;
            overflow: hidden;
            object-fit: contain;
        }

        #result-pop .result-tip {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            width: max-content;
            max-width: calc(100% - 32px);
            min-height: 32px;
            margin-bottom: 10px;
            padding: 0 11px;
            color: #fff;
            background: rgba(30, 33, 40, 0.78);
            border: 1px solid rgba(255, 255, 255, 0.22);
            border-radius: 999px;
            box-sizing: border-box;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 13px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
            pointer-events: none;
        }

        #result-pop .result-tip-icon {
            display: inline-block;
            transform: rotate(180deg);
            font-size: 15px;
        }

        #result-pop .result-close {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            min-width: 92px;
            height: 36px;
            margin-top: 10px;
            padding: 0 14px;
            border: 1px solid #e5e6eb;
            border-radius: 8px;
            background: #fff;
            color: #1e2128;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
        }

        #result-pop .result-close i {
            font-size: 18px;
        }

        #result-pop .result-close:active {
            background: #f2f3f5;
        }

        /* 生成中的加载遮罩 */
        #loading-pop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #loading-pop .loading-box {
            background-color: #fff;
            border-radius: 10px;
            border: 1px solid #e5e6eb;
            padding: 24px 32px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
        }

        #loading-pop .spinner {
            width: 28px;
            height: 28px;
            border: 3px solid #e5e6eb;
            border-top-color: #2d5cf6;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        #loading-pop .loading-text {
            font-size: 14px;
            color: #1e2128;
        }

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

        #bottom {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            box-sizing: border-box;
            background-color: #ffffff;
            border-top: 1px solid #e5e6eb;
            padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        #weight-summary {
            min-width: 0;
            text-align: left;
        }

        #weight-summary .sub {
            display: block;
            font-size: 11px;
            color: #86909c;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #weight-summary .total {
            display: block;
            font-size: 18px;
            font-weight: bold;
            color: #2d5cf6;
            white-space: nowrap;
        }

        #bottom .btns {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        /* 主操作按钮：底部工具栏"生成"、弹窗里的"确定覆盖"等真正的主操作 */
        button.primary {
            background-color: #2d5cf6;
            border: 1px solid #2d5cf6;
            color: #fff;
            padding: 0 15px;
            border-radius: 6px;
            font-size: 14px;
            height: 32px;
            cursor: pointer;
        }

        /* 次要操作按钮：底部工具栏"重置"、弹窗里的"取消/关闭"等 */
        button.outline {
            background-color: #fff;
            color: #505968;
            border: 1px solid #e5e6eb;
            padding: 0 15px;
            border-radius: 6px;
            font-size: 14px;
            height: 32px;
            cursor: pointer;
        }

        /* 纯图标按钮：底部工具栏"历史单据"，无背景块，点击态给淡淡反馈 */
        .icon-btn {
            background-color: transparent;
            border: none;
            color: #505968;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
        }

        .icon-btn:active {
            background-color: rgba(0, 0, 0, 0.05);
        }

        /* 通用组件 */
        /* Toast，悬浮在底部10% */
        #toast {
            position: fixed;
            bottom: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 200px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            border-radius: 2px;
            background-color: rgba(0, 0, 0, 0.7);
            color: #fff;
            z-index: 999;
            opacity: 100;
            transition: all 1s;
        }

        .mask {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
            overflow: auto;
        }

        /* 弹窗淡入淡出：配合 <transition name="fade"> 使用，Vue 会在 v-show 切换时
           自动加上/去掉这些类名。只做透明度变化，不做缩放/位移。 */
        .fade-enter-active,
        .fade-leave-active {
            transition: opacity 0.25s ease-out;
        }

        .fade-enter,
        .fade-leave-to {
            opacity: 0;
        }

        .mask>.content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 300px;
            height: 200px;
            background-color: #fff;
            border-radius: 6px;
            z-index: 1000;
            padding: 20px;
        }

        /* 弹窗通用样式：历史选择/历史单据/确认弹窗共用，
           用 flex 居中替代 .mask>.content 的绝对定位，高度随内容自适应 */
        .mask.pop {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px 16px;
            box-sizing: border-box;
        }

        .mask.pop>.pop-card {
            position: static;
            transform: none;
            width: 100%;
            max-width: 340px;
            height: auto;
            max-height: 80vh;
            overflow-y: auto;
            padding: 20px;
            text-align: left;
            box-sizing: border-box;
            border-radius: 10px;
            border: 1px solid #e5e6eb;
        }

        .pop-header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
            padding-bottom: 12px;
            border-bottom: 1px solid #f2f3f5;
        }

        #form-history-pop .pop-header {
            flex-wrap: wrap;
        }

        #form-history-pop .pop-header .pop-title {
            flex: 1;
        }

        #form-history-pop .pop-desc {
            width: 100%;
            margin: 4px 0 0;
        }

        .pop-header-icon {
            flex-shrink: 0;
            font-size: 18px;
            color: #2d5cf6;
        }

        .pop-title {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-weight: bold;
            font-size: 16px;
            color: #1e2128;
        }

        .pop-header-close {
            margin-left: auto;
            background: none;
            border: none;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            font-size: 20px;
            color: #86909c;
            padding: 0;
            line-height: 1;
            border-radius: 6px;
        }

        .pop-header-close:hover {
            color: #1e2128;
        }

        .pop-header-close:active {
            background: rgba(0, 0, 0, 0.05);
        }

        .pop-desc {
            color: #86909c;
            font-size: 12px;
            margin: -6px 0 12px;
        }

        #form-history-pop .pop-desc {
            margin: 4px 0 0;
            width: 100%;
        }

        .pop-empty {
            color: #86909c;
            font-size: 14px;
            padding: 24px 0;
            text-align: center;
        }

        .pop-actions {
            text-align: right;
            margin-top: 16px;
        }

        #company-select {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
            overflow: auto;
        }
