* { box-sizing: border-box; font-family: Inter, system-ui, Arial, sans-serif; }
body { margin: 0; background: radial-gradient(circle at 10% 10%, #eef6ff 0%, #f7f9fc 40%, #f4f5ff 100%); color: #1f2937; }
.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
body.has-sidebar { padding-left: 244px; }
body.has-sidebar .container { margin: 24px 24px 24px 0; max-width: calc(100vw - 292px); }
.side-nav { position: fixed; inset: 0 auto 0 0; width: 244px; padding: 18px 14px; background: rgba(15,23,42,.96); color: #e5e7eb; box-shadow: 12px 0 30px rgba(15,23,42,.18); z-index: 25; overflow-y: auto; }
.side-brand { font-size: 18px; font-weight: 800; letter-spacing: .2px; padding: 8px 10px 18px; color: #fff; }
.side-section { border-top: 1px solid rgba(148,163,184,.22); padding-top: 14px; margin-top: 12px; }
.side-heading { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; padding: 0 10px 8px; }
.side-link { display: block; text-decoration: none; color: #dbeafe; padding: 10px 11px; border-radius: 10px; font-size: 14px; font-weight: 650; margin: 3px 0; }
.side-link:hover { background: rgba(59,130,246,.18); color: #fff; }
.side-link.active { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 10px 22px rgba(37,99,235,.25); }
.header h1 { margin: 0; font-size: 30px; letter-spacing: .2px; }
.header p { margin-top: 6px; color: #4b5563; }
.card { background: rgba(255,255,255,.92); border: 1px solid #e8ecf7; border-radius: 14px; padding: 16px; margin-top: 14px; box-shadow: 0 10px 24px rgba(25,45,86,.08); }
.header { background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(241,245,255,.95)); border: 1px solid #e8ecf7; border-radius: 16px; padding: 18px; box-shadow: 0 12px 24px rgba(25,45,86,.08); }
.header-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.menu-actions { display: flex; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select, textarea { border: 1px solid #d1d5db; border-radius: 8px; padding: 10px; font-size: 14px; background: #fff; }
.muted { color: #475569; margin: 8px 0; }
kbd { background: #111827; color: #fff; border-radius: 6px; padding: 2px 7px; font-size: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border-bottom: 1px solid #e5e7eb; padding: 10px; text-align: left; }
th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table-wrap td input,
.table-wrap td select {
  min-height: 44px;
  font-size: 15px;
  border-radius: 10px;
}
.table-wrap .item-search {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  text-align: left;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  border: 1px solid #c7d2fe;
  color: #0f172a;
}
.table-wrap .item-search:hover {
  background: linear-gradient(135deg, #e0e7ff, #bfdbfe);
}
.btn { border: none; background: linear-gradient(135deg, #0f172a, #1f2937); color: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.btn.primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 8px 20px rgba(37,99,235,.24); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: #eef2ff; color: #1e293b; border: 1px solid #d7def8; }
.actions { margin-top: 14px; }
.hidden { display: none !important; }
.toast { position: fixed; top: 16px; right: 16px; background: #16a34a; color: #fff; padding: 12px 14px; border-radius: 8px; z-index: 40; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 30; }
.modal-content { width: min(640px, 92vw); background: #fff; border-radius: 12px; padding: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
#searchResults { list-style: none; margin: 10px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
#searchResults li { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
#searchResults li:hover { background: #f3f4f6; }
.loading-overlay { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: grid; place-items: center; z-index: 80; }
.loading-card { background: #fff; border-radius: 12px; padding: 18px 22px; min-width: 280px; text-align: center; }
.status-board { display: grid; gap: 12px; }
.status-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.status-chip { border-radius: 10px; padding: 10px 12px; background: #eef2ff; border: 1px solid #d9e2ff; }
.status-label { font-size: 11px; text-transform: uppercase; color: #64748b; letter-spacing: .4px; }
.status-value { font-size: 14px; font-weight: 600; color: #0f172a; margin-top: 3px; }
.stage-list { display: grid; gap: 8px; }
.stage-row { display: flex; align-items: center; justify-content: space-between; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; background: #fff; }
.stage-row .name { font-weight: 600; color: #0f172a; }
.stage-row .message { color: #475569; font-size: 12px; margin-top: 2px; }
.pill { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .3px; }
.pill.success { background: #dcfce7; color: #166534; }
.pill.failed { background: #fee2e2; color: #991b1b; }
.pill.running { background: #dbeafe; color: #1d4ed8; }
.pill.pending { background: #f1f5f9; color: #334155; }
.pill.warn { background: #ffedd5; color: #9a3412; }
.row-results { display: grid; gap: 10px; }
.row-card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; background: linear-gradient(180deg,#fff,#f8fbff); }
.row-title { font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.row-sub { color: #334155; font-size: 13px; }
.row-ids { color: #0369a1; font-size: 12px; margin-top: 6px; }
.status-error { border: 1px solid #fecaca; background: #fff1f2; color: #9f1239; border-radius: 10px; padding: 8px 10px; font-size: 13px; }

.dispatch-container { max-width: 1480px; }
.dispatch-toolbar { display: grid; gap: 12px; }
.preset-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preset-btn { border: 1px solid #d7def8; background: #fff; color: #1e293b; border-radius: 999px; padding: 8px 11px; cursor: pointer; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.preset-btn span { background: #e2e8f0; color: #334155; border-radius: 999px; padding: 2px 6px; font-size: 11px; }
.preset-btn.active { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; border-color: #1d4ed8; }
.preset-btn.active span { background: rgba(255,255,255,.22); color: #fff; }
.tab-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tab-btn { border: 1px solid #d7def8; background: #fff; color: #334155; border-radius: 10px; padding: 9px 12px; cursor: pointer; font-weight: 800; }
.tab-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.config-panel h2 { margin-top: 0; }
.config-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin: 14px 0; }
.config-form .wide-field { grid-column: span 2; }
.config-list { overflow-x: auto; margin-top: 12px; }
.config-table { min-width: 900px; margin-top: 0; }
.config-table th, .config-table td { font-size: 13px; vertical-align: top; }
.stock-alert-panel { border-color: #fecaca; background: #fff7ed; }
.stock-alert-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stock-alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stock-alert-list { display: grid; gap: 8px; margin-top: 10px; }
.stock-alert-item { display: grid; grid-template-columns: 180px minmax(220px, 1fr) minmax(260px, 1.4fr); gap: 10px; padding: 8px 10px; border: 1px solid #fed7aa; border-radius: 10px; background: #fff; color: #7c2d12; font-size: 13px; }
.toolbar-row { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.toolbar-row label { min-width: 180px; }
.toolbar-row label.item-images-test-label { min-width: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.toolbar-row input[type="search"] { min-width: min(420px, 72vw); }
.image-sync-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-radius: 10px; padding: 9px 11px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 13px; }
.image-sync-status.success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.image-sync-status.error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.item-images-sync-modal { width: min(520px, 94vw); max-height: 86vh; overflow-y: auto; }
.item-image-preview-modal { width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; }
.item-image-preview-body { margin-top: 12px; display: grid; place-items: center; min-height: 120px; }
.item-image-preview-img { max-width: 100%; max-height: min(72vh, 640px); height: auto; object-fit: contain; border-radius: 8px; border: 1px solid #e2e8f0; }
.item-image-preview-frame { width: 100%; min-height: 420px; max-height: min(72vh, 640px); border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.item-image-preview-open { margin-top: 12px; justify-self: center; }
.dispatch-table td.dispatch-cell-item-name.item-name-has-image { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; color: #1d4ed8; }
.dispatch-table td.dispatch-cell-item-name.item-name-has-image:hover { color: #1e40af; }
.item-images-sync-steps { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; font-size: 14px; color: #334155; }
.item-images-sync-steps li { line-height: 1.35; }
.item-images-sync-steps li.done { color: #166534; font-weight: 650; }
.item-images-sync-steps li.active { color: #1d4ed8; font-weight: 700; }
.item-images-sync-steps .step-detail { display: block; font-size: 12px; font-weight: 500; color: #64748b; margin-top: 2px; word-break: break-word; }
.item-images-sync-detail { margin-top: 10px; font-size: 13px; }
.column-panel { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; background: #f8fafc; }
.column-panel summary { cursor: pointer; font-weight: 700; color: #0f172a; }
.column-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
.column-control { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.column-control label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.column-control input { width: auto; }
.dispatch-status, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dispatch-table-wrap { overflow: auto; max-height: 70vh; border: 1px solid #e5e7eb; border-radius: 12px; margin-top: 10px; background: #fff; }
.dispatch-table { table-layout: fixed; min-width: 1500px; margin-top: 0; font-size: 13px; }
.dispatch-table thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; box-shadow: inset 0 -1px 0 #e5e7eb; white-space: nowrap; }
.dispatch-table thead .filter-row th { top: 39px; z-index: 2; padding: 6px 8px; background: #f1f5f9; }
.dispatch-table tbody tr:nth-child(even) { background: #f8fbff; }
.dispatch-table tbody tr:hover { background: #eef6ff; }
.dispatch-table tbody tr.selected { background: #dbeafe; }
.dispatch-table td { vertical-align: top; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dispatch-table td[data-cell-key="attentionReasons"] { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.dispatch-table .select-col { position: sticky; left: 0; z-index: 3; background: inherit; width: 44px; text-align: center; }
.dispatch-table thead .select-col { background: #f8fafc; }
.dispatch-table input[type="checkbox"] { width: 16px; height: 16px; padding: 0; }
.th-content { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 18px; padding-right: 8px; }
.th-sort { border: 0; background: transparent; color: #475569; cursor: pointer; font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-sort:hover { color: #1d4ed8; }
.sort-badge { color: #1d4ed8; font-weight: 800; }
.resize-handle { position: absolute; top: -10px; right: -10px; width: 12px; height: 42px; cursor: col-resize; touch-action: none; }
.resize-handle::after { content: ""; position: absolute; top: 10px; right: 5px; width: 2px; height: 22px; background: #cbd5e1; border-radius: 2px; }
.resize-handle:hover::after { background: #2563eb; }
.filter-cell { position: relative; }
.filter-menu-btn { width: 100%; border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 7px; padding: 6px 8px; font-size: 12px; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-menu-btn.active { border-color: #2563eb; background: #dbeafe; color: #1e3a8a; font-weight: 700; }
.filter-panel { position: absolute; top: 32px; left: 0; width: 300px; max-width: 82vw; z-index: 20; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; box-shadow: 0 18px 38px rgba(15,23,42,.22); padding: 10px; text-transform: none; white-space: normal; }
.filter-panel-title { font-size: 13px; font-weight: 800; color: #0f172a; margin-bottom: 8px; }
.filter-search, .numeric-filter input, .numeric-filter select { width: 100%; min-width: 0; padding: 7px 8px; border-radius: 8px; font-size: 12px; }
.numeric-filter { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.filter-values { max-height: 260px; overflow-y: auto; display: grid; gap: 4px; margin-top: 8px; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 12px; color: #0f172a; }
.filter-option:hover { background: #f1f5f9; }
.filter-option input { width: 14px; height: 14px; padding: 0; flex: 0 0 auto; }
.filter-option-all { margin-top: 8px; border-bottom: 1px solid #e2e8f0; border-radius: 0; padding-bottom: 8px; font-weight: 700; }
.filter-value-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { color: #64748b; font-size: 11px; }
.filter-more { color: #64748b; font-size: 11px; margin-top: 8px; }
.filter-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.empty-cell { text-align: center; color: #64748b; padding: 28px !important; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dispatch-modal-content { width: min(1180px, 94vw); max-height: 88vh; display: grid; grid-template-rows: auto 1fr auto; }
.dispatch-modal-body { overflow-y: auto; display: grid; gap: 12px; padding-right: 4px; }
.dispatch-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.dispatch-order-card { display: grid; gap: 8px; }
.dispatch-modal-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.dispatch-modal-item-head { display: flex; gap: 14px; align-items: flex-start; }
.dispatch-modal-thumb-wrap { flex-shrink: 0; }
.dispatch-modal-thumb { width: 88px; height: 88px; object-fit: contain; background: #f4f4f5; border-radius: 8px; border: 1px solid #e5e7eb; display: block; }
.dispatch-modal-thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 0.72rem; color: #6b7280; text-align: center; padding: 6px; }
.dispatch-modal-item-text { min-width: 0; }
.dispatch-order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.order-select { display: flex; align-items: center; gap: 8px; }
.order-select input { width: 16px; height: 16px; padding: 0; }
.dispatch-size-wrap { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.dispatch-size-table { min-width: 760px; margin-top: 0; }
.dispatch-size-table th, .dispatch-size-table td { padding: 8px; font-size: 12px; }
.dispatch-size-table input[type="number"] { width: 110px; padding: 7px 8px; font-size: 13px; }
.limit-error-row { background: #fff1f2 !important; }
.dispatch-orders-list { display: grid; gap: 12px; }
textarea { width: 100%; resize: vertical; font-family: inherit; }
.item-images-manual-stats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stat-pill { font-size: 13px; font-weight: 650; padding: 6px 11px; border-radius: 999px; background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.stat-pill.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.stat-pill.warn { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.stat-pill.muted { font-weight: 500; color: #64748b; }
.stat-pill.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.item-images-manual-toolbar { display: grid; gap: 12px; }
.item-images-manual-actions { align-items: end; }
.section-title { margin: 0 0 8px; font-size: 1.1rem; color: #0f172a; }
.staged-list { display: grid; gap: 8px; margin-top: 8px; }
.staged-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; font-size: 13px; }
.item-images-manual-table-wrap { overflow-x: auto; margin-top: 10px; }
.item-images-manual-table { min-width: 520px; font-size: 13px; }
.item-images-manual-table .thumb-cell { width: 72px; }
.item-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }
.item-images-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.danger-outline { border-color: #fecaca; color: #b91c1c; }
.btn.danger-outline:hover { background: #fff1f2; }
.item-images-manual-modal { width: min(520px, 94vw); max-height: 86vh; overflow-y: auto; }
.manual-upload-modal-body { margin-top: 12px; font-size: 14px; }
.manual-upload-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 48vh; overflow-y: auto; }
.manual-upload-results li { padding: 6px 8px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.manual-upload-results li.ok { border-color: #bbf7d0; background: #f0fdf4; }
.manual-upload-results li.fail { border-color: #fecaca; background: #fff1f2; }
.error-text { color: #b91c1c; font-size: 13px; }
.spinner-line { width: 100%; height: 3px; margin-top: 14px; border-radius: 999px; background: linear-gradient(90deg, #e2e8f0, #3b82f6, #e2e8f0); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.manual-bulk-file-label { display: inline-block; margin-bottom: 4px; cursor: pointer; }
.manual-bulk-tag-panel { display: grid; gap: 12px; margin-top: 12px; }
.manual-tag-card { display: grid; grid-template-columns: 88px 1fr auto; gap: 14px; align-items: start; padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.manual-tag-thumb-wrap { width: 88px; height: 88px; flex-shrink: 0; }
.manual-tag-thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; border: 1px solid #e2e8f0; display: block; }
.manual-tag-thumb.ph { width: 88px; height: 88px; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 10px; }
.manual-tag-fields { display: grid; gap: 10px; min-width: 0; }
.manual-tag-fields label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: #334155; }
.manual-tag-fields input { font-weight: 400; padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 14px; }
.manual-tag-fields input:disabled { background: #f1f5f9; color: #64748b; }
.manual-tag-barcode-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.manual-tag-barcode-row .manual-tag-barcode { flex: 1; min-width: 140px; }
.manual-tag-meta { margin: 0; }
.manual-tag-resolve { margin: 0; }
.staged-row .small { font-size: 12px; }

.dashboard-kpis { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 0.5rem; }
.dashboard-kpi-num { font-size: 1.75rem; font-weight: 700; color: #0f172a; }
.chart-wrap { position: relative; height: 280px; max-width: 100%; }
.chart-wrap.tall { height: 360px; }
.dashboard-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 960px) {
  .dashboard-grid-2 { grid-template-columns: 1fr; }
}
.dashboard-crumb { margin-bottom: 0.5rem; min-height: 1.25rem; }
.dashboard-crumb button { margin-right: 0.5rem; }

@media (max-width: 860px) {
  body.has-sidebar { padding-left: 0; padding-top: 250px; }
  body.has-sidebar .container { margin: 16px auto; max-width: 100%; }
  .side-nav { right: 0; bottom: auto; width: auto; min-height: 232px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .side-brand { grid-column: 1 / -1; padding-bottom: 4px; }
  .side-section { margin-top: 0; padding-top: 8px; }
  .stock-alert-item { grid-template-columns: 1fr; }
  .config-form .wide-field { grid-column: auto; }
}
