:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --sidebar: #0f172a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Be Vietnam Pro', 'Roboto', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea {
  font-family: inherit;
}
.hidden { display: none !important; }

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.brand-mark.sm { width: 34px; height: 34px; font-size: 12px; }
.login-card h1 { margin: 14px 0 4px; font-size: 20px; }
.subtitle { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.quick-accounts { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.qa-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qa-chip {
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.qa-chip:hover { border-color: var(--primary); background: var(--primary-soft); }

/* App Shell */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 248px;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-title { font-weight: 700; font-size: 15px; color: #fff; }
.brand-sub { font-size: 11px; color: #94a3b8; }
.nav-menu { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #64748b;
  padding: 12px 10px 4px;
  font-weight: 700;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.2); }
.user-name { font-weight: 600; color: #fff; font-size: 13px; }
.user-role { font-size: 11.5px; color: #93c5fd; margin-top: 2px; }
.sb-actions { display: flex; gap: 6px; margin-top: 10px; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.offline-banner {
  background: #dc2626;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle-btn:active { background: #e2e8f0; }
.sidebar-close-btn {
  display: none;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #e2e8f0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 55;
}
body.role-production #topbar-period-box,
body.cutter-focus #topbar-period-box {
  display: none !important;
}
.topbar h2 { margin: 0; font-size: 18px; }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.month-picker { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.month-picker input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.lock-pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.lock-pill.locked { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.lock-pill.open { background: var(--ok-soft); color: var(--ok); border: 1px solid #bbf7d0; }

.content-area { padding: 18px 22px; flex: 1; overflow-y: auto; }

/* Cards, Toolbar, Table */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-val { font-size: 21px; font-weight: 700; margin-top: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.kpi-card.warn { border-color: #fde68a; background: #fffbeb; }
.kpi-card.danger { border-color: #fecaca; background: #fef2f2; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-title { font-weight: 700; font-size: 14.5px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar input, .toolbar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 230px);
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}
.table-wrap.has-kpi-tabs {
  max-height: calc(100vh - 345px);
  min-height: 250px;
}
.table-wrap::-webkit-scrollbar,
.table-hscroll-top::-webkit-scrollbar {
  height: 12px;
  width: 10px;
}
.table-wrap::-webkit-scrollbar-track,
.table-hscroll-top::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 6px;
}
.table-wrap::-webkit-scrollbar-thumb,
.table-hscroll-top::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.table-hscroll-top::-webkit-scrollbar-thumb:hover {
  background: #334155;
}
.table-hscroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.table-hscroll-top > div {
  height: 1px;
}
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.data-table th.is-sticky-col,
table.data-table td.is-sticky-col {
  position: sticky;
  background-clip: padding-box;
}
table.data-table th.is-sticky-col {
  z-index: 7;
  background: #f8fafc;
}
table.data-table td.is-sticky-col {
  z-index: 2;
  background: #fff;
}
table.data-table tbody tr:hover td.is-sticky-col { background: #f8fafc !important; }
table.data-table tbody tr.row-warn td.is-sticky-col { background: #fffbeb !important; }
table.data-table tbody tr.row-danger td.is-sticky-col { background: #fef2f2 !important; }
table.data-table tbody tr.row-click:hover td.is-sticky-col { background: #eff6ff !important; }
table.data-table .is-sticky-last {
  border-right: 2px solid #cbd5e1;
  box-shadow: 3px 0 8px -3px rgba(15, 23, 42, 0.14);
}
table.data-table[data-freeze="3"] th:nth-child(2),
table.data-table[data-freeze="3"] td:nth-child(2) { min-width: 125px; }
table.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
table.data-table thead th.sortable:hover {
  background: #e2e8f0;
}
.sort-ind {
  font-size: 10px;
  color: var(--primary);
  margin-left: 3px;
}
table.data-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: #f8fafc; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center !important; }
.row-warn { background: #fffbeb !important; }
.row-danger { background: #fef2f2 !important; }

/* Badges & Buttons */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: #f1f5f9; color: #475569; }

.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #f1f5f9; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: #15803d; color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: #cbd5e1; border: 1px solid rgba(255,255,255,0.18); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.danger-text { color: #fca5a5 !important; }

/* Forms & Modal */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: #334155; }
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}
.alert { padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert-warn { background: var(--warn-soft); color: #92400e; border: 1px solid #fde68a; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.toast.error { background: var(--danger); }
.toast.ok { background: #15803d; }

/* A4 Print Statement */
.a4-sheet {
  background: #fff;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.a4-header { text-align: center; border-bottom: 2px solid #0f172a; padding-bottom: 12px; margin-bottom: 16px; }
.a4-header h2 { margin: 0 0 6px; font-size: 19px; text-transform: uppercase; }
.a4-meta { font-size: 12.5px; color: #334155; }
.a4-section-title { font-size: 13.5px; font-weight: 700; color: #1e3a8a; margin: 18px 0 8px; text-transform: uppercase; }
.a4-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
.a4-table th, .a4-table td { border: 1px solid #cbd5e1; padding: 6px 8px; }
.a4-table th { background: #f1f5f9; font-weight: 700; }
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 34px; text-align: center; }
.sign-box { min-height: 95px; }
.sign-title { font-weight: 700; font-size: 12.5px; }
.sign-note { font-size: 11.5px; color: var(--muted); font-style: italic; margin-top: 3px; }

.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diff-pre {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tab-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-pill {
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.tab-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal-box.wide { max-width: 980px; width: 96vw; }
.lop-input {
  width: 90px;
  padding: 6px 8px;
  border: 2px solid #93c5fd;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  background: #eff6ff;
}
.lop-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.info-grid-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.info-kv .k { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.info-kv .v { font-weight: 700; font-size: 13.5px; margin-top: 2px; }
.row-click { cursor: pointer; }
.row-click:hover td { background: #eff6ff !important; }

/* Searchable picker */
.ban-picker { position: relative; }
.ban-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 3px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 80;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
.ban-picker-item {
  padding: 7px 10px;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.ban-picker-item:hover, .ban-picker-item.selected { background: #eff6ff; color: #1d4ed8; }

.filter-summary-bar {
  padding: 7px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: #334155;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.mode-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.mode-tab {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.mode-tab.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.fifo-preview-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #1e3a8a;
}
.fifo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed #bfdbfe;
}
.fifo-item:last-child { border-bottom: none; }

.btn-zalo { background: #0068ff; color: #fff; }
.btn-zalo:hover { background: #0054cc; }
.danger-btn-txt { color: var(--danger) !important; }
.btp-act-group { display: flex; flex-wrap: wrap; gap: 4px; min-width: 190px; }
.btp-aux-row td {
  background: #fffdf5 !important;
  border-top: 1px dashed #fde68a;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  font-size: 12px;
}
.btp-aux-row td:first-child {
  padding-left: 20px !important;
  box-shadow: inset 3px 0 0 #f59e0b;
}
.btp-aux-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #f59e0b;
  background: #fef3c7;
  color: #92400e;
  transition: background 0.12s, transform 0.1s;
}
.btp-aux-toggle:hover { background: #fde68a; }
.btp-aux-toggle.all-done {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}
.btp-aux-toggle.all-done:hover { background: #bbf7d0; }
.btp-aux-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px dashed #94a3b8;
  background: #fff;
  color: #475569;
}
.btp-aux-add-btn:hover { border-color: #0284c7; color: #0284c7; background: #f0f9ff; }
.btp-sku-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 11px;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.55;
}
.btp-info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: #1e3a8a;
}
.btp-rolls-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.rm-inp {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
}
.btp-slip-meta th { width: 15%; background: #f8fafc; color: #334155; text-align: right; }
.btp-slip-strong { font-weight: 700; font-size: 13.5px; color: #0f172a; }
.btp-slip-qty { font-weight: 700; font-size: 14px; color: #1d4ed8; background: #eff6ff; }
.btp-slip-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.btp-slip-photo-card {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  page-break-inside: avoid;
  break-inside: avoid;
}
.btp-slip-photo-card.is-cutting {
  border: 2px solid #0284c7;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.14);
}
.btp-slip-photo-card img {
  width: 100%;
  height: 175px;
  object-fit: contain;
  background: #f8fafc;
  display: block;
  cursor: zoom-in;
}
.btp-slip-photo-cap {
  background: #0f172a;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 6px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Marker Paste Zone & SKU Image Vault */
.btp-paste-zone {
  border: 2px dashed #93c5fd;
  background: #f8fafc;
  border-radius: 9px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}
.btp-paste-zone:hover, .btp-paste-zone:focus, .btp-paste-zone.dragover {
  border-color: #0068ff;
  background: #eff6ff;
}
.btp-thumb {
  width: 68px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  cursor: zoom-in;
  display: block;
}
.btp-img-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.btp-img-card {
  width: 118px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.btp-img-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  cursor: zoom-in;
  background: #f1f5f9;
}
.btp-img-cap {
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btp-gallery-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 860px) {
  .btp-gallery-layout { grid-template-columns: 1fr; }
}
.btp-sku-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.btp-sku-list-item:hover { background: #f8fafc; }
.btp-sku-list-item.active { background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.btp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.btp-lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #fff;
}
.btp-lightbox-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 13.5px;
}

/* Flexible Searchable Chip Picker (DM Mau, Cong Doan, Vi Tri, Vai) */
.flex-picker { position: relative; }
.fp-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  cursor: text;
}
.fp-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.14);
}
.fp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
}
.fp-chip button {
  border: none;
  background: none;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
}
.fp-chip button:hover { color: var(--danger); }
.fp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.25);
  display: inline-block;
  flex-shrink: 0;
}
.fp-input {
  border: none !important;
  outline: none !important;
  padding: 3px 4px !important;
  flex: 1;
  min-width: 110px;
  font-size: 12.5px !important;
  background: transparent !important;
}
.fp-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 95;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}
.fp-item {
  padding: 7px 10px;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.fp-item:hover { background: #eff6ff; color: #1d4ed8; }
.fp-item.is-picked { background: #f0fdf4; color: #15803d; font-weight: 600; }
.fp-item-create { background: #fffbeb; color: #92400e; font-weight: 600; }
.fp-item-create:hover { background: #fef3c7; }

/* Multi-select Checkbox Color Dropdown for Cutting Orders */
.btp-cdd { position: relative; }
.btp-cdd-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid #93c5fd;
  border-radius: 7px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.btp-cdd-trigger:hover { border-color: var(--primary); background: #f8fafc; }
.btp-cdd-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.2);
  z-index: 100;
  overflow: hidden;
}
.btp-cdd-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.btp-cdd-head input {
  flex: 1;
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  background: #fff;
}
.btp-cdd-list {
  max-height: 230px;
  overflow-y: auto;
}
.btp-cdd-group {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #eff6ff;
  color: #1e40af;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btp-cdd-group.all { background: #f1f5f9; color: #475569; border-bottom-color: #e2e8f0; }
.btp-cdd-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  user-select: none;
}
.btp-cdd-opt:hover { background: #f8fafc; }
.btp-cdd-opt.checked { background: #f0fdf4; color: #166534; font-weight: 600; }
.btp-cdd-opt input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.btp-cdd-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.btp-cdd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
}
.btp-cdd-row-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}
.btp-cdd-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btp-cdd-step-btn {
  width: 26px;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  color: #0f172a;
}
.btp-cdd-step-btn:hover { background: #e2e8f0; }

/* Ultra-clean Order Form Layout */
.of-grid-3 {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 640px) {
  .of-grid-3 { grid-template-columns: 1fr; }
}
.of-adv {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  margin-top: 8px;
  margin-bottom: 6px;
}
.of-adv > summary {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.of-adv > summary::-webkit-details-marker { display: none; }
.of-adv > summary:hover { color: #0f172a; background: #f1f5f9; border-radius: 8px; }
.of-adv[open] > summary { border-bottom: 1px solid #e2e8f0; border-radius: 8px 8px 0 0; }
.of-adv-body { padding: 10px 12px; background: #fff; border-radius: 0 0 8px 8px; }

/* =========================================================
   CUTTER TABLET MODE (Chalky-Finger / Non-Tech Friendly)
   ========================================================= */
.ct-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.ct-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ct-tools-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ct-tab {
  min-height: 46px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.ct-tab.active.st-cho { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.ct-tab.active.st-dang { background: #d97706; color: #fff; border-color: #d97706; }
.ct-tab.active.st-da { background: #15803d; color: #fff; border-color: #15803d; }
.ct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 16px;
}

/* Tablet / Mobile & Cutter Focus: Full-width Cutting Workspace + Slide-over Sidebar Drawer */
body.cutter-focus .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 60;
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.35);
}
body.cutter-focus .sidebar.open { transform: translateX(0); }
body.cutter-focus .menu-toggle-btn { display: inline-flex; }
body.cutter-focus .sidebar-close-btn { display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.35);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle-btn { display: inline-flex; }
  .sidebar-close-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar h2 { font-size: 17px; }
  .content-area { padding: 12px 14px; }
  #ct-pc-mode { display: none !important; }
}
@media (hover: none) and (pointer: coarse) {
  #ct-pc-mode { display: none !important; }
}
@media (max-width: 900px) {
  .ct-topbar { gap: 8px; }
  .ct-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }
  .ct-tab {
    justify-content: center;
    padding: 9px 6px;
    font-size: 13.5px;
    white-space: nowrap;
  }
  .ct-tools-row { width: 100%; }
  .ct-tools-row #ct-q { flex: 1; min-width: 0 !important; }
  .ct-grid { grid-template-columns: 1fr; }
}
.ct-card {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ct-card.st-dang { border-color: #f59e0b; background: #fffdf7; }
.ct-card.st-da { border-color: #22c55e; background: #f7fef9; }
.ct-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.ct-card-title {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.ct-card-sub {
  font-size: 13.5px;
  color: #475569;
  font-weight: 500;
  margin-top: 3px;
}
.ct-media-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 2px;
}
.ct-marker-box {
  flex: 0 0 185px;
  height: 112px;
  border: 2px solid #93c5fd;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
  cursor: zoom-in;
}
.ct-marker-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ct-marker-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 3px 4px;
}
.ct-sku-thumb {
  flex: 0 0 84px;
  height: 112px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  cursor: zoom-in;
}
.ct-sku-thumb img {
  width: 100%;
  height: 86px;
  object-fit: cover;
  display: block;
}
.ct-sku-thumb span {
  background: #0f172a;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  padding: 4px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-spec-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  line-height: 1.5;
}
.ct-color-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.ct-color-pill {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13.5px;
  font-weight: 600;
}
.ct-aux-strip {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ct-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}
.ct-big-btn {
  flex: 1;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 11px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.ct-big-btn.primary { background: #1d4ed8; color: #fff; }
.ct-big-btn.primary:hover { background: #1e40af; }
.ct-big-btn.warn { background: #d97706; color: #fff; }
.ct-big-btn.warn:hover { background: #b45309; }
.ct-big-btn.success { background: #15803d; color: #fff; }
.ct-big-btn.success:hover { background: #166534; }
.ct-big-btn.secondary { background: #e2e8f0; color: #0f172a; }
.ct-big-btn.secondary:hover { background: #cbd5e1; }

/* Big Touch Ply Entry Rows */
.ct-roll-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
}
.ct-roll-row.has-val { border-color: #22c55e; background: #f0fdf4; }
.ct-roll-row.is-new { border-color: #0284c7; background: #f0f9ff; }
.ct-touch-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ct-step-btn {
  min-width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1.5px solid #94a3b8;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.ct-step-btn:active { background: #cbd5e1; transform: scale(0.96); }
.ct-step-btn.plus { background: #dbeafe; border-color: #3b82f6; color: #1e3a8a; }
.ct-step-inp {
  width: 86px;
  height: 44px;
  border: 2px solid #3b82f6;
  border-radius: 10px;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  background: #fff;
  -moz-appearance: textfield;
}
.ct-step-inp::-webkit-outer-spin-button,
.ct-step-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ct-note-inp {
  flex: 1;
  min-width: 140px;
  height: 42px;
  padding: 0 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  font-size: 14px;
  background: #fff;
}
.ct-tab-main.active {
  background: #1d4ed8 !important;
  color: #fff !important;
  border-color: #1d4ed8 !important;
}
.ct-tab-aux.active {
  background: #d97706 !important;
  color: #fff !important;
  border-color: #d97706 !important;
}
.ct-sheet-main {
  background: #eff6ff;
  border: 2px solid #93c5fd;
  border-radius: 14px;
  padding: 12px;
}
.ct-sheet-aux {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  padding: 12px;
}

/* =========================================================================
   TRIM WAREHOUSE TABLET WORKSPACE (.tt-*) — Touch-First, High-Clarity UI
   ========================================================================= */
body.trim-tablet-focus #topbar-period-box,
body.role-warehouse #topbar-period-box {
  display: none !important;
}
body.trim-tablet-focus .content-area {
  padding: 12px 14px 28px;
}
.tt-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tt-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.tt-nav-grid.is-p1-only {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tt-nav-btn {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: transform 0.08s ease, background 0.12s ease;
}
.tt-nav-btn:active { transform: scale(0.98); }
.tt-nav-btn.active.t-stock { background: #15803d; border-color: #15803d; color: #fff; }
.tt-nav-btn.active.t-prep { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.tt-nav-btn.active.t-receive { background: #0f766e; border-color: #0f766e; color: #fff; }
.tt-nav-btn.active.t-transfer { background: #d97706; border-color: #d97706; color: #fff; }
.tt-nav-pill {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}
.tt-nav-btn:not(.active) .tt-nav-pill {
  background: #fee2e2;
  color: #b91c1c;
}

.tt-wh-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.tt-wh-btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tt-wh-btn .w-title { font-size: 12.5px; font-weight: 700; color: #475569; }
.tt-wh-btn .w-val { font-size: 18px; font-weight: 700; color: #0f172a; }
.tt-wh-btn .w-sub { font-size: 11.5px; color: #64748b; }
.tt-wh-btn.active.w-tong { background: #f0fdf4; border-color: #16a34a; }
.tt-wh-btn.active.w-tong .w-title,
.tt-wh-btn.active.w-tong .w-val { color: #15803d; }
.tt-wh-btn.active.w-main { background: #eff6ff; border-color: #2563eb; }
.tt-wh-btn.active.w-main .w-title,
.tt-wh-btn.active.w-main .w-val { color: #1e3a8a; }
.tt-wh-btn.active.w-p1 { background: #fffbeb; border-color: #d97706; }
.tt-wh-btn.active.w-p1 .w-title,
.tt-wh-btn.active.w-p1 .w-val { color: #b45309; }

.tt-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.tt-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.tt-search-inp {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 14px;
  border: 2px solid #94a3b8;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 600;
  background: #fff;
  color: #0f172a;
}
.tt-search-inp:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.tt-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: #e2e8f0;
  color: #334155;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.tt-select-big {
  height: 48px;
  padding: 0 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  color: #0f172a;
}
.tt-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 8px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.tt-chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.tt-chip.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.tt-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.tt-card {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.tt-card.is-neg { border-color: #f87171; background: #fffafa; }
.tt-card.is-pending { border-color: #facc15; background: #fefce8; }
.tt-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.tt-photo-box {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tt-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.tt-photo-empty {
  width: 100%;
  height: 100%;
  border: 2px dashed #f59e0b;
  border-radius: 9px;
  background: #fffbeb;
  color: #b45309;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 4px;
  line-height: 1.25;
}
.tt-code {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  word-break: break-word;
}
.tt-name {
  font-size: 13.5px;
  color: #334155;
  font-weight: 500;
  line-height: 1.35;
  margin-top: 3px;
}
.tt-meta-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
  font-size: 11.5px;
  color: #475569;
}
.tt-stock-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.tt-stock-quad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.tt-stock-cell {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 7px 6px;
  text-align: center;
}
.tt-stock-cell .k {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}
.tt-stock-cell .v {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
}
.tt-stock-cell.hi-tong { background: #ecfdf5; border-color: #86efac; }
.tt-stock-cell.hi-tong .v { color: #065f46; }
.tt-stock-cell.hi-main { background: #eff6ff; border-color: #93c5fd; }
.tt-stock-cell.hi-main .v { color: #1e3a8a; }
.tt-stock-cell.hi-p1 { background: #fffbeb; border-color: #fcd34d; }
.tt-stock-cell.hi-p1 .v { color: #92400e; }
.tt-stock-cell.is-neg .v { color: #b91c1c !important; }

.tt-card-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.tt-btn {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.tt-btn:active { transform: scale(0.98); }
.tt-btn.primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.tt-btn.success { background: #15803d; border-color: #15803d; color: #fff; }
.tt-btn.warn { background: #d97706; border-color: #d97706; color: #fff; }
.tt-btn.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.tt-stepper {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}
.tt-step-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1.5px solid #94a3b8;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.tt-step-btn.plus {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e3a8a;
}
.tt-step-btn.fill {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
  font-size: 13px;
}
.tt-qty-inp {
  width: 90px;
  min-width: 72px;
  height: 44px;
  border: 2px solid #3b82f6;
  border-radius: 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  background: #fff;
}
.tt-line-card {
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tt-line-card.has-qty {
  border-color: #22c55e;
  background: #f7fef9;
}
.tt-line-card.is-private {
  border-left: 4px solid #16a34a;
}
.tt-sticky-footer {
  position: sticky;
  bottom: 8px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.tt-pick-list {
  margin-top: 8px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  max-height: 290px;
  overflow-y: auto;
}
.tt-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}
.tt-pick-item:last-child { border-bottom: none; }
.tt-pick-item:active, .tt-pick-item:hover { background: #eff6ff; }

@media (max-width: 760px) {
  .tt-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tt-wh-grid { grid-template-columns: 1fr; }
  .tt-stock-quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tt-card-grid { grid-template-columns: 1fr; }
  .tt-qty-inp { flex: 1; width: auto; }
}

.top-back-btn {
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1.5px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.top-back-btn:active { transform: scale(0.97); }
.a4-preview-bar {
  position: sticky;
  top: 0;
  z-index: 35;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

@media print {
  body { background: #fff; }
  .app-shell, .main-area, .content-area { height: auto !important; overflow: visible !important; display: block !important; }
  .table-wrap { max-height: none !important; overflow: visible !important; }
  table.data-table thead th,
  table.data-table th.is-sticky-col,
  table.data-table td.is-sticky-col {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }
  .no-print { display: none !important; }
  .content-area { padding: 0; }
  .a4-sheet { border: none; border-radius: 0; padding: 0; max-width: 100%; }
  .bp-issue-inp { border: none !important; background: transparent !important; padding: 0 !important; width: auto !important; font-weight: 700; }
}
