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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 200px;
    background: #1a1a2e;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.logo {
    text-align: center;
    padding: 0 20px 30px;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.logo img {
    max-width: 100%;
    height: auto;
    display: block;
}

.nav-menu {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-item {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    font-size: 15px;
}

.nav-item:hover {
    background: #16213e;
}

.nav-item.active {
    background: #0f3460;
    border-left: 3px solid #e94560;
}

.nav-logout {
    margin-top: auto;
    border-top: 1px solid #333;
    color: #aaa;
}

.nav-logout:hover {
    background: #2a2a3e;
    color: #fff;
}

.icon {
    font-size: 18px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.page {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.page.active {
    display: block;
}

/* 页面标题 */
.page-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #1a1a2e;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

/* 表单元素 */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"] {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #0f3460;
}

input.jan-input {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
    min-width: 250px;
}

/* 按钮 */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #0f3460;
    color: white;
}

.btn-primary:hover {
    background: #16213e;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

/* 数量控制 */
.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-draft {
    background: #fff3cd;
    color: #856404;
}

.badge-saved {
    background: #d4edda;
    color: #155724;
}

.badge-exported {
    background: #d4edda;
    color: #155724;
}

.badge-modifying {
    background: #ffe0b2;
    color: #e65100;
}

.badge-confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-inbounded {
    background: #d0e7ff;
    color: #0b4d8a;
}

/* 提示信息 */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 400px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    margin-bottom: 20px;
}

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

/* 扫描状态 */
.scan-status {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 16px;
}

.scan-status.waiting {
    background: #e3f2fd;
    color: #1565c0;
}

.scan-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.scan-status.error {
    background: #ffebee;
    color: #c62828;
}

/* 通用隐藏 */
.hidden {
    display: none !important;
}

/* 登录页 */
.login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 9999;
}

.login-page.hidden {
    display: none;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-brand h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.login-brand p {
    font-size: 13px;
    color: #888;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-group label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.login-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: #0f3460;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.login-form button[type="submit"]:hover {
    background: #16213e;
}

.login-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    color: #c62828;
    font-size: 13px;
    text-align: center;
    display: none;
}

.login-error.show {
    display: block;
}

/* 占位页面 */
.placeholder-page {
    text-align: center;
    padding: 100px 20px;
    color: #999;
}

.placeholder-page h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.placeholder-page p {
    font-size: 16px;
}

/* 表格横向滚动 */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #eee;
    border-radius: 6px;
}

.table-scroll table {
    min-width: 100%;
    white-space: nowrap;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-header .detail-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-header .detail-info strong {
    font-size: 16px;
    color: #1a1a2e;
}

.detail-header .detail-meta {
    color: #666;
    font-size: 14px;
}

/* 视图切换按钮 */
.view-toggle {
    display: inline-flex;
}

.view-toggle button {
    background: #e9ecef;
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 0;
}

.view-toggle button:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.view-toggle button:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.view-toggle button.active {
    background: #0f3460;
    color: white;
    border-color: #0f3460;
}

/* 箱子区块 */
.box-section {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.box-section:last-child {
    border-bottom: none;
}

.box-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

/* 组合框 */
.combo-box {
    position: relative;
}

.combo-box input {
    width: 100%;
}

.combo-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.combo-dropdown.hidden {
    display: none;
}

.combo-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

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

.combo-item:hover {
    background: #f5f5f5;
}

.combo-hint {
    color: #999;
    cursor: default;
}

.combo-hint:hover {
    background: transparent;
}

/* 批次操作区域左右布局 */
.batch-action-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.batch-action-col {
    flex: 1;
    min-width: 0;
}

.batch-action-divider {
    width: 1px;
    background: #e9ecef;
    margin: 0 5px;
    flex-shrink: 0;
}

/* select 样式 */
select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #0f3460;
}

/* 明细视图导航 */
.detail-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-nav-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-nav-info strong {
    font-size: 16px;
    color: #1a1a2e;
}

.detail-nav-info span {
    color: #666;
    font-size: 14px;
}

/* 滑动面板容器 */
.sheet-panels {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.list-panel {
    grid-column: 1;
    grid-row: 1;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.sheet-panels.show-detail .list-panel {
    transform: translateX(-8%);
    opacity: 0;
    pointer-events: none;
}

.detail-panel {
    grid-column: 1;
    grid-row: 1;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

.sheet-panels.show-detail .detail-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* 打印样式 */
@media print {
    .sidebar,
    .nav-menu,
    button,
    input,
    .qty-control,
    .modal,
    .scan-status {
        display: none !important;
    }

    .main-content {
        padding: 0;
        overflow: visible;
    }

    .page {
        display: block !important;
    }

    table {
        font-size: 12px;
    }

    th {
        background: #ddd !important;
    }
}
