:root {
    --primary: #2f6fed;
    --primary-dark: #1f56c4;
    --danger: #e5484d;
    --success: #30a46c;
    --bg: #f5f6f8;
    --border: #e3e5e8;
    --text: #22262b;
    --muted: #7a828c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background: #1d2733;
    color: #c6d0db;
    padding: 18px 0;
    flex-shrink: 0;
    overflow-y: auto;
}
.brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding: 0 20px 18px;
    border-bottom: 1px solid #2b3846;
}
.sidebar nav { padding: 12px 0; }
.sidebar nav a {
    display: block;
    padding: 11px 20px;
    color: #c6d0db;
    font-size: 14px;
}
.sidebar nav a:hover { background: #263341; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a.nav-sub {
    padding-left: 38px;
    font-size: 13px;
    color: #9fb0c3;
}
.sidebar nav a.nav-sub:hover { color: #fff; background: #263341; }
.sidebar nav .nav-group-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar nav .nav-section.nav-group-main { cursor: pointer; }
.nav-arrow {
    font-size: 16px;
    line-height: 1;
    color: #9fb0c3;
    margin-left: 8px;
    transition: transform .2s;
}
.sidebar nav a.nav-group-main.open .nav-arrow { transform: rotate(180deg); }
.nav-sub-wrap {
    overflow: hidden;
    max-height: 500px;
    transition: max-height .25s ease;
}
.nav-sub-wrap.closed { max-height: 0; }
.sidebar nav .nav-section {
    padding: 14px 20px 6px;
    font-size: 12px;
    color: #6f7d8d;
}
@media (max-width: 768px) {
    .nav-sub-wrap { width: 100%; }
}

/* 权限勾选 */
.perm-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.perm-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: stretch;
}
.perm-group {
    flex: 1 1 320px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fbfcfd;
}
.perm-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.perm-line {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
}
.perm-line-group {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    padding-top: 3px;
    min-width: 78px;
}
.perm-badges {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: hidden;
    max-width: 100%;
}
.perm-badges .badge {
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.2;
}
.perm-badges .perm-badge-more { line-height: 1.2; }
.perm-badges.perm-expanded {
    flex-wrap: wrap;
    overflow: visible;
}
body.app-view .perm-badges {
    flex-wrap: wrap;
    overflow: visible;
}
.admins-table td:nth-child(2) { max-width: 520px; }
body:not(.app-view) .admins-table td { font-size: 0; line-height: 0; }
body:not(.app-view) .admins-table td:first-child { font-size: 14px; line-height: normal; }
.perm-badge-more {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 8px;
    border: 1px solid #2f6fed;
    border-radius: 12px;
    background: #eef4fe;
    color: #2f6fed;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.perm-pop {
    position: fixed;
    z-index: 600;
    width: 340px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 10px;
    font-size: 12px;
}
.perm-pop-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #1d2733;
}
.perm-pop-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.remark-cell {
    white-space: pre-line;
}
.cost-tax-price,
.tax-price {
    color: #e5484d;
    font-weight: 600;
}
.cost-pick-hidden {
    display: none !important;
}
.scan-hint {
    color: #e5484d;
    font-size: 13px;
    font-weight: 400;
}
.admins-table td:first-child,
.admins-table td:last-child {
    white-space: nowrap;
}
.perm-grid .perm-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.perm-grid .perm-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--primary);
}

/* 成本逐行录入 */
#cost-rows .cost-row {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
}
.cost-row-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 16px;
}
.cost-row-grid .cost-field {
    width: fit-content;
    min-width: 0;
}
.cost-field {
    display: block;
    font-size: 12px;
    color: var(--muted);
}
.cost-field input,
.cost-field select,
.cost-field textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 8px 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    background: #fff;
    font-family: inherit;
}
.cost-field input:focus,
.cost-field select:focus,
.cost-field textarea:focus { outline: none; border-color: var(--primary); }
.out-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: #fbfbfc;
}
.out-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}
.out-row-no { font-size: 12px; color: var(--muted); }
.out-row-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}
.out-row-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 16px;
}
/* 出库登记：辅料/充电器/备注一行，宽度适应内容靠左 */
.out-row-end {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}
.out-row-end .cost-field {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
}.out-row-grid .cost-field {
    width: fit-content;
    min-width: 0;
}
.out-row-grid .out-product {
    width: 200px;
}
.out-row-grid .out-qty {
    width: 60px;
}
.out-row-grid .out-codes {
    width: 310px;
}
.out-row-grid .out-note {
    width: 330px;
}
.out-row-grid .cost-field textarea { min-height: 34px; resize: vertical; }

/* 出库登记-生产单号勾选 */
.po-pick {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    margin-top: 5px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    min-height: 34px;
    max-height: 104px;
    overflow-y: auto;
    box-sizing: border-box;
}
.out-row-grid .po-pick { width: auto; flex: 1 1 auto; min-width: 220px; max-width: 100%; }
.po-pick .muted { padding: 4px 2px; }
.po-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #2f6fed;
    background: #eef4fe;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
}
.po-check input {

    width: auto;
    height: auto;
    margin: 0;
    display: inline-block;
}

/* 出库登记-生产单号点选标签（每行两个，选中变红） */
.po-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    flex: none;
    box-sizing: border-box;
    font-size: 12px;
    color: #2f6fed;
    background: #eef4fe;
    border: 1px solid #c9d6e8;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.po-tag:hover { border-color: #2f6fed; }
