:root {
    --bg-color: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --card-bg: rgba(255, 255, 255, 0.75);
    --accent-color: #0071e3;
    --border-radius: 20px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    --transition-spring: 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

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

html {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 10% 30%, rgba(0, 113, 227, 0.03), transparent 30%),
                      radial-gradient(circle at 90% 80%, rgba(52, 199, 89, 0.02), transparent 30%);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

body.admin-page {
    display: block;
    min-height: 100vh;
    height: auto;
    overflow: auto;
}

.hidden {
    display: none !important;
}

.login-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    padding: 24px;
    overflow: auto;
}

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

.login-box {
    width: min(420px, 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    background: #fff;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

.login-title {
    margin-bottom: 22px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 800;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 18px;
    color: var(--text-secondary);
    font-size: 13px;
}

.remember-row input {
    width: auto;
}

.login-message {
    min-height: 20px;
    margin-top: 12px;
    color: #d70015;
    font-size: 13px;
}

.user-pill {
    margin: -30px 0 28px 16px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.admin-shell {
    width: min(960px, calc(100vw - 32px));
    margin: 48px auto;
}

.admin-card {
    margin-bottom: 20px;
}

.sidebar {
    width: 260px;
    padding: 40px 20px;
    background: rgba(245, 245, 247, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.logo {
    display: grid;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 40px;
    padding-left: 12px;
    letter-spacing: 0;
    color: var(--text-primary);
    cursor: default;
    user-select: none;
}

.brand-title {
    display: grid;
    justify-items: center;
    gap: 10px;
}

.brand-logo {
    display: block;
    object-fit: contain;
}

.login-brand-logo {
    width: min(260px, 100%);
    max-height: 86px;
}

.sidebar-brand-logo {
    width: 176px;
    max-width: 100%;
    max-height: 72px;
    justify-self: start;
}

.logo span {
    line-height: 1.25;
}

.admin-brand-title {
    margin-bottom: 20px;
}

.admin-brand-logo {
    width: min(280px, 100%);
    max-height: 92px;
}

.admin-head-brand {
    grid-auto-flow: column;
    justify-items: start;
    align-items: center;
    gap: 10px;
}

.admin-head-logo {
    width: 112px;
    max-height: 42px;
}

.nav-item {
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    transition: all 0.25s ease;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: #fff;
    color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.main-content {
    flex: 1;
    padding: 40px;
    position: relative;
    overflow-y: auto;
}

.page {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition: transform var(--transition-spring), opacity var(--transition-spring);
}

.page.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

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

.header-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.status-pill {
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 600;
}

.inbound-layout {
    display: grid;
    grid-template-columns: minmax(360px, 1.15fr) minmax(300px, 0.85fr);
    gap: 24px;
    align-items: start;
}

.inbound-panel {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.inbound-panel .panel-title {
    margin-bottom: 0;
}

.inbound-panel > .form-group,
.inbound-panel > .modal-grid,
.inbound-panel > .form-grid,
.inbound-panel > .inbound-total {
    margin-bottom: 0;
}

.outbound-entry-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin: -8px 0 22px;
    border: var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
}

.outbound-mode-tab {
    min-width: 112px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 9px 16px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.outbound-mode-tab:hover {
    color: var(--text-primary);
}

.outbound-mode-tab.active {
    background: #fff;
    color: var(--accent-color);
    box-shadow: 0 5px 14px rgba(0, 113, 227, 0.12);
}

.outbound-mode-panel {
    display: none;
}

.outbound-mode-panel.active {
    display: block;
}

.manual-outbound-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin: 0 0 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.035);
}

.manual-outbound-tab {
    min-width: 104px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 8px 14px;
}

.manual-outbound-tab.active {
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.manual-outbound-panel {
    display: none;
}

.manual-outbound-panel.active {
    display: block;
}

.multi-outbound-panel {
    gap: 22px;
}

.multi-outbound-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.multi-outbound-head .muted {
    margin-top: 6px;
}

.multi-outbound-summary {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 12px;
}

.multi-outbound-add-box {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.58);
}

.multi-outbound-add-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: stretch;
}

.compact-match-card {
    min-height: 110px;
    padding: 16px;
}

.quantity-with-unit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(74px, auto);
    gap: 8px;
    align-items: center;
}

.quantity-with-unit.compact {
    grid-template-columns: minmax(88px, 1fr) auto;
}

.quantity-with-unit select {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font: inherit;
    padding: 10px 9px;
    outline: none;
}

.multi-outbound-list-wrap {
    overflow-x: auto;
    width: 100%;
}

.multi-outbound-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.multi-outbound-table th,
.multi-outbound-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    text-align: left;
    vertical-align: middle;
}

.multi-outbound-table th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.recognition-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.recognition-panel-head .muted {
    margin-top: 6px;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
}

.inbound-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(0, 113, 227, 0.08);
    color: var(--text-secondary);
    margin-top: 0;
}

.inbound-total strong {
    color: var(--accent-color);
    font-size: 26px;
    line-height: 1;
}

.match-card {
    min-height: 218px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px;
}

.match-empty {
    color: var(--text-secondary);
    line-height: 1.8;
}

.match-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.match-meta {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.match-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.match-meta-row strong {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.missing-name,
.negative-stock {
    color: #d70015;
    font-weight: 700;
}

.scan-row-missing {
    background: rgba(215, 0, 21, 0.06);
}

.scan-edit-input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--text-primary);
    font: inherit;
    line-height: 1.25;
    padding: 7px 9px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea.scan-edit-input {
    resize: vertical;
    min-height: 46px;
    overflow-wrap: anywhere;
    white-space: normal;
}

.scan-edit-input:focus {
    border-color: rgba(0, 113, 227, 0.7);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.scan-order-input {
    width: min(220px, 100%);
    font-weight: 700;
    text-align: right;
}

.scan-barcode-input {
    min-width: 260px;
}

.scan-name-input {
    min-width: 300px;
}

.scan-boxes-input {
    min-width: 92px;
    max-width: 110px;
    text-align: center;
}

.scan-unit-input {
    min-width: 76px;
    max-width: 96px;
    text-align: center;
}

.scan-warehouse-input {
    min-width: 160px;
}

.recognition-upload-card {
    display: grid;
    gap: 14px;
}

.recognition-upload-card.running .recognition-drop-zone,
.recognition-upload-card.running .recognition-file-list {
    display: none;
}

.recognition-drop-zone {
    min-height: 150px;
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    display: grid;
    place-items: center;
    gap: 8px;
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.62);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.recognition-drop-zone.dragging {
    border-color: rgba(0, 113, 227, 0.72);
    background: rgba(0, 113, 227, 0.08);
    box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.16);
}

.recognition-drop-zone strong {
    color: var(--text-primary);
    font-size: 17px;
}

.recognition-drop-zone span {
    color: var(--text-secondary);
    font-size: 13px;
}

.recognition-format-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.recognition-format-list span,
.recognition-format-list strong {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
}

.recognition-format-list span {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
}

.recognition-format-list strong {
    color: var(--accent-color);
    background: rgba(0, 113, 227, 0.08);
}

.recognition-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recognition-file-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    padding: 8px 10px;
    border: var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.recognition-file-pill span {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.recognition-file-pill strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recognition-file-pill small {
    color: var(--text-secondary);
    white-space: nowrap;
}

.recognition-progress {
    display: none;
    gap: 8px;
}

.recognition-progress.active {
    display: grid;
}

.recognition-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.recognition-progress-meta strong {
    color: var(--text-primary);
}

.recognition-progress-detail {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.recognition-progress-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.08);
}

#recognitionProgressBar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #0071e3, #34c759);
    transition: width 0.2s ease;
}

.recognition-result-list {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.recognition-result-card {
    display: grid;
    gap: 14px;
}

.recognition-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.recognition-result-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.recognition-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    flex: 1;
}

.recognition-meta-grid label {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.recognition-input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-primary);
    font: inherit;
    line-height: 1.25;
    padding: 7px 9px;
    outline: none;
}

