* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F8F5F0;
    color: #212121;
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════
   侧边栏
   ═══════════════════════════════════════════ */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: #1B1B1B;
    color: #B0B0B0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand img {
    height: 32px;
    width: auto;
}
.sidebar-brand span {
    font-size: 15px;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #909090;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #D0D0D0;
}
.sidebar-nav a.active {
    background: rgba(222,27,21,0.12);
    color: #DE1B15;
    border-left-color: #DE1B15;
    font-weight: 600;
}
.sidebar-nav .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
}
.sidebar-footer .user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.sidebar-footer .user-name {
    color: #D0D0D0;
    font-size: 13px;
}
.sidebar-footer .btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #909090;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.sidebar-footer .btn-logout:hover {
    border-color: #DE1B15;
    color: #DE1B15;
}

/* ═══════════════════════════════════════════
   主内容区
   ═══════════════════════════════════════════ */
.main-wrapper {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: #FFFFFF;
    padding: 14px 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h1 {
    font-size: 18px;
    font-weight: 600;
    color: #212121;
    letter-spacing: -0.01em;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* ═══════════════════════════════════════════
   通用组件
   ═══════════════════════════════════════════ */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(97,97,97,0.08);
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #F5F5F5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.batch-form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.batch-form-row .form-group {
    min-width: 0;
    flex: none;
}
.form-group {
    flex: 1;
    min-width: 200px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #616161;
    font-weight: 500;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #DE1B15;
}
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.btn-primary {
    background: linear-gradient(135deg, #DE1B15 0%, #B71510 100%);
    color: white;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success {
    background: linear-gradient(135deg, #DE1B15 0%, #B71510 100%);
    color: white;
}
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-export {
    background: #DE1B15;
    color: white;
    padding: 6px 16px;
    font-size: 12px;
}
.btn-export:hover { opacity: 0.9; }
.btn-logout {
    background: #DE1B15;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.btn-logout:hover { background: #B81610; }
.btn-small {
    padding: 6px 14px;
    font-size: 12px;
}
.btn-danger {
    background: #DE1B15;
    color: white;
}
.btn-danger:hover { background: #B81610; }
.btn-secondary {
    background: #F5F5F5;
    color: #616161;
}
.btn-secondary:hover { background: #E0E0E0; }
.action-btns {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.table-container {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #F5F5F5;
}
th {
    background: #F5F5F5;
    font-weight: 600;
    color: #616161;
    font-size: 13px;
}
tr:hover { background: #f8f9fa; }
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.tag-inner { background: #FFECEB; color: #DE1B15; }
.tag-end { background: #FFECEB; color: #B71510; }
.tag-outer { background: #FFECEB; color: #B71510; }
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9E9E9E;
}
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}
.toast.success { background: #2ECC71; }
.toast.error { background: #DE1B15; }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 进度条 */
.progress-section {
    background: linear-gradient(135deg, #F8F5F0 0%, #FFFFFF 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid #FFECEB;
    display: none;
}
.progress-section.active {
    display: block;
}
.progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.progress-icon {
    font-size: 24px;
    animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
.progress-title {
    font-size: 16px;
    font-weight: 600;
    color: #212121;
}
.progress-container {
    background: #FFECEB;
    border-radius: 10px;
    padding: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 28px;
    background: linear-gradient(90deg, #DE1B15 0%, #F25450 100%);
    border-radius: 8px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    min-width: 40px;
}
.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #616161;
    margin-top: 8px;
}
.progress-detail {
    font-size: 13px;
    color: #DE1B15;
    margin-top: 6px;
    font-weight: 500;
}

/* 弹窗 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9E9E9E;
}
.barcode-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.barcode-item {
    background: #F5F5F5;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-item {
    background: #F5F5F5;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #DE1B15;
}
.stat-label {
    font-size: 12px;
    color: #616161;
    margin-top: 4px;
}

/* 登录遮盖层 */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #F8F5F0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-overlay.hidden { display: none; }
.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(97,97,97,0.1);
    width: 360px;
    text-align: center;
}
.login-box h2 { margin-bottom: 8px; font-size: 22px; }
.login-box p { color: #9E9E9E; margin-bottom: 24px; font-size: 14px; }
.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
}
.login-box .btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    color: white;
    background: linear-gradient(135deg, #DE1B15 0%, #B71510 100%);
    cursor: pointer;
    font-weight: 500;
}
.login-box .btn-login:hover { opacity: 0.9; }
.login-error {
    color: #ff4d4f;
    font-size: 13px;
    margin-bottom: 8px;
    display: none;
}
