/* ================================================================
   京璟仓库报单工具 - 全局样式
   设计：护眼暖色主题 + 渐变强调色
   ================================================================ */

/* ── CSS 变量 ──────────────────────────────────────────────────── */
:root {
    --bg-primary: #f0ede6;
    --bg-secondary: #e8e4dc;
    --bg-card: #ffffff;
    --bg-card-hover: #faf9f7;
    --bg-input: #f7f5f0;
    --bg-sidebar: #2c3e50;
    --bg-elevated: #ffffff;

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #95a5a6;
    --text-color: #2d3436;

    --accent-primary: #5b4ccc;
    --accent-secondary: #6c5ce7;
    --accent-gradient: linear-gradient(135deg, #5b4ccc 0%, #8b7cf7 100%);

    --success: #00b894;
    --success-bg: rgba(0, 184, 148, 0.12);
    --warning: #e17055;
    --warning-bg: rgba(225, 112, 85, 0.10);
    --danger: #d63031;
    --danger-bg: rgba(214, 48, 49, 0.10);
    --info: #0984e3;
    --info-bg: rgba(9, 132, 227, 0.10);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --border: rgba(0, 0, 0, 0.08);
    --hover-bg: rgba(0, 0, 0, 0.03);

    --shadow-sm: 0 1px 3px 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);
    --shadow-glow: 0 0 16px rgba(91, 76, 204, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius: 8px;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 全局重置 ──────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── 滚动条 ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ── 布局 ─────────────────────────────────────────────────────── */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ── 侧边栏 ───────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 100;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.65);
    transition: var(--transition);
    margin-bottom: 4px;
    cursor: pointer;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* 导航徽标（预刷管理超时预警数量） */
.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
    animation: navBadgePulse 1.8s ease-in-out infinite;
}
@keyframes navBadgePulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12); }
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.version-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ── 折叠导航组 ─────────────────────────────────────────────────── */
.nav-group { margin-bottom: 2px; }

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    user-select: none;
    margin-bottom: 1px;
}

.nav-group-header:hover,
.nav-group-header.open {
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.05);
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.nav-group-chevron {
    width: 13px;
    height: 13px;
    transition: transform 0.22s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-group-header.open .nav-group-chevron {
    transform: rotate(180deg);
    opacity: 0.9;
}

.nav-group-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1);
}

.nav-group-items.open {
    max-height: 600px;
    background: rgba(0,0,0,0.18);
    border-radius: var(--radius-md);
    margin: 2px 0 6px;
    padding: 4px 0;
    border-left: 2px solid rgba(255,255,255,0.08);
}

.nav-group-items .nav-item {
    padding-left: 22px;
    font-size: 13px;
    margin-bottom: 0;
    border-radius: 8px;
}

/* ── 主内容区 ──────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: none;
}

.menu-toggle:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.current-time {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

/* ── 卡片 ─────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── 统计卡片 ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(108, 92, 231, 0.15); color: var(--accent-secondary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ── 按钮 ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: #f0ede6;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e8e4dc;
    border-color: var(--border-hover);
}

.btn-success {
    background: linear-gradient(135deg, #00d2a0 0%, #00b894 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 210, 160, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 210, 160, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc048 0%, #f0932b 100%);
    color: #1a1a2e;
}

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

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── 表单 ─────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── 数据表格 ──────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px); /* 表格区域最大高度，让表头 sticky 生效 */
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}


.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;  /* 关键：列宽固定，不受空值/短值影响 */
}

.data-table th {
    text-align: center !important;
    padding: 12px 16px;
    background: #f7f5f0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table td {
    text-align: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    word-break: break-word;   /* 防止长内容撑开列宽 */
    overflow: hidden;
}


/* 左对齐列（订单号、SKU等长内容）*/
.data-table th.col-left,
.data-table td.col-left {
    text-align: left !important;
}

/* SKU 竖列展示 — 每个 SKU 独占一行 */
.sku-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
    width: 100%;
}

/* SKU 标签本体 */
.sku-tag {
    display: inline-block;
    background: rgba(108, 92, 231, 0.08);
    color: var(--accent-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 500;
    word-break: break-all;
    white-space: normal;
}


.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(91, 76, 204, 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── 搜索/操作栏 ──────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    /* 功能键固定在页面顶部 */
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-primary);
    padding: 10px 0 10px;
    margin-top: -4px;
}

/* card-header 不 sticky，只做布局 */


.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box .form-input {
    padding-left: 40px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ── 文件上传区 ────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.05);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.upload-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── 标签/徽章 ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

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

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-purple {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-secondary);
}