.recognition-input:focus {
    border-color: rgba(0, 113, 227, 0.7);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.recognition-excel-name {
    color: var(--text-secondary);
    font-size: 13px;
}

.recognition-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.recognition-table {
    width: 100%;
    min-width: 1340px;
    table-layout: fixed;
}

.recognition-table th,
.recognition-table td {
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
}

.recognition-table th:nth-child(1),
.recognition-table td:nth-child(1) {
    width: 48px;
    text-align: center;
}

.recognition-table th:nth-child(2),
.recognition-table td:nth-child(2) {
    width: 64px;
    text-align: center;
}

.recognition-table th:nth-child(3),
.recognition-table td:nth-child(3) {
    width: 240px;
}

.recognition-table th:nth-child(4),
.recognition-table td:nth-child(4) {
    width: 260px;
}

.recognition-table th:nth-child(6),
.recognition-table td:nth-child(6),
.recognition-table th:nth-child(7),
.recognition-table td:nth-child(7) {
    width: 140px;
}

.recognition-table th:nth-child(10),
.recognition-table td:nth-child(10) {
    width: 170px;
}

.recognition-table th:nth-child(11),
.recognition-table td:nth-child(11) {
    width: 86px;
    text-align: center;
}

.recognition-row-error {
    background: rgba(215, 0, 21, 0.08);
}

.recognition-row-modified {
    background: rgba(255, 204, 0, 0.16);
}

.recognition-row-error.recognition-row-modified {
    background: linear-gradient(90deg, rgba(215, 0, 21, 0.1), rgba(255, 204, 0, 0.18));
}

.recognition-empty {
    color: var(--text-secondary);
}

.recognition-sequence {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent-color);
    font-weight: 700;
}

