/* ========================================================
   PRECISION INDUSTRIAL LEDGER & WORKFLOOR TICKET DESIGN SYSTEM
   WIP FLOW TRACKING - BÁO CÁO ĐỐI CHIẾU NHẬP XUẤT TỒN
   ======================================================== */

:root {
  --primary-navy: #111827;
  --primary-teal: #0d6e5b;
  --bg-main: #f4f5f7;
  --bg-canvas: #f4f5f7;
  --surface-card: #ffffff;
  --surface-sheet: #ffffff;
  --surface-recessed: #eef0f4;
  --border-subtle: #e2e8f0;
  --border-card: #cbd5e1;
  --border-ledger: #d5dce6;
  --border-ledger-strong: #94a3b8;
  --text-main: #111827;
  --text-muted: #4b5563;
  --ink-carbon: #111827;
  --ink-slate: #4b5563;
  --ink-muted: #6b7280;

  /* Precision Industrial Accent Tokens */
  --blueprint-navy: #1e3a5f;
  --blueprint-tint: #eff4fa;
  --workfloor-emerald: #0d6e5b;
  --workfloor-emerald-tint: #edf7f5;
  --inspection-crimson: #c81e51;
  --inspection-crimson-tint: #fdf2f5;
  --caution-ochre: #b45309;
  --caution-ochre-tint: #fef6ec;

  /* Legacy Alias Tokens */
  --hdr-bg-slate: #f1f5f9;
  --hdr-bg-blue: #eff4fa;
  --hdr-bg-green: #edf7f5;
  --hdr-bg-amber: #fef6ec;
  --hdr-bg-cyan: #ecfeff;
  --hdr-bg-rose: #fdf2f5;

  --accent-blue: #1d4ed8;
  --accent-green: #0d6e5b;
  --accent-cyan: #0e7490;
  --accent-amber: #b45309;
  --accent-rose: #c81e51;

  /* Typography Pair */
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-canvas);
  color: var(--ink-carbon);
  line-height: 1.45;
  padding-bottom: 60px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 140px;
}

input, select, textarea, .form-group, .manage-card, .table-responsive, [id] {
  scroll-margin-top: 140px;
}

@keyframes pulseInputError {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    border-color: #ef4444;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    border-color: #ef4444;
  }
}

.input-error-highlight {
  border: 2px solid #ef4444 !important;
  background-color: #fff1f2 !important;
  animation: pulseInputError 1.2s ease-in-out 3 !important;
}

/* TOAST POPUP NOTIFICATION */
.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border-left: 4px solid #10b981;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-popup.show {
  transform: translateY(0);
  opacity: 1;
}

/* STICKY HEADER WRAPPER (FREEZE TOP APP BAR & NAV TABS ON SCROLL) */
.sticky-header-wrapper {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  background-color: #ffffff;
}

/* TOP APP BAR & FILTERS */
.top-app-bar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-bar-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
}

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

.app-title .icon {
  font-size: 24px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 9px;
  border-radius: 8px;
}

.app-title h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin: 0;
}

.app-title small {
  color: #94a3b8;
  font-size: 11.5px;
}

.user-action-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-filters-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.control-item {
  display: flex;
  flex-direction: column;
}