.po-tag.sel { background: #fdecec; color: #e5484d; border-color: #e5484d; }
.out-row-grid .out-codes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-height: 34px;
    width: 400px;
    box-sizing: border-box;
}
@media (max-width: 992px) {
    .out-row-grid {
        grid-template-columns: minmax(150px, 1fr) 90px minmax(160px, 1fr);
    }
    .out-row-grid .cost-field:first-child,
    .out-row-grid .cost-field:nth-child(4) {
        grid-column: 1 / -1;
    }
}
@media (max-width: 560px) {
    .out-row-grid { grid-template-columns: 1fr; }
    .out-row-grid .cost-field:first-child,
    .out-row-grid .cost-field:nth-child(4) { grid-column: auto; }
}
.cost-row-summary {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 12px;
    font-size: 14px;
}
.cost-row-summary .btn { margin-left: auto; }
.cost-row-summary .cost-row-btns {
    margin-left: auto;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.cost-row-summary .cost-row-btns .btn { margin-left: 0; }
.cost-row-summary .cost-add-row-btn {
    border: 1px solid #2f6fed;
    color: #2f6fed;
    background: #fff;
}
.cost-row-summary .cost-del-row-btn {
    border: 1px solid #e5484d;
    color: #e5484d;
    background: #fff;
}

/* 报价页左右布局 + 弹窗 */
.prices-layout { display: flex; gap: 16px; align-items: stretch; }
.prices-left { flex: 1; min-width: 0; display: flex; }
.prices-left .panel { flex: 1; }
.prices-right { width: 320px; flex-shrink: 0; display: flex; }
.prices-right .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.prices-right .panel form {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.prices-right textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    flex: 1;
    min-height: 90px;
    resize: vertical;
}
.prices-right textarea:focus { outline: none; border-color: var(--primary); }

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.modal {
    background: #fff;
    border-radius: 12px;
    width: 92%;
    max-width: 420px;
    padding: 22px;
    text-align: center;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--danger); margin-bottom: 12px; }
.modal-content {
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 18px;
    text-align: left;
}
.prod-detail {
    text-align: left;
    margin-bottom: 16px;
}
.prod-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
}
.prod-row .prod-col {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
}
.prod-row .prod-col + .prod-col { margin-left: 16px; }
.prod-row span { color: var(--muted); }
.ship-overdue { color: var(--danger); font-weight: 700; }
.shield-icon { display: inline-block; margin-left: 4px; filter: hue-rotate(70deg) saturate(2); }

/* 生产排单打印 */
.print-area { display: none; }
.print-preview-body {
    background: #fff;
    padding: 12px 16px;
    color: #222;
    font-size: 12px;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.print-preview-body .print-head {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    min-height: 80px;
    border-bottom: 2px solid #222;
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.print-preview-body .print-head-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 80px;
    flex: 1;
    min-width: 0;
}
.print-preview-body .print-title-line {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.print-preview-body .print-no {
    font-size: 13px;
    font-weight: 400;
    color: #555;
    line-height: 1.3;
}
.print-preview-body .p-row {
    display: flex;
    gap: 24px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.print-preview-body .p-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.print-preview-body .p-cell span { color: #555; flex-shrink: 0; }
.print-preview-body .p-cell b {
    font-weight: 400;
    word-break: break-all;
}
.print-preview-body .print-qr {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.print-preview-body .print-qr img,
.print-preview-body .print-qr canvas {
    width: 80px;
    height: 80px;
}
/* 生产排单打印内容：随打印尺寸设置整体缩放（--po-scale 由页面注入，打印前可自动再缩小） */
body.print-sheet #print-area {
    display: block;
    box-sizing: border-box;
    padding: calc(var(--po-scale, 1) * 1.5mm) calc(var(--po-scale, 1) * 2mm);
    color: #222;
    font-size: calc(var(--po-scale, 1) * 9px);
    overflow: hidden;
}
body.print-sheet #print-area .print-sheet-label {
    break-inside: avoid;
    page-break-inside: avoid;
}
body.print-sheet #print-area .print-head {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    min-height: calc(var(--po-scale, 1) * 80px);
    border-bottom: calc(var(--po-scale, 1) * 1px) solid #222;
    padding-bottom: calc(var(--po-scale, 1) * 1mm);
    margin-bottom: calc(var(--po-scale, 1) * 1mm);
}
body.print-sheet #print-area .print-head-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: calc(var(--po-scale, 1) * 1px);
    min-height: calc(var(--po-scale, 1) * 80px);
    flex: 1;
    min-width: 0;
}
body.print-sheet #print-area .print-title-line {
    font-size: calc(var(--po-scale, 1) * 12px);
    font-weight: 700;
    line-height: 1.15;
}
body.print-sheet #print-area .print-no {
    font-size: calc(var(--po-scale, 1) * 10px);
    font-weight: 400;
    color: #555;
    line-height: 1.15;
}
body.print-sheet #print-area .p-row {
    display: flex;
    gap: calc(var(--po-scale, 1) * 12px);
    padding: calc(var(--po-scale, 1) * 1.5px) 0;
    border-bottom: calc(var(--po-scale, 1) * 1px) solid #eee;
}
body.print-sheet #print-area .p-cell {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: calc(var(--po-scale, 1) * 6px);
}
body.print-sheet #print-area .p-cell span { color: #555; flex-shrink: 0; }
body.print-sheet #print-area .p-cell b { font-weight: 400; word-break: break-all; }
body.print-sheet #print-area .print-qr {
    width: calc(var(--po-scale, 1) * 80px);
    height: calc(var(--po-scale, 1) * 80px);
    flex-shrink: 0;
}
body.print-sheet #print-area .print-qr img,
body.print-sheet #print-area .print-qr canvas {
    width: calc(var(--po-scale, 1) * 80px);
    height: calc(var(--po-scale, 1) * 80px);
}
@media print {
    /* 生产排单打印：纸张尺寸由「打印尺寸设置」控制（页面内联样式注入 @page） */
    @page { size: 60mm 40mm; margin: 0; }
    body.print-sheet > *:not(#print-area) {
        display: none !important;
    }
    body.print-sheet #print-area {
        position: static;
        left: auto;
        top: auto;
    }
}