.recognition-input.locked,
.recognition-textarea.locked {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.recognition-textarea {
    width: 100%;
    min-height: 38px;
    resize: vertical;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-primary);
    font: inherit;
    line-height: 1.35;
    padding: 7px 9px;
    outline: none;
}

.recognition-barcode-input {
    white-space: nowrap;
    overflow-x: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.recognition-quantity-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

.recognition-quantity-stack {
    display: grid;
    gap: 6px;
}

.recognition-unit-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    cursor: default;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.recognition-unit-pill.editable {
    cursor: pointer;
}

.recognition-unit-pill.editable:hover {
    background: rgba(0, 113, 227, 0.12);
    color: var(--accent-color);
}

.recognition-unit-pill.needs-confirmation {
    background: rgba(215, 0, 21, 0.14);
    color: #b42318;
    cursor: pointer;
    animation: recognitionUnitPulse 1s ease-in-out infinite;
}

.recognition-unit-pill.confirmed {
    background: rgba(11, 110, 47, 0.12);
    color: #0b6e2f;
    cursor: default;
    animation: none;
}

@keyframes recognitionUnitPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(215, 0, 21, 0.18);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(215, 0, 21, 0.16);
        transform: scale(1.04);
    }
}

.recognition-deduct {
    display: grid;
    gap: 8px;
}

.recognition-deduct-line {
    display: grid;
    gap: 3px;
}

.recognition-deduct strong {
    color: #0b6e2f;
    font-size: 13px;
    line-height: 1.3;
}

.recognition-deduct span {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.recognition-deduct.pending strong {
    color: #b42318;
}

.recognition-add-row td {
    padding: 12px;
    text-align: center;
    background: rgba(0, 113, 227, 0.03);
}

.recognition-add-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px dashed rgba(0, 113, 227, 0.45);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--accent-color);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.recognition-add-button:hover {
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 113, 227, 0.16);
    transform: translateY(-1px);
}

.pending-toolbar {
    margin-bottom: 14px;
}

.pending-toolbar input {
    width: min(420px, 100%);
}

.document-sections {
    display: grid;
    gap: 18px;
}

.document-section {
    display: grid;
    gap: 10px;
}

.document-section-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.pending-list {
    display: grid;
    gap: 12px;
}

.pending-doc {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
}

.pending-doc-main {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) minmax(100px, auto) minmax(100px, auto);
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
}

.pending-doc-main span {
    color: var(--text-secondary);
    font-size: 13px;
}

.pending-doc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 14px 12px;
}

.pending-doc-actions .btn {
    white-space: nowrap;
}

.pending-doc-detail {
    display: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 14px;
}

.pending-doc-detail.open {
    display: block;
}

.pending-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: end;
    margin-bottom: 12px;
}

