:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --sidebar-text: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;
  --zalo: #0068ff;
  --zalo-light: #e0f2fe;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --sidebar-width: 272px;
  --sidebar-collapsed-width: 68px;
  --workspace-zoom: 1;
}

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

body {
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 13.5px;
  overflow-x: hidden;
}

/* ==========================================================================
   APP SHELL: PROFESSIONAL SIDEBAR (EXPANDED 272PX & MINI-COLLAPSED 68PX) + WORKSPACE
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #172554 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  box-shadow: 4px 0 16px rgba(15, 23, 42, 0.18);
  transition: transform 0.22s ease, width 0.22s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Chế độ Thu gọn Sidebar (Mini-Icon Rail 68px chuyên nghiệp) */
.app-shell.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

.app-shell.sidebar-collapsed .app-workspace {
  margin-left: var(--sidebar-collapsed-width);
}

.app-shell.sidebar-collapsed .brand-info,
.app-shell.sidebar-collapsed .sidebar-group-label,
.app-shell.sidebar-collapsed .nav-item-text,
.app-shell.sidebar-collapsed .sidebar-footer-text {
  display: none !important;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  padding: 12px 6px;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.app-shell.sidebar-collapsed .sidebar-nav {
  padding: 10px 6px;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 11px 6px;
  position: relative;
}

.app-shell.sidebar-collapsed .nav-item-left {
  justify-content: center;
  gap: 0;
}

.app-shell.sidebar-collapsed .nav-item-icon {
  font-size: 18px;
  width: auto;
}

.app-shell.sidebar-collapsed .nav-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 9px;
  padding: 0 4px;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  padding: 10px 6px;
  display: flex;
  justify-content: center;
}