/* 右下角悬浮操作按钮 */
.float-actions {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}
.float-actions .btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    padding: 10px 18px;
}
.flow-label {
    font-size: 14px;
    color: var(--muted);
    margin-right: 4px;
    align-self: center;
}

@media (max-width: 992px) {
    .prices-layout { flex-direction: column; }
    .prices-right { width: 100%; }
}

.main {
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-left .home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #eef4fe;
    color: #2f6fed;
    font-size: 16px;
    text-decoration: none;
    flex-shrink: 0;
}
.topbar-left .home-btn:hover {
    background: #dce9ff;
}
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.menu-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 150;
}
.user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

    .content {
        padding: 24px;
        width: 100%;
        max-width: 1440px;
        box-sizing: border-box;
        margin: 0;
    }

.welcome { margin-bottom: 18px; }
.welcome h2 { margin: 0 0 6px; font-size: 22px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
}
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: var(--muted); margin-top: 4px; font-size: 13px; }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 16px;
}
.panel h3 { margin: 0 0 12px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panel-head h3 { margin: 0; }
.placeholder-box {
    margin-top: 14px;
    padding: 26px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    background: #fafbfc;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
code {
    background: #f0f2f5;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 13px;
}

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
/* 散客表单：用友智慧车间风格 */
.wk-panel {
    padding: 18px 20px 20px;
}
.wk-form {
    margin-top: 4px;
}
.wk-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
    align-items: flex-end;
}
.wk-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #6b7a8d;
    min-width: 0;
}
.wk-fields label input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    font-size: 14px;
    color: #1d2733;
    box-sizing: border-box;
    background: #fff;
}
.wk-fields label input:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 2px rgba(47, 111, 237, .12);
}
.wk-fields label.wk-full {
    width: 100%;
}
.wk-fields label.wk-full input {
    width: 420px;
}
/* PC 新增散客：备注紧跟微信号后面同行显示 */
.wk-fields label.wk-remark {
    width: auto;
    flex: 1 1 200px;
    min-width: 0;
}
.wk-fields label.wk-remark input {
    width: 100%;
}
.wk-fields .req {
    color: #e5484d;
    font-weight: 700;
}/* 散客列表操作按钮高度 30px */
.table td.actions.walkin-actions .btn-sm {
    height: 30px;
    min-height: 30px;
    line-height: 28px;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}
body.app-view .table td.actions.walkin-actions .btn-sm {
    height: 30px;
    min-height: 30px;
    line-height: 28px;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}
/* 溯源码列表：操作按钮高度 32px，行分隔线与按钮对齐 */
.table td.actions.tc-actions {
    vertical-align: middle;
    white-space: nowrap;
}
.table td.actions.tc-actions form.inline { display: inline-block; margin: 0; vertical-align: middle; }
.table td.actions.tc-actions .btn-sm,
.table td.actions.tc-actions a.btn-sm,
.table td.actions.tc-actions button.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-height: 32px;
    line-height: 30px;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}
/* 管理员列表：操作按钮高度 32px，行分隔线与按钮对齐 */
.table td.actions.admins-actions {
    display: table-cell;
    white-space: nowrap;
    width: 1px;
    padding: 0;
    font-size: 0;
    line-height: 0;
}
.table td.actions.admins-actions .admins-act-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 52.7px;
    padding: 10px 12px;
    box-sizing: border-box;
}
.table td.actions.admins-actions form.inline { margin: 0; }
.table td.actions.admins-actions .btn-sm,
.table td.actions.admins-actions a.btn-sm,
.table td.actions.admins-actions button.btn-sm {
    display: inline-flex;
    vertical-align: middle;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-height: 32px;
    line-height: 30px;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}