.control-item label {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.form-control {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
  min-width: 220px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.select-customer-styled {
  min-width: 240px;
}

.select-po-styled {
  min-width: 200px;
}

/* NAV TABS */
.nav-tabs {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.tab-btn {
  padding: 13px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--primary-teal); }
.tab-btn.active {
  color: var(--primary-teal);
  border-bottom-color: var(--primary-teal);
}

.status-tag {
  background-color: #fef08a;
  color: #854d0e;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid #fde047;
}

.status-tag.submitted {
  background-color: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

/* MAIN CONTENT */
.main-content {
  max-width: 1480px;
  margin: 18px auto;
  padding: 0 16px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ACTION TOOLBAR */
.action-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  background: #ffffff;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.btn-group-left, .btn-group-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.keyboard-hint {
  font-size: 12px;
  color: #64748b;
  margin-left: 10px;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.btn {
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn:active { transform: translateY(1px); }

.btn-primary { background-color: #0f766e; color: white; }
.btn-primary:hover { background-color: #115e59; }
.btn-secondary { background-color: #475569; color: white; }
.btn-secondary:hover { background-color: #334155; }
.btn-success { background-color: #16a34a; color: white; }
.btn-success:hover { background-color: #15803d; }
.btn-info { background-color: #0284c7; color: white; }
.btn-info:hover { background-color: #0369a1; }
.btn-warning { background-color: #d97706; color: white; padding: 4px 8px; font-size: 11px; }
.btn-warning:hover { background-color: #b45309; }
.btn-danger { background-color: #dc2626; color: white; padding: 4px 8px; font-size: 11px; }
.btn-danger:hover { background-color: #b91c1c; }
.btn-dark { background-color: #1e293b; color: white; }
.btn-outline { background-color: #ffffff; border: 1px solid #cbd5e1; color: var(--text-main); }
.btn-outline:hover { background-color: #f8fafc; }

/* REPORT HEADER BANNER */
.report-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  margin-bottom: 22px;
}

.banner-title-group .sheet-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.banner-title-group .sheet-subtitle {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.banner-date-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

.banner-date-picker label {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.date-input-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-date-nav {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s;
}

.btn-date-nav:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.report-date-control {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  background: #ffffff;
}

/* TOP SUMMARY FIXED TABLE CARD */
.summary-card-wrapper {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  margin-bottom: 30px;
  overflow-x: auto;
}

.excel-summary-table {
  border-collapse: collapse;
  font-size: 13px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
}

.excel-summary-table td {
  border: 1px solid #cbd5e1;
  padding: 7px 14px;
  text-align: center;
}

.cell-header {
  font-weight: 700;
  width: 110px;
  background-color: #f8fafc;
  color: #334155;
}

.cell-val {
  width: 110px;
  font-weight: 700;
  background-color: #ffffff;
}

.bg-prep-hdr {
  font-size: 12px;
  font-weight: 700;
  width: 150px;
  background-color: #f8fafc;
  color: #334155;
}

.bg-prep-val {
  width: 130px;
  font-weight: 800;
  font-size: 16px;
  color: var(--accent-amber);
  background-color: #fffbeb;
}

.bg-sum-hdr {
  font-size: 11.5px;
  font-weight: 700;
  background-color: #f1f5f9;
  color: #1e293b;
  width: 135px;
}

.bg-sum-val {
  background-color: #eff6ff !important;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-blue);
}

.txt-red { color: var(--accent-rose) !important; background-color: #fff1f2 !important; }
.bold-txt { font-weight: 800; font-size: 15px; }

.blank-cell {
  border: none !important;
  background: transparent !important;
}

/* BATCH CARDS CONTAINER */
.excel-batches-container {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.excel-batch-wrapper {
  background-color: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  overflow-x: auto;
}

.batch-date-tag {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  padding-left: 55px;
}

/* TABLE 1: TẦNG 1 */
.table-card-1 {
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

/* DESKTOP vs MOBILE BATCH DISPLAY */
.desktop-batch-layout {
  display: block;
}
.mobile-batch-layout {
  display: none;
}

.batch-table-1 {
  border-collapse: collapse;
  font-size: 13px;
  background-color: #ffffff;
}

.batch-table-1 th, .batch-table-1 td {
  border: 1px solid #e2e8f0;
  text-align: center;
  padding: 6px 8px;
  vertical-align: middle;
}

.col-batch-name { width: 100px; }
.col-ton-dau { width: 95px; }
.col-nhap { width: 110px; }
.col-xuat { width: 105px; }
.col-ton-cuoi { width: 130px; }
.col-ton-thucte { width: 120px; }
.col-thieu { width: 105px; }

.th-batch-title {
  background-color: #f8fafc;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.th-ton-dau {
  background-color: var(--hdr-bg-slate);
  color: #334155;
  font-weight: 800;
  font-size: 12.5px;
}

.th-nhap {
  background-color: var(--hdr-bg-blue);
  color: #1e40af;
  font-weight: 800;
  font-size: 12.5px;
}

.th-xuat {
  background-color: var(--hdr-bg-green);
  color: #166534;
  font-weight: 800;
  font-size: 12.5px;
}

.th-ton-cuoi {
  background-color: var(--hdr-bg-amber);
  color: #92400e;
  font-weight: 800;
  font-size: 12.5px;
}

.th-ton-thucte {
  background-color: var(--hdr-bg-cyan);
  color: #0e7490;
  font-weight: 800;
  font-size: 12.5px;
}

.th-thieu-cell {
  background-color: var(--hdr-bg-rose);
  color: var(--accent-rose);
  font-weight: 900;
  font-size: 13.5px;
}

.sub-ton-dau { background-color: #f8fafc; font-size: 11px; font-style: italic; color: #64748b; }
.sub-nhap { background-color: #f0f7ff; font-size: 11px; font-style: italic; font-weight: 700; color: #2563eb; }
.sub-xuat { background-color: #f4fcf6; font-size: 11px; font-style: italic; font-weight: 700; color: #16a34a; }
.sub-ton-cuoi { background-color: #fffdf5; font-size: 11px; font-style: italic; font-weight: 700; color: #b45309; line-height: 1.2; }
.sub-ton-thucte { background-color: #f0fdfa; font-size: 11px; font-style: italic; font-weight: 700; color: #0891b2; }

.val-plan-box { background-color: #ffffff; font-size: 16px; font-weight: 800; color: #0f172a; text-align: center; }
.val-ton-dau-box { font-size: 15px; font-weight: 800; color: #64748b; background-color: #f8fafc; }
.val-nhap-box { font-size: 15px; font-weight: 800; color: #0284c7; background-color: #f0f9ff; }
.val-xuat-box { font-size: 15px; font-weight: 800; color: #16a34a; background-color: #f0fdf4; }
.val-ton-cuoi-box { font-size: 15px; font-weight: 800; color: #b45309; background-color: #fffbeb; }
.val-ton-thucte-box { font-size: 15px; font-weight: 800; color: #0e7490; background-color: #ecfeff; }

/* 3-ROW LAYOUT STYLES FOR TABLE 1 */
.row-prev-cumulative {
  background-color: #f8fafc !important;
  color: #64748b;
  font-size: 12.5px;
}

.row-prev-cumulative td {
  border-bottom: 1px dashed #cbd5e1 !important;
  padding: 5px 8px !important;
}

.row-today-activity {
  background-color: #fffdf5 !important;
  font-size: 13px;
}

.row-today-activity td {
  border-bottom: 2px solid #94a3b8 !important;
  padding: 4px 6px !important;
}

.row-batch-cumulative {
  background-color: #ffffff !important;
  font-size: 13.5px;
}

.row-batch-cumulative td {
  padding: 6px 8px !important;
}

.lbl-row-type {
  text-align: left !important;
  padding-left: 10px !important;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: #475569;
}

.row-today-activity .lbl-row-type {
  color: #92400e !important;
  font-weight: 800;
}

.val-dash {
  color: #94a3b8 !important;
  font-weight: 600;
  letter-spacing: 1px;
}

.val-prev-in {
  font-size: 14px;
  font-weight: 800;
  color: #0369a1;
}

.val-prev-out {
  font-size: 14px;
  font-weight: 800;
  color: #15803d;
}

.val-today-in {
  background-color: #ffffff !important;
  padding: 2px 4px !important;
}

.val-today-in input {
  width: 100%;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  padding: 4px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: #0c4a6e;
  background: #f0f9ff;
  outline: none;
}

.val-today-in input:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.val-today-out {
  background-color: #ffffff !important;
  padding: 2px 4px !important;
}

.val-today-out input {
  width: 100%;
  border: 1px solid #86efac;
  border-radius: 4px;
  padding: 4px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: #166534;
  background: #f0fdf4;
  outline: none;
}

.val-today-out input:focus {
  background: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.sub-batch-plan {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
}

/* THIẾU DATA CELL & 4 SHORTAGE BREAKDOWN BOXES */
.cell-thieu-data {
  background-color: #fff1f2;
  padding: 4px !important;
  vertical-align: middle;
  min-width: 90px;
}

.thieu-num-display {
  font-size: 16px;
  font-weight: 900;
  color: #be123c;
}

/* RED RIGHT ARROW (VERTICALLY CENTERED & NO BORDERS) */
.col-arrow-thieu {
  width: 32px !important;
  border: none !important;
}

.th-arrow-cell-clean {
  background: transparent !important;
  border: none !important;
  width: 32px !important;
  padding: 0 !important;
}

.cell-arrow-thieu-clean {
  background: transparent !important;
  border: none !important;
  text-align: center !important;
  vertical-align: middle !important;
  padding: 0 4px !important;
}

.red-right-arrow {
  width: 24px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.4));
  animation: pulse-arrow-right 2s infinite ease-in-out;
}

@keyframes pulse-arrow-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* 3 SHORTAGE BREAKDOWN COLUMNS (WITH NOTE DIRECTLY IN HEADER) */
.hdr-shortage-breakdown {
  background: linear-gradient(135deg, #be123c 0%, #881337 100%) !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 6px 8px !important;
}

.sub-matxac { background-color: #ffe4e6 !important; color: #9f1239 !important; font-size: 11px; font-weight: 700; width: 105px; }
.sub-hangphe { background-color: #fef3c7 !important; color: #92400e !important; font-size: 11px; font-weight: 700; width: 105px; }
.sub-shortage-khac { background-color: #f3e8ff !important; width: 135px; padding: 4px 6px !important; }

.sub-khac-header-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.sub-khac-title {
  font-size: 11px;
  font-weight: 800;
  color: #6b21a8;
}

.th-khac-note-input {
  width: 100%;
  border: 1px dashed #c084fc !important;
  border-radius: 4px;
  padding: 2px 4px !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  text-align: center;
  background: #ffffff !important;
  color: #581c87 !important;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.th-khac-note-input:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2) !important;
}

.cell-shortage-matxac {
  background-color: #fff1f2 !important;
  padding: 3px !important;
}

.cell-shortage-hangphe {
  background-color: #fffbeb !important;
  padding: 3px !important;
}

.cell-shortage-khac {
  background-color: #faf5ff !important;
  padding: 3px !important;
}

.field-shortage-matxac {
  color: #be123c !important;
  font-weight: 800 !important;
  font-size: 14.5px !important;
}

.field-shortage-hangphe {
  color: #b45309 !important;
  font-weight: 800 !important;
  font-size: 14.5px !important;
}

.field-shortage-khac {
  color: #7c3aed !important;
  font-weight: 800 !important;
  font-size: 14.5px !important;
}

.field-shortage-note {
  font-size: 11.5px !important;
  text-align: left !important;
  padding: 4px 6px !important;
}

/* ARROW ROW */
.arrow-row {
  display: flex;
  margin: 4px 0;
}

.arrow-offset {
  width: 580px;
  flex-shrink: 0;
  transition: width 0.1s ease-out;
}

.arrow-holder {
  width: 32px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.blue-block-arrow {
  width: 24px;
  height: 26px;
  filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.25));
}

.mobile-flow-text {
  display: none;
}

/* LOWER SECTION: TABLE 2 */
.lower-section {
  display: flex;
  align-items: flex-end;
}

.lower-left-spacer {
  width: 580px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 16px;
  height: 40px;
  transition: width 0.1s ease-out;
}

.executor-label-txt {
  font-style: italic;
  font-size: 13px;
  color: #475569;
  font-weight: 700;
  line-height: 1;
}

.table-card-2 {
  display: inline-block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

.batch-table-2 {
  border-collapse: collapse;
  font-size: 12px;
  background-color: #ffffff;
}

.batch-table-2 th, .batch-table-2 td {
  border: 1px solid #e2e8f0;
  text-align: center;
  padding: 5px 6px;
}

.wip-col-1 { width: 120px; }
.wip-col-2 { width: 110px; }
.wip-col-3 { width: 110px; }
.wip-col-4 { width: 110px; }
.wip-col-5 { width: 130px; }
.wip-col-6 { width: 105px; }

.hdr-wip-top {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.hdr-out-top {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.sub-wip-1 { background-color: #fef9c3; font-weight: 700; font-size: 11px; color: #854d0e; }
.sub-wip-2 { background-color: #f8fafc; font-weight: 700; font-size: 11px; color: #334155; }
.sub-wip-3 { background-color: #ffedd5; font-weight: 700; font-size: 11px; color: #9a3412; }
.sub-wip-4 { background-color: #f1f5f9; font-weight: 700; font-size: 11px; color: #334155; }
.sub-wip-5 { background-color: #dcfce7; font-weight: 700; font-size: 11px; color: #166534; }
.sub-wip-6 { background-color: #ffedd5; font-weight: 700; font-size: 11px; color: #9a3412; }

.sub-batch-tag {
  font-style: italic;
  font-size: 11px;
  color: #94a3b8;
  font-weight: normal;
  background-color: #ffffff;
}

.wip-num-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  background: transparent;
  outline: none;
  padding: 4px 0;
  transition: all 0.15s;
}

.wip-num-input-out {
  color: #ea580c;
  font-weight: 800;
}

.wip-executor-input {
  width: 100%;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
  background: #f8fafc;
  outline: none;
  color: #334155;
  padding: 5px 2px;
  transition: all 0.15s;
}

.wip-executor-input:focus, .wip-num-input:focus {
  background-color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* TABLE 2 ACTION COLUMN & EDITABLE/LOCKED STATES */
.wip-col-action {
  width: 95px !important;
}

.hdr-action-top {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.cell-batch-actions {
  text-align: center;
  vertical-align: middle;
  background-color: #f8fafc;
  padding: 6px 4px !important;
}

.btn-batch-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.btn-batch-toggle.is-editing {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  color: #ffffff !important;
  border: 1px solid #15803d !important;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35) !important;
  font-weight: 800;
}

.btn-batch-toggle.is-editing:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.45) !important;
}

.btn-batch-toggle.is-locked {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.12);
  font-weight: 800;
}

.btn-batch-toggle.is-locked:hover {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.2);
}

/* Locked mode styling */
.batch-row-locked .wip-num-input {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid transparent !important;
  cursor: default;
}

.batch-row-locked .wip-num-input-out {
  color: #c2410c !important;
  font-weight: 800;
}

.batch-row-locked .wip-executor-input {
  background: #f8fafc !important;
  border: 1px solid transparent !important;
  color: #475569 !important;
  cursor: default;
}

/* Editing mode styling */
.batch-row-editing .wip-num-input {
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
  color: #0f172a !important;
}

.batch-row-editing .wip-num-input-out {
  border-color: #ea580c !important;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15) !important;
  color: #c2410c !important;
}

.batch-row-editing .wip-executor-input {
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  color: #0f172a !important;
}

/* ========================================================
   TAB 3: MASTER DATA MANAGEMENT & STATISTICS BANNER
   ======================================================== */
.manage-stats-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .manage-stats-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .manage-grid {
    grid-template-columns: 1fr;
  }
}

.manage-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.manage-card-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 12px 18px;
}

.manage-card-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.manage-card-body {
  padding: 18px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.batch-tag-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin: 2px;
}

/* FLOW LOG TABLE */
.shadow-card {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.table-responsive {
  overflow-x: auto;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
}

.flow-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.flow-log-table th, .flow-log-table td {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.th-meta { background-color: #f8fafc; font-weight: 700; color: #334155; }
.th-daily { background-color: #eff6ff; font-weight: 700; color: #1e40af; }
.th-cum { background-color: #f0fdf4; font-weight: 700; color: #166534; }
.th-check { background-color: #fff1f2; font-weight: 700; color: #be123c; }

.flow-log-table tfoot tr {
  background-color: #0f172a;
  color: #ffffff;
  font-weight: 800;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-box {
  background: white;
  width: 90%;
  max-width: 520px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h4 { font-size: 15px; font-weight: 700; }

.btn-close {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.8;
}

.btn-close:hover { opacity: 1; }

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 18px;
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* NUMPAD MODAL */
.modal-numpad {
  background: #ffffff;
  width: 320px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.numpad-display {
  background-color: #0f172a;
  color: #38bdf8;
  font-size: 32px;
  font-weight: 800;
  text-align: right;
  padding: 14px 20px;
  letter-spacing: 1px;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px;
  background-color: #f8fafc;
}

.num-key {
  padding: 16px;
  font-size: 20px;
  font-weight: 800;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.num-key:active { background-color: #e2e8f0; }
.num-clear { background-color: #fee2e2; color: #dc2626; }
.num-back { background-color: #fef3c7; color: #d97706; }

.numpad-footer { padding: 10px; background-color: #f8fafc; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* TAB 3: MANAGEMENT & BATCH CONFIGURATION STYLES */
.manage-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.manage-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .manage-grid {
    grid-template-columns: 1fr;
  }
}

.manage-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border: 1px solid #cbd5e1;
  overflow: hidden;
}

.manage-card-header {
  background: #f8fafc;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}

.manage-card-header h3 {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.manage-card-body {
  padding: 18px;
}

/* DYNAMIC BATCH CONFIGURATION GRID */
.batch-config-wrapper {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 4px;
}

.batch-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.batch-config-title {
  font-weight: 700;
  color: #1e293b;
  font-size: 13.5px;
  margin-bottom: 0;
}

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

.batch-count-control label {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0;
}

.select-batch-count {
  width: auto !important;
  padding: 5px 12px !important;
  font-weight: 700 !important;
  color: #0284c7 !important;
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  border-radius: 6px !important;
  cursor: pointer;
}

.batch-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.batch-card-item {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.batch-card-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.batch-card-item.is-tail {
  border: 1.5px solid #c084fc;
  background: #faf5ff;
}

.batch-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 800;
  background: #e0f2fe;
  color: #0369a1;
  letter-spacing: 0.3px;
}

.batch-card-item.is-tail .batch-card-badge {
  background: #ede9fe;
  color: #7c3aed;
}

.batch-card-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.batch-card-input-wrapper label {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0;
}

.batch-card-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: right;
  outline: none;
  background: #ffffff;
}

.batch-card-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.batch-card-item.is-tail .batch-card-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.batch-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.batch-sum-info {
  color: #334155;
  font-weight: 500;
}

.batch-diff-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11.5px;
}

.batch-diff-badge.match {
  background: #dcfce7;
  color: #15803d;
}

.batch-diff-badge.diff-warn {
  background: #fef3c7;
  color: #b45309;
}

.batch-tag-badge {
  display: inline-block;
  padding: 2px 7px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  margin-right: 4px;
  margin-bottom: 3px;
}

/* INTERACTIVE MASTER-DETAIL CUSTOMER TABLE */
.table-clickable-customers tbody tr.customer-row-item {
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  border-left: 4px solid transparent;
}

.table-clickable-customers tbody tr.customer-row-item:hover {
  background-color: #f0f9ff !important;
}

.table-clickable-customers tbody tr.customer-row-item.selected-cust-row {
  background-color: #e0f2fe !important;
  border-left: 4px solid #0284c7 !important;
  font-weight: 600;
}

.table-clickable-customers tbody tr.customer-row-item.selected-cust-row td:first-child strong {
  color: #0369a1 !important;
}

/* ACTION BUTTONS (EDIT ✏️ / DELETE 🗑️) */
.btn-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  line-height: 1.2;
}

.btn-action-edit {
  background-color: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.btn-action-edit:hover {
  background-color: #fde68a;
  color: #92400e;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-action-danger {
  background-color: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-action-danger:hover {
  background-color: #fecaca;
  color: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.badge-po-count {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 800;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}


/* TAB 2: BÁO CÁO ĐỐI CHIẾU NHẬP XUẤT TỒN + THEO DÕI SẢN LƯỢNG (HỢP NHẤT LIỀN MẠCH) */
.dept-main-header {
  margin-bottom: 14px;
}

.dept-top-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.dept-summary-wrapper {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #cbd5e1;
}

.dept-summary-table {
  border-collapse: collapse;
  background: #ffffff;
  font-size: 13px;
}

.dept-summary-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  text-align: center;
  min-width: 110px;
}

.bg-hdr-cyan {
  background-color: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
}

.bg-hdr-slate {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

.val-dept-sum {
  background-color: #ffffff;
  font-size: 15px;
}

.dept-section-title-right {
  flex: 1;
  text-align: right;
  padding-bottom: 6px;
}

.dept-section-title-right h3 {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.5px;
  margin: 0;
}

.dept-batches-container {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dept-batch-block {
  display: block;
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 10px 12px;
  overflow-x: auto;
}

.dept-unified-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 8px;
  overflow: hidden;
}

.dept-unified-table th, .dept-unified-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
}

.th-top-batch-banner {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 8px 10px;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1.5px solid #0284c7;
}

.th-top-batch-banner .plan-tag {
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 10px;
  border-radius: 12px;
  margin-left: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.th-ngay {
  width: 95px;
}

.th-dept-tondau {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  width: 95px;
}

.th-dept-nhap {
  background-color: #fed7aa;
  color: #9a3412;
  font-weight: 800;
  width: 100px;
}

.th-dept-xuat {
  background-color: #fed7aa;
  color: #9a3412;
  font-weight: 800;
  width: 100px;
}

.th-dept-toncuoi {
  background-color: #fed7aa;
  color: #9a3412;
  font-weight: 800;
  width: 125px;
}

.sub-dept-header {
  font-size: 10.5px;
  font-style: italic;
  font-weight: 600;
  padding: 4px 6px;
  background-color: #f8fafc;
  color: #64748b;
  line-height: 1.2;
}

.sub-dept-toncuoi {
  font-size: 9.5px;
  line-height: 1.15;
}

.dept-executor-note {
  font-size: 11.5px;
  font-style: italic;
  color: #64748b;
  text-align: right;
  padding-right: 4px;
}

.th-dept-col {
  background-color: #e0f2fe;
  color: #0369a1;
  font-weight: 800;
  font-size: 12px;
  padding: 7px 6px;
}

.dept-nav-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  text-align: center;
  padding: 3px;
  outline: none;
  border-radius: 3px;
}

.dept-nav-input:focus {
  background: #eff6ff;
  box-shadow: inset 0 0 0 1.5px #0284c7;
}

.dept-nav-input.txt-date {
  font-weight: 700;
  color: #334155;
}

.btn-add-dept-row {
  background: #f1f5f9;
  border: 1px dashed #94a3b8;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  padding: 4px 10px;
  margin: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-add-dept-row:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #64748b;
}

/* Remove default number arrows (spinners) across all tables */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

.dept-nav-input::placeholder {
  color: #cbd5e1;
  font-size: 11px;
}

/* TAB 2 FIXED FOOTER SUMMARY & STATUS BADGE */
.dept-table-tfoot {
  background-color: #f8fafc;
  border-top: 2px solid #cbd5e1;
}

.tr-dept-total td {
  padding: 8px 6px !important;
  vertical-align: middle;
}

.td-dept-sum-label {
  background-color: #f1f5f9;
  color: #1e293b;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.td-dept-sum-val {
  background-color: #f8fafc;
  color: #0f172a;
  font-size: 13.5px;
  font-weight: 800;
}

.td-dept-sum-status {
  background-color: #ffffff;
  padding: 4px 6px !important;
}

.dept-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.dept-status-badge.is-ok {
  background-color: #dcfce7;
  color: #15803d;
  border: 1.5px solid #86efac;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.15);
}

.dept-status-badge.is-not-ok {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #fca5a5;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15);
}

/* ========================================================
   ROLE SELECTOR & PERMISSION UI
   ======================================================== */
.role-control-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.role-badge.is-worker {
  background-color: #0284c7;
  color: #ffffff;
  border: 1px solid #38bdf8;
}

.role-badge.is-manager {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  border: 1px solid #fcd34d;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn-role-switch {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-role-switch:hover {
  background: rgba(255, 255, 255, 0.28);
}

.hidden,
.admin-only-tab.hidden,
.manager-only-tab.hidden {
  display: none !important;
}

/* NÚT VÉT SỐ ĐUÔI TẠI HEADER TỔNG HỢP VÀ TOOLBAR */
.btn-sweep-tail {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: 1px solid #b45309;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-sweep-tail:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(217, 119, 6, 0.45);
}

.btn-sweep-tail.disabled,
.btn-sweep-tail:disabled {
  background: #e2e8f0 !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
  cursor: default !important;
  box-shadow: none !important;
  transform: none !important;
}

.cell-sweep-action {
  vertical-align: middle;
}

/* ========================================================
   SUB-TABS IN TAB 1 (KIỂM KÊ THEO NGÀY VS LỊCH SỬ CÁC NGÀY)
   ======================================================== */
.sub-tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 6px;
}

.sub-tab-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 8px 18px;
  border-radius: 8px 8px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.sub-tab-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.sub-tab-btn.active {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.25);
}

.subtab-pane {
  display: none;
}

.subtab-pane.active {
  display: block;
}

/* ========================================================
   HISTORY ALL-DATES TABLE STYLING
   ======================================================== */
.history-table-wrapper {
  margin-top: 15px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  max-height: 620px;
  overflow: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: center;
}

.history-table th {
  background: #1e293b;
  color: #ffffff;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #334155;
  position: sticky;
  top: 0;
  z-index: 10;
}

.history-table td {
  padding: 8px 6px;
  border: 1px solid #e2e8f0;
  vertical-align: middle;
}

.history-table td.cell-merged-batch {
  background-color: #f0f9ff !important;
  color: #0369a1 !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
  border-right: 2px solid #93c5fd !important;
  border-left: 2px solid #93c5fd !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.history-table tbody tr:hover {
  background-color: #f8fafc;
}

.history-tfoot {
  position: sticky;
  bottom: 0;
  background: #f1f5f9;
  z-index: 9;
}

.tr-hist-summary td {
  border-top: 2px solid #0f172a;
  padding: 10px 6px;
  font-weight: 800;
  font-size: 13px;
  background-color: #f1f5f9;
}

/* AUTH PIN & OTP MODAL */
.modal-auth-card {
  max-width: 480px;
}

.auth-modal-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px 0;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  color: #0f766e;
  border-bottom-color: #0f766e;
  background: #ffffff;
}

.auth-pane {
  display: none;
}

.auth-pane.active {
  display: block;
}

.role-badge.is-admin {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #ffffff;
  border: 1px solid #c4b5fd;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.user-role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.user-role-badge.is-admin {
  background-color: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #d8b4fe;
}

.user-role-badge.is-manager {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.user-role-badge.is-worker {
  background-color: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

/* ========================================================
   LOGIN SCREEN
   Mobile: dark header (keeps the iOS status bar readable) + white sheet.
   Desktop: centered card.
   ======================================================== */
.lp-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lp-wrap {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.lp-head {
  padding: calc(env(safe-area-inset-top) + 40px) 24px 32px;
}

.lp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.lp-logo {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.lp-title {
  margin-top: 20px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.lp-sheet {
  flex: 1 0 auto;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 32px 24px calc(env(safe-area-inset-bottom) + 24px);
}

.lp-field {
  margin-bottom: 18px;
}

.lp-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.lp-input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-size: 16px; /* >= 16px: iOS does not zoom on focus */
  font-weight: 500;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lp-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.lp-input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.lp-pass {
  position: relative;
}

.lp-pass .lp-input {
  padding-right: 64px;
}

.lp-pass-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 0 16px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #0f766e;
  cursor: pointer;
}

.lp-remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 24px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.lp-remember input {
  width: 18px;
  height: 18px;
  accent-color: #0f766e;
  cursor: pointer;
}

.lp-submit {
  display: block;
  width: 100%;
  height: 52px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  background: #0f766e;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lp-submit:hover {
  background: #115e59;
}

.lp-submit:disabled {
  opacity: 0.7;
  cursor: default;
}

/* display is toggled inline (none / inline-flex) by initPWA() */
.lp-install {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #0f766e;
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
}

@media (min-width: 640px) {
  .lp-screen {
    padding: 32px 16px;
  }

  .lp-wrap {
    flex: 0 0 auto;
    max-width: 420px;
    margin: auto;
  }

  .lp-head {
    padding: 0 4px 24px;
  }

  .lp-sheet {
    flex: 0 0 auto;
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
  }
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 6px;
}

.btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* ========================================================
   CROSS-PLATFORM RESPONSIVENESS (LAPTOP, TABLET, ANDROID, iOS)
   ======================================================== */
@media (max-width: 768px) {
  /* Fix iOS Safari auto-zoom by forcing minimum font-size on form inputs */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea,
  .form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 6px;
  }

  /* 1. COMPACT STICKY HEADER FOR MOBILE */
  .sticky-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #0f1d33;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .top-app-bar {
    padding: 6px 10px;
    gap: 5px;
  }

  .top-bar-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .app-title {
    gap: 6px;
    flex-shrink: 0;
  }

  .app-title .icon {
    font-size: 18px;
    padding: 3px 6px;
    border-radius: 6px;
  }

  .app-title h2 {
    font-size: 12.5px;
    font-weight: 800;
    margin: 0;
    white-space: nowrap;
  }

  .hide-mobile {
    display: none !important;
  }

  .user-action-cluster {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .role-badge {
    font-size: 10px !important;
    padding: 3px 6px !important;
    border-radius: 4px !important;
    white-space: nowrap;
  }

  .btn-role-switch, .btn-logout, .btn-install-pwa {
    padding: 3px 6px !important;
    font-size: 10px !important;
    border-radius: 4px !important;
    margin-left: 2px !important;
    white-space: nowrap;
  }

  .top-filters-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 2px !important;
  }

  .filter-col {
    width: 100%;
    min-width: 0;
  }

  .filter-col label {
    font-size: 9.5px !important;
    font-weight: 800 !important;
    color: #94a3b8 !important;
    margin-bottom: 1px !important;
    letter-spacing: 0.3px !important;
  }

  .select-customer-styled, .select-po-styled {
    min-width: 0 !important;
    width: 100% !important;
    padding: 4px 6px !important;
    font-size: 11.5px !important;
    height: 30px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }

  /* 2. HIDE NAV TABS ON MOBILE (CHỈ GIỮ TRÊN LAPTOP / DESKTOP) */
  .nav-tabs {
    display: none !important;
  }

  .tab-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    gap: 4px !important;
  }

  #reportStatusTag {
    display: none !important;
  }

  /* 3. MAIN CONTAINER & TOOLBAR ON MOBILE */
  .main-content {
    padding: 6px 6px !important;
    margin: 6px auto !important;
  }

  .action-toolbar {
    padding: 8px !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .keyboard-hint {
    display: none !important;
  }

  .btn-group-left, .btn-group-right {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    justify-content: space-between !important;
  }

  .btn {
    padding: 5px 8px !important;
    font-size: 11px !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* 4. REPORT HEADER BANNER & DATE PICKER */
  .report-header-banner {
    padding: 8px 10px !important;
    margin-bottom: 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .sheet-title {
    font-size: 14px !important;
    text-align: center !important;
    margin-bottom: 0 !important;
  }

  .sheet-subtitle {
    display: none !important;
  }

  .banner-date-picker {
    width: 100% !important;
    justify-content: center !important;
    padding: 4px 8px !important;
    gap: 6px !important;
  }

  .banner-date-picker label {
    font-size: 11px !important;
  }

  .report-date-control {
    font-size: 12.5px !important;
    padding: 4px 6px !important;
    width: 125px !important;
    text-align: center !important;
  }

  /* 5. SUMMARY CARD ON MOBILE */
  .summary-card-wrapper {
    padding: 6px !important;
    margin-bottom: 12px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .excel-summary-table {
    min-width: 480px !important;
    font-size: 11px !important;
  }

  .excel-summary-table td {
    padding: 4px 6px !important;
  }

  /* 6. BATCH FLOW TABLES (TABLE 1 ⬇ ARROW ⬇ TABLE 2) */
  .excel-batches-container {
    gap: 14px !important;
  }

  .excel-batch-wrapper {
    padding: 8px !important;
    border-radius: 10px !important;
    margin-bottom: 12px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .batch-date-tag {
    padding-left: 2px !important;
    margin-bottom: 4px !important;
    font-size: 11px !important;
  }

  /* DESKTOP vs MOBILE TOGGLE */
  .desktop-batch-layout {
    display: none !important;
  }
  .mobile-batch-layout {
    display: block !important;
  }

  /* MOBILE BATCH CARD (HÌNH 2) */
  .mobile-batch-layout {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
    margin-bottom: 18px;
  }

  /* 1. Header Meta Bar (Ngày | 29.9.2026 | Tên lô | Lô 1 | KH (đôi) | 237) */
  .mob-batch-meta-bar {
    display: grid;
    grid-template-columns: 65px 1fr 65px 1fr 75px 1fr;
    border: 1px solid #94a3b8;
    background: #ffffff;
    margin-bottom: 10px;
    font-size: 12px;
    text-align: center;
    border-radius: 4px;
    overflow: hidden;
  }
  .mob-meta-cell {
    padding: 5px 3px;
    border-right: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
  .mob-meta-cell:last-child {
    border-right: none;
  }
  .mob-meta-lbl {
    font-weight: 800;
    color: #0f172a;
    background: #f1f5f9;
  }
  .mob-meta-val {
    font-weight: 700;
    color: #0369a1;
  }

  /* 2. Scrollable sheet */
  .mob-scrollable-sheet {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }

  .mob-top-grid {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  /* Table 1 Mobile (7 Cột) */
  .mob-batch-table-1 {
    border-collapse: collapse;
    font-size: 11.5px;
    background: #ffffff;
    border: 1px solid #94a3b8;
    white-space: nowrap;
  }
  .mob-batch-table-1 th, .mob-batch-table-1 td {
    border: 1px solid #cbd5e1;
    text-align: center;
    padding: 4px 6px;
    vertical-align: middle;
  }
  .mob-hdr-main {
    font-weight: 800;
    font-size: 11.5px;
  }
  .mob-hdr-sub {
    font-size: 9.5px;
    font-weight: 600;
    color: #64748b;
    font-style: italic;
  }
  .mob-col-type { width: 145px; background: #f8fafc; font-weight: 800; }
  .mob-col-tondau { width: 85px; background: #f1f5f9; }
  .mob-col-nhap { width: 90px; background: #e0f2fe; color: #0369a1; }
  .mob-col-xuat { width: 90px; background: #dcfce7; color: #15803d; }
  .mob-col-tonlt { width: 100px; background: #ffedd5; color: #9a3412; }
  .mob-col-tontt { width: 100px; background: #cffafe; color: #0e7490; }
  .mob-col-thieu { width: 95px; background: #ffe4e6; color: #be123c; }

  /* Dòng 3 Tích lũy (NỀN VÀNG RỰC RỠ NHƯ HÌNH 2) */
  .mob-row-cumulative {
    background-color: #ffff00 !important;
    color: #000000 !important;
    font-weight: 800 !important;
  }
  .mob-row-cumulative td {
    border-color: #858500 !important;
    color: #000000 !important;
  }
  .mob-cum-label {
    font-weight: 900 !important;
    color: #000000 !important;
    text-align: left !important;
    padding-left: 6px !important;
  }

  /* Red Arrow between Table 1 and Breakdown Table */
  .mob-arrow-thieu-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    flex-shrink: 0;
  }
  .mob-arrow-thieu-wrapper .red-right-arrow {
    width: 24px;
    height: 20px;
  }

  /* Table Phân Tích Nguyên Nhân (2 Cột x 5 Dòng) */
  .mob-breakdown-card {
    border: 1px solid #94a3b8;
    display: inline-block;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
  }
  .mob-breakdown-table {
    border-collapse: collapse;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .mob-breakdown-table th, .mob-breakdown-table td {
    border: 1px solid #cbd5e1;
    padding: 4px 6px;
    text-align: center;
  }
  .mob-hdr-breakdown-top {
    background-color: #881337;
    color: #ffffff;
    font-weight: 800;
    font-size: 11.5px;
    letter-spacing: 0.3px;
    padding: 6px 8px !important;
  }
  .mob-lbl-reason {
    text-align: left !important;
    font-weight: 700;
    color: #1e293b;
    background: #f8fafc;
    padding-left: 8px !important;
    min-width: 140px;
  }
  .mob-col-reason-val {
    min-width: 110px;
    font-weight: 800;
    background: #f1f5f9;
  }
  .mob-unallocated-box {
    color: #0284c7;
    font-weight: 900;
    font-size: 13px;
  }

  /* Blue Down Arrow Row (Dưới Cột Tồn Thực Tế) */
  .mob-blue-arrow-row {
    display: flex;
    margin: 6px 0;
    height: 28px;
    align-items: center;
  }
  .mob-blue-arrow-holder {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    margin-left: 450px;
  }

  /* Table 2 WIP Kiểm Kê 5 Trạm (Dọc 3 Cột) */
  .mob-wip-section {
    display: block;
    padding-left: 260px;
  }
  .mob-wip-table-wrapper {
    display: inline-block;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    overflow: hidden;
  }
  .mob-wip-table {
    border-collapse: collapse;
    font-size: 11.5px;
    background: #ffffff;
    white-space: nowrap;
  }
  .mob-wip-table th, .mob-wip-table td {
    border: 1px solid #cbd5e1;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
  }
  .mob-hdr-wip-top {
    background-color: #0e7490;
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
    padding: 6px 10px !important;
    letter-spacing: 0.5px;
  }
  .mob-wip-col-station { width: 130px; background: #f8fafc; font-weight: 800; }
  .mob-wip-col-qty { width: 95px; background: #f1f5f9; font-weight: 800; }
  .mob-wip-col-executor { width: 130px; background: #f8fafc; font-weight: 800; }

  .station-bg-yellow {
    background-color: #fef9c3 !important;
  }
  .station-bg-green {
    background-color: #dcfce7 !important;
  }
  .station-name-cell {
    text-align: left !important;
    padding-left: 8px !important;
    font-weight: 700;
    font-size: 11.5px;
    line-height: 1.25;
  }
  .station-name-cell .st-num {
    display: block;
    font-weight: 800;
    color: #0f172a;
  }
  .station-name-cell .st-batch {
    display: block;
    font-size: 10px;
    color: #475569;
    font-weight: 600;
  }

  /* Footer row */
  .mob-wip-footer-row td {
    background: #f8fafc;
    font-weight: 800;
  }
  .mob-wip-footer-label {
    color: #0e7490 !important;
    font-size: 11.5px !important;
    text-align: left !important;
    padding-left: 8px !important;
  }
  .mob-wip-footer-sum {
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 900 !important;
  }
  .mob-wip-footer-target {
    font-style: italic;
    color: #0284c7;
    font-size: 11px;
  }

  .mob-wip-action-bar {
    margin-top: 8px;
  }
  .mob-wip-action-bar .btn-batch-toggle {
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
  }
}

/* ========================================================
   PWA INSTALL BUTTON & IOS INSTALL MODAL STYLES
   ======================================================== */
.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7, #0f766e);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  animation: pulse-pwa 2.5s infinite;
}

.btn-install-pwa:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
  filter: brightness(1.1);
}

@keyframes pulse-pwa {
  0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(2, 132, 199, 0); }
  100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.ios-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  background: #f1f5f9;
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 4px solid #0f766e;
}

.ios-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f766e;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ios-step-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
}




/* ==========================================================================
   STREAMLINED HEADER (THEO ĐÚNG HÌNH 2)
   Không hiển thị logo, tên công ty, tên hệ thống
   Chỉ hiển thị: 2 Bộ lọc, Tài khoản/Role, Đổi quyền, Đăng xuất & Nav Tabs
   ========================================================================== */

.top-app-bar.compact-header {
  background: #1e293b !important;
  padding: 8px 20px !important;
  border-bottom: 1px solid #334155 !important;
}

.compact-header .top-bar-inner {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.top-filters-group {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
}

.top-filters-group .filter-item {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.top-filters-group .filter-item label {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #f1f5f9 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  margin: 0 !important;
}

.top-filters-group .filter-item select {
  background-color: #ffffff !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  height: 36px !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  min-width: 180px !important;
}

.user-action-cluster {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.role-badge.is-admin {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%) !important;
  color: #6d28d9 !important;
  border: 1.5px solid #d8b4fe !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 1px 3px rgba(109, 40, 217, 0.15) !important;
}

.role-badge.is-manager {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  color: #92400e !important;
  border: 1.5px solid #fde68a !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.15) !important;
}

.role-badge.is-worker {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  color: #0369a1 !important;
  border: 1.5px solid #bae6fd !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 1px 3px rgba(3, 105, 161, 0.15) !important;
}

.btn-role-switch {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  color: #0369a1 !important;
  border: 1.5px solid #7dd3fc !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(3, 105, 161, 0.1) !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

.btn-role-switch:hover {
  background: #bae6fd !important;
  border-color: #38bdf8 !important;
  color: #0284c7 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(3, 105, 161, 0.2) !important;
}

.btn-logout {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important;
  color: #be123c !important;
  border: 1.5px solid #fecdd3 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(190, 18, 60, 0.1) !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

.btn-logout:hover {
  background: #fecdd3 !important;
  border-color: #fda4af !important;
  color: #9f1239 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(190, 18, 60, 0.2) !important;
}

.btn-install-pwa {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.nav-tabs {
  display: flex !important;
  align-items: center !important;
  background: #ffffff !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  padding: 0 16px !important;
  overflow-x: auto !important;
  gap: 8px !important;
  scrollbar-width: thin !important;
}

.nav-tabs .tab-btn {
  font-size: 13.5px !important;
  font-weight: 700 !important;
  padding: 11px 16px !important;
  color: #475569 !important;
  border: none !important;
  background: none !important;
  cursor: pointer !important;
  border-bottom: 3px solid transparent !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.nav-tabs .tab-btn:hover {
  color: #0f766e !important;
}

.nav-tabs .tab-btn.active {
  color: #0f766e !important;
  border-bottom-color: #0f766e !important;
  font-weight: 800 !important;
}

#reportStatusTag {
  margin-left: auto !important;
  background: #fef08a !important;
  color: #854d0e !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 5px 14px !important;
  border-radius: 20px !important;
  white-space: nowrap !important;
  border: 1px solid #fde047 !important;
}

#reportStatusTag.submitted {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}


/* ==========================================================================
   UNIFIED BATCH CARD (THEO ĐÚNG 100% THIẾT KẾ HÌNH 1 TRÊN LAPTOP, ANDROID, IOS)
   ========================================================================== */

.excel-batches-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
  justify-content: center !important;
  gap: 16px !important;
  max-width: 1750px !important;
  margin: 20px auto !important;
  padding: 0 12px !important;
}

.excel-batch-wrapper {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
}

.h1-batch-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04) !important;
  padding: 16px 18px !important;
  width: 100% !important;
  max-width: 520px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  box-sizing: border-box !important;
}

/* 1. Header: Date Badge & Dark Navy Batch Badge */
.h1-batch-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 2px !important;
}

.h1-date-badge {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 20px !important;
  padding: 6px 14px !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  color: #334155 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

.h1-batch-badge {
  background: #0f172a !important;
  color: #ffffff !important;
  border-radius: 12px !important;
  padding: 6px 18px !important;
  text-align: center !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25) !important;
}

.h1-batch-badge .b-name {
  font-size: 16px !important;
  font-weight: 900 !important;
  letter-spacing: 0.3px !important;
  line-height: 1.2 !important;
}

.h1-batch-badge .b-plan {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #cbd5e1 !important;
  margin-top: 1px !important;
}

/* 2. Section Titles */
.h1-section-block {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.h1-sec-title {
  font-size: 13.5px !important;
  font-weight: 900 !important;
  color: #1e293b !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
}

.h1-num-bullet {
  font-size: 16px !important;
  color: #1e293b !important;
  line-height: 1 !important;
}

/* Table 1: Nhập - Xuất trong ngày */
.h1-table-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
}

.h1-table-nx {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
  font-size: 13px !important;
}

.h1-table-nx thead tr {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.h1-table-nx th {
  padding: 8px 6px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  color: #64748b !important;
  text-transform: none !important;
  line-height: 1.25 !important;
  vertical-align: middle !important;
}

.h1-table-nx th.col-target, .h1-table-nx td.cell-label {
  width: 36% !important;
}

.h1-table-nx th.col-prev, .h1-table-nx td.cell-prev-val, .h1-table-nx tr.row-ton-dau td:nth-child(2) {
  width: 16% !important;
  text-align: center !important;
}

.h1-table-nx th.col-today, .h1-table-nx td.cell-calc-group, .h1-table-nx tr.row-ton-dau td:nth-child(3) {
  width: 24% !important;
  text-align: center !important;
}

.h1-table-nx th.col-total, .h1-table-nx td.cell-total-val, .h1-table-nx tr.row-ton-dau td:nth-child(4) {
  width: 24% !important;
  text-align: center !important;
}

.h1-table-nx td {
  padding: 8px 6px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
  display: table-cell !important;
}

.h1-table-nx tbody tr:last-child td {
  border-bottom: none !important;
}

.h1-table-nx .cell-label {
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
  padding-left: 10px !important;
}

.h1-table-nx .main-lbl {
  font-size: 13.5px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

.h1-table-nx .sub-lbl {
  font-size: 11px !important;
  font-style: italic !important;
  color: #94a3b8 !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.h1-table-nx .text-blue { color: #0284c7 !important; }
.h1-table-nx .text-green { color: #16a34a !important; }

.h1-table-nx .cell-dash {
  color: #cbd5e1 !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  text-align: center !important;
}

.h1-table-nx .cell-val-bold {
  font-size: 14.5px !important;
  font-weight: 900 !important;
  color: #1e293b !important;
  text-align: center !important;
}

.h1-table-nx .cell-prev-val {
  font-size: 15px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  text-align: center !important;
}

.h1-table-nx .cell-calc-group {
  text-align: center !important;
}

.h1-table-nx .cell-total-val {
  text-align: center !important;
}

.h1-calc-inline-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.op-sym {
  font-size: 14px !important;
  font-weight: 800 !important;
  color: #94a3b8 !important;
}

.h1-table-nx-transposed th {
  padding: 6px 8px !important;
  background: #f8fafc !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  font-size: 11.5px !important;
}

.h1-table-nx-transposed td {
  padding: 6px 6px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
}

.h1-table-nx-transposed tr.row-tong td {
  background: #f8fafc !important;
  border-top: 1.5px solid #e2e8f0 !important;
  font-weight: 900 !important;
}

.input-yellow {
  border: 1.5px solid #eab308 !important;
  color: #713f12 !important;
  background: #fef08a !important;
  outline: none !important;
  text-align: center !important;
  font-weight: 800 !important;
  transition: all 0.2s ease !important;
}

.input-yellow:focus {
  background: #fef9c3 !important;
  border-color: #ca8a04 !important;
  box-shadow: 0 0 0 2.5px rgba(234, 179, 8, 0.35) !important;
}

.h1-table-nx input.inp-blue,
.h1-table-nx input.inp-green {
  width: 62px !important;
  height: 32px !important;
  border: 1.5px solid #eab308 !important;
  border-radius: 8px !important;
  text-align: center !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  color: #713f12 !important;
  background: #fef08a !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.h1-table-nx input.inp-blue:focus,
.h1-table-nx input.inp-green:focus {
  background: #fef9c3 !important;
  border-color: #ca8a04 !important;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.35) !important;
}

.h1-table-nx .cell-total-val .val-num {
  font-size: 15px !important;
  font-weight: 900 !important;
}

/* Connecting Arrow 1 */
.h1-arrow-connector-1 {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 1px 0 !important;
}

.h1-orange-arrow {
  width: 16px !important;
  height: 20px !important;
}

.h1-arrow-label {
  font-size: 11.5px !important;
  font-style: italic !important;
  font-weight: 800 !important;
  color: #d97706 !important;
  margin-top: 1px !important;
}

/* 3 Equation Cards */
.h1-equation-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
}

.h1-eq-card {
  flex: 1 !important;
  padding: 7px 5px !important;
  border-radius: 12px !important;
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
}

.h1-eq-card .eq-hdr {
  font-size: 10.5px !important;
  font-weight: 900 !important;
  letter-spacing: 0.2px !important;
  line-height: 1.15 !important;
}

.h1-eq-card .eq-sub {
  font-size: 9.5px !important;
  font-style: italic !important;
  color: #64748b !important;
  margin-bottom: 2px !important;
}

.h1-eq-card .eq-val {
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

.card-blue-soft {
  background: #f0f7ff !important;
  border: 1.5px solid #dbeafe !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.05) !important;
}

.text-blue-navy {
  color: #1e3a8a !important;
  font-weight: 800 !important;
}

.text-blue-vivid {
  color: #1d4ed8 !important;
}

.card-amber-soft {
  background: #fffdf5 !important;
  border: 1.5px solid #fef3c7 !important;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.05) !important;
}

.text-amber-dark {
  color: #92400e !important;
  font-weight: 900 !important;
}

.h1-eq-op {
  font-size: 16px !important;
  font-weight: 900 !important;
  color: #94a3b8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  flex-shrink: 0 !important;
}

/* Dual Arrow Row */
.h1-dual-arrows-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  margin: 6px 0 6px 0 !important;
}

.dual-arrow-col {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
}

.dual-arrow-col.left-col {
  justify-content: flex-end !important;
  padding-right: 12px !important;
  gap: 6px !important;
}

.dual-arrow-col.right-col {
  justify-content: flex-start !important;
  padding-left: 45% !important;
  gap: 6px !important;
}

.arrow-text-wrap {
  display: flex !important;
  flex-direction: column !important;
  font-size: 11.5px !important;
  font-style: italic !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

.text-blue-wrap {
  color: #0284c7 !important;
  text-align: right !important;
}

.text-red-wrap {
  color: #dc2626 !important;
  text-align: left !important;
}

.h1-arrow-svg {
  width: 22px !important;
  height: 30px !important;
  flex-shrink: 0 !important;
}

.h1-arrow-blue {
  fill: #0284c7 !important;
  filter: drop-shadow(0 2px 3px rgba(2, 132, 199, 0.35)) !important;
}

.h1-arrow-red {
  fill: #dc2626 !important;
  filter: drop-shadow(0 2px 3px rgba(220, 38, 38, 0.35)) !important;
}

/* Two-Column Split Grid */
.h1-split-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  align-items: stretch !important;
}

.h1-box {
  background: #ffffff !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  border: 1px solid #e2e8f0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

.h1-box-hdr {
  padding: 6px 8px !important;
  text-align: center !important;
  color: #ffffff !important;
}

.h1-box-hdr .box-title {
  font-size: 11.5px !important;
  font-weight: 900 !important;
  letter-spacing: 0.3px !important;
  line-height: 1.2 !important;
}

.h1-box-hdr .box-sub {
  font-size: 10px !important;
  font-weight: 600 !important;
  opacity: 0.9 !important;
}

.bg-teal {
  background: linear-gradient(135deg, #0e7490 0%, #0f766e 100%) !important;
}

.bg-burgundy {
  background: linear-gradient(135deg, #9f1239 0%, #881337 100%) !important;
}

.h1-station-list, .h1-reason-list {
  display: flex !important;
  flex-direction: column !important;
  padding: 2px 0 !important;
}

.h1-station-row, .h1-reason-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 4px 8px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  min-height: 36px !important;
}

.st-tag-name {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.st-badge {
  width: 18px !important;
  height: 18px !important;
  border-radius: 4px !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.badge-yellow { background: #eab308 !important; }
.badge-gray { background: #64748b !important; }
.badge-orange { background: #f97316 !important; }
.badge-slate { background: #94a3b8 !important; }
.badge-green { background: #22c55e !important; }

.st-text {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  white-space: nowrap !important;
}

.st-val-wrap input.wip-num-input {
  width: 58px !important;
  height: 28px !important;
  text-align: center !important;
  border-radius: 6px !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  outline: none !important;
}

.st-val-wrap input.wip-num-input,
.rs-input-wrap input.wip-num-input,
.h1-station-row input.wip-num-input,
.h1-reason-row input.wip-num-input {
  width: 58px !important;
  height: 28px !important;
  text-align: center !important;
  border-radius: 6px !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  outline: none !important;
  background: #ffffff !important;
  border: 1.5px solid #10b981 !important;
  color: #065f46 !important;
  transition: all 0.2s ease !important;
}

.st-val-wrap input.wip-num-input:focus,
.rs-input-wrap input.wip-num-input:focus,
.h1-station-row input.wip-num-input:focus,
.h1-reason-row input.wip-num-input:focus {
  background: #fef9c3 !important;
  border-color: #ca8a04 !important;
  box-shadow: 0 0 0 2.5px rgba(234, 179, 8, 0.35) !important;
}

.rs-label-wrap {
  display: flex !important;
  flex-direction: column !important;
}

.rs-title {
  font-size: 11.5px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

.rs-sub {
  font-size: 9.5px !important;
  color: #94a3b8 !important;
  font-style: italic !important;
}

.text-rose { color: #be123c !important; }
.text-amber { color: #b45309 !important; }
.text-purple { color: #7c3aed !important; }

.inp-rose,
.inp-amber,
.inp-purple {
  border: 1.5px solid #eab308 !important;
  color: #713f12 !important;
  background: #fef08a !important;
}

.h1-reason-note-row {
  padding: 5px 8px !important;
}

.h1-reason-note-row .field-shortage-note {
  width: 100% !important;
  height: 30px !important;
  border: 1.5px dashed #c084fc !important;
  border-radius: 6px !important;
  padding: 2px 8px !important;
  font-size: 11px !important;
  color: #334155 !important;
  background: #faf5ff !important;
  outline: none !important;
}

.h1-box-footer {
  padding: 6px 8px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.footer-teal {
  background: #ecfeff !important;
  border-top: 1.5px solid #a5f3fc !important;
  color: #0e7490 !important;
}

.footer-burgundy {
  background: #fff1f2 !important;
  border-top: 1.5px solid #fecdd3 !important;
  color: #be123c !important;
}

/* Status Banner */
.h1-status-banner-wrap {
  margin-top: 2px !important;
}

.h1-status-banner {
  padding: 7px 10px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-align: center !important;
  line-height: 1.3 !important;
}

.banner-ok {
  background: #f0fdf4 !important;
  border: 1.5px solid #bbf7d0 !important;
  color: #15803d !important;
}

.banner-shortage {
  background: #fff1f2 !important;
  border: 1.5px solid #fecdd3 !important;
  color: #b91c1c !important;
}

.banner-surplus {
  background: #fffbeb !important;
  border: 1.5px solid #fde68a !important;
  color: #b45309 !important;
}

/* Bottom Action Bar */
.h1-bottom-bar {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  margin-top: 2px !important;
}

.h1-executor-wrap {
  flex: 1 !important;
}

.h1-executor-wrap .wip-executor-input {
  width: 100% !important;
  height: 36px !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 0 12px !important;
  font-size: 12.5px !important;
  font-style: italic !important;
  color: #334155 !important;
  background: #ffffff !important;
  outline: none !important;
}

.h1-executor-wrap .wip-executor-input:focus {
  border-color: #0284c7 !important;
}

.h1-btn-toggle {
  height: 36px !important;
  padding: 0 18px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}

.h1-btn-toggle.is-locked {
  background: #fffbeb !important;
  border: 1.5px solid #f59e0b !important;
  color: #b45309 !important;
}

.h1-btn-toggle.is-locked:hover {
  background: #fef3c7 !important;
  transform: translateY(-1px) !important;
}

.h1-btn-toggle.is-editing {
  background: #10b981 !important;
  border: 1.5px solid #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35) !important;
}

.h1-btn-toggle.is-editing:hover {
  background: #059669 !important;
  transform: translateY(-1px) !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN (3 THIẾT BỊ: LAPTOP, ANDROID, IOS)
   ========================================================================== */

/* Laptop / Màn hình lớn */
@media (min-width: 1024px) {
  .excel-batches-container {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
  }
}

/* ==========================================================================
   APP-LIKE MOBILE INTERFACE & POPOVER MENUS (ANDROID & IOS MOCKUP)
   ========================================================================== */

/* 1. Base Popovers & Pill Selectors */
.pill-prefix {
  display: none;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.btn-user-avatar {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e293b;
  border: 1.5px solid #475569;
  color: #94a3b8;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.btn-user-avatar:hover, .btn-user-avatar:active {
  background: #334155;
  color: #38bdf8;
  border-color: #38bdf8;
}

/* User Popover Menu */
.user-popover-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 10000;
  overflow: hidden;
  text-align: left;
  animation: popoverFadeIn 0.15s ease-out;
}

.user-popover-header {
  padding: 14px 16px 10px;
}

.user-popover-name {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.user-popover-role {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-top: 3px;
}

.user-popover-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 2px 0;
}

.popover-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.popover-item:hover, .popover-item:active {
  background: #f8fafc;
}

.popover-item.text-danger {
  color: #dc2626 !important;
}

.popover-item.text-danger:hover, .popover-item.text-danger:active {
  background: #fef2f2 !important;
}

.popover-item .p-icon {
  font-size: 15px;
}

/* More Popover Menu */
.more-popover-menu {
  position: absolute;
  top: 42px;
  right: 0;
  width: 185px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  overflow: hidden;
  text-align: left;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 2. Mobile Action Bar (Single Row) */
.mobile-action-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 6px;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-mobile-vet-lo {
  position: relative;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
  flex-shrink: 0;
  transition: transform 0.1s ease;
}

.btn-mobile-vet-lo:active {
  transform: scale(0.96);
}

.btn-mobile-vet-lo .vet-lo-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #dc2626;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 12px;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  min-width: 18px;
  text-align: center;
}

.mobile-date-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  max-width: 210px;
}

.btn-mobile-date-nav {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  width: 28px;
  height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: #334155;
  cursor: pointer;
  font-weight: 800;
  flex-shrink: 0;
}

.btn-mobile-date-nav:active {
  background: #e2e8f0;
}

.mobile-date-box {
  position: relative;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  flex: 1;
}

.mobile-date-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.mobile-more-cluster {
  position: relative;
  flex-shrink: 0;
}

.btn-mobile-more {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  width: 33px;
  height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #334155;
  cursor: pointer;
  letter-spacing: 1px;
}

.btn-mobile-more:active {
  background: #e2e8f0;
}

/* Nút Tải Lại / Đồng Bộ Mới Nhất trên Mobile */
.btn-mobile-sync-data {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.35);
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-mobile-sync-data:active {
  transform: scale(0.95);
  background: #0284c7 !important;
}

.btn-mobile-sync-data .sync-icon {
  font-size: 13px;
  display: inline-block;
  line-height: 1;
}

.btn-mobile-sync-data.is-syncing .sync-icon,
.sync-icon.is-spin {
  animation: spinSync 0.6s linear infinite;
}

@keyframes spinSync {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 3. Mobile KPI Card */
.mobile-kpi-card {
  display: none;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 8px 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.mobile-kpi-title {
  text-align: center;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #0f172a;
  margin-bottom: 10px;
}

.mobile-kpi-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mobile-kpi-table td {
  border: 1px solid #e2e8f0;
  padding: 7px 8px;
  font-size: 12.5px;
  vertical-align: middle;
}

.mkpi-hdr {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  width: 25%;
  text-align: left;
}

.mkpi-val {
  background: #ffffff;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  width: 25%;
}

.mkpi-val.mkpi-bold {
  font-weight: 900;
  font-size: 13px;
}

.mkpi-val.mkpi-blue {
  color: #1d4ed8 !important;
  font-weight: 900;
  font-size: 14px;
}

.mkpi-debt-hdr {
  background: #fef3c7 !important;
  color: #92400e !important;
  font-weight: 700 !important;
}

.mkpi-debt-val {
  background: #fef3c7 !important;
  color: #b45309 !important;
  font-weight: 900 !important;
  font-size: 15px !important;
}

/* Tablet & Mobile (Android & iOS) Media Query */
@media (max-width: 768px) {
  /* ========================================================
     GIAO DIỆN DI ĐỘNG (CHUẨN 100% THEO THIẾT KẾ SCREENSHOT)
     Tối ưu hóa tối đa diện tích hiển thị trên iOS & Android
     ======================================================== */

  /* 1. TOP APP BAR (HEADER TỐI MÀU CHỨA 2 PILL KH & PO XẾP DỌC) */
  .top-app-bar.compact-header {
    background: #0f1d33 !important;
    padding-top: max(4px, env(safe-area-inset-top, 4px)) !important;
    padding-left: max(8px, env(safe-area-inset-left, 8px)) !important;
    padding-right: max(8px, env(safe-area-inset-right, 8px)) !important;
    padding-bottom: 4px !important;
    border-bottom: 1px solid #1a2c47 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
  }

  /* CỐ ĐỊNH 2 BỘ LỌC KH VÀ PO Ở TRÊN CÙNG MÀN HÌNH */
  .sticky-header-wrapper {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10000 !important;
    background: #0f1d33 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }

  .compact-header .top-bar-inner {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    gap: 3px 6px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .top-filters-group {
    display: contents !important;
  }

  .pill-filter-customer {
    grid-column: 1 / 2 !important;
    grid-row: 1 / 2 !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    background: #13243d !important;
    border: 1px solid #233958 !important;
    border-radius: 16px !important;
    height: 28px !important;
    padding: 0 8px 0 5px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .user-action-cluster {
    grid-column: 2 / 3 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    position: relative !important;
    /* overflow-x: auto ở khối trên làm menu TK (position: absolute) bị cắt mất trên điện thoại */
    overflow: visible !important;
  }

  .btn-user-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: #182842 !important;
    border: 1px solid #283a54 !important;
    color: #38bdf8 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
  }

  .user-popover-menu {
    position: absolute !important;
    right: 0 !important;
    top: calc(100% + 8px) !important;
    z-index: 100000 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
  }

  .pill-filter-po {
    grid-column: 1 / 3 !important;
    grid-row: 2 / 3 !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    background: #13243d !important;
    border: 1px solid #233958 !important;
    border-radius: 16px !important;
    height: 28px !important;
    padding: 0 8px 0 5px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .pill-prefix {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #0284c7 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    flex-shrink: 0 !important;
    line-height: 1.2 !important;
  }

  .sr-only-mobile {
    display: none !important;
  }

  .top-filters-group .filter-item select,
  select.select-customer-styled,
  select.select-po-styled {
    background: transparent !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    padding: 0 4px !important;
    height: 100% !important;
    width: 100% !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    cursor: pointer !important;
    outline: none !important;
  }

  .top-filters-group .filter-item select option {
    background-color: #0f1d33 !important;
    color: #ffffff !important;
    font-size: 14px !important;
  }

  /* ẨN TOÀN BỘ CÁC NÚT DESKTOP & VÙNG SỐ 1 (TAB NAVIGATION) TRÊN ĐIỆN THOẠI */
  #currentRoleBadge,
  #btnSwitchRole,
  #btnLogout,
  #btnInstallPWA,
  .desktop-only-pwa,
  .desktop-only-role,
  .desktop-only-btn,
  .role-badge,
  .btn-role-switch,
  .btn-logout,
  .action-toolbar,
  .report-header-banner,
  .summary-card-wrapper,
  .nav-tabs,
  #reportStatusTag {
    display: none !important;
  }

  /* THANH TÁC VỤ DI ĐỘNG (VÉT LÔ, KIỂM TRA, NGÀY) HIỂN THỊ GỌN GÀNG */
  .mobile-action-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 2px 2px 1px !important;
    gap: 4px !important;
    margin-bottom: 2px !important;
  }

  .btn-mobile-vet-lo,
  .btn-mobile-balance-fast,
  .btn-mobile-sync-data {
    padding: 3px 8px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
  }

  .btn-mobile-sync-data .sync-icon {
    font-size: 11px !important;
  }

  .btn-mobile-date-nav {
    width: 22px !important;
    height: 24px !important;
    font-size: 9.5px !important;
  }

  .mobile-date-box {
    padding: 3px 6px !important;
    font-size: 11.5px !important;
    height: 24px !important;
    box-sizing: border-box !important;
  }

  .btn-mobile-more {
    width: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
  }

  /* VÙNG SỐ 2: BÁO CÁO ĐỐI CHIẾU NHẬP XUẤT TỒN THU GỌN / MỞ RỘNG */
  .mobile-kpi-card {
    display: block !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 2px 6px !important;
    margin: 2px 0 3px 0 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    transition: all 0.25s ease !important;
  }

  .mobile-kpi-header-wrap {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    user-select: none !important;
    padding: 1px 0 !important;
    gap: 1px !important;
  }

  .mobile-kpi-title {
    text-align: center !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.2px !important;
    color: #0f172a !important;
    margin: 0 !important;
    line-height: 1.1 !important;
  }

  .kpi-arrow-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }

  .kpi-toggle-arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    color: #0284c7 !important;
    background: #e0f2fe !important;
    width: 28px !important;
    height: 16px !important;
    border-radius: 8px !important;
    transition: transform 0.2s ease, background 0.2s ease !important;
    line-height: 1 !important;
  }

  .mobile-kpi-header-wrap:hover .kpi-toggle-arrow,
  .mobile-kpi-header-wrap:active .kpi-toggle-arrow {
    background: #bae6fd !important;
  }

  .mobile-kpi-body {
    margin-top: 8px !important;
  }

  .mobile-kpi-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
  }

  .mobile-kpi-table td {
    border: 1px solid #e2e8f0 !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    vertical-align: middle !important;
  }

  /* 2. MAIN CONTAINER & BATCH CARD */
  main.main-content {
    padding: 3px 4px max(12px, env(safe-area-inset-bottom, 12px)) 4px !important;
    margin: 0 !important;
    background: #f1f5f9 !important;
    min-height: 100vh !important;
    box-sizing: border-box !important;
  }

  .excel-sheet-wrapper {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
  }

  .excel-batches-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .excel-batch-wrapper {
    width: 100% !important;
    margin: 0 !important;
  }

  .h1-batch-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    padding: 5px 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 6px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  /* 3. CARD HEADER (NGÀY - PO - BADGE LÔ) */
  .h1-batch-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 2px !important;
    padding: 0 2px !important;
  }

  .h1-date-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 14px !important;
    padding: 2px 8px !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    cursor: pointer !important;
    position: relative !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    line-height: 1.2 !important;
  }

  .h1-date-hidden-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    cursor: pointer !important;
  }

  .h1-header-po {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #1e3a8a !important;
    line-height: 1.2 !important;
  }

  .h1-batch-badge {
    background: #1e3a8a !important;
    border-radius: 6px !important;
    padding: 3px 10px !important;
    text-align: center !important;
    box-shadow: 0 1px 3px rgba(30, 58, 138, 0.2) !important;
  }

  .h1-batch-badge .b-name {
    color: #ffffff !important;
    font-size: 14.5px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
  }

  .h1-batch-badge .b-plan {
    color: #93c5fd !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
  }

  /* 4. TIÊU ĐỀ SECTION */
  .h1-sec-title {
    font-size: 14.5px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    margin-top: 2px !important;
    margin-bottom: 3px !important;
    padding-left: 1px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1.2 !important;
  }

  .h1-num-bullet {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    background: #1e3a8a !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    font-size: 11.5px !important;
    font-weight: 900 !important;
    flex-shrink: 0 !important;
  }

  /* 5. SECTION 1: BẢNG NHẬP - XUẤT TRONG NGÀY */
  .h1-table-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  .h1-table-nx {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .h1-table-nx thead tr {
    background: #edf2f7 !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }

  .h1-table-nx th {
    padding: 3px 2px !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: #334155 !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }

  .h1-table-nx td {
    padding: 2px 4px !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
  }

  .h1-table-nx td.cell-label {
    color: #0f172a !important;
    font-weight: 700 !important;
    padding-left: 6px !important;
    text-align: left !important;
  }

  .h1-table-nx tr.row-luy-ke-truoc td {
    color: #0f172a !important;
    font-weight: 700 !important;
  }

  .h1-table-nx tr.row-tong td.cell-label {
    font-weight: 900 !important;
    color: #0f172a !important;
    font-size: 14.5px !important;
  }

  .h1-table-nx tr.row-tong .val-num {
    font-weight: 900 !important;
    color: #0f172a !important;
    font-size: 14.5px !important;
  }

  .h1-table-nx tr.row-note td {
    background: #ffffff !important;
    color: #64748b !important;
    font-size: 12px !important;
    font-style: normal !important;
    padding: 2px 6px !important;
    border-bottom: none !important;
    text-align: left !important;
    line-height: 1.2 !important;
  }

  /* 6. SECTION 2: 3 Ô ĐỐI CHIẾU SỐ TỒN THỰC TẾ (TỒN LT - TỒN TT = THIẾU) */
  .h1-equation-row {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 4px !important;
    margin-bottom: 3px !important;
  }

  .h1-eq-col {
    flex: 1 !important;
    text-align: center !important;
    min-width: 0 !important;
  }

  .h1-eq-col .eq-hdr {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin-bottom: 2px !important;
    line-height: 1.1 !important;
  }

  .h1-eq-col .eq-hdr.text-pink {
    color: #db2777 !important;
  }

  .h1-eq-col .eq-box {
    background: #e6f0fa !important;
    border-radius: 6px !important;
    padding: 2px 0 !important;
    width: 100% !important;
    text-align: center !important;
    min-height: 26px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .h1-eq-col .eq-val {
    font-size: 19px !important;
    font-weight: 900 !important;
    color: #1e3a8a !important;
    line-height: 1 !important;
  }

  .h1-eq-col .eq-val.text-pink,
  .h1-eq-col .eq-val span.text-pink {
    color: #db2777 !important;
  }

  .h1-eq-op {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #64748b !important;
    margin-bottom: 4px !important;
    flex-shrink: 0 !important;
  }

  /* 7. SECTION 2 SUB-PANEL: KIỂM KÊ THỰC TẾ (ĐẢO THỨ TỰ 5 -> 4 -> 3 -> 2 -> 1) */
  .h1-station-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    margin-top: 2px !important;
  }

  .h1-station-hdr {
    background: #f1f5f9 !important;
    padding: 3px 8px !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }

  .station-title {
    font-size: 13.5px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
  }

  .station-sub {
    font-size: 11.5px !important;
    color: #64748b !important;
    margin-top: 0 !important;
    line-height: 1.1 !important;
  }

  .h1-station-list {
    display: flex !important;
    flex-direction: column !important;
  }

  .h1-station-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1px 8px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    min-height: 25px !important;
  }

  .st-tag-name {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .st-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 17px !important;
    height: 17px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #334155 !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    border-radius: 3px !important;
    flex-shrink: 0 !important;
  }

  .st-text {
    font-size: 16.5px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
  }

  .h1-station-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 3px 8px !important;
    background: #ffffff !important;
    border-top: 1px solid #cbd5e1 !important;
  }

  .h1-station-footer .ft-lbl {
    font-size: 13.5px !important;
    font-weight: 900 !important;
    color: #1e3a8a !important;
  }

  .h1-station-footer .ft-val {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
  }

  /* 8. SECTION 3: NGUYÊN NHÂN THIẾU */
  .h1-reason-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    margin-top: 2px !important;
  }

  .h1-reason-hdr {
    background: #f1f5f9 !important;
    padding: 2px 8px !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }

  .reason-hdr-title {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    line-height: 1.2 !important;
  }

  .h1-reason-list {
    display: flex !important;
    flex-direction: column !important;
  }

  .h1-reason-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1px 8px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    min-height: 25px !important;
  }

  .h1-reason-row .rs-title {
    font-size: 16.5px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
  }

  .h1-reason-note-row {
    padding: 2px 8px !important;
    background: #ffffff !important;
  }

  .h1-reason-note-row .rs-note-lbl {
    font-size: 12px !important;
    color: #475569 !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
    line-height: 1.1 !important;
  }

  .h1-pink-note-input,
  input.h1-pink-note-input {
    border: 1px dashed #f472b6 !important;
    background: #fdf2f8 !important;
    border-radius: 4px !important;
    width: 100% !important;
    height: 22px !important;
    padding: 2px 6px !important;
    font-size: 12.5px !important;
    color: #0f172a !important;
    outline: none !important;
    box-sizing: border-box !important;
  }

  .h1-reason-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 3px 8px !important;
    background: #ffffff !important;
    border-top: 1px solid #fce7f3 !important;
  }

  .h1-reason-footer .ft-lbl {
    font-size: 13.5px !important;
    font-weight: 900 !important;
    color: #db2777 !important;
  }

  .h1-reason-footer .ft-val {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #db2777 !important;
  }

  /* 9. Ô NHẬP LIỆU MÀU HỒNG (PINK INPUTS) TRÊN DI ĐỘNG */
  input.h1-pink-input,
  .h1-pink-input,
  .st-val-wrap input.h1-pink-input,
  .rs-input-wrap input.h1-pink-input,
  .h1-table-nx input.h1-pink-input,
  .h1-station-row input.h1-pink-input,
  .h1-reason-row input.h1-pink-input {
    width: 58px !important;
    height: 22px !important;
    background: #fdf2f8 !important;
    border: 1.2px solid #ec4899 !important;
    border-radius: 4px !important;
    color: #0284c7 !important;
    font-weight: 900 !important;
    font-size: 14.5px !important;
    text-align: center !important;
    outline: none !important;
    box-sizing: border-box !important;
    padding: 0 2px !important;
    line-height: 20px !important;
    transition: all 0.2s ease !important;
  }

  input.h1-pink-input:focus,
  .h1-pink-input:focus {
    background: #fdf4f9 !important;
    border-color: #db2777 !important;
    box-shadow: 0 0 0 2px rgba(219, 39, 119, 0.25) !important;
  }
}

/* ========================================================
   SECTION 3: KIỂM TRA CÂN ĐỐI (QC & PHỐI ĐÔI) - PHƯƠNG ÁN 2
   Đặt ở cuối lô cuối cùng (Cuối Lô 1 nếu có 1 lô, Cuối Lô 2 nếu có 2 lô)
   Mở rộng kích thước theo chiều dọc cho cả Laptop & Điện thoại
   ======================================================== */
.h1-balance-check-card {
  margin-top: 14px;
  margin-bottom: 10px;
  background: #ffffff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08);
}

.h1-balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.h1-balance-title {
  font-size: 13px;
  font-weight: 900;
  color: #312e81;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}

.h1-balance-title .h1-num-bullet {
  font-size: 15px;
}

.h1-balance-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

.badge-balanced {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1.5px solid #a7f3d0 !important;
}

.badge-unbalanced {
  background: #fff1f2 !important;
  color: #be123c !important;
  border: 1.5px solid #fecdd3 !important;
}

.h1-balance-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h1-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  min-height: 42px;
  border-radius: 8px;
  font-size: 12.5px;
  gap: 8px;
}

.balance-flow-row {
  background: #f5f3ff;
  border: 1.5px solid #ddd6fe;
  color: #4338ca;
}

.balance-actual-row {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  color: #1e40af;
}

.balance-calc-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: #334155;
}

.balance-calc-group strong {
  font-size: 13.5px;
  font-weight: 900;
}

.balance-calc-group .op-sym {
  color: #94a3b8;
  font-weight: 900;
  font-size: 13px;
}

.balance-calc-group .lbl-tp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #713f12;
  font-weight: 800;
}

.balance-calc-group input.field-daily-finished {
  width: 70px !important;
  height: 30px !important;
  font-size: 14px !important;
  padding: 0 6px !important;
  margin: 0 4px !important;
  display: inline-block !important;
  border-radius: 6px !important;
}

.balance-eq-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  color: #0f172a;
}

.balance-eq-val .val-bold {
  font-size: 15px;
  font-weight: 900;
}

@media (max-width: 768px) {
  .h1-balance-check-card {
    margin-top: 8px !important;
    margin-bottom: 6px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
  }

  .h1-balance-header {
    margin-bottom: 6px !important;
    gap: 4px !important;
  }

  .h1-balance-title {
    font-size: 11px !important;
  }

  .h1-balance-title .h1-num-bullet {
    font-size: 13px !important;
  }

  .h1-balance-badge {
    font-size: 10.5px !important;
    padding: 2.5px 8px !important;
    border-radius: 6px !important;
  }

  .h1-balance-body {
    gap: 6px !important;
  }

  .h1-balance-row {
    padding: 6px 10px !important;
    min-height: 34px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
  }

  .balance-calc-group {
    font-size: 11px !important;
    gap: 5px !important;
  }

  .balance-calc-group strong {
    font-size: 12px !important;
  }

  .balance-calc-group .op-sym {
    font-size: 11.5px !important;
  }

  .balance-calc-group .lbl-tp {
    font-size: 11px !important;
    gap: 3px !important;
  }

  .balance-calc-group input.field-daily-finished {
    width: 60px !important;
    height: 24px !important;
    font-size: 12px !important;
    padding: 0 4px !important;
    margin: 0 2px !important;
  }

  .balance-eq-val {
    font-size: 11.5px !important;
  }

  .balance-eq-val .val-bold {
    font-size: 13px !important;
  }
}

/* ========================================================
   SECTION 2 LEGEND & DIRECT INPUT STYLING (HÌNH 1 SPEC)
   - Chú thích: Ô xanh lá = công nhân nhập, Số xanh dương = máy tính
   - 5 Trạm kiểm kê và 3 Lý do thiếu: Luôn cho nhập trực tiếp
   - Nút Sửa bỏ, LK bỏ
   ======================================================== */
.h1-sec-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.h1-legend-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.pill-worker {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.pill-system {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.legend-color-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.box-green {
  background: #10b981;
  border: 1px solid #059669;
}

.box-blue {
  background: #0284c7;
  border: 1px solid #0369a1;
}

/* Green border inputs for station checking and reasons (Hình 1) */
.input-station-green,
.input-reason-green {
  background: #ffffff !important;
  border: 1.5px solid #86efac !important;
  color: #166534 !important;
  font-weight: 800 !important;
  border-radius: 8px !important;
  text-align: center !important;
  transition: all 0.2s ease !important;
}

.input-station-green:focus,
.input-reason-green:focus {
  background: #f0fdf4 !important;
  border-color: #22c55e !important;
  box-shadow: 0 0 0 2.5px rgba(34, 197, 94, 0.25) !important;
}

/* Soft clean panel styling per latest image */
.card-soft-panel {
  background: #ffffff !important;
  border: 1px solid #e0e7ff !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.hdr-clean-blue {
  background: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 8px 12px !important;
  text-align: left !important;
}

.text-navy-title {
  color: #1e3a8a !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
}

.text-slate-sub {
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

.badge-clean-num {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  font-weight: 700 !important;
}

.footer-clean-blue {
  background: #f8fafc !important;
  border-top: 1px solid #f1f5f9 !important;
  padding: 8px 12px !important;
}

.rs-note-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
}

.input-note-green {
  background: #ffffff !important;
  border: 1.5px solid #86efac !important;
  border-radius: 8px !important;
  color: #334155 !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
}

.input-note-green:focus {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 2.5px rgba(34, 197, 94, 0.25) !important;
  background: #f0fdf4 !important;
}

.h1-executor-clean-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
}

.input-executor-green {
  flex: 1;
  background: #ffffff !important;
  border: 1.5px solid #86efac !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  color: #334155 !important;
}

.input-executor-green:focus {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 2.5px rgba(34, 197, 94, 0.25) !important;
  background: #f0fdf4 !important;
}

.banner-amber {
  background: #fffdf0 !important;
  border: 1px solid #fef3c7 !important;
  color: #92400e !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  font-size: 12.5px !important;
}
/* ========================================================
   NÚT KIỂM TRA ĐỎ CHỮ TRẮNG NHẤP NHÁY (DESKTOP & MOBILE)
   ======================================================== */
@keyframes pulseBlinkRed {
  0%, 100% {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    transform: scale(1);
  }
  50% {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    transform: scale(1.04);
  }
}

.btn-kiem-tra-pulse {
  background: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  border: 1.5px solid #b91c1c !important;
  animation: pulseBlinkRed 1.8s infinite ease-in-out !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
}

.btn-kiem-tra-pulse:hover {
  background: #b91c1c !important;
  color: #ffffff !important;
}

.btn-mobile-balance-fast {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1.5px solid #b91c1c !important;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.35);
  flex-shrink: 0;
  animation: pulseBlinkRed 1.8s infinite ease-in-out !important;
}

/* ========================================================
   MODAL TỐI GIẢN: KIỂM TRA CÂN ĐỐI TOÀN NHÀ MÁY
   ======================================================== */
#modalFactoryBalance.modal-overlay {
  z-index: 99999 !important;
}

#modalFactoryBalance.show {
  opacity: 1 !important;
  pointer-events: auto !important;
  display: flex !important;
}

.modal-factory-balance-card {
  max-width: 660px !important;
  width: 95% !important;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.modal-factory-balance-hdr {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #ffffff !important;
  padding: 12px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.fb-hdr-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fb-hdr-icon {
  font-size: 24px;
}

.fb-hdr-title {
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.3px;
  margin: 0;
}

.fb-hdr-sub {
  font-size: 11.5px;
  color: #cbd5e1;
  font-weight: 500;
}

.fb-modal-body {
  padding: 16px 18px !important;
  background: #f8fafc;
  max-height: 80vh;
  overflow-y: auto;
}

.fb-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.fb-date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fb-date-lbl {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.fb-date-input {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  color: #0f172a;
}

.fb-prev-date-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.fb-status-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-balanced {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-unbalanced {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.fb-minimal-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Hàng phép tính tối giản */
.fb-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 10px;
  gap: 6px;
}

.fb-calc-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 6px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.fb-item-input {
  background: #fffbeb !important;
  border: 1.5px solid #fde68a !important;
  flex: 1.25;
}

.fb-item-total {
  background: #f0fdfa !important;
  border: 1.5px solid #99f6e4 !important;
}

.fb-ci-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
  white-space: nowrap;
}

.fb-ci-val {
  font-size: 17px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

.fb-ci-hint {
  font-size: 9.5px;
  color: #64748b;
  margin-top: 3px;
  white-space: nowrap;
}

.fb-minimal-input {
  width: 90%;
  max-width: 110px;
  height: 32px;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  background: #ffffff;
  border: 2px solid #f59e0b;
  border-radius: 6px;
  color: #b45309;
  outline: none;
}

.fb-minimal-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.fb-calc-op {
  font-size: 18px;
  font-weight: 900;
  color: #64748b;
  padding: 0 2px;
  user-select: none;
}

/* Dòng đối chiếu Tồn hôm nay */
.fb-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fdfa;
  border: 1.5px solid #99f6e4;
  border-radius: 8px;
  padding: 10px 14px;
}

.fb-cr-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f766e;
}

.fb-cr-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.fb-cr-val {
  font-size: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.fb-cr-unit {
  font-size: 12px;
  color: #0f766e;
  font-weight: 700;
}

/* 1 Ô DUY NHẤT: HIỂN THỊ ĐỦ HAY LỆCH HAY DƯ */
.fb-single-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.fb-single-result-card.is-balanced {
  background: #ecfdf5;
  border-color: #34d399;
  color: #065f46;
}

.fb-single-result-card.is-short {
  background: #fef2f2;
  border-color: #f87171;
  color: #991b1b;
}

.fb-single-result-card.is-surplus {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1e40af;
}

.fb-single-result-card.is-pending {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.fb-sr-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.fb-sr-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fb-sr-badge {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.fb-sr-message {
  font-size: 12.5px;
  opacity: 0.95;
  line-height: 1.4;
}

.fb-modal-footer {
  padding: 12px 18px !important;
  background: #f1f5f9 !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  justify-content: space-between !important;
}

@media (max-width: 600px) {
  .fb-calc-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .fb-calc-item {
    flex: 1 1 45%;
  }
  .fb-item-input {
    flex: 1 1 45%;
  }
  .fb-item-total {
    flex: 1 1 100%;
  }
  .fb-calc-op {
    display: none;
  }
  .fb-single-result-card {
    padding: 12px 14px;
    gap: 10px;
  }
  .fb-sr-icon {
    font-size: 26px;
  }
  .fb-sr-badge {
    font-size: 14px;
  }
  .fb-sr-message {
    font-size: 12px;
  }
}

/* ========================================================
   KIỂM TRA CÂN ĐỐI - GIAO DIỆN ĐIỆN THOẠI (≤ 768PX)
   Khối 1 tồn lý thuyết, khối 2 tồn thực tế, rồi 1 câu so sánh.
   Laptop giữ nguyên giao diện cũ.
   ======================================================== */
.fb-mobile-view,
.fb-mob-only {
  display: none;
}

@media (max-width: 768px) {
  #modalFactoryBalance .modal-factory-balance-card {
    width: 94% !important;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }
  .modal-factory-balance-hdr {
    padding: 12px 16px !important;
  }
  .fb-hdr-title {
    font-size: 16px;
  }
  .fb-hdr-sub {
    display: none;
  }
  .fb-modal-body {
    padding: 12px !important;
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: #ffffff;
    gap: 10px !important;
  }

  /* Chọn khách hàng (1 hàng) + ngày có ◀ ▶ (1 hàng) */
  .fb-date-row {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    margin-bottom: 0 !important;
  }
  .fb-date-row > div:first-child {
    width: 100%;
    gap: 8px !important;
  }
  .fb-date-row .fb-date-lbl,
  .fb-prev-date-badge,
  .fb-status-badge-wrap {
    display: none !important;
  }
  .fb-cust-picker-wrap,
  .fb-date-picker-wrap {
    width: 100%;
  }
  #fbCustomerSelect {
    min-width: 0 !important;
    width: 100%;
    height: 40px;
    padding: 0 12px !important;
    font-size: 15px;
  }
  .fb-date-picker-wrap {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .fb-mob-only {
    display: inline-flex;
  }
  .fb-date-nav {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    cursor: pointer;
  }
  .fb-date-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    font-size: 15px;
    text-align: center;
  }

  /* Ẩn bố cục cũ, hiện bố cục điện thoại */
  .fb-minimal-box {
    display: none !important;
  }
  .fb-mobile-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .fbm-block {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
  }
  .fbm-block-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #f8fafc;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
  }
  .fbm-num {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .fbm-hdr-note {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
  }
  .fbm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 14px;
    font-size: 14px;
    color: #334155;
  }
  .fbm-op {
    display: inline-block;
    width: 16px;
    font-weight: 800;
    color: #94a3b8;
  }
  .fbm-sub {
    font-size: 12px;
    color: #94a3b8;
  }
  .fbm-val {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
  }
  .fbm-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 800;
  }
  .fbm-total-lt {
    background: #eeedfe;
    color: #3c3489;
    border-top: 1.5px solid #7f77dd;
  }
  .fbm-total-tt {
    background: #e1f5ee;
    color: #085041;
  }
  .fbm-tt-note {
    font-size: 13px;
    font-weight: 500;
  }
  .fbm-big {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 26px;
    font-weight: 800;
  }

  /* Ô nhập thành phẩm: cùng kiểu ô hồng nhạt như các ô nhập khác trong app */
  #fbmThanhPhamInput.fbm-input {
    width: 92px;
    height: 36px;
    padding: 0 6px;
    background: #fdf2f8 !important;
    border: 1.5px solid #ec4899 !important;
    border-radius: 8px !important;
    color: #2563eb !important;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    outline: none;
  }
  #fbmThanhPhamInput.fbm-input::placeholder {
    color: #94a3b8;
  }
  #fbmThanhPhamInput.fbm-input:focus {
    background: #fdf4f9 !important;
    border-color: #db2777 !important;
    box-shadow: 0 0 0 2.5px rgba(236, 72, 153, 0.3);
  }

  /* Ô kết quả: 1 câu khẳng định */
  .fbm-result {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 14px 16px;
  }
  .fbm-result-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .fbm-result-icon {
    flex-shrink: 0;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.2;
  }
  .fbm-statement {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
  }
  .fbm-gap {
    font-size: 24px;
    white-space: nowrap;
  }
  .fbm-result-detail {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid transparent;
    font-size: 13px;
    line-height: 1.5;
  }
  .fbm-result.is-off {
    background: #fef1f1;
    border-color: #f7c1c1;
    color: #791f1f;
  }
  .fbm-result.is-off .fbm-gap,
  .fbm-result.is-off .fbm-result-icon {
    color: #e8191f;
  }
  .fbm-result.is-off .fbm-result-detail {
    border-top-color: #f7c1c1;
    color: #a32d2d;
  }
  .fbm-result.is-balanced {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
  }
  .fbm-result.is-balanced .fbm-result-detail {
    border-top-color: #a7f3d0;
  }
  .fbm-result.is-pending {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
  }
  .fbm-result.is-pending .fbm-result-detail {
    border-top-color: #fde68a;
  }

  .fb-modal-footer {
    padding: 10px 12px !important;
    gap: 8px;
  }
  .fb-modal-footer .btn {
    flex: 1;
  }
}

/* ========================================================
   THEME MỚI ĐỒNG BỘ CHO TẤT CẢ CÁC LÔ (MOCKUP PINK & NAVY)
   ======================================================== */

/* Batch card container & card */
.h1-batch-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04) !important;
  padding: 14px 16px !important;
  width: 100% !important;
  max-width: 440px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  box-sizing: border-box !important;
}

/* Badge Lô góc phải trên */
.h1-batch-badge {
  background: #1e3a5f !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  padding: 5px 14px !important;
  text-align: center !important;
  box-shadow: 0 2px 6px rgba(30, 58, 95, 0.25) !important;
}

.h1-batch-badge .b-name {
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: 0.2px !important;
  line-height: 1.2 !important;
  color: #ffffff !important;
}

.h1-batch-badge .b-plan {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #93c5fd !important;
  margin-top: 1px !important;
}

/* Bảng Section 1: Nhập - Xuất 3 cột */
.h1-table-nx-3col {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

.h1-table-nx-3col thead tr {
  background: #f0f4f8 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.h1-table-nx-3col th {
  padding: 7px 6px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #475569 !important;
}

.h1-table-nx-3col td {
  padding: 6px 6px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
}

.h1-table-nx-3col .cell-sub-note {
  font-size: 11px !important;
  font-style: italic !important;
  color: #94a3b8 !important;
  padding: 4px 8px !important;
  background: #fafafa !important;
}

/* Tất cả các ô nhập số màu hồng viền hồng chữ xanh đậm */
.h1-pink-input,
input.h1-pink-input,
.st-val-wrap input.h1-pink-input,
.rs-input-wrap input.h1-pink-input,
.h1-table-nx input.h1-pink-input,
.h1-station-row input.h1-pink-input,
.h1-reason-row input.h1-pink-input {
  width: 66px !important;
  height: 30px !important;
  background: #fdf2f8 !important;
  border: 1.5px solid #ec4899 !important;
  border-radius: 6px !important;
  color: #2563eb !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  text-align: center !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.h1-pink-input:focus,
input.h1-pink-input:focus,
.st-val-wrap input.h1-pink-input:focus,
.rs-input-wrap input.h1-pink-input:focus,
.h1-table-nx input.h1-pink-input:focus,
.h1-station-row input.h1-pink-input:focus,
.h1-reason-row input.h1-pink-input:focus {
  background: #fdf4f9 !important;
  border-color: #db2777 !important;
  box-shadow: 0 0 0 2.5px rgba(236, 72, 153, 0.3) !important;
}

/* Ô nhập ghi chú lý do thiếu */
.h1-pink-note-input,
input.h1-pink-note-input {
  width: 100% !important;
  height: 28px !important;
  background: #fff5f8 !important;
  border: 1px dashed #f472b6 !important;
  border-radius: 6px !important;
  color: #334155 !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  outline: none !important;
  box-sizing: border-box !important;
}

.h1-pink-note-input:focus,
input.h1-pink-note-input:focus {
  border-color: #ec4899 !important;
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.2) !important;
}

/* Section 2: 3 Cards cùng nền xanh nhạt */
.card-blue-soft {
  background: #edf4fc !important;
  border: 1px solid #dbeafe !important;
  border-radius: 8px !important;
  padding: 8px 6px !important;
}

.text-pink {
  color: #db2777 !important;
}

/* Sub-panel header & footers */
.hdr-clean-blue {
  background: #f0f4f8 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 6px 10px !important;
}

.footer-clean-blue {
  background: #edf4fc !important;
  border-top: 1px solid #dbeafe !important;
  padding: 6px 10px !important;
}

.footer-clean-pink {
  background: #ffffff !important;
  border-top: 1px solid #fce7f3 !important;
  padding: 6px 10px !important;
}

/* Mobile responsive for pink inputs & card elements */
@media (max-width: 768px) {
  .h1-pink-input,
  input.h1-pink-input,
  .st-val-wrap input.h1-pink-input,
  .rs-input-wrap input.h1-pink-input,
  .h1-table-nx input.h1-pink-input,
  .h1-station-row input.h1-pink-input,
  .h1-reason-row input.h1-pink-input {
    width: 58px !important;
    height: 22px !important;
    font-size: 14.5px !important;
    font-weight: 900 !important;
    background: #fdf2f8 !important;
    border: 1.2px solid #ec4899 !important;
    border-radius: 4px !important;
    color: #0284c7 !important;
    text-align: center !important;
    line-height: 20px !important;
    padding: 0 2px !important;
    box-sizing: border-box !important;
  }

  /* Badge Lô góc phải trên trên di động */
  .h1-batch-badge {
    padding: 3px 10px !important;
    border-radius: 6px !important;
  }

  .h1-batch-badge .b-name {
    font-size: 14.5px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
  }

  .h1-batch-badge .b-plan {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    margin-top: 0 !important;
  }

  /* Bảng Section 1 trên di động */
  .h1-table-nx-3col th {
    padding: 3px 2px !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
  }

  .h1-table-nx-3col td {
    padding: 2px 4px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }

  .h1-table-nx-3col .cell-sub-note {
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 2px 6px !important;
    line-height: 1.2 !important;
  }

  /* Sub-panel header & footers trên di động */
  .hdr-clean-blue,
  .h1-station-hdr,
  .h1-reason-hdr {
    padding: 2px 8px !important;
  }

  .footer-clean-blue,
  .footer-clean-pink,
  .h1-station-footer,
  .h1-reason-footer {
    padding: 2px 8px !important;
  }

  .h1-station-list,
  .h1-reason-list {
    padding: 0 !important;
  }
}

/* ============================================================================
   FRONTEND-DESIGN SKILL: PRECISION INDUSTRIAL LEDGER & WORKFLOOR TICKET SYSTEM
   ============================================================================ */

/* 1. NUMERIC & MONOSPACE TABULAR ALIGNMENT */
.mono-num,
.mono-code,
.val-summary,
.eq-val,
.stat-value,
.wip-num-input,
.dept-nav-input,
.td-dept-sum-val,
.h1-batch-badge .b-plan,
.plan-tag,
.b-qty,
.m-kpi-item b,
.f-val {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.02em;
}

.mono-code {
  display: inline-block;
  background: #f1f5f9;
  color: var(--blueprint-navy);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Eliminate distracting infinite animations */
.btn-kiem-tra-pulse,
.pulse-arrow-right,
.btn-pwa-install,
.shortage-badge-box.is-shortage {
  animation: none !important;
}

/* 3. STICKY HEADER & NAVIGATION TABS */
.top-app-bar {
  background: var(--ink-carbon) !important;
  border-bottom: 1px solid #1f2937;
}

.btn-header-action {
  background: #1f2937 !important;
  color: #f8fafc !important;
  border: 1px solid #374151 !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-header-action:hover {
  background: #374151 !important;
  border-color: #4b5563 !important;
}

.btn-logout-header {
  background: rgba(200, 30, 81, 0.18) !important;
  color: #fda4af !important;
  border: 1px solid rgba(244, 63, 94, 0.4) !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  cursor: pointer;
}

.btn-logout-header:hover {
  background: #be123c !important;
  color: #ffffff !important;
}

.nav-tabs {
  background: #ffffff !important;
  border-bottom: 1px solid var(--border-ledger) !important;
}

.nav-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-transform: none !important;
  letter-spacing: -0.01em !important;
  font-weight: 600 !important;
  color: var(--ink-slate) !important;
  border-bottom: 2px solid transparent !important;
}

.nav-tabs .tab-btn .tab-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.nav-tabs .tab-btn.active {
  color: var(--blueprint-navy) !important;
  font-weight: 800 !important;
  border-bottom-color: var(--blueprint-navy) !important;
  background: #f8fafc !important;
}

.nav-tabs .tab-btn.active .tab-num {
  background: var(--blueprint-navy);
  color: #ffffff;
  border-color: var(--blueprint-navy);
}

/* 4. TAB 1: WORKFLOOR TICKET & RECONCILIATION TABLE */
.btn-amber-action {
  background: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #f59e0b !important;
  font-weight: 700 !important;
}

.btn-amber-action:hover {
  background: #fef3c7 !important;
}

.btn-kiem-tra-pulse {
  background: var(--blueprint-navy) !important;
  color: #ffffff !important;
  border: 1px solid #0f2942 !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.btn-kiem-tra-pulse:hover {
  background: #152c4a !important;
}

.empty-ledger-state {
  text-align: center;
  padding: 28px 20px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  margin: 12px 0;
}

.empty-ledger-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-carbon);
  margin-bottom: 4px;
}

.empty-ledger-desc {
  font-size: 0.82rem;
  color: var(--ink-slate);
}

/* 5. TAB 2: UNIFIED DAILY FLOW LEDGER */
.dept-header-banner {
  background: var(--ink-carbon) !important;
  border-bottom: 2px solid var(--blueprint-navy) !important;
}

.dept-banner-title {
  text-transform: none !important;
  letter-spacing: -0.01em !important;
}

.th-top-batch-banner {
  background: var(--blueprint-navy) !important;
  color: #ffffff !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 8px 12px !important;
}

.th-top-batch-banner .batch-title-label {
  font-weight: 800;
  font-size: 0.92rem;
}

.dept-batch-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  gap: 8px;
}

/* 6. TAB 3 & TAB 4: STRUCTURAL MANAGEMENT LEDGER & FORMS */
.manage-stats-banner {
  background: #ffffff !important;
  border: 1px solid var(--border-ledger) !important;
  border-top: 3px solid var(--blueprint-navy) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.manage-stat-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
}

.manage-stat-card .stat-label {
  text-transform: none !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--ink-slate) !important;
}

.manage-card {
  border: 1px solid var(--border-ledger) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

.manage-card-header h3 {
  text-transform: none !important;
  letter-spacing: -0.01em !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
}

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

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

.form-actions-row .btn-block {
  flex: 1;
}

.btn-cancel-edit {
  display: none;
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

.batch-setup-box {
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-ledger);
  margin-bottom: 12px;
}

.batch-setup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.batch-setup-title {
  font-weight: 700;
  color: var(--blueprint-navy);
  font-size: 0.82rem;
  margin: 0;
}

.batch-count-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.batch-count-selector span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-slate);
}

.batch-count-selector select {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  font-weight: 700;
  color: var(--ink-carbon);
  background: #ffffff;
}

.dynamic-batch-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.batch-input-item {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 6px 8px;
}

.batch-input-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-slate);
  margin-bottom: 3px;
}

.batch-Summary-check {
  margin-top: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-slate);
  text-align: right;
}

.batch-Summary-check.is-matched {
  color: var(--workfloor-emerald);
}

.batch-Summary-check.is-mismatch {
  color: var(--inspection-crimson);
}

.manage-list-divider {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.manage-list-Title {
  font-size: 0.8rem;
  color: var(--ink-slate);
  margin-bottom: 8px;
  font-weight: 700;
}

.batch-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.batch-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.74rem;
}

.batch-pill .b-label {
  color: var(--ink-slate);
  font-weight: 600;
}

.batch-pill .b-qty {
  color: var(--blueprint-navy);
  font-weight: 700;
}

/* Tab 4 User Form & Table */
.user-permission-form {
  background: #f8fafc;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border-ledger);
  margin-bottom: 16px;
}

.user-form-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.user-form-title {
  margin: 0;
  font-size: 0.88rem;
  color: var(--blueprint-navy);
  font-weight: 800;
}

.user-form-mode-badge {
  font-size: 0.72rem;
  background: var(--blueprint-tint);
  color: var(--blueprint-navy);
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.user-form-mode-badge.is-editing {
  background: var(--caution-ochre-tint);
  color: var(--caution-ochre);
  border-color: #fde68a;
}

.user-form-hint {
  display: none;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: end;
}

.user-form-actions {
  display: flex;
  gap: 6px;
}

/* 7. MODALS: CLEAN STRUCTURAL DIALOGS */
.modal-card {
  border-radius: 8px !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28) !important;
}

.modal-header {
  background: var(--ink-carbon) !important;
  color: #ffffff !important;
  border-bottom: 1px solid #334155 !important;
}

.modal-header h3 {
  text-transform: none !important;
  font-size: 0.96rem !important;
  font-weight: 700 !important;
}

.modal-lead-desc {
  font-size: 0.84rem;
  color: var(--ink-slate);
  margin-bottom: 14px;
  line-height: 1.5;
}

.sweep-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--border-ledger);
}

.sweep-field label {
  display: block;
  font-weight: 700;
  color: var(--ink-carbon);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.sweep-select,
.sweep-input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 5px;
  border: 1.5px solid #cbd5e1;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-carbon);
  background: #ffffff;
}

.sweep-input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.sweep-formula-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fffbeb;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.45;
}

.factory-equation-banner {
  background: var(--ink-carbon);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.factory-equation-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #93c5fd;
}

.factory-equation-desc {
  font-size: 0.76rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.factory-status-pill {
  background: var(--workfloor-emerald);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.8rem;
}

.factory-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.factory-summary-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
}

.factory-summary-card.is-blue {
  background: var(--blueprint-tint);
  border-color: #93c5fd;
}

.factory-summary-card.is-emerald {
  background: var(--workfloor-emerald-tint);
  border-color: #6ee7b7;
}

.factory-summary-card.is-amber {
  background: var(--caution-ochre-tint);
  border-color: #fcd34d;
}

.factory-summary-card.is-rose {
  background: var(--inspection-crimson-tint);
  border-color: #fda4af;
}

.factory-summary-card .f-lbl {
  font-size: 0.74rem;
  color: var(--ink-slate);
  font-weight: 700;
}

.factory-summary-card .f-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink-carbon);
  margin-top: 2px;
}

.factory-summary-card .f-sub {
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.factory-table-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink-carbon);
  margin-bottom: 8px;
}

/* ========================================================
   THẢ CHUYỀN / CHỈ LỆNH ĐÓNG GÓI / TỔNG HỢP
   ======================================================== */
.rel-ico {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Nút trên thanh công cụ laptop (tab 01) */
.btn.rel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  font-weight: 700;
}
.btn.rel-btn-tc { background: #0f766e !important; }
.btn.rel-btn-dg { background: #7c3aed !important; }
.btn.rel-btn-sum {
  background: #fdf2f8 !important;
  color: #1e3a5f !important;
  border-color: #ec4899 !important;
}
.btn.rel-btn-sum.is-ok { background: #f0f4f8 !important; color: #1e3a5f !important; border-color: #e2e8f0 !important; }
.btn.rel-btn-sum.is-empty { background: #f0f4f8 !important; color: #475569 !important; border-color: #e2e8f0 !important; }
.rel-btn-count { font-family: var(--font-mono); font-weight: 800; }
.btn.rel-btn-sum:not(.is-ok):not(.is-empty) .rel-btn-count { color: #db2777; }

/* Nút và thanh tổng hợp trên điện thoại */
.rel-mobile { display: none; }

@media (max-width: 768px) {
  .rel-mobile {
    display: block;
    margin: 6px 2px 6px;
  }
  .rel-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .rel-big {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    border-radius: 8px;
    padding: 11px 6px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
  }
  .rel-big .rel-ico { width: 17px; height: 17px; }
  .rel-big-tc { background: #0f766e; }
  .rel-big-dg { background: #7c3aed; }
  .rel-big-log { background: #1e3a5f; }
  .rel-big:active,
  .rel-sumbar:active { transform: scale(0.98); }

  /* Hàng dưới: Tổng hợp (trái) + Datalog (phải). Quyền không có Datalog: Tổng hợp dài hết hàng */
  .rel-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
  }
  body:not(.role-admin):not(.role-manager) .rel-row2 { grid-template-columns: 1fr; }
  body:not(.role-admin):not(.role-manager) .rel-dlbtn { display: none !important; }
  body.role-admin .rel-sumbar-more,
  body.role-manager .rel-sumbar-more { display: none; }

  /* Tổng hợp: lúc thường màu cam (khớp / chưa có số), lệch hoặc từ chối thì hồng */
  .rel-sumbar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 9px;
    border-radius: 8px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    background: #fdf2f8;
    color: #1e3a5f;
    border: 1px solid #ec4899;
  }
  .rel-sumbar-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #db2777;
    color: #ffffff;
  }
  .rel-sumbar-ic .rel-ico { width: 15px; height: 15px; }
  .rel-sumbar-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .rel-sumbar-txt,
  .rel-sumbar-val {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rel-sumbar-txt { font-size: 13.5px; font-weight: 800; line-height: 1.2; }
  .rel-sumbar-val { font-size: 11.5px; font-weight: 700; line-height: 1.25; color: #db2777; }
  .rel-sumbar.is-ok,
  .rel-sumbar.is-empty { background: #fff7ed; border-color: #fdba74; }
  .rel-sumbar.is-ok .rel-sumbar-ic,
  .rel-sumbar.is-empty .rel-sumbar-ic { background: #ea580c; }
  .rel-sumbar.is-ok .rel-sumbar-val { color: #c2410c; }
  .rel-sumbar.is-empty .rel-sumbar-val { color: #64748b; }
  .rel-sumbar.rel-dlbtn { background: #eef4ff; border-color: #93b4e6; }
  .rel-dlbtn .rel-sumbar-ic { background: #1e3a5f; }
  .rel-dlbtn .rel-sumbar-val { color: #475569; }

  /* Bỏ thẻ "Tổng hợp đối chiếu nhập xuất tồn" trên điện thoại */
  .mobile-kpi-card { display: none !important; }

  /* Bỏ nút Vét lô trên điện thoại, chữ nút Kiểm tra màu trắng */
  #btnMobileVetLo { display: none !important; }
  #btnOpenGlobalBalanceMobile { color: #ffffff !important; }
}

/* Phân quyền: ẩn/hiện theo vai trò (lớp role-* do applyUserRole gắn lên body) */
body.role-leader .rel-btn-tc,
body.role-leader .rel-big-tc,
body.role-worker .rel-btn-dg,
body.role-worker .rel-big-dg,
body.role-worker .rel-btn-sum,
body.role-worker .rel-sumbar,
body.role-feeder .rel-btn-dg,
body.role-feeder .rel-big-dg,
body.role-feeder .rel-btn-sum,
body.role-feeder .rel-sumbar,
body.role-packer .rel-btn-tc,
body.role-packer .rel-big-tc,
body.role-packer .rel-btn-sum,
body.role-packer .rel-sumbar,
body:not(.role-leader) .rel-big-log {
  display: none !important;
}

/* Nhân viên kiểm kê (thả chuyền) / Đóng gói: chỉ còn 2 bộ lọc KH, PO và 1 nút */
body.role-worker .mobile-action-bar,
body.role-worker .mobile-kpi-card,
body.role-worker .excel-sheet-wrapper,
body.role-worker .action-toolbar .btn-group-right,
body.role-worker .action-toolbar .btn-group-left > :not(.rel-btn),
body.role-worker #reportStatusTag,
body.role-feeder .mobile-action-bar,
body.role-packer .mobile-action-bar,
body.role-feeder .mobile-kpi-card,
body.role-packer .mobile-kpi-card,
body.role-feeder .excel-sheet-wrapper,
body.role-packer .excel-sheet-wrapper,
body.role-feeder .action-toolbar .btn-group-right,
body.role-packer .action-toolbar .btn-group-right,
body.role-feeder .action-toolbar .btn-group-left > :not(.rel-btn),
body.role-packer .action-toolbar .btn-group-left > :not(.rel-btn),
body.role-feeder #reportStatusTag,
body.role-packer #reportStatusTag {
  display: none !important;
}

@media (max-width: 768px) {
  body.role-worker .rel-row,
  body.role-feeder .rel-row,
  body.role-packer .rel-row {
    grid-template-columns: 1fr;
    margin-top: 8px;
  }
  body.role-worker .rel-big,
  body.role-feeder .rel-big,
  body.role-packer .rel-big {
    padding: 16px 8px;
    font-size: 16px;
  }
}

/* Popup */
#modalRelease.modal-overlay,
#modalPackLogM.modal-overlay,
#modalDatalog.modal-overlay { z-index: 100000 !important; }
#modalRelease.show,
#modalPackLogM.show,
#modalDatalog.show {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.rel-card {
  width: 95%;
  max-width: 520px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  color: #0f172a;
  font-family: 'Be Vietnam Pro', sans-serif;
}
.rel-head {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px 9px;
}
.rel-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rel-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
  padding: 0;
}
.rel-back .rel-ico { width: 18px; height: 18px; }
.rel-title { font-size: 17px; font-weight: 800; }
.rel-title { color: #1e3a5f; }
.rel-date {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.rel-info {
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
  line-height: 1.45;
}
.rel-info b { color: #0f172a; }
.rel-info .rel-art { color: #db2777; }
.rel-info .rel-num { font-family: var(--font-mono); }
.rel-seg {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 3px;
  margin-top: 9px;
}
.rel-seg[hidden] { display: none; }
.rel-seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 7px 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  border-radius: 7px;
  cursor: pointer;
}
.rel-seg-btn.on {
  background: #1e3a5f;
  color: #ffffff;
}
.rel-seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.rel-body [hidden] { display: none !important; }
.rel-loading,
.rel-empty {
  margin: 14px 10px;
  padding: 14px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.rel-loading { color: #64748b; }
.rel-empty {
  background: #f0f4f8;
  color: #1e3a5f;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}
.rel-chips {
  display: flex;
  gap: 6px;
  padding: 8px 8px 0;
}
.rel-chip {
  flex: 1;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.rel-chip.ok { background: #f0f4f8; color: #1e3a5f; border-color: #1e3a5f; }
.rel-table-card {
  background: #ffffff;
  margin: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.rel-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.rel-col-size { width: 15%; }
.rel-col-cum { width: 21%; }
.rel-col-size2 { width: 16%; }
.rel-table th {
  background: #f1f5f9;
  color: #475569;
  font-size: 11.5px;
  font-weight: 700;
  padding: 7px 2px;
  text-align: center;
  line-height: 1.25;
  border: none;
}
.rel-th-cum,
.rel-th-tc,
.rel-th-dg { color: #1e3a5f !important; }
.rel-table td {
  padding: 3px 2px;
  text-align: center;
  vertical-align: middle;
  border: none;
  border-top: 1px solid #eef2f7;
}
.rel-size {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.15;
  word-break: break-word;
}
.rel-input {
  width: 100%;
  height: 32px;
  box-sizing: border-box;
  background: #fdf2f8;
  border: 1.5px solid #ec4899;
  border-radius: 6px;
  color: #2563eb;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.rel-input::placeholder { color: #cbd5e1; }
.rel-input:focus { border-color: #db2777; box-shadow: 0 0 0 2px #fbcfe8; }
.rel-input[readonly] {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}
.rel-cum {
  display: block;
  border-radius: 6px;
  padding: 7px 0;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 14px;
  background: #f0f4f8;
  color: #1d4ed8;
}
.rel-table tfoot td {
  background: #f8fafc;
  border-top: 1.5px solid #cbd5e1;
  padding: 8px 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.rel-table tfoot td.rel-foot-lbl { font-family: inherit; font-weight: 800; }
.rel-sum-table td { padding: 7px 2px; font-family: var(--font-mono); font-weight: 700; }
.rel-sum-table td.rel-size { font-family: 'Be Vietnam Pro', sans-serif; }
.rel-v-tc,
.rel-v-dg { color: #1d4ed8; }
.rel-ok {
  display: inline-block;
  background: #f0f4f8;
  color: #1e3a5f;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 12px;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 800;
  font-size: 13px;
}
.rel-diff { color: #db2777; font-weight: 800; font-size: 16px; }
.rel-none { color: #94a3b8; }
.rel-banner {
  margin: 8px 8px 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
  background: #fdf2f8;
  color: #1e3a5f;
  border: 1px solid #ec4899;
}
.rel-banner.is-ok { background: #f0f4f8; color: #1e3a5f; border-color: #e2e8f0; }
.rel-banner.is-empty { background: #f0f4f8; color: #475569; border-color: #e2e8f0; }
.rel-banner .rel-diff-txt { color: #db2777; }
.rel-banner small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}
.rel-note {
  padding: 0 12px 6px;
  font-size: 11.5px;
  color: #64748b;
}
.rel-foot {
  flex-shrink: 0;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
}
.rel-foot:empty { display: none; }
.rel-fbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 12px 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}
.rel-fbtn:disabled { opacity: 0.45; cursor: not-allowed; }
.rel-fbtn-gray { background: #e2e8f0; color: #334155; }
.rel-fbtn-tc { background: #0f766e; }
.rel-fbtn-dg { background: #7c3aed; }
.rel-fbtn-leader { background: #1e3a5f; }
.rel-fbtn-reject { background: #ffffff; color: #be123c; border: 1.5px solid #f43f5e; }
.rel-fbtn-rejsend { background: #e11d48; }

/* Đóng gói từ chối: ô trạng thái đỏ, dòng ghi size sai + lý do, size bị đánh dấu tô hồng */
.rel-chip.bad { background: #fff1f2; color: #be123c; border-color: #fda4af; }
.rel-reject {
  margin: 6px 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff1f2;
  border: 1px solid #fda4af;
  color: #9f1239;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.rel-reject[hidden] { display: none; }
.rel-reject b { font-weight: 800; }
.rel-reject span { display: block; }
.rel-table tr.is-rejected td.rel-size { background: #ffe4e6; color: #be123c; box-shadow: inset 3px 0 0 #e11d48; }
.rel-lot-rej { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #e11d48; color: #ffffff; font-size: 11px; font-weight: 800; }

/* Khung từ chối: nằm trên popup, chọn size sai + lý do */
#modalRelease .rel-card { position: relative; }
.rel-rej-sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  background: rgba(15, 23, 42, 0.45);
}
.rel-rej-sheet[hidden] { display: none; }
.rel-rej-card {
  width: 100%;
  max-height: 85%;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
}
.rel-rej-title { font-size: 16px; font-weight: 800; color: #9f1239; margin-bottom: 8px; }
.rel-rej-label { margin: 10px 0 6px; font-size: 12.5px; font-weight: 800; color: #1e3a5f; }
.rel-rej-label small { font-weight: 600; color: #64748b; }
.rel-rej-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rel-rej-chip {
  min-width: 52px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.rel-rej-chip.on { background: #e11d48; border-color: #e11d48; color: #ffffff; }
.rel-rej-note {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  height: 42px;
  padding: 0 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
}
.rel-rej-err { margin-top: 8px; font-size: 12.5px; font-weight: 700; color: #e11d48; }
.rel-rej-err[hidden] { display: none; }
.rel-rej-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; margin-top: 12px; }
.rel-hint {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: #db2777;
  text-align: center;
}

@media (max-width: 768px) {
  #modalRelease.modal-overlay,
  #modalPackLogM.modal-overlay,
  #modalDatalog.modal-overlay {
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  .rel-card {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .rel-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .rel-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* ========================================================
   TAB 03: KHÁCH HÀNG + DÃY SIZE CỦA KHÁCH
   ======================================================== */
.cust-mgr-card {
  margin-bottom: 16px;
}
.cust-mgr-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.manage-header-hint {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.cust-mgr-card .manage-card-header,
.size-preview-card .manage-card-header,
.po-list-card .manage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#tableCustomers td:nth-child(3),
#tableCustomers td:nth-child(4),
#tableCustomers td:nth-child(5) {
  white-space: nowrap;
}
.size-editor {
  background: #f0f4f8;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px 12px;
}
.size-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.size-editor-title { font-size: 13.5px; font-weight: 800; color: #1e3a5f; }
.size-count {
  background: #ffffff;
  color: #1e3a5f;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 700;
}
.size-editor-help { font-size: 12px; color: #475569; margin: 4px 0 8px; }
.size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 42px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px;
}
.size-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 3px 0 4px;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid #1e3a5f;
  color: #1e3a5f;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  cursor: grab;
  user-select: none;
}
.size-chip .rel-ico { width: 12px; height: 12px; color: #64748b; }
.size-chip.is-drag { opacity: 0.4; }
.size-chip.is-over { border-color: #1d4ed8; box-shadow: -3px 0 0 #1d4ed8; }
.size-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #1e3a5f;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.size-chip-x:hover { background: #f0f4f8; }
.size-chips-empty { font-size: 12.5px; color: #94a3b8; padding: 5px; }
.size-add-row { display: flex; gap: 6px; margin-top: 8px; }
.size-add-row .form-control { flex: 1; min-width: 0 !important; }
.btn.size-add-btn {
  background: #1e3a5f !important;
  color: #ffffff !important;
  border: none !important;
  white-space: nowrap;
}
.size-err { font-size: 12px; color: #dc2626; min-height: 16px; margin-top: 4px; }
.size-hint { font-size: 11.5px; color: #64748b; margin-bottom: 6px; }
.size-quick { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.size-quick-lbl { font-size: 11.5px; font-weight: 700; color: #475569; }
.size-quick-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: #1e3a5f;
  background: #ffffff;
  border: 1px dashed #1e3a5f;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.size-quick-btn.is-clear { border-color: #cbd5e1; color: #64748b; }
.size-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.size-brief {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.size-brief.is-empty { background: #fdf2f8; color: #db2777; font-family: inherit; }
.selected-cust-row .size-brief { background: #1e3a5f; color: #ffffff; }
.selected-cust-row .size-brief.is-empty { background: #fdf2f8; color: #db2777; }
.size-brief-n { font-size: 11px; color: #94a3b8; margin-left: 4px; }

.size-preview-note { font-size: 12.5px; color: #475569; margin-bottom: 8px; }
.size-preview-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.size-preview-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.size-preview-table th {
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  border: none;
}
.size-preview-table td {
  text-align: center;
  padding: 3px;
  border: none;
  border-top: 1px solid #eef2f7;
}
.size-preview-table td.rel-size { font-size: 12.5px; padding: 5px 2px; }
.size-pv-box { height: 22px; border: 1.5px solid #f9a8d4; background: #fdf2f8; border-radius: 5px; }
.size-pv-cum { height: 22px; background: #f0f4f8; border-radius: 5px; }
.size-pv-more { font-size: 11.5px; color: #64748b; margin-top: 6px; }
.po-list-card { margin-top: 16px; }

@media (max-width: 1024px) {
  .cust-mgr-body { grid-template-columns: 1fr; }
}

/* ========================================================
   CHUYỂN QUYỀN (nút TK): chọn quyền rồi nhập mật khẩu của quyền
   ======================================================== */
#modalRoleSwitch.modal-overlay { z-index: 100000 !important; }
#modalRoleSwitch.show {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
#modalRoleAuth.modal-overlay { z-index: 100001 !important; }
.rs-card {
  width: 95%;
  max-width: 420px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  color: #0f172a;
  font-family: 'Be Vietnam Pro', sans-serif;
}
.rs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e2e8f0;
}
.rs-title { font-size: 17px; font-weight: 800; }
.rs-current { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.rs-current b { color: #0f172a; }
.rs-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.rs-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 14px;
}
.rs-body [hidden] { display: none !important; }
.rs-roles { display: grid; gap: 8px; }
.rs-role {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  font-family: inherit;
  color: #0f172a;
}
.rs-role:active { transform: scale(0.99); }
.rs-role.is-current {
  border-color: #0f766e;
  background: #f0fdfa;
  cursor: default;
}
.rs-role-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
}
.rs-ico-admin { background: #7c2d12; }
.rs-ico-worker { background: #0f766e; }
.rs-ico-leader { background: #1e3a5f; }
.rs-ico-packer { background: #7c3aed; }
.rs-role-text { flex: 1; min-width: 0; }
.rs-role-name { display: block; font-size: 15px; font-weight: 800; }
.rs-role-desc { display: block; font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.35; }
.rs-role-tag {
  font-size: 11px;
  font-weight: 800;
  color: #0f766e;
  background: #ccfbf1;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.rs-picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}
.rs-label { display: block; font-size: 12.5px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.rs-pass-row { display: flex; gap: 6px; }
.rs-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  box-sizing: border-box;
  border: 1.5px solid #ec4899;
  background: #fdf2f8;
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  outline: none;
}
.rs-input:focus { border-color: #db2777; box-shadow: 0 0 0 2px #fbcfe8; }
.rs-eye {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
}
.rs-error { min-height: 18px; margin: 6px 0 4px; font-size: 13px; font-weight: 600; color: #dc2626; }
.rs-submit {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  background: #0f766e;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.rs-submit:disabled { opacity: 0.55; cursor: progress; }
.rs-back {
  width: 100%;
  margin-top: 8px;
  border: none;
  background: transparent;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
}
.rs-foot {
  padding: 10px 14px 12px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}
.rs-link {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #0369a1;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 768px) {
  #modalRoleSwitch.modal-overlay {
    align-items: flex-end !important;
  }
  .rs-card {
    width: 100%;
    max-width: none;
    border-radius: 18px 18px 0 0;
    border: none;
  }
  .rs-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* Tab 04: mật khẩu từng quyền */
.role-pw-card { margin-top: 16px; }
.role-pw-card .manage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.role-pw-list { display: grid; gap: 8px; }
.role-pw-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}
.role-pw-name { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; }
.role-pw-name .rs-role-ico { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
.role-pw-status {
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  background: #fdf2f8;
  color: #db2777;
}
.role-pw-status.is-set { background: #f0f4f8; color: #1e3a5f; }
.role-pw-row .form-control { min-width: 0 !important; width: 100%; }
.role-pw-loading,
.role-pw-note { font-size: 12px; color: #64748b; }
.role-pw-note { margin: 10px 0 0; }

@media (max-width: 768px) {
  .role-pw-row { grid-template-columns: 1fr auto; }
}

/* ========================================================
   THẢ CHUYỀN THEO LÔ + ĐỒNG BỘ / CHI TIẾT (bộ màu thẻ NXT)
   ======================================================== */
.rel-mode-note { margin-top: 6px; font-size: 11.5px; font-weight: 600; color: #db2777; }
.rel-head [hidden] { display: none !important; }
.rel-lots {
  display: flex;
  gap: 6px;
  margin-top: 9px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.rel-lot-tab {
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #1e3a5f;
  border-radius: 8px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.rel-lot-tab.on { background: #1e3a5f; color: #ffffff; border-color: #1e3a5f; }
.rel-lot-bad { margin-left: 5px; color: #db2777; }
.rel-lot-tab.on .rel-lot-bad { color: #fbcfe8; }
.rel-lot-info { margin-top: 7px; font-size: 12px; font-weight: 700; color: #1e3a5f; }
.rel-lot-info:empty { display: none; }
.rel-lot-sub { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: #475569; }
.rel-lot-sub.is-lock { color: #0369a1; }
.rel-num-blue,
.rel-num-pink,
.rel-num-navy,
.rel-num-sky { font-family: var(--font-mono); font-weight: 800; }
.rel-num-blue { color: #1d4ed8; }
.rel-num-pink { color: #db2777; }
.rel-num-navy { color: #1e3a5f; }
.rel-num-sky { color: #0284c7; }

/* Chi tiết: mỗi chi tiết 1 cột; ART nhiều chi tiết thì kéo ngang, cột Size đứng yên */
#modalRelease[data-mode="ct"] .rel-table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#modalRelease[data-mode="ct"] .rel-ct-sticky { position: sticky; left: 0; z-index: 1; background: #ffffff; }
#modalRelease[data-mode="ct"] th.rel-ct-sticky { background: #f1f5f9; }
#modalRelease[data-mode="ct"] tfoot td.rel-ct-sticky { background: #f8fafc; }
.rel-table th.rel-th-part { color: #1e3a5f; font-weight: 800; padding: 8px 3px; word-break: break-word; }
.rel-table td.rel-ct-cell { vertical-align: top; padding: 4px 3px; }
.rel-ct-tl {
  margin-top: 3px;
  border-radius: 5px;
  background: #f0f4f8;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  white-space: nowrap;
}
.rel-ct-ft-day { display: block; font-size: 10.5px; font-weight: 600; color: #64748b; }
.rel-ct-ft-cum { display: block; font-size: 13px; font-weight: 800; color: #1d4ed8; }

/* Chi tiết: tích đủ theo đơn hàng (X đỏ hồng trong ô còn thiếu, nút Đủ trên tên chi tiết), size đủ bộ tự ghi sang Đồng bộ.
   Đủ thì tô xanh da trời nhạt */
#modalRelease[data-mode="ct"] th.rel-ct-sticky small { display: block; font-size: 9.5px; font-weight: 600; color: #94a3b8; }
.rel-ct-pn { display: block; }
.rel-ct-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 3px 9px 3px 5px;
  border: 1.5px solid #7dd3fc;
  border-radius: 999px;
  background: #ffffff;
  color: #0369a1;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.rel-ct-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 1.5px solid #38bdf8;
  border-radius: 4px;
  background: #ffffff;
  color: #0369a1;
  font-size: 10px;
  line-height: 1;
}
.rel-ct-full.on { background: #bae6fd; border-color: #7dd3fc; color: #075985; }
.rel-ct-full.on .rel-ct-box { border-color: currentColor; background: transparent; color: currentColor; }
.rel-ct-full:disabled { cursor: default; opacity: 0.7; }
.rel-ct-in { position: relative; }
/* Ô đủ từ các ngày trước: số đang có hiện mờ thay cho 0, gõ vào là sửa */
.rel-ct-in.is-fix .rel-input::placeholder { color: #9fb0c6; }
.rel-ct-tick {
  display: none;
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1.5px solid #fb7185;
  border-radius: 6px;
  background: #fff1f2;
  color: #e11d48;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rel-ct-tick .rel-ico { width: 14px; height: 14px; stroke-width: 3; }
.rel-ct-in.can-tick .rel-ct-tick { display: flex; }
.rel-ct-tick:active { background: #ffe4e6; }
.rel-ct-tl small { font-size: 10px; font-weight: 700; color: #94a3b8; }
.rel-ct-tl.is-ok { background: #e0f2fe; color: #0369a1; letter-spacing: 0.5px; }
.rel-ct-tl.is-over { background: #fdf2f8; color: #db2777; }
.rel-ct-tl.is-over small { color: #f472b6; }
.rel-ct-ord { display: block; margin-top: 1px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: #94a3b8; }
.rel-ct-badge { display: block; margin-top: 1px; font-style: normal; font-size: 9.5px; font-weight: 800; color: #0369a1; }
#modalRelease[data-mode="ct"] td.rel-ct-sticky.is-full { background: #e0f2fe; }
.rel-cum.is-auto { background: #e0f2fe; color: #0369a1; }
.rel-from-ct { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 700; color: #0369a1; line-height: 1.2; }

/* Tab 03: bảng chia lô (số tổng + size của lô) */
.po-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) !important; }
.lot-config-wrap { margin: 8px 0; overflow-x: auto; }
.lot-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.lot-col-name { width: 86px; }
.lot-col-total { width: 112px; }
.lot-table th {
  background: #f0f4f8;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 6px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}
.lot-table th.lot-th-sizes { text-align: left; }
.lot-th-sizes span { font-weight: 600; color: #64748b; }
.lot-table td {
  padding: 5px 6px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  vertical-align: middle;
}
.lot-table td.lot-size-cell { text-align: left; }
.lot-badge {
  display: inline-block;
  background: #1e3a5f;
  color: #ffffff;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.lot-row.is-tail .lot-badge { background: #475569; }
.lot-table .lot-total-input {
  width: 100% !important;
  height: 32px !important;
  box-sizing: border-box;
  background: #fdf2f8 !important;
  border: 1.5px solid #ec4899 !important;
  border-radius: 6px !important;
  color: #2563eb !important;
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  text-align: center !important;
  padding: 0 4px !important;
}
.lot-sz {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  margin: 2px;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.lot-sz.on { background: #1e3a5f; border-color: #1e3a5f; color: #ffffff; }
.lot-sz-all {
  margin: 2px 0 2px 6px;
  border: 1px solid #e2e8f0;
  background: #f0f4f8;
  color: #1e3a5f;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.lot-size-empty { font-size: 12px; font-weight: 600; color: #db2777; }
.lot-preview { margin-top: 10px; }
.lot-preview-title { font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 4px; }
.lot-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  font-weight: 600;
  color: #1e3a5f;
}

/* Tab 03: chi tiết theo ART */
.art-parts-card { margin-bottom: 16px; }
.art-parts-card .manage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.art-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.art-col-name { width: 160px; }
.art-table th {
  background: #f0f4f8;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.art-th-parts span { font-weight: 600; color: #64748b; }
.art-table td { padding: 6px 8px; border-top: 1px solid #e2e8f0; vertical-align: middle; }
.art-name { font-weight: 800; color: #db2777; }
.art-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.art-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 3px 0 9px;
  border-radius: 7px;
  background: #f0f4f8;
  border: 1px solid #1e3a5f;
  color: #1e3a5f;
  font-size: 12.5px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
}
.art-chip.is-drag { opacity: 0.4; }
.art-chip.is-over { box-shadow: -3px 0 0 #1d4ed8; }
.art-chip-x {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #1e3a5f;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.art-chip-x:hover { background: #e2e8f0; }
.art-table .art-add-input {
  width: 180px !important;
  min-width: 0 !important;
  height: 30px !important;
  padding: 0 8px !important;
  font-size: 12.5px !important;
}
.art-empty { font-size: 12.5px; color: #64748b; padding: 6px 2px; }

/* Chi tiết theo công đoạn (dưới hàng chi tiết của ART): dòng = chi tiết, cột = công đoạn */
.asg-box { margin-top: 8px; padding: 8px 10px 10px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.asg-title { font-size: 12px; font-weight: 800; color: #1e3a5f; margin-bottom: 6px; }
.asg-title span { font-weight: 600; color: #64748b; }
.asg-grid { display: grid; gap: 0; border: 1px solid #dbe3ec; border-radius: 6px; overflow: hidden; background: #ffffff; }
.asg-grid > * { border-right: 1px solid #edf1f5; border-bottom: 1px solid #edf1f5; }
.asg-corner { padding: 6px 8px; font-size: 11px; font-weight: 700; color: #64748b; background: #f0f4f8; }
.asg-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 4px;
  border: 0;
  border-right: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  background: #f0f4f8;
  color: #1e3a5f;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.asg-col small { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: #047857; }
.asg-col.is-none small { color: #b91c1c; }
.asg-col:hover { background: #e2e8f0; }
.asg-pn { padding: 6px 8px; font-size: 12px; font-weight: 700; color: #1e3a5f; display: flex; align-items: center; }
.asg-cell {
  height: 32px;
  border: 0;
  border-right: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  background: #ffffff;
  color: #cbd5e1;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}
.asg-cell.on { background: #dcfce7; color: #047857; }
.asg-cell:hover { box-shadow: inset 0 0 0 2px #93b4e6; }
.art-name { display: flex; align-items: center; gap: 4px; }
.art-table td.art-name { display: table-cell; }
.art-del {
  margin-left: 4px;
  width: 20px;
  height: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
}
.art-del:hover { color: #db2777; border-color: #db2777; }
.art-table tr.art-new-row td { background: #f0f4f8; }
.art-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.art-table .art-new-input {
  width: 260px !important;
  min-width: 0 !important;
  height: 32px !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 700;
}
.art-new-btn { white-space: nowrap; }
.art-new-err { font-size: 12px; font-weight: 600; color: #db2777; }
.po-art-hint { margin-top: 4px; font-size: 11.5px; font-weight: 600; color: #db2777; }
.po-art-hint:empty { display: none; }

@media (max-width: 1024px) {
  .po-grid { grid-template-columns: 1fr !important; }
}

/* ========================================================
   THANH TRÊN TRÊN LAPTOP: NỀN NAVY GỌN (MÀU THẺ NXT), TÊN APP,
   Ô KH / PO TRONG SUỐT, NÚT TÀI KHOẢN CÓ MENU (LÀM MỚI / CHUYỂN QUYỀN / ĐĂNG XUẤT)
   Điện thoại giữ nguyên giao diện cũ
   ======================================================== */
.top-brand { display: none; }
.btn-user-avatar .avatar-ini,
.btn-user-avatar .avatar-meta,
.btn-user-avatar .avatar-caret { display: none; }

@media (min-width: 769px) {
  .sticky-header-wrapper {
    background: #1e3a5f !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12) !important;
  }
  .top-app-bar.compact-header {
    background: #1e3a5f !important;
    border-bottom: none !important;
    padding: 8px 20px !important;
  }
  .compact-header .top-bar-inner {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }
  .top-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-right: 6px;
    flex-shrink: 0;
  }
  .top-brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #ffffff;
    color: #1e3a5f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
  }
  .top-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
  .top-brand-text b { font-size: 13.5px; font-weight: 800; color: #ffffff; white-space: nowrap; }
  .top-brand-text small { font-size: 11px; font-weight: 500; color: #bcd0ea; white-space: nowrap; }

  .top-filters-group {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .top-filters-group .filter-item {
    position: relative;
    min-width: 0;
    height: 34px;
    gap: 0 !important;
    padding-left: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }
  .top-filters-group .filter-item:hover { background: rgba(255, 255, 255, 0.13); }
  .top-filters-group .filter-item:focus-within { border-color: rgba(255, 255, 255, 0.5); }
  .pill-filter-customer { flex: 0 1 230px; }
  .pill-filter-po { flex: 0 1 360px; }
  .top-filters-group .pill-prefix {
    display: inline-flex !important;
    align-items: center;
    flex-shrink: 0;
    background: transparent !important;
    color: #bcd0ea !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.4px;
  }
  /* Nhãn "Khách hàng" / "Đơn hàng / PO" chỉ để trình đọc màn hình */
  .top-filters-group .filter-item label.sr-only-mobile {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  .top-filters-group .filter-item select,
  .top-filters-group select.select-customer-styled,
  .top-filters-group select.select-po-styled {
    -webkit-appearance: none;
    appearance: none;
    width: 100% !important;
    min-width: 0 !important;
    height: 32px !important;
    padding: 0 28px 0 7px !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23bcd0ea' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 9px center !important;
    background-size: 13px !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-overflow: ellipsis;
    outline: none;
    cursor: pointer;
  }
  .top-filters-group .filter-item select option { background: #ffffff; color: #0f172a; }

  .user-action-cluster {
    margin-left: auto;
    position: relative;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  #btnForceRefreshApp,
  #currentRoleBadge,
  #btnSwitchRole,
  #btnLogout { display: none !important; }
  .btn-install-pwa {
    background: transparent !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    height: 34px;
    border-radius: 8px !important;
  }
  .btn-user-avatar {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    width: auto !important;
    height: 36px !important;
    padding: 0 10px 0 3px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 12px !important;
  }
  .btn-user-avatar:hover,
  .btn-user-avatar:active {
    background: rgba(255, 255, 255, 0.13) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
  }
  .btn-user-avatar .avatar-icon { display: none; }
  .btn-user-avatar .avatar-ini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    color: #1e3a5f;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
  }
  .btn-user-avatar .avatar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    min-width: 0;
  }
  .avatar-name {
    max-width: 170px;
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .avatar-role { font-size: 11px; font-weight: 500; color: #bcd0ea; white-space: nowrap; }
  .btn-user-avatar .avatar-caret {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #bcd0ea;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .user-popover-menu {
    top: calc(100% + 8px) !important;
    right: 0 !important;
    width: 220px;
    border-radius: 10px;
  }

  /* Hàng tab: chữ xám, tab đang mở chữ navy gạch chân navy */
  .nav-tabs {
    padding: 0 20px !important;
    gap: 2px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
  }
  .nav-tabs .tab-btn {
    padding: 11px 12px 10px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    background: none !important;
    border-bottom: 2px solid transparent !important;
  }
  .nav-tabs .tab-btn:hover { color: #1e3a5f !important; }
  .nav-tabs .tab-btn .tab-txt-mobile { display: none; }
  .nav-tabs .tab-btn.active {
    color: #1e3a5f !important;
    font-weight: 800 !important;
    border-bottom-color: #1e3a5f !important;
    background: none !important;
  }
  .nav-tabs .tab-btn .tab-num,
  .nav-tabs .tab-btn.active .tab-num {
    padding: 0;
    border: none;
    background: none;
    font-size: 11px;
  }
  .nav-tabs .tab-btn .tab-num { color: #94a3b8; }
  .nav-tabs .tab-btn.active .tab-num { color: #1e3a5f; }
  #reportStatusTag {
    background: #f0f4f8 !important;
    color: #1e3a5f !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 11.5px !important;
    padding: 3px 10px !important;
  }
  #reportStatusTag.submitted {
    background: #1e3a5f !important;
    color: #ffffff !important;
    border-color: #1e3a5f !important;
  }
}

/* ========================================================
   TAB 03 TRÊN LAPTOP: DANH SÁCH KHÁCH BÊN TRÁI,
   KHÁCH ĐANG CHỌN BÊN PHẢI CHIA 3 MỤC (DÃY SIZE / ART & CHI TIẾT / ĐƠN HÀNG PO)
   ======================================================== */
#tab-manage .mg-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
#tab-manage .mg-kpis .stat-card {
  padding: 9px 14px;
  gap: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: none;
  transform: none;
}
#tab-manage .mg-kpis .stat-label { font-size: 11.5px; font-weight: 600; color: #64748b; text-transform: none; }
#tab-manage .mg-kpis .stat-value { font-family: var(--font-mono); font-size: 18px; font-weight: 800; color: #1e3a5f; }

.mg-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
#tab-manage .manage-card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

/* Cột trái: danh sách khách */
.mg-cust-panel { position: sticky; top: 100px; }
.mg-cust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  background: #f0f4f8;
  border-bottom: 1px solid #e2e8f0;
}
.mg-cust-title { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 800; color: #1e3a5f; }
.mg-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #1e3a5f;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 7px;
}
.mg-cust-list { max-height: calc(100vh - 190px); overflow-y: auto; }
.mg-cust-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px 9px 11px;
  border: none;
  border-top: 1px solid #f1f5f9;
  border-left: 3px solid transparent;
  background: #ffffff;
  font-family: inherit;
  cursor: pointer;
}
.mg-cust-item:first-child { border-top: none; }
.mg-cust-item:hover { background: #f8fafc; }
.mg-cust-item.selected-cust-row { background: #f0f4f8; border-left-color: #1e3a5f; }
.mg-cust-item-name {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-cust-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11.5px; color: #64748b; }
.mg-cust-item-code { font-family: var(--font-mono); font-weight: 700; color: #475569; }
.mg-cust-item .size-brief { padding: 0 6px; border: 1px solid #e2e8f0; background: #ffffff; color: #1e3a5f; }
.mg-cust-item .size-brief.is-empty { border-color: #fbcfe8; background: #fdf2f8; color: #db2777; }
.mg-cust-item.selected-cust-row .size-brief { border-color: #1e3a5f; background: #1e3a5f; color: #ffffff; }
.mg-cust-item.selected-cust-row .size-brief.is-empty { border-color: #fbcfe8; background: #fdf2f8; color: #db2777; }
.mg-cust-item .size-brief-n { display: none; }
.mg-cust-item-po { margin-left: auto; font-weight: 700; color: #1e3a5f; white-space: nowrap; }
.mg-cust-empty { padding: 16px 12px; font-size: 12.5px; color: #64748b; }

/* Cột phải: tên khách + 3 mục */
.mg-head { padding: 12px 16px 0; }
.mg-head-view { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.mg-cust-name { margin: 0; font-size: 18px; font-weight: 800; color: #1e3a5f; letter-spacing: -0.01em; }
.mg-cust-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1px 7px;
}
.mg-cust-code:empty { display: none; }
.mg-head-actions { display: flex; gap: 6px; margin-left: auto; }
.mg-head-form { display: none; }
.mg-detail.is-editing-name .mg-head-view { display: none; }
.mg-detail.is-editing-name .mg-head-form { display: block; }
.mg-head-form-title { font-size: 13px; font-weight: 800; color: #1e3a5f; margin-bottom: 6px; }
.mg-head-form-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.mg-head-form .form-group { margin: 0; }
.mg-name-group { flex: 1 1 260px; }
.mg-code-group { flex: 0 1 170px; }
.mg-head-form .form-control {
  width: 100%;
  min-width: 0 !important;
  height: 36px;
  border: 1px solid #cbd5e1 !important;
  box-shadow: none !important;
}
.mg-head-form-actions { display: flex; gap: 6px; }
.mg-req { color: #db2777; font-weight: 800; }
.mg-opt { font-weight: 500; color: #94a3b8; }
.mg-detail.is-new [data-mg-tab="art"],
.mg-detail.is-new [data-mg-tab="po"] { display: none; }

.mg-subtabs {
  display: flex;
  gap: 2px;
  margin-top: 10px;
  padding: 0 10px;
  border-bottom: 1px solid #e2e8f0;
}
.mg-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 9px 10px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
}
.mg-subtab:hover { color: #1e3a5f; }
.mg-subtab.on { color: #1e3a5f; font-weight: 800; border-bottom-color: #1e3a5f; }
.mg-subtab-n {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: #f0f4f8;
  border-radius: 9px;
  padding: 0 6px;
}
.mg-subtab.on .mg-subtab-n { background: #1e3a5f; color: #ffffff; }
.mg-panel { padding: 14px 16px 16px; }
.mg-panel[hidden] { display: none !important; }
.mg-panel-note { font-size: 12.5px; color: #475569; margin-bottom: 10px; }
.mg-panel-note b { color: #1e3a5f; }

/* Nút trong tab 03: navy là nút chính, viền xám là nút phụ, chữ hồng đậm là nút xóa */
.mg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mg-btn[hidden] { display: none; }
.mg-btn:disabled { opacity: 0.6; cursor: progress; }
.mg-btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.mg-btn-primary { background: #1e3a5f; border-color: #1e3a5f; color: #ffffff; }
.mg-btn-primary:hover { background: #16304f; }
.mg-btn-outline { background: #ffffff; border-color: #cbd5e1; color: #1e3a5f; }
.mg-btn-outline:hover { border-color: #1e3a5f; }
.mg-btn-outline.is-danger { color: #db2777; }
.mg-btn-outline.is-danger:hover { border-color: #db2777; background: #fdf2f8; }
#btnTogglePoForm.is-open { background: #ffffff; border-color: #cbd5e1; color: #1e3a5f; }
#tab-manage .btn.btn-primary { background: #1e3a5f !important; color: #ffffff !important; }
.mg-link-btn {
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  align-self: flex-start;
}
.po-art-hint .mg-link-btn { margin: 0 0 0 4px; }

/* Mục Dãy size: khung nhập + xem trước trên điện thoại */
.mg-size-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: start;
}
.size-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.mg-preview { padding: 10px 12px 12px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px; }
.mg-preview-title { font-size: 13px; font-weight: 800; color: #1e3a5f; margin-bottom: 4px; }

/* Mục ART & chi tiết */
#tab-manage .art-parts-list { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
#tab-manage .art-parts-list .art-empty { padding: 12px; }

/* Mục Đơn hàng PO: thanh tìm, biểu mẫu thêm / sửa, bảng PO */
.mg-po-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#tab-manage .mg-search {
  flex: 1;
  min-width: 0 !important;
  height: 34px;
  padding-left: 32px !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center / 15px;
}
.mg-po-form {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px 14px;
  background: #fbfcfe;
  border: 1px solid #1e3a5f;
  border-radius: 12px;
}
.mg-po-form.is-open { display: block; }
.mg-po-form-title { font-size: 14px; font-weight: 800; color: #1e3a5f; margin-bottom: 10px; }
.mg-hidden-field { display: none; }
.mg-po-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.mg-po-fields .form-group { min-width: 0; margin: 0; }
#tab-manage .mg-po-form .form-control {
  width: 100% !important;
  min-width: 0 !important;
  height: 36px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #0f172a;
}
#tab-manage .mg-po-form .mg-plan-input {
  background: #fdf2f8 !important;
  border: 1.5px solid #ec4899 !important;
  color: #1d4ed8 !important;
  font-family: var(--font-mono) !important;
  font-weight: 800 !important;
}
#tab-manage .mg-lot-box {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.mg-lot-box .batch-setup-header { margin-bottom: 0; }
.mg-lot-box .batch-setup-header label { margin: 0; font-size: 13px; font-weight: 800; color: #1e3a5f; }
#tab-manage .mg-lot-box .select-batch-count {
  width: auto !important;
  height: 32px;
  border: 1px solid #cbd5e1 !important;
  color: #1e3a5f !important;
  font-size: 12.5px !important;
}
.mg-po-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.mg-po-form .batch-sum-checker { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: #475569; }
.mg-po-form .batch-sum-checker strong { font-family: var(--font-mono); color: #1d4ed8; }
#tab-manage .badge-checker-ok,
#tab-manage .badge-checker-warn {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 800;
}
#tab-manage .badge-checker-ok { background: #f0f4f8; color: #1e3a5f; }
#tab-manage .badge-checker-warn { background: #fdf2f8; color: #db2777; }
.mg-po-form-actions { display: flex; gap: 8px; }

.mg-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
.mg-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.mg-col-po { width: 17%; }
.mg-col-art { width: 15%; }
.mg-col-line { width: 11%; }
.mg-col-plan { width: 10%; }
.mg-col-act { width: 112px; }
.mg-table th {
  padding: 8px 10px;
  background: #f0f4f8;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
.mg-table th.mg-th-num { text-align: right; }
.mg-table td {
  padding: 8px 10px;
  border-top: 1px solid #f1f5f9;
  color: #1e293b;
  font-size: 13px;
  vertical-align: middle;
}
.mg-table tbody tr:first-child td { border-top: none; }
.mg-table tbody tr:hover td { background: #f8fafc; }
.mg-table tbody tr.is-editing td { background: #f0f4f8; }
.mg-table td.mg-po-num { font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; color: #0f172a; }
.mg-table td.mg-art { font-weight: 800; color: #db2777; }
.mg-table td.mg-num { text-align: right; font-family: var(--font-mono); font-weight: 800; color: #1d4ed8; }
.mg-table td.mg-lots { line-height: 1.9; }
.mg-lot-tag {
  display: inline-block;
  margin: 1px 4px 1px 0;
  padding: 1px 7px;
  background: #f0f4f8;
  border-radius: 6px;
  color: #1e3a5f;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mg-lot-tag b { font-weight: 800; }
.mg-muted { color: #94a3b8; font-size: 12px; }
.mg-table td.mg-row-actions { text-align: right; white-space: nowrap; }
.mg-row-btn {
  margin-left: 4px;
  padding: 4px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mg-row-btn:hover { border-color: #1e3a5f; }
.mg-row-btn.is-danger { color: #db2777; }
.mg-row-btn.is-danger:hover { border-color: #db2777; background: #fdf2f8; }
.mg-table td.mg-table-empty { padding: 22px 10px; text-align: center; color: #64748b; font-size: 12.5px; }

@media (max-width: 1100px) {
  .mg-po-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-size-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .mg-layout { grid-template-columns: 1fr; }
  .mg-cust-panel { position: static; }
  .mg-cust-list { max-height: 240px; }
  #tab-manage .mg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ========================================================
   CÔNG ĐOẠN THẢ CHUYỀN: bảng công đoạn của khách (tab 03),
   ô Công đoạn trong popup Thả chuyền, bảng Tổng hợp công đoạn
   ======================================================== */
.mg-detail.is-new [data-mg-tab="stage"] { display: none; }
.stage-table-wrap { max-width: 640px; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.stage-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.stage-col-no { width: 48px; }
.stage-col-act { width: 132px; }
.stage-table th {
  padding: 7px 10px;
  background: #f0f4f8;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
.stage-table td { padding: 4px 10px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.stage-table tbody tr:first-child td { border-top: none; }
.stage-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #1e3a5f;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}
.stage-table tr.is-empty .stage-no { background: #e2e8f0; color: #64748b; }
#tab-manage .stage-input {
  width: 100%;
  min-width: 0 !important;
  height: 32px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  color: #1e3a5f;
}
#tab-manage .stage-table tr.is-empty .stage-input { background: #f8fafc; font-weight: 500 !important; }
.stage-acts { text-align: right; white-space: nowrap; }
.stage-act {
  margin-left: 3px;
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.stage-act:hover:not(:disabled) { border-color: #1e3a5f; }
.stage-act.is-danger { color: #db2777; }
.stage-act.is-danger:hover:not(:disabled) { border-color: #db2777; background: #fdf2f8; }
.stage-act:disabled { opacity: 0.35; cursor: default; }
.stage-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 640px; margin-top: 10px; }
#tab-manage .stage-copy {
  width: auto !important;
  min-width: 0 !important;
  max-width: 260px;
  height: 30px;
  padding: 0 8px !important;
  border: 1px dashed #1e3a5f !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #1e3a5f;
}
.stage-dirty {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  color: #db2777;
  background: #fdf2f8;
  border-radius: 6px;
  padding: 2px 8px;
}
.stage-dirty[hidden] { display: none; }
.stage-dirty[hidden] + #btnSaveStages { margin-left: auto; }
.stage-flow {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 640px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0f4f8;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.stage-chip { background: #1e3a5f; color: #ffffff; border-radius: 6px; padding: 2px 8px; font-weight: 800; font-size: 12px; }
.stage-chip.is-pack { background: #7c3aed; }
.stage-arrow { color: #94a3b8; }

/* Popup Thả chuyền: ô Công đoạn (chữ 16px để iPhone không tự phóng to) */
.rel-stage { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rel-stage label { font-size: 12.5px; font-weight: 800; color: #1e3a5f; white-space: nowrap; }
.rel-stage-sel {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid #1e3a5f;
  border-radius: 9px;
  background: #ffffff;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3a5f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  cursor: pointer;
}

/* Tổng hợp công đoạn: mỗi cột so với cột trước, cuộn ngang khi nhiều công đoạn, cột Size đứng yên */
.rel-table-card.rel-sum-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rel-sum-table th { vertical-align: bottom; padding: 6px 3px; }
.rel-sum-table th small { display: block; margin-top: 1px; font-size: 10px; font-weight: 600; color: #94a3b8; }
.rel-sum-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 3px;
  border-radius: 4px;
  background: #1e3a5f;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  vertical-align: 1px;
}
.rel-sum-table th.rel-sum-size,
.rel-sum-table td.rel-sum-size { width: 52px; position: sticky; left: 0; z-index: 1; }
.rel-sum-table th.rel-sum-size { background: #f1f5f9; }
.rel-sum-table td.rel-sum-size { background: #ffffff; }
.rel-sum-table tfoot td.rel-sum-size { background: #f8fafc; }
.rel-sum-table td { padding: 5px 2px; line-height: 1.2; }
.rel-sum-v { display: block; color: #1d4ed8; font-size: 14px; font-weight: 800; }
.rel-sum-v.is-zero { color: #cbd5e1; }
.rel-sum-d { display: block; margin-top: 2px; font-family: 'Be Vietnam Pro', sans-serif; font-size: 10.5px; font-weight: 800; color: #64748b; }
.rel-sum-d.is-bad { font-family: var(--font-mono); font-size: 12px; color: #db2777; }
.rel-banner.rel-steps { padding: 8px 10px; font-size: 13px; }
.rel-steps-title { margin-bottom: 4px; }
.rel-step {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #ffffff;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 700;
}
.rel-step b { white-space: nowrap; }
.rel-step.is-bad { color: #db2777; }
.rel-banner.is-ok .rel-step { background: #ffffff; }

/* ========================================================
   ĐƠN HÀNG THEO SIZE: dán theo đợt (tab 03), cột Đơn hàng (Thả chuyền),
   tab 05 Nhật ký đóng gói. OK đủ đơn = xanh lá, còn lại theo bộ màu thẻ NXT
   ======================================================== */
#btnTogglePaste.is-open { border-color: #1e3a5f; box-shadow: inset 0 0 0 1px #1e3a5f; }
.mg-paste {
  margin-bottom: 14px;
  padding: 12px 14px 14px;
  background: #fbfcfe;
  border: 1px solid #1e3a5f;
  border-radius: 12px;
}
.mg-paste[hidden] { display: none; }
.mg-paste-hint { font-size: 12px; color: #475569; line-height: 1.5; }
/* Bước ① Đợt đơn hàng, ② Bảng đơn hàng */
.mg-paste-step { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mg-paste-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e3a5f;
  color: #ffffff;
  font: 800 11px var(--font-mono);
}
.mg-paste-lbl { font-size: 12.5px; font-weight: 800; color: #1e3a5f; white-space: nowrap; }
.mg-paste-step .mg-paste-hint { flex: 1; min-width: 240px; }
.mg-paste-wave {
  width: 190px;
  height: 32px;
  padding: 0 10px;
  border: 1.5px solid #ec4899;
  border-radius: 8px;
  background: #fdf2f8;
  color: #0f172a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  outline: none;
}
.mg-paste-wave:focus { border-color: #db2777; box-shadow: 0 0 0 2px #fbcfe8; }
.mg-paste-wave::placeholder { color: #f0a6c9; font-weight: 700; }
.mg-paste-waves { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mg-wave-chip {
  height: 26px;
  padding: 0 9px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #f0f4f8;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mg-wave-chip:hover { border-color: #1e3a5f; }
.mg-wave-chip.is-on { background: #1e3a5f; border-color: #1e3a5f; color: #ffffff; }
/* Bảng dán đơn: PO | ART | size | Tổng, mỗi ô là 1 ô nhập */
.mg-pg-wrap { overflow-x: auto; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; }
.mg-pg { border-collapse: collapse; min-width: 100%; }
.mg-pg th {
  height: 28px;
  padding: 0 4px;
  background: #1e3a5f;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
  border-right: 1px solid #2c4a73;
  white-space: nowrap;
}
.mg-pg th.mg-pg-po { width: 120px; text-align: left; padding-left: 8px; }
.mg-pg th.mg-pg-art { width: 90px; text-align: left; padding-left: 8px; }
.mg-pg th.mg-pg-sz { min-width: 42px; font-family: var(--font-mono); }
.mg-pg th.mg-pg-tot { width: 64px; }
.mg-pg td { padding: 0; border-right: 1px solid #eef2f7; border-bottom: 1px solid #eef2f7; }
.mg-pg-in {
  display: block;
  width: 100%;
  min-width: 40px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: #1e3a5f;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
}
.mg-pg-in.is-num { text-align: right; color: #0f172a; font-family: var(--font-mono); }
.mg-pg-in:focus { background: #eff6ff; box-shadow: inset 0 0 0 2px #1e3a5f; }
.mg-pg-in.is-hint { background: #fdf2f8; box-shadow: inset 0 0 0 2px #ec4899; }
.mg-pg-in.is-hint::placeholder { color: #db2777; font-weight: 700; }
.mg-pg td.mg-pg-tot { padding: 0 7px; background: #f1f5f9; color: #1e3a5f; font: 800 12.5px var(--font-mono); text-align: right; }
.mg-pg-note { padding: 10px 12px; background: #f0f4f8; color: #1e3a5f; font-size: 12.5px; font-weight: 600; line-height: 1.5; }
.mg-paste-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mg-paste-actions.is-end { justify-content: flex-end; }
.mg-paste-gap { flex: 1; }
.mg-paste-foot { margin-top: 6px; }
.mg-paste-note { font-size: 11.5px; color: #64748b; }
.mg-paste-note.is-bad { color: #db2777; font-weight: 700; }
.mg-paste-err {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdf2f8;
  color: #db2777;
  font-size: 12.5px;
  font-weight: 600;
}
.mg-paste-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.mg-paste-sum span {
  padding: 3px 9px;
  border-radius: 6px;
  background: #f0f4f8;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 700;
}
.mg-paste-sum span.is-bad { background: #fdf2f8; color: #db2777; }
.mg-paste-table { min-width: 0; table-layout: auto; }
.mg-paste-table td, .mg-paste-table th { white-space: nowrap; }
.mg-paste-table tr.is-bad td { background: #fdf2f8; }
.mg-paste-notes { white-space: normal !important; }
.mg-note {
  display: inline-block;
  margin: 1px 3px 1px 0;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: #f0f4f8;
  color: #1e3a5f;
}
.mg-note.is-up { background: #fff7ed; color: #9a3412; }
.mg-note.is-art,
.mg-note.is-warn,
.mg-note.is-bad { background: #fdf2f8; color: #db2777; }
.mg-table tr.mg-wave-row td {
  background: #1e3a5f;
  color: #ffffff;
  font-weight: 800;
  font-size: 12.5px;
  text-align: left;
}
.mg-table tr.mg-wave-row td span { margin-left: 8px; font-weight: 600; color: #bcd0ea; font-size: 11.5px; }
.mg-table tbody tr.mg-wave-row:hover td { background: #1e3a5f; }
.mg-ord-n { display: block; font-family: 'Be Vietnam Pro', sans-serif; font-size: 10.5px; font-weight: 600; color: #64748b; }

/* Biểu mẫu PO: đơn theo size phía trên bảng chia lô */
.po-order-sizes { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: #f0f4f8; }
.po-order-sizes[hidden] { display: none; }
.po-order-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.po-order-title { font-size: 12.5px; font-weight: 800; color: #1e3a5f; }
.po-order-title b { font-family: var(--font-mono); color: #1d4ed8; }
.po-order-title s { font-family: var(--font-mono); color: #94a3b8; font-weight: 700; }
.po-order-warn { color: #b45309; font-weight: 700; }
.po-order-chg { font-size: 11.5px; font-weight: 700; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 20px; padding: 1px 9px; }
.po-order-chg[hidden], .po-order-undo[hidden] { display: none; }
.po-order-sp { flex: 1; }
.po-order-head .po-order-undo { margin: 0; color: #b91c1c; }
.po-order-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px dashed #93b4e6;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.po-order-new:disabled { opacity: .5; cursor: not-allowed; }
.po-order-hint { margin-top: 6px; font-size: 11.5px; color: #64748b; line-height: 1.5; }
.po-order-hint b { color: #334155; }

/* Bảng đơn theo size: dòng = lô (hoặc cả PO), cột = size, ô gõ số */
.po-og-wrap { overflow-x: auto; border: 1px solid #dbe3ec; border-radius: 8px; background: #ffffff; }
.po-og { border-collapse: collapse; width: 100%; table-layout: fixed; min-width: calc(var(--n) * 44px + 170px); }
.po-og col.po-og-col-lc { width: 92px; }
.po-og col.po-og-col-tc { width: 78px; }
.po-og th, .po-og td { border-bottom: 1px solid #edf1f5; border-right: 1px solid #edf1f5; text-align: center; padding: 0; }
.po-og thead th { background: #f8fafc; font-family: var(--font-mono); font-size: 12px; font-weight: 800; color: #1e3a5f; height: 28px; }
.po-og .po-og-lc { position: sticky; left: 0; z-index: 1; background: #ffffff; text-align: left; padding: 0 8px; font-size: 12px; font-weight: 800; color: #1e3a5f; white-space: nowrap; }
.po-og thead th.po-og-lc { background: #f8fafc; font-family: inherit; font-size: 11.5px; color: #475569; }
.po-og .po-og-lc .lot-badge { padding: 2px 7px; font-size: 11.5px; }
.po-og td.po-og-c { height: 34px; position: relative; }
.po-og .po-og-in {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: #1d4ed8;
  padding: 0 2px;
  box-shadow: none;
}
.po-og .po-og-in::placeholder { color: #d5dde6; font-weight: 500; }
.po-og td.po-og-c:focus-within { box-shadow: inset 0 0 0 2px #2563eb; background: #eff6ff; }
.po-og td.po-og-c.is-ch { background: #fef9c3; }
.po-og td.po-og-c.is-ch .po-og-in { color: #92400e; padding-top: 7px; }
.po-og .po-og-was { position: absolute; left: 0; right: 0; top: 1px; font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; color: #a16207; text-decoration: line-through; pointer-events: none; }
.po-og .po-og-tc { background: #f8fafc; font-family: var(--font-mono); font-size: 13px; font-weight: 800; color: #1e3a5f; padding: 0 8px; text-align: right; }
.po-og .po-og-tc.is-ch { color: #b45309; }
.po-og tfoot td { background: #eef4ff; font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; color: #1e3a5f; height: 30px; border-bottom: 0; }
.po-og tfoot td.po-og-lc { background: #eef4ff; font-family: inherit; }
.po-og tfoot td.is-ch { color: #b45309; }
.po-og tfoot td.po-og-tc { background: #dbe7fb; }

/* Hộp xem lại số đơn đã đổi khi lưu PO */
.oc-card { background: #ffffff; width: 92%; max-width: 480px; overflow: hidden; }
.oc-card .btn-close-modal { background: none; border: 0; color: #ffffff; font-size: 22px; line-height: 1; cursor: pointer; opacity: .8; }
.oc-body { max-height: 60vh; overflow-y: auto; }
.oc-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: #0f172a; }
.oc-list b { font-family: var(--font-mono); }
.oc-up { color: #047857; font-weight: 700; }
.oc-dn { color: #b91c1c; font-weight: 700; }
.oc-note { margin: 0; font-size: 12px; color: #64748b; line-height: 1.5; }

/* Popup thả chuyền: cột Đơn hàng (so với tích lũy cả PO của công đoạn đang chọn) */
.rel-th-ord { color: #1e3a5f !important; }
.rel-th-ord small { display: block; font-size: 9.5px; font-weight: 600; color: #94a3b8; }
.rel-ord { border-radius: 6px; padding: 2px 0; line-height: 1.15; }
.rel-ord small { display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: #94a3b8; }
.rel-ord b { display: block; font-size: 11.5px; font-weight: 800; }
.rel-ord.is-ok { background: #dcfce7; }
.rel-ord.is-ok b { color: #15803d; }
.rel-ord.is-less b { color: #64748b; font-weight: 700; }
.rel-ord.is-over { background: #fdf2f8; }
.rel-ord.is-over b { color: #db2777; }
.rel-ord-count { font-family: 'Be Vietnam Pro', sans-serif; font-size: 11px; font-weight: 700; color: #64748b; }
.rel-table tfoot .rel-ord.is-ok { display: inline-block; padding: 2px 10px; }

/* Tab 05: Nhật ký đóng gói */
#tab-pack-log .manage-card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
.pl-card { margin-bottom: 12px; }
.pl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px 8px; }
.pl-title { margin: 0; font-size: 18px; font-weight: 800; color: #1e3a5f; }
.pl-sub { margin-top: 2px; font-size: 12.5px; color: #64748b; }
.pl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 4px 16px 12px; }
.pl-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #475569; }
.pl-filters select,
.pl-filters input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #1e3a5f;
}
.pl-filters select { max-width: 260px; }
.pl-count { margin-left: auto; font-size: 12px; font-weight: 700; color: #475569; }
.pl-empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}
.pl-wave { display: flex; align-items: center; gap: 8px; margin: 14px 2px 6px; font-size: 13px; font-weight: 700; color: #475569; }
.pl-wave span { background: #1e3a5f; color: #ffffff; border-radius: 6px; padding: 3px 10px; font-size: 13px; font-weight: 800; }
.pl-po { margin-bottom: 10px; }
.pl-po-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  background: #f0f4f8;
  border-bottom: 1px solid #e2e8f0;
}
.pl-po-num { font-family: var(--font-mono); font-size: 14px; font-weight: 800; color: #1e3a5f; }
.pl-po-meta { font-size: 12.5px; font-weight: 600; color: #475569; }
.pl-prog { flex: 1 1 120px; max-width: 220px; height: 8px; border-radius: 6px; background: #e2e8f0; overflow: hidden; }
.pl-prog i { display: block; height: 100%; background: #1d4ed8; }
.pl-prog i.is-done { background: #16a34a; }
.pl-badge {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.pl-badge.is-done { background: #16a34a; border-color: #16a34a; color: #ffffff; }
.pl-badge.is-none { color: #64748b; font-weight: 700; }
.pl-table-wrap { border: none; border-radius: 0; }
.pl-table { table-layout: fixed; }
.pl-table th, .pl-table td { white-space: nowrap; text-align: center; }
.pl-table th:nth-child(1), .pl-table th:nth-child(2),
.pl-table td:nth-child(1), .pl-table td:nth-child(2) { text-align: left; }
.pl-table td.pl-date { font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; color: #1e3a5f; }
.pl-table tr.pl-sub-row td { border-top: 1px dashed #eef2f7; }
.pl-v { font-family: var(--font-mono); font-weight: 800; color: #1d4ed8; }
.pl-zero { color: #cbd5e1; }
.pl-none { color: #94a3b8; padding: 14px !important; }
.pl-table tfoot td {
  background: #f0f4f8;
  border-top: 1.5px solid #cbd5e1;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #334155;
  padding: 7px 10px;
}
.pl-table tfoot td:first-child { font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a5f; }
.pl-remain { color: #db2777 !important; font-family: var(--font-mono); font-weight: 800; }
.pl-ok {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 5px;
  background: #dcfce7;
  color: #15803d;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 12px;
  font-weight: 800;
}
.pl-ok-txt { color: #15803d; }

/* Nhật ký đóng gói trên điện thoại (tổ trưởng): mỗi PO 1 thẻ, bảng size xếp dọc, số từng ngày dạng ô nhỏ */
.plm-card { margin: 10px 10px 4px; padding: 12px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; }
.plm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.plm-head .pl-badge { margin-left: auto; }
.plm-art { font-size: 12.5px; font-weight: 600; color: #475569; }
.plm-stats { margin-top: 6px; font-size: 13px; font-weight: 600; color: #475569; }
.plm-prog { display: block; max-width: none; margin-top: 7px; }
.plm-lots { margin-top: 8px; }
.plm-table { margin-top: 10px; }
.plm-table th, .plm-table td { text-align: center; }
.plm-table td { font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
.plm-table .pl-ok { font-size: 13px; }
.plm-sec { margin: 14px 0 6px; font-size: 13.5px; font-weight: 800; color: #1e3a5f; }
.plm-sec small { font-size: 11.5px; font-weight: 600; color: #94a3b8; }
.plm-day { padding: 8px 0; border-top: 1px dashed #e2e8f0; }
.plm-day-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: #475569; }
.plm-date { font-family: var(--font-mono); font-size: 14px; font-weight: 800; color: #1e3a5f; }
.plm-lot { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.plm-lot .lot-badge { flex-shrink: 0; }
.plm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.plm-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 42px; padding: 2px 6px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; line-height: 1.15; }
.plm-chip small { font-family: var(--font-mono); font-size: 10.5px; font-weight: 800; color: #1e3a5f; }
.plm-chip b { font-family: var(--font-mono); font-size: 13px; color: #1d4ed8; }
.plm-none { padding: 6px 0; font-size: 12.5px; color: #94a3b8; }
.plm-more { display: block; width: 100%; margin-top: 6px; padding: 9px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f1f5f9; color: #1e3a5f; font-family: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }

.po-order-hint .mg-link-btn { margin: 0 0 0 6px; }
.pl-table th.mg-th-num { text-align: center; }
.pl-table tfoot td:nth-child(2) { text-align: center; }

/* Dán đơn theo lô (CLSX): dòng lô, dòng cộng PO; nhật ký: trạng thái từng lô */
.mg-paste-table tr.mg-po-total td { background: #f0f4f8; font-weight: 800; color: #1e3a5f; border-top: 1px solid #cbd5e1; }
.mg-paste-table tr.mg-po-total.is-bad td { background: #fdf2f8; }
.mg-paste-table td.mg-crd { font-family: var(--font-mono); font-size: 12px; color: #475569; }
.pl-lots { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.pl-lot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
}
.pl-lot b { font-family: 'Be Vietnam Pro', sans-serif; color: #1e3a5f; }
.pl-lot.is-done { background: #dcfce7; border-color: #bbf7d0; color: #15803d; }

/* Màu của lô (cùng 1 PO có nhiều màu): nhãn nhỏ cạnh tên lô */
.mg-lot-color {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #ffffff;
  color: #475569;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.mg-lot-tag .mg-lot-color { margin-left: 2px; padding: 0 4px; }
.mg-lot-cell { white-space: nowrap; }
.rel-lot-color { font-size: 11px; font-weight: 700; color: #64748b; }
.rel-lot-tab.on .rel-lot-color { color: #cbd5e1; }

/* Hàng nút lô (Thả chuyền, Chỉ lệnh đóng gói): chữ to hơn; lô đã có số tô đậm, lô chưa nhập gì làm mờ */
.rel-lots { gap: 8px; }
.rel-lot-tab { padding: 9px 14px; font-size: 15px; border-radius: 10px; }
.rel-lot-color { font-size: 13px; }
.rel-lot-tab.has-data:not(.on) { background: #e8eef6; border: 1.5px solid #1e3a5f; color: #1e3a5f; font-weight: 800; }
.rel-lot-tab.is-empty:not(.on) { background: #f8fafc; border-style: dashed; border-color: #cbd5e1; color: #94a3b8; font-weight: 600; }
.rel-lot-tab.is-empty:not(.on) .rel-lot-color { color: #b6c2d1; }
.rel-lot-info { font-size: 13.5px; }

/* Cùng 1 nút / 1 màn: Sếp thấy "Tiến độ sản xuất" + ô chọn đợt, Quản lý thấy "Datalog" như cũ */
body:not(.role-admin) .dl-boss,
body.role-admin .dl-std { display: none !important; }
#modalDatalog .rel-stage label { width: 98px; }
.rel-stage-sel.dlg-wave-sel { border-color: #ec4899; background-color: #fdf2f8; }

/* Datalog (Sếp, Quản lý): bảng PO × công đoạn, cột PO + Tổng SL và dòng tiêu đề / Cộng đứng yên khi cuộn */
.dlg-drow { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dlg-dlabel { flex: 1; font-size: 12.5px; font-weight: 700; color: #475569; }
.dlg-dn {
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
}
.dlg-dn:disabled { opacity: 0.35; cursor: default; }
.dlg-dv {
  min-width: 108px;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 7px 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
}
.dlg-count { margin-top: 8px; font-size: 12px; font-weight: 600; color: #475569; }
.dlg-count b { color: #0f172a; }
.dlg-key {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 6px;
  padding: 5px 8px;
  font-size: 11.5px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
}
.dlg-key span { display: inline-flex; align-items: center; gap: 4px; }
.dlg-key .kv { font-weight: 800; color: #0f172a; }
.dlg-key .kd { font-weight: 800; color: #0f766e; }
.dlg-key .sw { width: 12px; height: 12px; border-radius: 3px; background: #dcfce7; border: 1px solid #86efac; }
.dlg-body { overflow: auto; background: #ffffff; padding-bottom: 0; }
.dlg-tbl { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.dlg-tbl th,
.dlg-tbl td { border-bottom: 1px solid #eef2f7; border-right: 1px solid #f1f5f9; padding: 6px 7px; vertical-align: middle; }
.dlg-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  color: #334155;
  text-align: right;
  line-height: 1.25;
  min-width: 74px;
  max-width: 90px;
  white-space: normal;
  border-bottom: 2px solid #cbd5e1;
  border-top: 3px solid #0f766e;
}
.dlg-tbl thead th .no { display: block; font: 700 9.5px var(--font-mono); color: #94a3b8; }
.dlg-tbl thead th.tp { border-top-color: #7c3aed; background: #faf5ff; }
.dlg-tbl .pc {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  text-align: left;
  width: 94px;
  min-width: 94px;
  max-width: 94px;
}
.dlg-tbl .sl {
  position: sticky;
  left: 94px;
  z-index: 1;
  background: #f8fafc;
  text-align: right;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  box-shadow: 2px 0 0 #cbd5e1;
}
.dlg-tbl thead th.pc,
.dlg-tbl thead th.sl { z-index: 3; background: #f1f5f9; border-top-color: #1e3a5f; }
.dlg-tbl .pc b { display: block; font-size: 12.5px; color: #1e3a5f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-tbl .pc small { display: block; font-size: 10.5px; font-weight: 600; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-tbl .sl .v { font: 800 12.5px var(--font-mono); color: #1e3a5f; }
.dlg-tbl td.c { text-align: right; position: relative; padding-bottom: 8px; }
.dlg-tbl .c .v { font: 800 12.5px var(--font-mono); color: #0f172a; }
.dlg-tbl .c .d { display: block; min-height: 13px; font: 700 10.5px var(--font-mono); color: #0f766e; }
.dlg-tbl .c.tp .d { color: #7c3aed; }
.dlg-tbl .c .bar { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: #eef2f7; overflow: hidden; }
.dlg-tbl .c .bar i { display: block; height: 100%; background: #60a5fa; }
.dlg-tbl .c.full { background: #f0fdf4; }
.dlg-tbl .c.full .v { color: #15803d; }
.dlg-tbl .c.full .bar i { background: #22c55e; }
.dlg-tbl .c.zero .v { color: #cbd5e1; }
.dlg-tbl tfoot td { position: sticky; bottom: 0; z-index: 1; background: #eef4ff; border-top: 2px solid #93b4e6; }
.dlg-tbl tfoot td.pc,
.dlg-tbl tfoot td.sl { z-index: 2; background: #eef4ff; }
.dlg-hint { position: sticky; left: 0; padding: 6px 0 10px; font-size: 11px; color: #94a3b8; text-align: center; }