.pending-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pending-detail-head label {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.accepted-doc-info {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) auto minmax(160px, 1fr);
    gap: 6px 12px;
    align-items: center;
}

.accepted-doc-info span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.accepted-doc-info strong {
    color: var(--text-primary);
    font-size: 13px;
    word-break: break-word;
}

.pending-detail-table {
    width: 100%;
    min-width: 1680px;
    border-collapse: collapse;
    table-layout: fixed;
}

.pending-detail-table-wrap {
    overflow-x: auto;
    padding-bottom: 4px;
}

.pending-detail-table th,
.pending-detail-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.pending-detail-table th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pending-detail-table td {
    color: var(--text-primary);
    font-size: 13px;
    overflow: visible;
}

.pending-col-name {
    width: 330px;
}

.pending-col-barcode {
    width: 300px;
}

.pending-col-warehouse {
    width: 180px;
}

.pending-col-quantity {
    width: 112px;
}

.pending-col-unit {
    width: 98px;
}

.pending-col-matched {
    width: 240px;
}

.pending-col-stock {
    width: 210px;
}

.pending-col-deduction {
    width: 210px;
}

.pending-col-status {
    width: 260px;
}

.pending-diagnostic-cell {
    min-width: 180px;
}

.pending-status-cell {
    min-width: 220px;
    line-height: 1.45;
}

.pending-ref-id,
.pending-ref-name,
.pending-ref-meta,
.pending-stock-lines span,
.pending-stock-lines strong,
.pending-status-note,
.pending-rematch-hint,
.pending-ref-empty,
.pending-deduction-empty {
    display: block;
    word-break: break-word;
}

.pending-ref-id {
    color: var(--accent-color);
    font-weight: 800;
}

.pending-ref-name {
    margin-top: 4px;
    font-weight: 700;
}

.pending-ref-meta,
.pending-stock-lines span,
.pending-deduction-empty,
.pending-ref-empty {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.pending-stock-lines strong {
    margin-top: 6px;
    color: var(--text-primary);
    font-size: 12px;
}

.pending-status-note {
    margin-top: 6px;
    color: #9f5b00;
    font-size: 12px;
}

.pending-rematch-hint {
    margin-top: 6px;
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 700;
}

.pending-row-rematchable {
    cursor: pointer;
}

.pending-row-rematchable:hover {
    background: rgba(0, 113, 227, 0.06);
}

.pending-redirect-picker {
    display: grid;
    gap: 12px;
}

.pending-redirect-search {
    margin-bottom: 0;
}

.pending-redirect-results {
    display: grid;
    gap: 10px;
    max-height: min(460px, 52vh);
    overflow-y: auto;
    padding-right: 4px;
}

.pending-redirect-option {
    display: grid;
    gap: 7px;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    padding: 12px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.pending-redirect-option:hover {
    border-color: rgba(0, 113, 227, 0.45);
    box-shadow: 0 8px 22px rgba(0, 113, 227, 0.1);
}

.pending-redirect-title {
    font-weight: 800;
}

.pending-redirect-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 12px;
}

.pending-redirect-stock {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.45;
}

.record-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 240px));
    gap: 14px;
    margin-bottom: 18px;
}

.record-tab {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--text-secondary);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.record-tab strong {
    color: var(--text-primary);
    font-size: 20px;
}

.record-tab.active {
    background: #fff;
    border-color: rgba(0, 113, 227, 0.42);
    color: var(--text-primary);
    box-shadow: 0 8px 22px rgba(0, 113, 227, 0.08);
}

.operation-record-list {
    display: grid;
    gap: 12px;
}

.operation-record-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.operation-record-head .panel-title {
    margin-bottom: 0;
}

.operation-export-tools {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.operation-export-tools input {
    width: auto;
    min-width: 150px;
    padding: 8px 10px;
    border-radius: 8px;
}

.operation-record-item {
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
}

.operation-record-summary {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.5fr);
    gap: 18px;
    align-items: center;
    padding: 14px 16px;
}

.operation-record-summary strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.operation-record-summary span,
.operation-record-meta {
    color: var(--text-secondary);
    font-size: 13px;
}

.operation-record-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.operation-record-meta .btn {
    margin-left: 2px;
}

.operation-record-meta time {
    color: var(--text-primary);
    font-weight: 600;
}