.btn-outline-primary {
    border-color: #9cc0f8;
    color: var(--primary);
    background: #fff;
}
.btn-outline-primary:hover,
body.app-view .btn.btn-outline-primary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef4fe;
}
.btn:disabled,
button:disabled {
    opacity: .5;
    cursor: not-allowed;
}.btn-outline-danger {
    border-color: #f3c0c2;
    color: var(--danger);
    background: #fff;
}
.btn-outline-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fdecec;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-card {
    width: 360px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-card form { margin-top: 20px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.login-card input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--primary); }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-danger { background: #fdecec; color: var(--danger); border: 1px solid #f7c6c8; }
.alert-info { background: #eef4fe; color: var(--primary-dark); border: 1px solid #c9dcf9; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; background: #fafbfc; }
.table .empty { text-align: center; color: var(--muted); padding: 24px; }

/* 售后列表：同单合并单元格 */
.as-merge { background: #fbfcfe; }
.as-ship-info {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 2px;
}
.as-code-info {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 2px;
    word-break: break-all;
    overflow-wrap: anywhere;
}
.as-ship-form { margin-top: 6px; }
.as-ship-form input {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}
.stock-form { margin-top: 6px; }
.stock-form input {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    width: 90px;
}
.mat-unit,
.mat-price,
.mat-warn,
.mat-stock {
    width: 110px !important;
}
.mat-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mat-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}
.mat-form-row label {
    flex: 1;
    min-width: 220px;
    font-size: 13px;
    color: var(--muted);
}
.mat-form-row label input,
.mat-form-row label select {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
.mat-form-row label input:focus,
.mat-form-row label select:focus { outline: none; border-color: var(--primary); }
.mat-form-small label {
    flex: 0 1 160px;
    min-width: 130px;
}
.mat-form-small label input,
.mat-form-small label select {
    width: 110px;
}
.mat-supplier {
    width: 220px !important;
}
.mat-model {
    width: 400px !important;
}
.sa-fields-row {
    align-items: flex-end;
}
.sa-fields-row label {
    flex: 0 1 auto;
    min-width: 0;
}
.scan-form input[name="barcode"] { width: 220px; }
.scan-form input[name="qty"] { width: 70px; }
.scan-form input[name="unit_price"] { width: 110px; }
.scan-form input[name="note"] { width: 160px; }
.dict-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.dict-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    background: #fff;
}
.dict-code {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}
.dict-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    word-break: break-all;
}
.dict-del {
    position: absolute;
    top: 0;
    right: 2px;
    border: none;
    background: none;
    color: #c0c6cd;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.dict-del:hover { color: var(--danger); }
@media (max-width: 992px) {
    .dict-grid { grid-template-columns: repeat(3, 1fr); }
}
.tc-code-cell {
    position: relative;
    cursor: pointer;
}
.tc-tip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 99;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.bc-copied {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 99;
    background: #e6f6ec;
    color: #1a8a4c;
    border: 1px solid #bfe6cf;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
/* 入库登记-序号选择 */
.si-seqs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fbfbfc;
    min-height: 40px;
}
.si-seq {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #2f6fed;
    background: #eef4fe;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
}
.si-seqs .si-seq input { display: none !important; }
.si-seq.sel { background: #fdecec; color: #e5484d; border: 1px solid #e5484d; }
.si-trace {
    display: flex;
    flex-wrap: wrap;
    gap: 0 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fbfbfc;
    min-height: 34px;
    font-size: 12px;
}
.si-trace-item { color: #2f6fed; white-space: nowrap; }

.stock-customer-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    margin-bottom: 14px;
}
.stock-customer-row .form-block {
    flex: 0 1 auto;
    min-width: 0;
    margin-bottom: 0;
}
.stock-customer-row select {
    width: auto;
    min-width: 160px;
    max-width: 100%;
}

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-grid label { display: block; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--primary); }
.form-grid .full { grid-column: 1 / -1; }
.form-inline { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.form-inline label { font-size: 13px; color: var(--muted); }
.form-inline input, .form-inline select {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}
.form-inline input:focus, .form-inline select:focus { outline: none; border-color: var(--primary); }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.actions form.inline { margin-top: 0; }
/* 表格操作栏：按钮高度与同行内容一致（撑满行内容高度） */
.table td.actions { white-space: nowrap; }
.table td.actions form.inline { display: inline-block; margin: 0; vertical-align: middle; }
.table td.actions .btn {
 display: inline-flex; align-items: center; justify-content: center; min-height: 44px; box-sizing: border-box; vertical-align: middle; }

/* 售后操作列：两行显示、按钮高度统一 */
.table td.actions.as-actions {
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    max-width: 430px;
}
.table td.actions.as-actions form.inline { margin: 0; }
.table td.actions.as-actions .btn,
.table td.actions.as-actions a.btn {
    min-height: 30px;
    height: 30px;
    padding: 0 10px;
    line-height: 28px;
}
.inline { display: inline; }

/* 修改密码 */
.form-block { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.form-block input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.form-block input:focus { outline: none; border-color: var(--primary); }
.form-block select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
}
.form-block select:focus { outline: none; border-color: var(--primary); }
.admin-top-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}
.admin-top-row label {
    flex: 1;
    min-width: 0;
}
.admin-top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 0 0 auto;
}

/* 徽章 */
.badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 12px;
    background: #eef0f3;
    color: var(--muted);
}
.badge-ok { background: #e9f7ef; color: var(--success); }
.badge-off { background: #fdecec; color: var(--danger); }
.badge-up { background: #fdecec; color: var(--danger); }
.badge-down { background: #e9f7ef; color: var(--success); }
.stock-zero { color: var(--danger); font-weight: 700; }

.table input[type="number"] {
    width: 120px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.table input[type="number"]:focus { outline: none; border-color: var(--primary); }

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 18px;
    margin-bottom: 14px;
    font-size: 14px;
}

/* 标签页 */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--muted);
    background: #fff;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 分类列表：总分类行 */
.cat-root td { background: #f7f9fc; }

/* 价格走势图 */
.chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.chart-head h3 { margin: 0; }
.chart-wrap { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 12px; }
.chart-summary { margin-top: 12px; font-size: 14px; }

/* 质保进度条 */
.progress { background: #eef0f3; border-radius: 8px; height: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: #30a46c; border-radius: 8px; }
.progress-fill.mid { background: #f5a623; }
.progress-fill.low { background: #e5484d; }

/* 质保管理左右布局 */
.warranty-layout { display: flex; gap: 16px; align-items: flex-start; }
.warranty-left { flex: 1; min-width: 0; }
.warranty-right { width: 380px; flex-shrink: 0; }

/* ============ 自适应 ============ */
@media (max-width: 992px) {
    .warranty-layout { flex-direction: column; }
    .warranty-right { width: 100%; }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: inline-flex;
    }
    .menu-mask.show { display: block; }
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 250px;
        max-width: 84vw;
        height: 100%;
        overflow-y: auto;
        padding: 10px 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 200;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, .18);
    }
    .brand { padding: 4px 16px 10px; font-size: 16px; }
    .sidebar nav { display: block; padding: 4px 0; }
    .sidebar nav a { padding: 11px 20px; font-size: 14px; }
    .main { margin-left: 0; }
    .topbar { padding: 10px 12px; flex-wrap: nowrap; gap: 8px; }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar h1 {
        font-size: 16px;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .user { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
    .content { padding: 12px; }
    .panel { overflow-x: auto; }
    .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .login-card { width: 92%; max-width: 360px; }
}

/* 成本核算：输入框自适应 */
.costs-table { table-layout: auto; width: 100%; }
.costs-table th, .costs-table td { padding: 8px 6px; }
.costs-table td input[type="number"],
.costs-table td select {
        width: 60px;
    min-width: 0;
    box-sizing: border-box;
    padding: 7px 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.costs-table td input[type="number"].cost-series { width: 60px; }
    .costs-table td select { width: 60px; }
.costs-table input:focus,
.costs-table select:focus { outline: none; border-color: var(--primary); }
.costs-table input[type="number"]::-webkit-outer-spin-button,
.costs-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.costs-table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* 全局：数字输入框隐藏上下调整按钮 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

@media (max-width: 768px) {
    /* 成本核算：窄屏转卡片布局，自动压缩换行 */
    .costs-panel { overflow-x: visible; }
    .costs-table,
    .costs-table thead,
    .costs-table tbody,
    .costs-table tr,
    .costs-table th,
    .costs-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .costs-table thead { display: none; }
    .costs-table tr {
        margin-bottom: 14px;
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px;
        background: #fff;
    }
    .costs-table td {
        display: inline-block;
        width: 50%;
        vertical-align: top;
        padding: 6px;
    }
    .costs-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        color: var(--muted);
        margin-bottom: 4px;
    }
    .costs-table td:first-child {
        width: 100%;
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
    }
    .costs-table td:first-child::before {
        font-size: 12px;
        font-weight: 400;
        color: var(--muted);
    }
    .costs-table td:nth-child(2) { width: 100%; }
    .costs-table td input[type="number"],
    .costs-table td select { width: 100%; font-size: 13px; padding: 8px 6px; }
}

/* ===== 手机 APP（WebView 套壳）适配 ===== */
html { -webkit-text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }

@media (max-width: 768px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: 40;
        padding-top: calc(10px + env(safe-area-inset-top));
        box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    }
    .content {
        padding: 12px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    input, select, textarea { font-size: 16px !important; }
    .btn { min-height: 38px; padding: 8px 14px; }
    .btn-sm { min-height: 32px; padding: 6px 10px; }
    .table th, .table td { white-space: nowrap; }
    .actions { flex-wrap: wrap; }
    .panel-head { flex-wrap: wrap; gap: 8px; }
    .mat-form-row label { min-width: 100%; }
    .sa-fields-row label { min-width: 0; }
    .mat-supplier, .mat-model, .mat-price, .mat-warn, .mat-stock { max-width: 100%; }
    .dict-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
 * 全局统一输入框 / 下拉框样式（以溯源编码输入框为准）
 * 统一内边距、圆角、边框、字号；不影响各处已设定的宽度
 * ============================================================ */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="search"],
select,
textarea {
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #1d2733;
    box-sizing: border-box;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* 扫码输入框与日期/下拉框高度统一 */
input[type="date"],
select,
.scan-inner input {
    min-height: 42px;
}

/* 全局输入框高度强制统一（覆盖各页面/组件差异，保持 42px 一致） */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="search"],
select,
textarea {
    height: auto !important;
    min-height: 42px !important;
    padding: 9px 11px !important;
    line-height: normal !important;
    box-sizing: border-box !important;
}
textarea {
    min-height: 42px !important;
}

/* 生产排单行内编辑控件：紧凑显示，避免下拉/输入框变形 */
.ie-model,
.ie-spec,
.ie-cell,
.ie-bms,
.ie-series {
    width: 100%;
    min-width: 80px;
    padding: 4px 6px !important;
    min-height: 30px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    border-radius: 4px;
}

/* 型号规则校验：不符合 LFP- / NCM- 开头时标红 */
.model-invalid {
    border-color: #e5484d !important;
    background: #fdf0f0 !important;
    color: #c0392b !important;
}

/* 出库记录溯源码：默认 1 行，多个时右侧加号展开 */
.tc-wrap { line-height: 1.45; }
.tc-first {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tc-line {
    font-size: 11px;
    color: #5a6a7a;
    word-break: break-all;
}
.tc-toggle {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c9d6e8;
    border-radius: 50%;
    color: var(--primary);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
}
.tc-toggle:hover { background: #eef4fe; }

/* 物料入库页表单宽度限制 */
.materials-in-panel {
    max-width: 1200px;
}

/* 成本核算行内输入框：数字框 60px，下拉框 120px */
.cost-row-grid .cost-field input[type="number"] {
    width: 60px !important;
}
.cost-row-grid .cost-field select {
    width: 120px !important;
}

/* 新增生产排单表单：弹性一行排列，串数/数量 60px */
.form-flex {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 16px;
}
.form-flex > label {
    width: fit-content;
    min-width: 0;
}
.form-flex .full {
    width: 100%;
}
.form-flex input[name="series"],
.form-flex input[name="qty"] {
    width: 60px;
}
.form-flex input[name="customer_name"],
.form-flex input[name="bms"] {
    width: 160px;
}
.form-flex label.full:has(input[name="remark"]) {
    width: 330px;
}
/* PC 新增生产排单：整行紧凑排列，备注缩窄后一行放下 */
body:not(.app-view) .po-form {
    gap: 8px 8px;
}
body:not(.app-view) .po-form > label {
    flex: 1 1 0;
    min-width: 0;
}
body:not(.app-view) .po-form input[name="customer_name"],
body:not(.app-view) .po-form input[name="model"] {
    width: 100%;
}
body:not(.app-view) .po-form select[name="bms"] {
    width: 100%;
}
body:not(.app-view) .po-form input[name="order_date"],
body:not(.app-view) .po-form input[name="ship_date"] {
    width: 100%;
}
body:not(.app-view) .po-form label.full:has(input[name="remark"]) {
    flex: 1 1 0;
    width: auto;
}
/* 串数/数量：保持紧凑宽度 */
body:not(.app-view) .po-form label:has(input[name="series"]),
body:not(.app-view) .po-form label:has(input[name="qty"]) {
    flex: 0 0 auto;
}

/* 新增散客：备注宽度 330px */
.form-grid label.full:has(input[name="remark"]) {
    width: 330px;
}

/* 新增产品表单：各字段宽度 */
.form-flex select#root-category,
.form-flex select#sub-category {
    width: 120px;
}
.form-flex input[name="unit"] {
    width: 60px;
}
.form-flex input[name="supply_stock"] {
    width: 100px;
}
.form-flex label.full:has(input[name="image_url"]) {
    display: none;
}
/* 新增管理员：输入框宽度 300px */
.admin-top-row label {
    flex: 0 0 300px;
    min-width: 0;
}

/* 工厂在售商品：分类大框 + 型号小卡片 */
.factory-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #fbfbfc;
}
.factory-group-title {
    font-size: 14px;
    font-weight: 700;
    color: #1d2733;
    margin-bottom: 10px;
}
.factory-group-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.model-card {
    width: 150px;
    border: 1px solid #dde1e7;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    text-align: center;
}
.model-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #2f6fed;
    word-break: break-all;
}
/* 工厂库存-型号下拉生产单号 */
.model-seqs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    margin: 0 4px 10px;
    background: #f7f9fc;
    border: 1px dashed #d5deea;
    border-radius: 8px;
}
.model-seqs .po-no-tag { cursor: pointer; }
.model-seqs .po-no-tag:hover { background: #dce9ff; }
/* factory stock: floating model seqs bubble */
.model-seqs-pop {
    position: fixed;
    z-index: 900;
    width: 300px;
    max-height: 260px;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 10px 12px;
    font-size: 12px;
    overflow: hidden;
    animation: modelSeqsSlide .18s ease-out;
}
@keyframes modelSeqsSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.model-seqs-pop-title {
    font-weight: 700;
    color: #1d2733;
    margin-bottom: 8px;
}
.model-seqs-pop-body {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.model-card-stock {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7a8d;
}
.model-card-stock b {
    color: #1d2733;
    font-size: 15px;
}
.model-card-empty {
    border-color: #f3c1c4;
    background: #fdf5f5;
}
.model-card-empty .model-card-stock b {
    color: #e5484d;
}

/* 创建代理/分销商账号：输入框宽度 160px */
.agents-form input[type="text"],
.agents-form input[type="password"] {
    width: 160px;
}

/* 录入电池质保信息：顾客/电话/微信号 130px */
.warranty-form input[name="customer_name"],
.warranty-form input[name="customer_phone"],
.warranty-form input[name="wechat_id"] {
    width: 130px;
}

/* 新增售后单：客户姓名 200px */
.as-form {
    margin-bottom: 14px;
}
.as-form input[name="customer_name"] {
    width: 200px;
}
#as-rows .as-code {
    width: 260px !important;
}

/* 供货商售后记录：型号 180px，数量 60px，返修原因 330px */
#sa-form .sa-model {
    width: 180px !important;
}
#sa-form .sa-qty {
    width: 60px !important;
}
#sa-form .sa-reason {
    width: 330px !important;
}
#sa-form .mat-form-row {
    align-items: flex-end;
    gap: 10px 16px;
}
#sa-form .mat-form-row label {
    flex: 0 1 auto;
    min-width: 0;
    width: fit-content;
}
#sa-form .sa-item-row .btn {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}
.supplier-qry .btn {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}
.trace-qry .btn {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}
.trace-qry {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    flex-wrap: nowrap;
}
.trace-qry .scan-inner {
    flex: 0 1 240px;
    max-width: 100%;
}
.trace-qry .btn {
    flex-shrink: 0;
}
#tc-form .mat-form-row {
    align-items: flex-end;
    gap: 10px 16px;
}
#tc-form .mat-form-row label {
    flex: 0 1 auto;
    min-width: 0;
    width: fit-content;
}
.trace-qry ~ .btn {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}
.barcode-qry .btn,
.barcode-qry ~ .btn {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}
.barcode-qry ~ .btn {
    width: 100px;
    text-align: center;
}
#mat-form .mat-form-row {
    align-items: flex-end;
    gap: 10px 16px;
}
#mat-form .mat-form-row label {
    flex: 0 1 auto;
    min-width: 0;
    width: fit-content;
}
#mat-form input[name="name"] {
    width: 200px;
}
#mat-form select[name="category_id"] {
    width: 90px;
}
#mat-form input[name="spec"] {
    width: 160px;
}
#mat-form input[name="barcode"] {
    width: 200px !important;
}
#mat-form select[name="status"] {
    width: 80px;
}
#mat-form .mat-unit,
#mat-form .mat-price,
#mat-form .mat-stock,
#mat-form .mat-warn {
    width: 60px !important;
}
/* 物料分类卡片 */
.mat-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.mat-cat-card {
    width: 160px;
    border: 1px solid #dde1e7;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    text-align: center;
}
.mat-cat-name {
    font-size: 14px;
    font-weight: 700;
    color: #2f6fed;
    word-break: break-all;
}
.mat-cat-sort {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7a8d;
}
.mat-cat-card .btn {
    margin-top: 8px;
}
/* 产品分类：主分类卡片 + 子分类标签 */
.cat-root-card {
    display: inline-block;
    vertical-align: top;
    width: fit-content;
    min-width: 240px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0 12px 12px 0;
    padding: 12px 14px;
    background: #fbfbfc;
}
.cat-root-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cat-root-name {
    font-size: 15px;
    font-weight: 700;
    color: #1d2733;
}
.cat-root-sort {
    font-size: 12px;
    color: var(--muted);
}
.cat-root-head .btn {
    margin-left: auto;
}
.cat-children {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.cat-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e3e5e8;
    border-radius: 8px;
    padding: 6px 10px;
    background: #fff;
    font-size: 13px;
}
.cat-child-name {
    font-weight: 600;
}
.reason-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.reason-tags button {
    border: 1px solid #c9d6e8;
    background: #fff;
    color: #2f6fed;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1.4;
}
.reason-tags button:hover {
    background: #eef4fe;
}

