/* ====== 全局重置 & 基础变量 ====== */
:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --header-h: 56px;
    --bottom-nav-h: 60px;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: var(--gray-800);
    background: var(--gray-100);
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100%;
    background: var(--gray-100);
}

/* ====== 顶部标题栏 ====== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-date {
    font-size: 13px;
    opacity: 0.85;
}

/* ====== 主内容区 ====== */
.app-main {
    padding: 12px 12px calc(var(--bottom-nav-h) + 12px);
    min-height: calc(100vh - var(--header-h));
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ====== 底部导航 ====== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    height: var(--bottom-nav-h);
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray-400);
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 20px;
    line-height: 1;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* ====== 通用组件 ====== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-700);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    background: var(--primary);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    color: var(--gray-400);
    padding: 24px 0;
    font-size: 14px;
}

/* ====== 按钮 ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: var(--white);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 8px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-icon {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--gray-200);
}

.icon {
    font-size: 16px;
}

/* ====== 扫码页面 ====== */
.scan-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-area {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.camera-wrap {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
}

.qr-reader {
    width: 100%;
    min-height: 60px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.qr-reader video {
    width: 100% !important;
    border-radius: var(--radius);
    object-fit: cover;
}

.qr-reader img {
    display: none;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.scan-overlay.active {
    display: flex;
}

.scan-frame {
    width: 200px;
    height: 200px;
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.scan-hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--white);
    font-size: 13px;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.scan-controls {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.scan-status {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-500);
    min-height: 18px;
}

/* 收货表单 */
.receive-form-area {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.receive-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.form-row-2col {
    flex-direction: row;
    gap: 12px;
}

.form-row-2col > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    resize: vertical;
    min-height: 40px;
}

.input-with-btn {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-btn input {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.form-actions .btn-primary {
    flex: 1;
}

/* 最近收货列表 */
.recent-scans {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    font-size: 14px;
}

.recent-item-info {
    flex: 1;
    min-width: 0;
}

.recent-item-name {
    font-weight: 500;
    color: var(--gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-item-meta {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.recent-item-qty {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.recent-item-time {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
}

/* ====== 看板页面 ====== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid;
}

.stat-primary {
    border-left-color: var(--primary);
}

.stat-success {
    border-left-color: var(--success);
}

.stat-info {
    border-left-color: var(--info);
}

.stat-warning {
    border-left-color: var(--warning);
}

.stat-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* 今日单量构成细分（完整签收 / 部分签收） */
.stat-sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 3px;
}

.bd-bar {
    display: flex;
    height: 5px;
    margin-top: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--gray-200);
}

.bd-seg {
    height: 100%;
    width: 0;
    transition: width .25s ease;
}

.bd-seg-full { background: var(--success); }
.bd-seg-partial { background: var(--warning); }
.bd-seg-unknown { background: var(--gray-400); }

.bd-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 5px;
    font-size: 11px;
    color: var(--gray-600);
}

.bd-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.bd-item b {
    font-weight: 600;
    color: var(--gray-800);
}

.bd-dot {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

.bd-dot-full { background: var(--success); }
.bd-dot-partial { background: var(--warning); }
.bd-dot-unknown { background: var(--gray-400); }

.bd-hint {
    font-size: 10px;
    color: var(--gray-400);
    margin-top: 4px;
}

.bd-note {
    font-size: 10px;
    color: var(--danger);
    margin-top: 3px;
}

.bd-note:empty {
    display: none;
}

/* ====== 合托（跨票货合并记录）====== */
.btn-block {
    width: 100%;
    justify-content: center;
}

.batch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    border: 1px solid var(--primary);
}

.batch-bar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.batch-seq {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
}

.batch-stat {
    font-size: 12px;
    color: var(--gray-700);
}

.batch-codes {
    font-size: 11px;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ====== 记录页「托号」列 ====== */
.batch-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--white);
    background: var(--primary);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
}

.batch-badge-cell {
    display: inline-block;
    cursor: pointer;
}

.batch-badge-cell:hover {
    filter: brightness(1.08);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* 进行中的托用绿色区分，已结束为蓝色 */
.batch-badge.is-open {
    background: var(--success);
}

.col-batch-empty {
    color: var(--gray-300);
}

/* 到货核对：缺口列里的缺箱号提示 */
.col-gap {
    max-width: 150px;
    white-space: normal;
}

.gap-boxes {
    font-size: 11px;
    color: var(--warning);
    margin-top: 3px;
    line-height: 1.35;
    word-break: break-word;
}

/* 进度条 */
.progress-section {
    padding: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
}

.progress-header span:last-child {
    color: var(--primary);
    font-weight: 700;
}

.progress-bar-track {
    width: 100%;
    height: 24px;
    background: var(--gray-200);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 20px;
    transition: width 0.5s ease;
    min-width: 0;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-400);
}

/* 图表 */
.chart-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.chart-card {
    padding: 16px;
}

.chart-wrap {
    position: relative;
    height: 220px;
    width: 100%;
}

/* 活动列表 */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.activity-info {
    flex: 1;
    min-width: 0;
}

.activity-name {
    color: var(--gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-meta {
    font-size: 12px;
    color: var(--gray-400);
}

.activity-qty {
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

/* ====== 记录页面 ====== */
.records-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-group label {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
}

.filter-input {
    flex: 1;
    min-width: 180px;
}

.filter-date {
    width: 140px;
}

.records-summary {
    display: flex;
    gap: 20px;
    padding: 0 4px;
    font-size: 14px;
    color: var(--gray-500);
}

.records-summary strong {
    color: var(--primary);
}

.table-wrap {
    overflow-x: auto;
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 800px;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
}

.data-table tr:hover {
    background: var(--gray-50);
}

.data-table .col-qty {
    font-weight: 600;
    color: var(--primary);
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    color: var(--gray-400);
    transition: color 0.15s;
}

.btn-delete:hover {
    color: var(--danger);
}

.table-empty {
    padding: 32px 0;
}

/* ====== 设置页面 ====== */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
}

.setting-card {
    padding: 16px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.setting-row:last-of-type {
    border-bottom: none;
}

.setting-row label {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

.setting-row input,
.setting-row select {
    max-width: 200px;
}

.setting-row strong {
    color: var(--primary);
    font-size: 16px;
}

.setting-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.setting-actions .btn {
    flex: 1;
    min-width: 140px;
}

.about-text {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.8;
}

/* ====== Toast ====== */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 100%;
    max-width: 360px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s ease;
    pointer-events: auto;
}

.toast-success {
    background: var(--success);
    color: var(--white);
}

.toast-error {
    background: var(--danger);
    color: var(--white);
}

.toast-info {
    background: var(--gray-700);
    color: var(--white);
}

.toast.fade-out {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}

/* ====== 弹窗 ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 320px;
    width: calc(100% - 48px);
    box-shadow: var(--shadow-lg);
}

.modal-text {
    font-size: 15px;
    color: var(--gray-700);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ====== 扫码匹配提示 ====== */
.match-hint {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 12px;
    border: 1px solid;
}

.match-partial {
    background: var(--primary-light);
    border-color: #93c5fd;
    color: var(--primary-dark);
}

.match-done {
    background: var(--success-light);
    border-color: #86efac;
    color: #15803d;
}

.match-none {
    background: var(--warning-light);
    border-color: #fcd34d;
    color: #b45309;
}

/* ====== 到货核对页 ====== */
.import-tip {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.7;
    margin-bottom: 12px;
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recon-summary {
    padding: 16px;
}

.recon-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.recon-qty-rate {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.recon-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.recon-stat {
    text-align: center;
    padding: 8px 4px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.recon-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
}

.recon-stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.status-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.status-tab {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 20px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.status-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending {
    background: var(--gray-200);
    color: var(--gray-600);
}

.badge-partial {
    background: var(--warning-light);
    color: #b45309;
}

.badge-done {
    background: var(--success-light);
    color: #15803d;
}

.badge-over {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    color: var(--gray-400);
    transition: color 0.15s;
}

.btn-edit:hover {
    color: var(--primary);
}

/* ====== 表单弹窗 ====== */
.modal-form {
    max-width: 400px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.modal-body-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-body-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

/* ====== 自定义列映射弹窗 ====== */
.map-hint {
    margin: 2px 0 10px;
    font-size: 12.5px;
    color: var(--gray-500);
}

.map-preview-wrap {
    margin-top: 6px;
}

.map-preview-wrap > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.map-preview {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--gray-50);
    padding: 8px;
    overflow-x: auto;
    max-height: 180px;
    overflow-y: auto;
}

.map-preview-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    margin: 8px 0;
}

.map-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.map-preview-table th {
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 600;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.map-preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--gray-700);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-preview-table tr:last-child td {
    border-bottom: none;
}

/* ====== 动态表单字段 ====== */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.form-empty-hint {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    padding: 16px 0;
    background: var(--gray-50, #f8fafc);
    border-radius: var(--radius, 8px);
    border: 1px dashed var(--gray-200, #e2e8f0);
}

.form-fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
}

.field-check-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200, #e2e8f0);
    border-radius: 8px;
    font-size: 13px;
    color: var(--gray-600, #475569);
    cursor: pointer;
    user-select: none;
    background: var(--bg-card, #fff);
    transition: border-color 0.15s, background 0.15s;
}

.field-check-item:hover {
    border-color: var(--primary, #2563eb);
}

.field-check-item:has(input:checked) {
    border-color: var(--primary, #2563eb);
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary, #2563eb);
    font-weight: 500;
}

.field-check-item input[type="checkbox"] {
    accent-color: var(--primary, #2563eb);
    width: 15px;
    height: 15px;
}

/* ====== 响应式 ====== */
@media (min-width: 768px) {
    .app-main {
        padding: 16px 20px calc(var(--bottom-nav-h) + 16px);
    }

    .stat-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .recon-stats {
        grid-template-columns: repeat(6, 1fr);
    }

    .chart-section {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 28px;
    }

    .scan-container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .scan-area {
        flex: 0 0 360px;
    }

    .receive-form-area {
        flex: 1;
        min-width: 320px;
    }

    .recent-scans {
        flex-basis: 100%;
    }
}

@media (min-width: 1024px) {
    .bottom-nav {
        max-width: 1200px;
    }
}

/* ====== 账号与权限 ====== */
.account-current {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.account-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
}

.account-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
    white-space: nowrap;
}

.account-role.role-supervisor {
    background: var(--warning-light);
    color: #92400e;
}

.account-role.role-ops_manager {
    background: #ede9fe;
    color: #5b21b6;
}

.account-role.role-biz_manager,
.account-role.role-biz_supervisor {
    background: #dcfce7;
    color: #166534;
}

.account-role.role-biz {
    background: #e0f2fe;
    color: #075985;
}

.account-role.role-finance {
    background: #fce7f3;
    color: #9d174d;
}

.account-role.role-admin {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.account-username {
    font-size: 12px;
    color: var(--gray-400);
    margin-left: auto;
}

.account-role-hint {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.6;
    margin-bottom: 12px;
}

.account-role-hint:empty {
    display: none;
}

.account-pwd-block {
    border-top: 1px dashed var(--gray-200);
    padding-top: 12px;
    margin-bottom: 12px;
}

.account-sub-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.account-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    outline: none;
    background: var(--white);
    color: var(--gray-900);
}

.account-input:focus {
    border-color: var(--primary);
}

.admin-only-tag {
    font-size: 11px;
    font-weight: 400;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 2px 7px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 4px;
}

.new-user-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.new-user-form .account-input {
    flex: 1 1 130px;
    min-width: 100px;
    margin-bottom: 0;
}

.new-user-form .btn {
    flex: 0 0 auto;
}

.user-list-wrap {
    overflow-x: auto;
}

.user-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.user-list-table th {
    text-align: left;
    font-weight: 500;
    color: var(--gray-500);
    font-size: 12px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.user-list-table td {
    padding: 8px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.user-row-disabled {
    opacity: .55;
}

.user-cell-name {
    font-size: 13px;
    color: var(--gray-900);
    font-weight: 500;
}

.user-cell-account {
    font-size: 11px;
    color: var(--gray-400);
}

.user-self {
    font-size: 10px;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 1px 5px;
    border-radius: 8px;
}

.user-state {
    font-size: 12px;
    white-space: nowrap;
}

.user-state.on {
    color: var(--success);
}

.user-state.off {
    color: var(--danger);
}

.user-cell-time {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.user-cell-actions {
    white-space: nowrap;
}

.user-role-select {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-700);
}

.btn-mini {
    font-size: 11px;
    padding: 4px 8px;
    margin-right: 4px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-mini:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-mini-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.user-list-err {
    color: var(--danger);
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.user-list-tip {
    font-size: 11px;
    color: var(--gray-400);
    line-height: 1.6;
    margin-top: 10px;
}

.col-operator {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}