.operation-record-detail {
    display: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 14px 16px 16px;
}

.operation-record-detail.open {
    display: block;
}

.operation-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.operation-detail-cell {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.64);
}

.operation-detail-cell span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.operation-detail-cell strong {
    color: var(--text-primary);
    font-size: 13px;
    word-break: break-word;
}

.operation-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.negative-note {
    display: block;
    margin-top: 4px;
    color: #d70015;
    font-size: 12px;
    font-weight: 600;
}

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

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
    gap: 18px;
    margin-bottom: 24px;
}

.overview-tile {
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 24px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.overview-tile:hover {
    transform: translateY(-2px);
}

.overview-tile:not(button) {
    cursor: default;
}

.overview-tile:not(button):hover {
    transform: none;
}

.overview-tile span,
.overview-tile small {
    display: block;
}

.overview-tile span {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.overview-tile strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 42px;
    line-height: 1;
    color: var(--text-primary);
}

.overview-tile small {
    color: var(--text-secondary);
    font-size: 13px;
}

.overview-tile.alert {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.28);
}

.overview-tile.alert strong,
.overview-tile.alert small {
    color: #d70015;
}

.overview-warehouse-panel {
    margin-bottom: 24px;
}

.overview-warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.overview-warehouse-card {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    min-height: 0;
}