/* 成品生产单号标签 */
.po-nos { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.po-no-tag {
    display: inline-block;
    font-size: 11px;
    color: #2f6fed;
    background: #eef4fe;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}
/* 排单处理页-序号：字体与型号一致，保留蓝色 */
.seq-no-tag {
    font-size: 14px;
    color: #2f6fed;
    background: #eef4fe;
    border-radius: 4px;
    padding: 1px 6px;
}
/* 排单处理页-序号：已录入蓝牙编码标红 */
.seq-no-tag.seq-bt-done {
    color: #e5484d;
    background: #fdecec;
}

/* 生产单号加号按钮与气泡 */
.po-more {
    display: inline-block;
    min-width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    border: 1px solid #c9d6e8;
    border-radius: 11px;
    background: #fff;
    color: #2f6fed;
    font-size: 12px;
    cursor: pointer;
    padding: 0 6px;
}
.po-more:hover { background: #eef4fe; }
.po-pop {
    position: fixed;
    z-index: 600;
    width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 10px;
    font-size: 12px;
}
.po-pop-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; margin-bottom: 8px; color: #1d2733; }
.po-pop-bt { color: #2f6fed; font-size: 12px; font-weight: 400; }
.po-pop .prod-row { font-size: 12px; }
.po-pop .prod-row b { font-weight: 400; }
.po-pop .po-no-tag { margin: 2px; }

.po-link { cursor: pointer; }
.po-link:hover { background: #dce9ff; }

/* PC/生产车间端：角色名称设置 460px，收款码设置同排右侧弹性 */
body:not(.app-view) .agent-role-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
body:not(.app-view) .agent-role-layout .agent-role-name-panel {
    width: 460px;
    flex-shrink: 0;
}
body:not(.app-view) .agent-role-layout .agent-role-pay-panel {
    flex: 1;
    min-width: 0;
}
/* 收款码图片预览：圆圈X关闭 */
.payqr-preview-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e6e9ef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
    color: #6b7a8d;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}
.payqr-preview-close:hover { color: #e5484d; }

/* 收银端：页面高度跟随浏览器窗口，内容超出后内容区滚动 */
body.pos-view {
    height: 100vh;
    overflow: hidden;
}
body.pos-view .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
}
body.pos-view .main {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 物料入库：左侧内容 + 右侧 560px 条码框 */
.mat-in-layout {
    position: relative;
}
.mat-in-layout .mat-in-left {
    width: 1200px;
    max-width: 100%;
}
.mat-in-layout .mat-bc-side {
    position: absolute;
    left: 1214px;
    top: 0;
    width: 430px;
}
.mat-in-layout .mat-bc-groups {
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 12px 12px;
}
.mat-bc-group {
    margin-bottom: 10px;
}
.mat-bc-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2733;
    padding: 6px 0 4px;
    border-bottom: 1px solid #f0f2f5;
}
.mat-bc-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 8px 0 2px;
}
.mat-bc-card {
    flex: 1 1 116px;
    max-width: 136px;
    border: 1px solid #e6e9ef;
    border-radius: 8px;
    padding: 8px 6px;
    text-align: center;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.mat-bc-qr {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}
.mat-bc-card-code {
    color: #2f6fed;
    font-family: Consolas, monospace;
    font-size: 11px;
    word-break: break-all;
    line-height: 1.3;
}
.mat-bc-card-label {
    font-size: 12px;
    color: #1d2733;
    margin-top: 2px;
    word-break: break-all;
}

/* 代理商在售商品：待采购行（无库存但工厂有货） */
.inv-pending td {
    background: #fdf8ee;
}

/* 全局气泡提示（toast） */
#app-toast {
    position: fixed;
    left: 50%;
    top: 80px;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(29, 39, 51, .92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    z-index: 9999;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    max-width: 80vw;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    text-align: center;
}
#app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#app-toast.error {
    background: rgba(229, 72, 77, .96);
}

/* 采购已完成：从属关系步骤条 */
.done-hier {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
    line-height: 1.4;
}
.hier-node {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.hier-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    line-height: 1.6;
    flex-shrink: 0;
}
.hier-factory { background: #5b6b7c; }
.hier-agent1 { background: #2f6fed; }
.hier-agent2 { background: #12a150; }
.hier-name { font-size: 12px; color: #1d2733; }
.hier-arrow {
    position: relative;
    width: 18px;
    height: 2px;
    background: #b6c2d2;
    border-radius: 2px;
    flex-shrink: 0;
    margin: 0 1px;
}
.hier-arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    border-left: 6px solid #b6c2d2;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

/* 分页切换行 */
.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}
.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid #d7dbe0;
    border-radius: 6px;
    background: #fff;
    color: #1d2733;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.pg-btn:hover {
    border-color: #2f6fed;
    color: #2f6fed;
    background: #eef4fe;
}
.pg-btn.active {
    background: #2f6fed;
    border-color: #2f6fed;
    color: #fff;
    font-weight: 600;
}
.pg-dots {
    color: #8a94a0;
    padding: 0 2px;
}

/* 采购单明细：默认两行，展开/收起 */
tr.po-extra-open {
    animation: poSlideDown .25s ease;
}
@keyframes poSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}
tr.po-expand-row td {
    text-align: center;
    border-bottom: none;
    padding: 6px 0;
}
.po-expand-btn {
    border: 1px solid #cfe0fc;
    color: #2f6fed;
    background: #fff;
    border-radius: 14px;
    padding: 2px 12px;
    font-size: 12px;
    cursor: pointer;
}
.po-expand-btn:hover { background: #eef4fe; }

/* 成本核算：比例/毛利率/税率下拉宽度 80px */
.cost-row-grid .cost-field select.cost-labor-ratio,
.cost-row-grid .cost-field select.cost-margin,
.cost-row-grid .cost-field select.cost-tax {
    width: 80px !important;
}

/* 去付款弹窗：无标题，宽度随图片自适应 */
.modal.payqr-modal {
    width: fit-content;
    max-width: min(90vw, 480px);
    padding: 16px;
    position: relative;
}
.modal.payqr-modal .payqr-content {
    text-align: center;
    margin-bottom: 12px;
}
.modal.payqr-modal .payqr-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e6e9ef;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    color: #6b7a8d;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
}
body.app-view .modal.payqr-modal {
    position: relative;
}
.modal.payqr-modal .payqr-image {
    max-width: min(72vw, 320px);
    max-height: 70vh;
    width: auto;
    height: auto;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* 采购审核：发货数量输入框 32px */
table.table .purchase-edit-qty {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 8px !important;
    line-height: normal !important;
    box-sizing: border-box !important;
}
body.app-view .purchase-edit-qty,
.purchase-edit-qty {
    font-size: 13px !important;
}
/* 采购审核：下拉、物流单号、发货按钮统一 32px 高度 */
.form-inline select[name="ship_method"],
.form-inline input[name="logistics_no"] {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 8px !important;
    line-height: normal !important;
    box-sizing: border-box !important;
}
form[id^="ship-"] .btn-primary {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 14px !important;
    line-height: 30px !important;
    box-sizing: border-box !important;
}
form[action="/purchases/paid"] .btn {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 14px !important;
    line-height: 30px !important;
    box-sizing: border-box !important;
}
.actions form[id^="ship-"],
.actions form[action="/purchases/paid"] {
    display: flex;
    align-items: center;
    height: 32px;
    margin: 0;
}
.po-actions {
    justify-content: flex-end;
    gap: 12px;
}
.actions form[id^="ship-"] input,
.actions form[id^="ship-"] select {
    margin-top: 0;
}
.actions form[id^="ship-"] .ship-logi-field {
    display: inline-flex;
    align-items: center;
    height: 32px;
    line-height: normal;
}
