/* ========================================
   出入库管理系统 - 移动优先样式
   ======================================== */

/* 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f5f5f5;
    color: #333;
    font-size: 14px;
    padding-bottom: 70px; /* 底部导航栏高度 */
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* =========== 登录页 =========== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    text-align: center;
}
.login-logo { font-size: 56px; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: #888; font-size: 13px; margin-bottom: 24px; }
.login-form { text-align: left; }
.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: #999;
}
.login-hint code {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* =========== 底部导航栏 =========== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid #eee;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    color: #888;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
}
.tab-item.active {
    color: #2563eb;
}
.tab-item.active .tab-icon {
    transform: scale(1.1);
}
.tab-icon { font-size: 22px; margin-bottom: 2px; }
.tab-label { font-size: 11px; }

/* =========== 首页仪表盘 =========== */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 15px;
}
.user-name-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.user-name-link:hover {
    color: #2563eb;
}
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }
.stat-inbound .stat-number { color: #10b981; }
.stat-outbound .stat-number { color: #ef4444; }
.stat-total .stat-number { color: #2563eb; }
.stat-types .stat-number { color: #8b5cf6; }

/* 快捷操作 */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.1s;
}
.action-btn:active { transform: scale(0.97); }
.action-stock,
.action-trace,
.action-product,
.action-settings {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* =========== 操作记录列表 =========== */
.section { margin-bottom: 20px; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.log-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.log-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}
.log-item:last-child { border-bottom: none; }
.log-time { font-size: 12px; color: #999; min-width: 40px; }
.log-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}
.badge-inbound { background: #d1fae5; color: #059669; }
.badge-outbound { background: #fee2e2; color: #dc2626; }
.log-info {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}
.log-name { font-weight: 500; }
.log-qty { font-weight: 600; color: #059669; }
.qty-danger { color: #dc2626; }
.log-recipient { color: #888; font-size: 12px; }
.log-remark { color: #aaa; font-size: 11px; }
.log-handler { font-size: 12px; color: #888; min-width: 40px; text-align: right; }

/* =========== 页面头部 =========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

/* =========== 扫码区域 =========== */
.scan-section { margin-bottom: 16px; }
.scanner-box {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.scanner-placeholder {
    color: white;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.scanner-icon { font-size: 40px; margin-bottom: 8px; }
.scan-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.manual-input {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}
.manual-input label { font-size: 13px; color: #666; margin-bottom: 6px; display: block; }
.input-row { display: flex; gap: 8px; }
.input-row .form-input { flex: 1; }

/* =========== 商品卡片 =========== */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.product-card-header h3 { font-size: 16px; font-weight: 600; }
.product-details {}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}
.detail-label { color: #888; }
.detail-value { font-weight: 500; }
.detail-value.code { font-family: monospace; font-size: 12px; color: #2563eb; }
.detail-value.highlight { color: #059669; font-weight: 700; font-size: 15px; }
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* =========== 库存徽标 =========== */
.stock-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: #d1fae5;
    color: #059669;
}
.badge-empty { background: #f3f4f6; color: #9ca3af; }
.badge-low { background: #fef3c7; color: #d97706; }

/* =========== 表单 =========== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}
.required { color: #ef4444; }
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    background: white;
}
.form-input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.form-input-lg { font-size: 18px; font-weight: 600; padding: 12px; }
.form-input-sm { padding: 8px 10px; font-size: 13px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-actions { margin-top: 20px; }
select.form-input { appearance: auto; }

/* =========== 按钮 =========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    gap: 4px;
}
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #059669; color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: white; }
.btn-warning:hover { background: #b45309; }
.btn-outline {
    background: white;
    color: #555;
    border: 1px solid #d1d5db;
}
.btn-outline:hover { border-color: #2563eb; color: #2563eb; }

/* 禁用按钮样式 */
.btn:disabled, .btn[disabled],
.btn-outline:disabled, .btn-outline[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-outline:disabled, .btn-outline[disabled] {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
}

/* =========== 消息提示 =========== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.3s;
}
.toast-success { background: #059669; color: white; }
.toast.show { opacity: 1; }

/* =========== 空状态 =========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.empty-state p { margin-bottom: 8px; }

/* =========== 搜索栏 =========== */
.search-bar { margin-bottom: 16px; }
.search-form {
    display: flex;
    gap: 8px;
}
.search-form .form-input { flex: 1; }

/* =========== 更多菜单 =========== */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.menu-card {
    background: white;
    border-radius: 12px;
    padding: 20px 16px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.1s;
}
.menu-card:active { transform: scale(0.97); }
.menu-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.menu-title { font-size: 15px; font-weight: 600; display: block; margin-bottom: 4px; }
.menu-desc { font-size: 12px; color: #999; }

/* =========== 用户管理 =========== */
.user-list { display: flex; flex-direction: column; gap: 12px; }
.user-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}
.user-info { flex: 1; }
.user-name { display: block; font-weight: 600; }
.user-phone { font-size: 12px; color: #999; }
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-admin { background: #dbeafe; color: #2563eb; }
.badge-operator { background: #f3f4f6; color: #6b7280; }
.user-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.perm-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: #f3f4f6;
    color: #555;
}
.perm-basic {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
}
.perm-none { font-size: 12px; color: #999; }
.user-actions { padding-top: 8px; border-top: 1px solid #f0f0f0; }

/* 权限复选框 */
.perm-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; }

/* =========== 筛选栏 =========== */
.filter-bar { margin-bottom: 16px; }
.filter-form { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.filter-form .btn { margin-top: 4px; }

/* =========== 统计小标签 =========== */
.stats-mini {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

/* =========== 翻页 =========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 0;
}
.page-info { font-size: 13px; color: #666; }

/* =========== 导入 =========== */
.import-section { margin-bottom: 16px; }
.import-section details {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.import-section summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.import-form { margin-top: 12px; }
.import-form .hint { font-size: 12px; color: #888; margin-bottom: 8px; }
.file-input { font-size: 13px; margin-bottom: 8px; }
.import-result { text-align: center; }

/* =========== 错误页 =========== */
.error-page {
    text-align: center;
    padding: 60px 20px;
}
.error-icon { font-size: 48px; margin-bottom: 16px; }
.error-page h2 { margin-bottom: 12px; }
.error-page p { color: #888; margin-bottom: 24px; }

/* =========== 操作指引卡片 =========== */
.action-card {
    background: white;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}
.action-card h4 { margin-bottom: 8px; }
.action-card p { color: #666; margin-bottom: 12px; }
.action-card .btn { margin: 4px; }

/* =========== 个人资料页 =========== */
.profile-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.profile-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 12px;
}
.profile-info { text-align: center; }
.profile-name-display { font-size: 18px; font-weight: 700; display: block; }
.profile-phone { font-size: 14px; color: #888; }
.perm-list { display: flex; flex-direction: column; gap: 8px; }
.perm-item {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
}
.perm-on { color: #059669; border-left: 3px solid #059669; }
.perm-off { color: #9ca3af; border-left: 3px solid #d1d5db; }
.profile-form { background: white; padding: 16px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

/* =========== 序列化追踪 =========== */
.asset-batch-list {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.asset-batch-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}
.asset-batch-item:last-child { border-bottom: none; }
.asset-batch-sn {
    font-family: monospace;
    font-size: 13px;
    color: #2563eb;
    flex: 1;
}
.asset-batch-name { font-size: 13px; color: #666; min-width: 80px; }
.asset-batch-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}
.asset-count {
    text-align: center;
    font-size: 13px;
    color: #888;
    padding: 8px 0;
}
.asset-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-in-stock { background: #d1fae5; color: #059669; }
.badge-out-stock { background: #fee2e2; color: #dc2626; }

/* 设备详情 */
.asset-detail-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.asset-detail-section h3 {
    font-size: 14px;
    color: #888;
    margin-bottom: 8px;
}
.asset-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
}
.asset-detail-row:last-child { border-bottom: none; }
.asset-detail-label { color: #888; }
.asset-detail-value { font-weight: 500; }
.event-log-item {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.event-log-item:last-child { border-bottom: none; }
.event-log-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.event-log-action {
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}
.event-log-action.inbound { background: #d1fae5; color: #059669; }
.event-log-action.outbound { background: #fee2e2; color: #dc2626; }

/* 序列管理首页 */
.asset-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.asset-stats {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.asset-stats-row {
    display: flex;
    justify-content: space-around;
    text-align: center;
}
.asset-stat-item {
    padding: 8px;
}
.asset-stat-number {
    font-size: 24px;
    font-weight: 700;
}
.asset-stat-label {
    font-size: 12px;
    color: #888;
}

/* =========== 响应式 =========== */
@media (min-width: 768px) {
    .container { max-width: 600px; padding: 24px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-actions { grid-template-columns: repeat(4, 1fr); }
}

/* =========== 自动补全输入框 =========== */
.autocomplete-wrapper {
    position: relative;
}
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.autocomplete-list.show {
    display: block;
}
.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover,
.autocomplete-item.active {
    background: #eff6ff;
    color: #2563eb;
}
.autocomplete-item .highlight {
    color: #2563eb;
    font-weight: 600;
}
.autocomplete-noresult {
    padding: 10px 12px;
    color: #999;
    font-size: 13px;
}

/* =========== 可点击的商品卡片链接 =========== */
.product-card-clickable {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
.product-card-clickable:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* =========== 折叠筛选区 =========== */
.filter-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #2563eb;
    font-size: 13px;
    padding: 6px 0 10px;
    cursor: pointer;
    text-align: left;
}
.filter-toggle:hover {
    color: #1d4ed8;
}
.filter-advanced {
    display: none;
}
.filter-advanced.expanded {
    display: block;
}

/* =========== 选项管理页 =========== */
.settings-section details {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.settings-section summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    padding: 4px 0;
}
.option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.option-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    color: #2563eb;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
}
.tag-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.add-option-form {
    display: flex;
    gap: 8px;
}
.add-option-form .form-input-sm { flex: 1; }
.empty-hint { font-size: 13px; color: #999; padding: 8px 0; }
.settings-hint { font-size: 12px; color: #888; margin: 4px 0 8px; }
.hidden-opt { display: none !important; }
.option-list.expanded .hidden-opt { display: inline-flex !important; }
.btn-more {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 0;
    display: block;
    width: 100%;
    text-align: left;
}
.btn-more:hover { color: #1d4ed8; }
.tag-default { background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; }
.tag-default-on { color: #f59e0b; }
.tag-default-off { color: #d1d5db; }
.tag-default-off:hover { color: #f59e0b; }

/* =========== 序列化页面 — 待处理列表 =========== */
.pending-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.pending-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.badge-count {
    background: #2563eb;
    color: white;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}
.pending-list {
    min-height: 60px;
}
.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}
.pending-item:last-child {
    border-bottom: none;
}
.pending-item-info {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.pending-sn {
    font-family: monospace;
    font-weight: 600;
    font-size: 14px;
    color: #2563eb;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}
.pending-product {
    font-size: 12px;
    color: #666;
}
.pending-meta {
    font-size: 11px;
    color: #999;
}
.pending-item .remove-btn {
    color: #ef4444;
    border-color: #fecaca;
    font-size: 14px;
    padding: 4px 10px;
}

/* =========== 批次表单 =========== */
.batch-form {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.batch-form h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: #333;
}
.field-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* =========== 序列化设备列表卡片 =========== */
.asset-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.asset-card {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.1s;
    display: block;
}
.asset-card:active {
    transform: scale(0.98);
}
.asset-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.asset-sn {
    font-family: monospace;
    font-weight: 600;
    font-size: 14px;
    color: #2563eb;
}
.asset-card-body .detail-row {
    padding: 2px 0;
}

/* =========== 单台设备详情卡 =========== */
.asset-detail-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.asset-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.asset-sn-lg {
    font-family: monospace;
    font-weight: 700;
    font-size: 16px;
    color: #2563eb;
}
.asset-detail-body {
    padding: 16px;
}
.detail-divider {
    border: none;
    border-top: 1px solid #f0f0f0;
    margin: 12px 0;
}

/* =========== 徽标扩展 =========== */
.badge-warning {
    background: #fef3c7;
    color: #d97706;
}
.badge-success {
    background: #d1fae5;
    color: #059669;
}

/* =========== 编辑弹窗 =========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}
.btn-edit-log {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    color: #6b7280;
    flex-shrink: 0;
}
.btn-edit-log:hover {
    color: #2563eb;
}

/* =========== 扫码扫描线动画（方案A：微信风格）============ */
.scan-line {
    position: absolute;
    left: 5%;
    right: 5%;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
    animation: scanMove 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s;
}
@keyframes scanMove {
    0% { top: 2%; }
    50% { top: 95%; }
    100% { top: 2%; }
}

/* 识别成功闪光 */
.scanning-success {
    box-shadow: inset 0 0 40px rgba(0, 255, 0, 0.5) !important;
}

/* 扫码容器基本样式 */
#scanner-container {
    border-radius: 8px;
    overflow: hidden;
}

/* 扫码视频淡入与扫描线延迟显示 */
#scanner-video {
    opacity: 0;
    transition: opacity 0.3s;
    height: 300px;
    object-fit: cover;
}
.scanner-video-visible {
    opacity: 1 !important;
}
.scan-line-visible {
    opacity: 1;
}

/* =========== 溯源明细：视图切换（卡片 / 列表） =========== */
.asset-view.alv-hidden { display: none; }
.view-switch { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 10px; }
.view-switch button {
    min-height: 34px; padding: 6px 16px; font-size: 13px; font-weight: 600;
    color: #475569; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.view-switch button.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.view-switch button:active { transform: scale(.97); }

/* =========== 分组维度切换：按日期 / 按产品名称（2026-09-23） =========== */
.dim-switch { margin: 0 0 8px; }
.dim-switch input[type="hidden"] { display: none; }

/* =========== 溯源明细：日志式列表（两行条目 + 分组折叠） =========== */
.alv-hidden { display: none !important; }
.alv-group {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 10px;
}
.alv-group-head {
    display: flex; align-items: center; gap: 8px; width: 100%;
    min-height: 48px; padding: 12px 14px; box-sizing: border-box;
    background: #f8fafc; border: none; border-bottom: 1px solid #eef1f5;
    font-size: 14px; font-weight: 600; color: #0f172a; text-align: left;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.alv-group-head:active { background: #eef2f7; }
.alv-caret { font-size: 11px; color: #94a3b8; flex-shrink: 0; transition: transform .15s ease; }
.alv-group.collapsed .alv-caret { transform: rotate(-90deg); }
.alv-group.collapsed .alv-group-body { display: none; }
.alv-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alv-group-count { font-size: 12px; font-weight: 500; color: #64748b; flex-shrink: 0; }

.alv-row {
    display: flex; align-items: center; gap: 8px;
    min-height: 56px; padding: 9px 14px; box-sizing: border-box;
    border-bottom: 1px solid #f2f4f7; text-decoration: none; color: #334155;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.alv-row:last-child { border-bottom: none; }
.alv-row:active { background: #f1f5f9; }
.alv-row-main { flex: 1; min-width: 0; display: block; }
.alv-line1 { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; overflow: hidden; }
.alv-line2 {
    display: block; margin-top: 4px; font-size: 12px; color: #475569; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.alv-line1 .log-type-badge { flex-shrink: 0; }
/* 出库地址：独占一行，超长省略号（2026-09-11） */
.alv-line-addr {
    display: block; margin-top: 3px; font-size: 13px; line-height: 1.4;
    color: #94a3b8; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
}
.alv-model, .alv-date { flex-shrink: 0; }
/* 人员：不参与收缩、不换行（过长公司名时由公司那一段出省略号）2026-09-11 */
.alv-person { flex-shrink: 0; white-space: nowrap; }
.alv-co { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alv-date { color: #94a3b8; flex-shrink: 0; }
.alv-addr { color: #94a3b8; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alv-sn { font-family: Consolas, Menlo, monospace; color: #0f172a; }
.alv-sep { color: #cbd5e1; }
.alv-arrow { font-size: 18px; color: #cbd5e1; flex-shrink: 0; }
.alv-more { margin-top: 4px; }

/* =========== 溯源明细：卡片视图也按产品名称分组 =========== */
.card-group-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.card-group-body .asset-card { box-shadow: none; border: 1px solid #eef1f5; }

/* ==== 层级浏览 / 详情抽屉（与首页下钻同款，全局共用）==== */
.dl-open-btn { display: block; width: 100%; text-align: center; padding: 9px; margin-bottom: 12px;
    background: #f8fafc; border: 1px dashed #cbd5e1; color: #475569; border-radius: 10px;
    font-size: 13px; cursor: pointer; }
.dl-open-btn:active { background: #f1f5f9; }

/* ==== 层级浏览抽屉（与首页下钻同款组件）==== */
.dl-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999;
    display: none; align-items: flex-end; justify-content: center; }
.dl-overlay.open { display: flex; }
.dl-sheet { background: #fff; width: 100%; max-width: 520px; border-radius: 16px 16px 0 0;
    max-height: 82vh; display: flex; flex-direction: column;
    box-shadow: 0 -8px 30px rgba(0,0,0,.18); animation: dlUp .22s ease-out; }
@keyframes dlUp { from { transform: translateY(40px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.dl-head { display: flex; align-items: center; justify-content: space-between;
    padding: 12px 12px; border-bottom: 1px solid #eef1f5; flex-shrink: 0; }
.dl-nav { background: #f1f5f9; border: none; border-radius: 10px; width: 34px; height: 34px;
    font-size: 17px; color: #334155; cursor: pointer; line-height: 1; }
.dl-nav:active { background: #e2e8f0; }
.dl-nav[disabled] { visibility: hidden; }
.dl-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.dl-body { overflow-y: auto; padding: 10px 12px 22px; -webkit-overflow-scrolling: touch; }
.dl-hint { font-size: 12px; color: #64748b; margin: 2px 2px 10px; }
.dl-row { display: flex; align-items: center; gap: 12px; background: #f8fafc; border: 1px solid #eef1f5;
    border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; cursor: pointer; }
.dl-row:active { background: #eef2f7; }
.dl-row-icon { font-size: 22px; flex-shrink: 0; }
.dl-row-main { flex: 1; min-width: 0; }
.dl-row-t { font-size: 15px; font-weight: 600; color: #0f172a; }
.dl-row-s { font-size: 12px; color: #64748b; margin-top: 2px; }
.dl-row-v { text-align: right; flex-shrink: 0; }
.dl-row-num { font-size: 20px; font-weight: 700; color: #2563eb; }
.dl-row-arrow { color: #94a3b8; font-size: 18px; margin-left: 6px; }
.dl-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.dl-tab { flex: 1; padding: 9px 0; border-radius: 10px; border: 1px solid #dbe3ec; background: #fff;
    font-size: 13px; color: #475569; cursor: pointer; }
.dl-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.dl-list-title { font-size: 12px; color: #64748b; margin: 4px 2px 8px; }
.dl-empty { text-align: center; color: #94a3b8; padding: 30px 0; font-size: 13px; }
.dl-serial-link { display: flex; align-items: center; gap: 10px; background: #f8fafc;
    border: 1px solid #eef1f5; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
    text-decoration: none; }
.dl-serial-link:active { background: #eef2f7; }
.dl-serial-code { flex: 1; min-width: 0; font-family: Consolas, Menlo, monospace; font-size: 13px;
    font-weight: 600; color: #0f172a; word-break: break-all; }
.dl-serial-sub { flex: 1; min-width: 0; font-size: 12px; color: #64748b; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.dl-arrow { color: #94a3b8; font-size: 16px; flex-shrink: 0; }

/* ==== 简单库存流水：两行式行 + 详情卡片（2026-09-11）==== */
.ledger-row { cursor: pointer; }
.ledger-row .log-qty { flex-shrink: 0; margin-left: 4px; font-size: 13px; }
.ledger-row .btn-edit-log { flex-shrink: 0; padding: 4px 8px; }
.dl-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dl-card-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.dl-card-sub { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.dl-kv { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #f2f4f7; font-size: 13px; }
.dl-kv:last-child { border-bottom: none; }
.dl-kv .k { width: 84px; flex-shrink: 0; color: #64748b; }
.dl-kv .v { flex: 1; min-width: 0; color: #0f172a; word-break: break-all; }
.dl-kv .v.mono { font-family: Consolas, Menlo, monospace; font-weight: 600; }

/* ===== 第二批：更早的日期（AJAX 追加）按钮 ===== */
.alv-more-days { margin-top: 6px; border-style: dashed; color: #475569; background: #f8fafc; }
.alv-more-days:active { background: #f1f5f9; }
.alv-more-days[disabled] { opacity: .6; }

/* =========== 序列号「复制」小按钮（2026-10-14）=========== */
.sn-copy {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; min-height: 30px; margin-left: 6px;
    font-size: 13px; line-height: 1;
    border: 1px solid #dbe3ec; border-radius: 8px;
    background: #f8fafc; color: #475569;
    cursor: pointer; user-select: none; -webkit-user-select: none;
    flex-shrink: 0; vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}
.sn-copy:active { background: #e2e8f0; }
.sn-copy.copied { background: #d1fae5; border-color: #6ee7b7; color: #059669; }