.sidebar-brand {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-collapse-pin {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-collapse-pin:hover {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

.sidebar-footer-collapse-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.sidebar-footer-collapse-btn:hover {
  background: #2563eb;
  border-color: #60a5fa;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.45);
}

.brand-info {
  flex: 1;
  min-width: 0;
}

.brand-info h1 {
  font-size: 14.5px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-info p {
  font-size: 11px;
  color: #93c5fd;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.sidebar-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 12px 12px 6px;
}

.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  margin-bottom: 3px;
  transition: all 0.15s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.nav-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-badge.danger {
  background: #ef4444;
  color: #fff;
}

.nav-badge.success {
  background: #10b981;
  color: #fff;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.5);
  font-size: 11.5px;
  color: #94a3b8;
}

/* Workspace (Right of Sidebar) */
.app-workspace {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.22s ease;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sidebar-toggle-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Bộ điều khiển Zoom Cửa sổ làm việc (50% -> 150%) gọn gàng */
.workspace-zoom-widget {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px 5px;
}

.workspace-zoom-widget select {
  width: auto !important;
  padding: 2px 4px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #334155 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
}

.zoom-step-btn,
.zoom-reset-btn {
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.zoom-step-btn:hover,
.zoom-reset-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-zoom-bar {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 2px 6px;
  font-size: 11px;
  margin-right: 6px;
}

.page-title-box {
  min-width: 0;
}

.page-title-box h2 {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-box p {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.topbar-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 2px;
}

.main-container {
  padding: 20px 24px 48px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

@media (max-width: 980px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-shell.sidebar-open-mobile .app-sidebar {
    transform: translateX(0);
  }
  .app-workspace {
    margin-left: 0;
  }
}

/* Grid & Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 15px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-card .kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kpi-card .kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.grid-3-1 {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

@media (max-width: 1120px) {
  .grid-2, .grid-3, .grid-3-1 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}

th, td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-zalo { background: var(--zalo-light); color: var(--zalo); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: #e2e8f0; color: #334155; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-xs {
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 5px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-zalo { background: var(--zalo); color: #fff; }
.btn-zalo:hover { background: #0052cc; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #6d28d9; }

.btn-outline {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--text);
}
.btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.action-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

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

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

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Progress bar */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.progress-bar-fill.done {
  background: var(--success);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.open,
.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header h3 {
  font-size: 15.5px;
  font-weight: 700;
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 430px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  border-left: 4px solid #3b82f6;
  animation: slideIn 0.2s ease;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.zalo { border-left-color: #0068ff; }

@keyframes slideIn {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.workflow-banner {
  background: linear-gradient(90deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.workflow-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: #1e3a8a;
}

.workflow-step {
  background: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  margin-top: 3px;
}

/* ==========================================================================
   TRANG IN BIỂU MẪU KẾ TOÁN / ISO CHUẨN QUY ĐỊNH (A5 PHIẾU KHO & A4 BÁO CÁO 1 TRANG)
   ========================================================================== */
.voucher-paper {
  background: #ffffff;
  color: #000000;
  font-family: "Times New Roman", Times, serif;
  border: 1px solid #94a3b8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  margin: 0 auto;
  box-sizing: border-box !important;
  overflow: hidden;
  position: relative;
}

/* 1. Chuẩn Khổ A5 Ngang (210mm x 148mm) — Dành cho Phiếu Nhập Kho (01-VT) & Phiếu Xuất Kho (02-VT) */
.voucher-paper.paper-a5-landscape {
  width: 210mm;
  max-width: 210mm;
  min-height: 144mm;
  padding: 8mm 10mm 8mm 12mm; /* Lề Trên 8mm, Phải 10mm, Dưới 8mm, Trái 12mm */
  font-size: 12px;
  line-height: 1.28;
}

/* 2. Khổ A5 Dọc (148mm x 210mm) */
.voucher-paper.paper-a5-portrait {
  width: 148mm;
  max-width: 148mm;
  min-height: 205mm;
  padding: 8mm 8mm 8mm 10mm;
  font-size: 11.5px;
  line-height: 1.28;
}

/* 3. Chuẩn Khổ A4 Dọc (210mm x 297mm) — Dành cho Báo cáo Kiểm kê (05-VT), IQC, NCR, PO, SO, BOM */
.voucher-paper.paper-a4-portrait {
  width: 210mm;
  max-width: 210mm;
  min-height: 285mm;
  padding: 15mm 15mm 15mm 20mm; /* Căn lề chuẩn NĐ30/TT200: Trên 15mm, Phải 15mm, Dưới 15mm, Trái 20mm */
  font-size: 12.5px;
  line-height: 1.34;
}

/* 4. Chuẩn Khổ A4 Ngang (297mm x 210mm) */
.voucher-paper.paper-a4-landscape {
  width: 297mm;
  max-width: 297mm;
  min-height: 202mm;
  padding: 12mm 14mm 12mm 18mm;
  font-size: 12px;
  line-height: 1.3;
}

.voucher-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
}

.voucher-company {
  font-size: 11.5px;
  max-width: 60%;
}

.voucher-company strong {
  font-size: 12px;
  text-transform: uppercase;
}

.voucher-legal-code {
  text-align: center;
  font-size: 11.5px;
  max-width: 39%;
}

.voucher-title-block {
  text-align: center;
  margin: 6px 0 8px;
}

.voucher-title-block h1 {
  font-size: 16.5px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0 0 2px;
  letter-spacing: 0.2px;
}

.paper-a5-landscape .voucher-title-block h1,
.paper-a5-portrait .voucher-title-block h1 {
  font-size: 15px;
}

.voucher-meta {
  margin-bottom: 7px;
  font-size: 12px;
}

.voucher-meta p {
  margin: 0 0 2.5px;
}

.voucher-meta-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2px 12px;
  margin-bottom: 6px;
  font-size: 11.8px;
}

.voucher-table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  margin: 6px 0 !important;
  font-size: 11.5px;
  box-sizing: border-box !important;
}

.voucher-table th,
.voucher-table td {
  border: 1px solid #000000 !important;
  padding: 4px 5px !important;
  color: #000000 !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  vertical-align: middle;
}

.paper-a5-landscape .voucher-table th,
.paper-a5-landscape .voucher-table td {
  padding: 3.5px 4px !important;
  font-size: 11.2px;
}

.voucher-table th {
  background: #f1f5f9 !important;
  text-align: center;
  font-weight: 700;
  text-transform: none;
  font-size: 11.2px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.voucher-signatures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 6px;
  margin-top: 8px;
  text-align: center;
  font-size: 11.5px;
  width: 100%;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.voucher-sig-box strong {
  display: block;
  margin-bottom: 1px;
  font-size: 11.5px;
}

.voucher-sig-box em {
  font-size: 10.5px;
  color: #222;
}

.voucher-sig-space {
  height: 44px;
}

.paper-a5-landscape .voucher-sig-space,
.paper-a5-portrait .voucher-sig-space {
  height: 32px;
}

@media print {
  @page {
    margin: 0mm !important;
  }
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    overflow: visible !important;
  }
  /* Triệt tiêu hoàn toàn giao diện nền để không làm lệch trang hoặc rớt trang 2 */
  #appShell,
  #loginScreenOverlay,
  .toast-container,
  #smartNotifyCenterHost,
  #centerNotificationHubModal,
  #universalEditModal,
  #customer360Modal,
  #taskProgressModal,
  #iqcEvaluateModal,
  #zaloConfigModal,
  #aiCopilotModal,
  #printPreviewModal .modal-header,
  #printPreviewModal .modal-footer,
  .no-print {
    display: none !important;
  }
  #printPreviewModal {
    position: static !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  #printPreviewModal .modal-box,
  #printPreviewModal .modal-body {
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    overflow: visible !important;
  }
  .voucher-paper {
    border: none !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* ==========================================================================
   TRANG LOGIN CHUYÊN NGHIỆP HIỆN ĐẠI & QUICK RBAC ROLE SWITCHER
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card-shell {
  width: 100%;
  max-width: 980px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

@media (max-width: 860px) {
  .login-card-shell {
    grid-template-columns: 1fr;
  }
  .login-showcase {
    display: none;
  }
}

.login-showcase {
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%);
  color: #ffffff;
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.login-pillar-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.login-pillar-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 9px 12px;
}

.login-pillar-item .pillar-icon {
  font-size: 18px;
  line-height: 1.2;
}

.login-pillar-item strong {
  display: block;
  font-size: 12.5px;
  color: #f8fafc;
  margin-bottom: 2px;
}

.login-pillar-item p {
  font-size: 11.5px;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.35;
}

.login-security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.login-security-badges span {
  font-size: 11px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(147, 197, 253, 0.35);
  color: #bfdbfe;
  padding: 4px 8px;
  border-radius: 999px;
}

.login-form-pane {
  padding: 28px 30px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quick-role-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.quick-role-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-role-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  transform: translateX(2px);
}

.quick-role-btn .qr-badge {
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  min-width: 78px;
  text-align: center;
}

.quick-role-btn strong {
  display: block;
  font-size: 12.5px;
  color: #0f172a;
}

.quick-role-btn small {
  font-size: 11px;
  color: #64748b;
}

.user-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.user-session-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta-info {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

#currentUserNameDisplay {
  font-weight: 700;
  font-size: 12.5px;
  color: #0f172a;
  white-space: nowrap;
}

.user-role-dot {
  color: #ffffff;
  background: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.user-switch-caret {
  font-size: 11px;
  color: #64748b;
  margin-left: 2px;
}

.print-template-card {
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.print-template-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.print-template-card h4 {
  margin: 10px 0 6px;
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}

.print-template-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.45;
  flex: 1;
}

/* ==========================================================================
   KANBAN SALES PIPELINE TRÊN MỘT MẶT PHẲNG & CẢNH BÁO ĐÓNG BĂNG (HÌNH 5)
   ========================================================================== */
.kanban-board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-col-header {
  padding-bottom: 8px;
  border-bottom: 2px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-col-title {
  font-size: 12px;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
}

.kanban-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  padding: 9px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-size: 12px;
}

.kanban-card.frozen {
  border: 1.5px solid #ef4444;
  border-left: 5px solid #dc2626;
  background: #fff5f5;
}

/* ========================================================================== */
/* ENTERPRISE UI/UX POLISH & MYSQL 9.7 LIVE SYNC DESIGN SYSTEM                */
/* ========================================================================== */

/* 1. Chuẩn hóa toàn bộ Input (Email, Password, Search, Tel) đồng bộ với Text/Number */
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  transition: all 0.15s;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 2. Bổ sung hệ thống Badge đầy đủ ngữ nghĩa (Info, Danger, Warning, Success) */
.badge-info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-danger {
  background: var(--danger-soft);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-warning {
  background: var(--warning-soft);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-success {
  background: var(--success-soft);
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* 3. Nâng cấp KPI Cards chuyên nghiệp (Viền nhấn màu sắc + Hiệu ứng nổi khối Hover) */
.kpi-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  border-top: 3px solid #cbd5e1;
}

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

.kpi-card.blue {
  border-top-color: #2563eb;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.kpi-card.green {
  border-top-color: #059669;
  background: linear-gradient(180deg, #f4fdf9 0%, #ffffff 100%);
}

.kpi-card.amber {
  border-top-color: #d97706;
  background: linear-gradient(180deg, #fffdf5 0%, #ffffff 100%);
}

.kpi-card.red {
  border-top-color: #dc2626;
  background: linear-gradient(180deg, #fff8f8 0%, #ffffff 100%);
}

.kpi-card.purple {
  border-top-color: #7c3aed;
  background: linear-gradient(180deg, #faf7ff 0%, #ffffff 100%);
}

/* 4. Bảng dữ liệu chuẩn Enterprise (Sticky Header + Custom Scrollbar + Zebra tinh tế) */
.table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}

.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #f8fafc;
}

.table-wrap::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 999px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.55);
}

tbody tr:hover td {
  background-color: #eff6ff !important;
}

/* 5. MySQL 9.7 Status Pill trên Topbar & Bảng Breakdown 26 Bảng CSDL */
.mysql-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 100%);
  border: 1.5px solid #6ee7b7;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: #065f46;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.08);
  white-space: nowrap;
}

.mysql-status-pill:hover {
  border-color: #059669;
  background: #d1fae5;
  transform: translateY(-1px);
}

.mysql-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.mysql-dot.connected {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.mysql-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 6px;
}

.mysql-table-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 9px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #059669;
  border-radius: 6px;
  font-size: 11.5px;
}

.mysql-table-chip code {
  font-weight: 700;
  color: #1e293b;
  font-size: 11px;
}

.mysql-table-chip span {
  font-weight: 800;
  color: #059669;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
}

/* ==========================================================================
   HỆ THỐNG THÔNG BÁO, CẢNH BÁO & MESSENGER CHUẨN THƯ VIỆN TRUNG TÂM MÀN HÌNH
   (SmartNotify Center-Screen Modal Engine - SweetAlert2 / AntD / Sonner Standard)
   ========================================================================== */
.smart-notify-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: smartOverlayFadeIn 0.18s ease-out;
}

.smart-notify-overlay.active {
  display: flex;
}

@keyframes smartOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes smartCardPopIn {
  0% {
    opacity: 0;
    transform: scale(0.86) translateY(14px);
  }
  70% {
    opacity: 1;
    transform: scale(1.02) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes smartRingPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.28);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.smart-notify-card {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(226, 232, 240, 0.95);
  overflow: hidden;
  text-align: center;
  padding: 26px 26px 22px;
  animation: smartCardPopIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.smart-notify-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.smart-notify-card.type-success::before {
  background: linear-gradient(90deg, #059669, #10b981);
}
.smart-notify-card.type-error::before {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}
.smart-notify-card.type-warning::before {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}
.smart-notify-card.type-zalo::before,
.smart-notify-card.type-messenger::before {
  background: linear-gradient(90deg, #0068ff, #38bdf8);
}
.smart-notify-card.type-confirm::before,
.smart-notify-card.type-prompt::before {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
}

.smart-notify-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.smart-notify-close-x:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.smart-notify-icon-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  animation: smartRingPulse 1.8s infinite;
}

.smart-notify-card.type-success .smart-notify-icon-ring {
  background: #ecfdf5;
  color: #059669;
  border: 2px solid #6ee7b7;
}
.smart-notify-card.type-error .smart-notify-icon-ring {
  background: #fef2f2;
  color: #dc2626;
  border: 2px solid #fca5a5;
}
.smart-notify-card.type-warning .smart-notify-icon-ring {
  background: #fffbeb;
  color: #d97706;
  border: 2px solid #fcd34d;
}
.smart-notify-card.type-info .smart-notify-icon-ring {
  background: #eff6ff;
  color: #2563eb;
  border: 2px solid #93c5fd;
}
.smart-notify-card.type-zalo .smart-notify-icon-ring,
.smart-notify-card.type-messenger .smart-notify-icon-ring {
  background: #e0f2fe;
  color: #0068ff;
  border: 2px solid #7dd3fc;
}
.smart-notify-card.type-confirm .smart-notify-icon-ring,
.smart-notify-card.type-prompt .smart-notify-icon-ring {
  background: #ede9fe;
  color: #6d28d9;
  border: 2px solid #c4b5fd;
}

.smart-notify-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.smart-notify-module-pill {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.smart-notify-time-pill {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.smart-notify-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px;
  line-height: 1.3;
}

.smart-notify-body {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #1e293b;
  margin-bottom: 16px;
  text-align: left;
  word-break: break-word;
}

.smart-notify-prompt-wrap {
  margin-bottom: 16px;
  text-align: left;
}

.smart-notify-prompt-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid #93c5fd;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
}

.smart-notify-prompt-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

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

.smart-notify-btn {
  min-width: 125px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.smart-notify-btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.smart-notify-btn.primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}

.smart-notify-btn.success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.smart-notify-btn.danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.smart-notify-btn.zalo {
  background: linear-gradient(135deg, #0068ff, #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.25);
}

.smart-notify-btn.secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.smart-notify-btn.secondary:hover {
  background: #e2e8f0;
}

.smart-notify-progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #f1f5f9;
}

.smart-notify-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  transform-origin: left center;
  transition: width 0.08s linear;
}

/* Nút Chuông Thông Báo & Messenger trên Topbar */
.notify-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1.5px solid #93c5fd;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.notify-bell-btn:hover {
  background: #dbeafe;
  border-color: #2563eb;
  transform: translateY(-1px);
}

.notify-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 0 2px #ffffff;
}

/* Trung tâm Thông báo, Cảnh báo & Messenger (Center-Screen Hub) */
.notify-hub-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.notify-hub-tab-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.notify-hub-tab-btn.active {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.22);
}

.notify-feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 4px;
}

.notify-feed-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  background: #ffffff;
  transition: background-color 0.15s ease;
}

.notify-feed-item:hover {
  background: #f8fafc;
}

.notify-feed-item.unread {
  background: #f0f9ff;
}

.notify-feed-item.sev-success { border-left-color: #10b981; }
.notify-feed-item.sev-error { border-left-color: #ef4444; background: #fff5f5; }
.notify-feed-item.sev-warning { border-left-color: #f59e0b; background: #fffbeb; }
.notify-feed-item.sev-zalo { border-left-color: #0068ff; }

.messenger-chat-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 310px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.messenger-bubble-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #0068ff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.messenger-bubble-card.urgent {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: #fff5f5;
}

/* ==========================================================================
   HỆ THỐNG HIỂN THỊ ĐA THIẾT BỊ & GIAO DIỆN NATIVE MOBILE / TABLET APP
   (Desktop Full • Tablet iPad Air 860px • Smartphone iOS/Android 430px)
   ========================================================================== */

/* 1. Bộ nút chuyển đổi thiết bị trên Topbar */
.device-switcher-group {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.device-mode-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.device-mode-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.65);
}

.device-mode-btn.active {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.28);
}

/* 2. Thanh điều khiển Khung mô phỏng Thiết bị khi xem trên màn hình PC */
.device-simulator-toolbar {
  position: sticky;
  top: 0;
  z-index: 2500;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  color: #f8fafc;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.device-sim-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.device-sim-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.device-sim-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.device-sim-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.device-sim-btn.active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

/* 3. Thanh trạng thái Mobile App (Status Bar) & Nút Điều hướng Đáy (Bottom Tab Bar) */
.mobile-app-status-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  color: #f8fafc;
  padding: 6px 16px;
  font-size: 11.5px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 150;
  user-select: none;
}

.mob-status-left,
.mob-status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mob-app-pill {
  background: rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
}

.mob-status-notch {
  width: 76px;
  height: 15px;
  background: #020617;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1150;
}

.mobile-bottom-nav {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #cbd5e1;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px));
}

.mob-nav-btn {
  position: relative;
  border: none;
  background: transparent;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 2px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mob-nav-btn.active {
  color: #1d4ed8;
  background: #eff6ff;
}

.mob-nav-icon {
  font-size: 18px;
  line-height: 1.1;
}

.mob-nav-label {
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.mob-nav-badge {
  position: absolute;
  top: 2px;
  right: 14%;
  background: #2563eb;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #ffffff;
}

.mob-nav-badge.danger {
  background: #dc2626;
}

.mob-nav-fab {
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 6px 4px;
  margin: -14px 4px 0;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.38);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.mob-nav-fab:hover {
  transform: translateY(-2px);
}

.mob-fab-plus {
  font-size: 17px;
  line-height: 1;
}

.mob-fab-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* 4. Lưới Tác Nghiệp Nhanh Mobile 9 Phân Hệ */
.mobile-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-quick-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-quick-card:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

.mobile-quick-card .mq-icon {
  font-size: 22px;
}

.mobile-quick-card strong {
  font-size: 11.5px;
  color: #0f172a;
}

.mobile-quick-card small {
  font-size: 10px;
  color: #64748b;
}

/* 5. Khung Mô Phỏng Thiết Bị Thực Tế (Mobile App 430px & Tablet App 860px) */
body.device-mode-mobile,
body.device-mode-tablet {
  background: radial-gradient(circle at top, #1e293b 0%, #090d16 100%) !important;
  min-height: 100vh;
}

body.device-mode-mobile #appShell {
  max-width: 432px;
  margin: 16px auto 28px;
  min-height: 840px;
  max-height: 89vh;
  background: var(--bg);
  border: 11px solid #1e293b;
  border-radius: 38px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65), 0 0 0 2px #475569;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

body.device-mode-mobile.device-landscape #appShell {
  max-width: 896px;
  min-height: 432px;
}

body.device-mode-tablet #appShell {
  max-width: 860px;
  margin: 16px auto 28px;
  min-height: 860px;
  max-height: 90vh;
  background: var(--bg);
  border: 12px solid #1e293b;
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65), 0 0 0 2px #475569;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

body.device-mode-tablet.device-landscape #appShell {
  max-width: 1140px;
}

/* 6. Quy tắc Giao diện Mobile App & Tablet App (Áp dụng cho cả Chế độ Mô phỏng VÀ Thiết bị Thật) */
body.device-mode-mobile .mobile-app-status-bar,
body.device-mode-tablet .mobile-app-status-bar {
  display: flex;
}

body.device-mode-mobile .mobile-bottom-nav,
body.device-mode-tablet .mobile-bottom-nav {
  display: grid;
}

body.device-mode-mobile .app-sidebar,
body.device-mode-tablet .app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px !important;
  z-index: 1200;
  transform: translateX(-105%);
}

body.device-mode-mobile #appShell.sidebar-open-mobile .app-sidebar,
body.device-mode-tablet #appShell.sidebar-open-mobile .app-sidebar,
#appShell.sidebar-open-mobile .app-sidebar {
  transform: translateX(0) !important;
}

body.device-mode-mobile #appShell.sidebar-open-mobile .mobile-sidebar-backdrop,
body.device-mode-tablet #appShell.sidebar-open-mobile .mobile-sidebar-backdrop,
#appShell.sidebar-open-mobile .mobile-sidebar-backdrop {
  display: block;
}

body.device-mode-mobile .app-workspace,
body.device-mode-tablet .app-workspace {
  margin-left: 0 !important;
  width: 100%;
}

/* Tối ưu Topbar, Grid, Form, Bảng dữ liệu trên Mobile App */
body.device-mode-mobile .topbar {
  padding: 8px 12px;
  gap: 8px;
  top: 29px;
}

body.device-mode-mobile .page-title-box h2 {
  font-size: 13.5px;
}

body.device-mode-mobile .page-title-box p,
body.device-mode-mobile .workspace-zoom-widget,
body.device-mode-mobile .notify-bell-text,
body.device-mode-mobile .topbar-btn-text,
body.device-mode-mobile .topbar-zalo-btn,
body.device-mode-mobile .topbar-divider,
body.device-mode-mobile #currentUserNameDisplay,
body.device-mode-mobile .dev-btn-label {
  display: none !important;
}

body.device-mode-mobile .main-container {
  padding: 12px 12px 28px;
}

body.device-mode-mobile .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px;
}

body.device-mode-mobile .kpi-card {
  padding: 11px 12px;
}

body.device-mode-mobile .kpi-card .kpi-value {
  font-size: 17px;
}

body.device-mode-mobile .grid-2,
body.device-mode-mobile .grid-3,
body.device-mode-mobile .grid-3-1,
body.device-mode-mobile .form-grid {
  grid-template-columns: 1fr !important;
  gap: 10px;
}

body.device-mode-mobile .card-header {
  padding: 10px 12px;
}

body.device-mode-mobile .card-body {
  padding: 12px;
}

/* Tối ưu trên Tablet App */
body.device-mode-tablet .topbar {
  padding: 10px 16px;
  top: 29px;
}

body.device-mode-tablet .workspace-zoom-widget,
body.device-mode-tablet .notify-bell-text,
body.device-mode-tablet #currentUserNameDisplay {
  display: none !important;
}

body.device-mode-tablet .kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px;
}

body.device-mode-tablet .grid-2,
body.device-mode-tablet .grid-3,
body.device-mode-tablet .grid-3-1 {
  grid-template-columns: 1fr !important;
  gap: 14px;
}

body.device-mode-tablet .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* 7. Responsive Tự Động Trên Thiết Bị Thật (Tablet <= 1024px & Điện Thoại <= 768px) */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-105%);
    width: 280px !important;
    z-index: 1200;
  }
  .app-workspace {
    margin-left: 0 !important;
  }
  .mobile-bottom-nav {
    display: grid;
  }
  .workspace-zoom-widget,
  .notify-bell-text {
    display: none !important;
  }
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .mobile-app-status-bar {
    display: flex;
  }
  .topbar {
    padding: 8px 12px;
    gap: 6px;
  }
  .page-title-box h2 {
    font-size: 13.5px;
  }
  .page-title-box p,
  .topbar-btn-text,
  .topbar-zalo-btn,
  .topbar-divider,
  #currentUserNameDisplay,
  .dev-btn-label,
  #mysqlTopbarPill {
    display: none !important;
  }
  .main-container {
    padding: 12px 10px 30px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }
  .kpi-card {
    padding: 11px 12px;
  }
  .kpi-card .kpi-value {
    font-size: 17px;
  }
  .grid-2,
  .grid-3,
  .grid-3-1,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .card-header {
    padding: 10px 12px;
  }
  .card-body {
    padding: 12px;
  }
  .modal-box {
    max-width: 96vw !important;
    max-height: 90vh !important;
    border-radius: 16px;
  }
  .smart-notify-card {
    max-width: 94vw;
    padding: 20px 18px 18px;
  }
}