/* ── 弹窗 ─────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Toast 通知 ────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: white;
    min-width: 280px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success { background: linear-gradient(135deg, #00d2a0, #00b894); }
.toast-error { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.toast-warning { background: linear-gradient(135deg, #ffc048, #f0932b); color: #1a1a2e; }
.toast-info { background: linear-gradient(135deg, #54a0ff, #2e86de); }

.toast-exit {
    animation: slideOutRight 0.3s ease forwards;
}

/* ── 标签打印样式（40x60mm） ───────────────────────────────── */
.label-preview {
    width: 226px; /* ~60mm at 96dpi */
    height: 151px; /* ~40mm at 96dpi */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px 4px;
    display: flex;
    flex-direction: column;
    background: white;
    color: #000;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

.label-preview .label-brand {
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    font-family: 'SimHei', 'Microsoft YaHei', sans-serif;
    letter-spacing: 4px;
    padding-bottom: 2px;
}

.label-preview .label-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.label-preview .label-qr {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.label-preview .label-code {
    font-size: 9px;
    font-weight: 600;
    text-align: center;
    margin-top: 2px;
    word-break: break-all;
    max-width: 200px;
    line-height: 1.2;
}

.label-preview .label-footer {
    font-size: 8px;
    text-align: center;
    color: #666;
    padding: 2px 0 1px;
    letter-spacing: 0.5px;
    border-top: 0.5px solid #ddd;
    margin-top: 2px;
}

/* ── 报单类型选择器 (Tabs) ──────────────────────────────────────── */
.type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.type-tab {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    font-family: inherit;
}

.type-tab:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.type-tab.active {
    background: rgba(108, 92, 231, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

/* ── 分页 ──────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0 8px;
}

/* ── 空状态 ────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

/* ── 进度条 ────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ── 批次卡片 ──────────────────────────────────────────────────── */
.batch-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    cursor: pointer;
}

.batch-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.batch-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.batch-no {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-secondary);
    font-family: 'Courier New', monospace;
}

.batch-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.batch-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── 标签打印区 印刷样式 ───────────────────────────────────────── */
.print-area {
    display: none;
}

/* ── 加载动画 ──────────────────────────────────────────────────── */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

/* ── 动画 ─────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── 响应式 ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        margin-left: calc(-1 * var(--sidebar-width));
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .page-container {
        padding: 16px;
    }
}

/* ── 打印媒体查询 ──────────────────────────────────────────────── */
@media print {
    body * {
        visibility: hidden;
    }

    .print-area, .print-area * {
        visibility: visible;
    }

    .print-area {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
    }

    .print-label-item {
        width: 60mm;
        height: 40mm;
        padding: 1.5mm 3mm 1.5mm;
        display: flex;
        flex-direction: column;
        page-break-after: always;
        box-sizing: border-box;
        font-family: 'SimHei', 'Microsoft YaHei', sans-serif;
    }

    .print-label-item .print-brand {
        font-size: 14pt;
        font-weight: 900;
        text-align: center;
        letter-spacing: 3pt;
        color: #000;
        padding-bottom: 0.5mm;
    }

    .print-label-item .print-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .print-label-item .print-qr {
        width: 18mm;
        height: 18mm;
        flex-shrink: 0;
        image-rendering: pixelated;
    }

    .print-label-item .print-code {
        font-size: 8pt;
        font-weight: 700;
        text-align: center;
        margin-top: 0.5mm;
        word-break: break-all;
        max-width: 54mm;
        line-height: 1.3;
        color: #000;
    }

    .print-label-item .print-footer {
        font-size: 6pt;
        text-align: center;
        color: #333;
        padding-top: 0.5mm;
        border-top: 0.3pt solid #999;
        margin-top: 0.5mm;
        letter-spacing: 0.5pt;
    }

    @page {
        size: 60mm 40mm;
        margin: 0;
    }
}

/* ── 仓库切换 Tabs ─────────────────────────────────────────────── */
.warehouse-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.wh-tab {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.wh-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: var(--transition);
}

.wh-tab:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.wh-tab.active {
    border-color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.08);
    box-shadow: var(--shadow-glow);
}

.wh-tab.active::before {
    background: var(--accent-gradient);
}

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

.wh-tab-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.wh-tab-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
    font-weight: 500;
}

.wh-tab.active .wh-tab-name {
    color: var(--accent-secondary);
}

.wh-tab.active .wh-tab-count {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 640px) {
    .warehouse-tabs {
        flex-direction: column;
        gap: 8px;
    }
    .wh-tab {
        padding: 14px 18px;
    }
}

/* ── 登录页面 ──────────────────────────────────────────────────── */

#loginContainer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: var(--accent-gradient);
    border-radius: 20px;
    margin-bottom: 16px;
    color: white;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 2px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}

.login-field input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.login-field input::placeholder {
    color: var(--text-muted);
}

.login-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 4px;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.login-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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