.overview-warehouse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.overview-warehouse-head strong {
    color: var(--text-primary);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.overview-warehouse-head span {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.overview-warehouse-metrics {
    display: grid;
    gap: 10px;
}

.overview-warehouse-metric {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 113, 227, 0.06);
}

.overview-warehouse-metrics span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.overview-unit-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.overview-unit-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(0, 113, 227, 0.12);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.overview-unit-chip.empty {
    color: var(--text-secondary);
}

.overview-unit-separator {
    align-self: center;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.expiry-warning-panel {
    display: none;
}

.expiry-warning-panel.active {
    display: block;
}

.warning-control-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
}

.warning-days-control {
    display: grid;
    grid-template-columns: auto 110px auto;
    align-items: center;
    gap: 10px;
}

.warning-days-control label,
.warning-days-control span {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.warning-days-control input {
    width: 110px;
    flex: initial;
}

tbody tr.expiry-alert-row {
    background: rgba(255, 59, 48, 0.08);
}

tbody tr.expiry-alert-row td {
    color: #b42318;
    border-bottom-color: rgba(255, 59, 48, 0.18);
}

.btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn:hover {
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}

.btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn.danger {
    background: #ff3b30;
}

.btn.danger:hover {
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.24);
}

.btn.mini {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.table-container {
    overflow-x: auto;
}

.inventory-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.inventory-toolbar input {
    width: min(460px, 100%);
}

.inventory-toolbar select {
    min-width: 160px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text-primary);
    font: inherit;
}

.inventory-table-note {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.inventory-flow-panel {
    display: grid;
    gap: 16px;
}

.inventory-flow-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.flow-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.flow-stat-box {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 14px;
    background: rgba(245, 247, 250, 0.9);
}

.flow-stat-box span {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
}

.flow-stat-box strong {
    color: var(--text-primary);
    font-size: 24px;
}

.inventory-backup-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.inventory-backup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.inventory-backup-column {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(245, 247, 250, 0.72);
    padding: 12px;
}

.inventory-backup-column h3 {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--text-primary);
}

.inventory-backup-list {
    display: grid;
    gap: 10px;
}

.inventory-backup-item {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 4px solid #16a34a;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.inventory-backup-item.outbound {
    border-left-color: #dc2626;
}

.inventory-backup-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.inventory-backup-title strong {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

.inventory-backup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.inventory-backup-summary {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.inventory-flow-list {
    display: grid;
    gap: 10px;
}

.inventory-flow-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 4px solid #8792a2;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.inventory-flow-item.inbound {
    border-left-color: #16a34a;
}

.inventory-flow-item.outbound {
    border-left-color: #dc2626;
}

.inventory-flow-item.adjustment {
    border-left-color: #2563eb;
}

.inventory-flow-main,
.inventory-flow-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.inventory-flow-main strong {
    min-width: 180px;
}

.inventory-flow-main span,
.inventory-flow-meta span,
.inventory-flow-meta time {
    color: var(--text-secondary);
    font-size: 13px;
}

.inventory-flow-note {
    margin-top: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.import-modal-box .modal-message {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 12px;
}

.import-mode-summary {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 12px;
    background: rgba(245, 247, 250, 0.9);
    margin-bottom: 14px;
}

.import-mode-summary span {
    color: var(--text-secondary);
    font-size: 13px;
}

.bad-stock-panel {
    margin-bottom: 16px;
    display: grid;
    gap: 14px;
}

.bad-stock-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.bad-stock-head .muted {
    margin-top: 4px;
}

.bad-stock-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.bad-stock-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.bad-stock-match {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.bad-stock-list {
    display: grid;
    gap: 8px;
}

.bad-stock-item {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(100px, auto));
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
}

.bad-stock-item strong,
.bad-stock-item span {
    overflow-wrap: anywhere;
}

.bad-stock-item .bad-stock-quantity {
    color: #d70015;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

#inventoryTable {
    min-width: 3900px;
}

.inventory-full-table th,
.inventory-full-table td {
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

.inventory-full-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(245, 245, 247, 0.96);
}

.inventory-pagination {
    position: sticky;
    left: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    min-width: min(100%, 760px);
    padding: 14px 0 2px;
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-summary {
    line-height: 1.5;
}

.pagination-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.pagination-actions span {
    min-width: 64px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

.tip-banner {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 100%;
    max-width: min(640px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    transform: scale(0.85) translateY(30px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    flex: 0 0 auto;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.modal-mode-switch {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 18px;
    padding: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.04);
}

.mode-btn {
    min-width: 0;
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.94);
    color: var(--accent-color);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.modal-mode-panel {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: none;
}

.modal-mode-panel.active {
    display: block;
}

.modal-mode-panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.modal-message {
    flex: 0 0 auto;
}

.dialog-input {
    flex: 0 0 auto;
    width: 100%;
    margin: 4px 0 18px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.92);
}

.dialog-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
}

.dialog-content {
    flex: 1 1 auto;
    min-height: 0;
    margin: 12px 0 18px;
    max-height: min(560px, calc(100vh - 260px));
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.dialog-content::-webkit-scrollbar {
    width: 6px;
}

.dialog-content::-webkit-scrollbar-track {
    background: transparent;
}

.dialog-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.16);
    border-radius: 999px;
}

.mixed-quantity-dialog {
    display: grid;
    gap: 12px;
    color: var(--text-primary);
}

.mixed-quantity-dialog p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.mixed-quantity-list {
    display: grid;
    gap: 10px;
    max-height: min(420px, 52vh);
    overflow-y: auto;
    padding-right: 4px;
}

.mixed-quantity-item {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    padding: 12px 14px;
}

.mixed-quantity-item strong {
    font-size: 14px;
    line-height: 1.35;
}

.mixed-quantity-item span {
    color: var(--text-primary);
    font-size: 13px;
}

.mixed-quantity-item small,
.mixed-quantity-more {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.inventory-candidate-list {
    display: grid;
    gap: 10px;
    max-height: min(420px, 52vh);
    overflow-y: auto;
    padding-right: 4px;
}

.inventory-candidate-option {
    width: 100%;
    display: grid;
    gap: 8px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-primary);
    padding: 12px 14px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.inventory-candidate-option:hover {
    border-color: rgba(0, 113, 227, 0.34);
    box-shadow: 0 8px 22px rgba(0, 113, 227, 0.1);
    transform: translateY(-1px);
}

.inventory-candidate-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.inventory-candidate-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.inventory-candidate-meta strong {
    color: var(--accent-color);
}

.inventory-candidate-stock,
.inventory-candidate-hint {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.inventory-candidate-hint {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 113, 227, 0.08);
}

.unit-choice-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.unit-choice-button {
    display: grid;
    gap: 6px;
    min-height: 72px;
    padding: 12px;
    border: 1px solid rgba(0, 113, 227, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.unit-choice-button:hover {
    border-color: rgba(0, 113, 227, 0.44);
    box-shadow: 0 8px 22px rgba(0, 113, 227, 0.1);
}

.unit-choice-button.active {
    border-color: rgba(0, 113, 227, 0.62);
    background: rgba(0, 113, 227, 0.08);
}

.unit-choice-button strong {
    color: var(--accent-color);
    font-size: 15px;
}

.unit-choice-button span {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 18px;
    min-width: 0;
}

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

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}

input {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    transition: all 0.3s var(--transition-spring);
    font-family: inherit;
}

.input-row input {
    flex: 1 1 auto;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

input[readonly] {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dynamic-list {
    max-height: 90px;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

.inbound-panel .modal-footer {
    margin-top: 4px;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.modal-grid .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
    row-gap: 18px;
}

.form-grid .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

.split-stock-summary {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 113, 227, 0.12);
    background: rgba(0, 113, 227, 0.06);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

.split-stock-summary strong {
    font-size: 14px;
}

.split-stock-summary span {
    color: var(--text-secondary);
}

.split-unit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.split-arrow {
    display: grid;
    place-items: center;
    min-height: 44px;
    color: var(--accent-color);
    font-size: 20px;
    font-weight: 800;
}

.split-preview {
    margin-top: 18px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.split-preview.warning {
    border-color: rgba(255, 149, 0, 0.24);
    background: rgba(255, 149, 0, 0.1);
    color: #9a5b00;
}

.split-preview.ok {
    border-color: rgba(52, 199, 89, 0.22);
    background: rgba(52, 199, 89, 0.1);
    color: #1f7a3b;
}

select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.76);
    color: var(--text-primary);
    font: inherit;
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.warehouse-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    display: grid;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.warehouse-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.warehouse-card.protected {
    border-color: rgba(59, 130, 246, 0.32);
}

.warehouse-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.warehouse-card-title {
    font-weight: 700;
    color: var(--text-primary);
}

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

.warehouse-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.warehouse-stat {
    border-radius: 8px;
    background: rgba(245, 245, 247, 0.85);
    padding: 10px;
    min-width: 0;
}

.warehouse-stat span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 5px;
}

.warehouse-stat strong {
    display: block;
    color: var(--text-primary);
    font-size: 16px;
    overflow-wrap: anywhere;
}

.warehouse-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.muted,
.product-alias {
    color: var(--text-secondary);
}

.product-alias {
    font-size: 12px;
}

.inline-icon {
    width: 16px;
    height: 16px;
}

.tip-icon {
    width: 14px;
    height: 14px;
}

.field-spacer {
    margin-top: 8px;
}

.mini-action {
    margin-top: 4px;
}

.danger-mini {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.loading-row,
.error-row {
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 980px) {
    body {
        display: block;
        height: auto;
        overflow: auto;
    }

    .sidebar {
        width: 100%;
        padding: 20px;
        position: sticky;
        top: 0;
        flex-direction: row;
        overflow-x: auto;
    }

    .logo {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: max-content;
        margin-bottom: 0;
        padding-left: 0;
        align-self: center;
    }

    .sidebar-brand-logo {
        width: 96px;
        max-height: 38px;
    }

    .nav-item {
        min-width: max-content;
    }

    .main-content {
        padding: 24px;
    }

    .header-container,
    .modal-grid,
    .form-grid,
    .inbound-layout,
    .scan-layout,
    .inventory-flow-filters,
    .flow-stat-grid,
    .inventory-backup-grid,
    .warning-control-row,
    .record-switch,
    .operation-record-head,
    .operation-record-summary,
    .recognition-meta-grid,
    .recognition-panel-head,
    .multi-outbound-head,
    .multi-outbound-add-footer,
    .accepted-doc-info {
        display: grid;
        grid-template-columns: 1fr;
    }

    .recognition-result-head {
        display: grid;
    }

    .operation-record-meta {
        justify-content: flex-start;
    }

    .operation-export-tools {
        justify-content: flex-start;
    }

    .warning-days-control {
        grid-template-columns: auto 1fr auto;
    }

    .form-grid .span-2 {
        grid-column: auto;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .outbound-entry-switch {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .outbound-mode-tab {
        min-width: 0;
    }

    .manual-outbound-switch {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .manual-outbound-tab {
        min-width: 0;
    }

    .multi-outbound-summary {
        width: max-content;
    }
}

