/* ==========================================================================
   app.css - Giao diện Giống Hệt Bản Word A4 Chuẩn 100% Bộ Y Tế (11pt)
   ========================================================================== */

:root {
  --word-bg: #064e3b; /* Xanh lá cây đậm cao cấp, độ tương phản cao */
  --page-bg: #ffffff;
  --font-word: "Times New Roman", Times, serif;
  --green-primary: #15803d;
  --green-dark: #064e3b;
  --green-light: #dcfce7;
  --green-border: #4ade80;
}

body {
  font-family: var(--font-word) !important;
  background-color: var(--word-bg);
  color: #ffffff; /* Chữ trắng hiển thị rõ ràng trên nền xanh lá cây đậm */
  margin: 0;
  padding: 0;
}

/* Thanh cuộn màu xanh lá đậm & ngọc */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #043324;
}
::-webkit-scrollbar-thumb {
  background: #10b981;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #34d399;
}

*, *::before, *::after {
  box-sizing: border-box;
  font-family: inherit;
}

/* --- ĐỊNH DẠNG TRANG A4 CHUẨN WORD (210mm x 297mm, Font 11pt) --- */
.word-page {
  width: 210mm;
  min-height: 297mm;
  margin: 18px auto;
  padding: 14mm 16mm;
  background: var(--page-bg);
  color: #000000; /* Văn bản trên tờ giấy bệnh án A4 chuẩn Bộ Y Tế chữ đen nền trắng */
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid #22c55e;
  border-radius: 3px;
  position: relative;
  font-size: 11pt;
  line-height: 1.32;
}

@media screen and (max-width: 900px) {
  .word-page {
    width: 96%;
    padding: 10mm 8mm;
    margin: 8px auto;
    font-size: 10pt;
  }
}

/* --- CÁC Ô NHẬP LIỆU DÒNG CHẤM CHẤM NẰM TRÊN 1 DÒNG DUY NHẤT --- */
.word-line-input {
  border: none;
  border-bottom: 1px dotted #475569;
  background: transparent;
  font-family: var(--font-word) !important;
  font-size: 11pt;
  color: #000000; /* Màu đen chuẩn tài liệu Word */
  font-weight: 600;
  padding: 0 3px;
  outline: none;
  height: 20px;
  min-width: 0 !important; /* Ngăn input flex đẩy phình bảng */
  box-sizing: border-box !important;
  transition: all 0.15s ease;
}

.word-line-input:focus {
  border-bottom: 1.5px solid #15803d;
  background-color: #f0fdf4;
}

/* --- ĐỊNH DẠNG CÁC Ô NHẬP LIỆU DÒNG KẺ CHẤM (DOTTED) BẮT ĐẦU TỪ TÊN MỤC --- */
.word-dotted-block {
  position: relative;
  width: 100%;
  margin-bottom: 5px;
  line-height: 24px;
}

.word-label-inline {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-word) !important;
  font-size: 10.5pt;
  line-height: 24px;
  color: #000000;
  background-color: #ffffff;
  padding-right: 5px;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}

.word-dotted-textarea {
  width: 100%;
  border: none;
  background-color: transparent;
  /* DÒNG CHẤM MỜ CHẠY NGANG TRANG GIẤY - CẤM ĐƯỜNG CHẤM DỌC */
  background-image: radial-gradient(circle at 2.5px 23px, #64748b 0.85px, transparent 0.95px);
  background-size: 5px 24px;
  background-repeat: repeat;
  line-height: 24px;
  font-family: var(--font-word) !important;
  font-size: 10.5pt;
  color: #000000;
  font-weight: 500;
  padding: 0;
  margin: 0;
  outline: none;
  resize: none;
  box-sizing: border-box;
  display: block;
}

.word-dotted-textarea:focus {
  background-color: transparent;
}

.word-dotted-textarea::placeholder,
.word-textarea::placeholder,
.word-line-textarea::placeholder,
.word-line-input::placeholder {
  color: #94a3b8 !important;
  font-style: italic !important;
  font-weight: normal !important;
  opacity: 0.8 !important;
}

/* Nút micro góc phải cho khối dòng chấm */
.mic-btn-corner {
  position: absolute;
  right: 2px;
  top: 1px;
  z-index: 5;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 11pt;
  padding: 1px 4px;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.word-dotted-block:hover .mic-btn-corner {
  opacity: 1;
  background: rgba(226, 232, 240, 0.7);
}

.word-textarea {
  width: 100%;
  border: none;
  background-color: transparent;
  /* DÒNG CHẤM MỜ CHẠY NGANG TRANG GIẤY - CẤM ĐƯỜNG CHẤM DỌC */
  background-image: radial-gradient(circle at 2.5px 23px, #64748b 0.85px, transparent 0.95px);
  background-size: 5px 24px;
  background-repeat: repeat;
  line-height: 24px;
  font-family: var(--font-word) !important;
  font-size: 10.5pt;
  color: #000000;
  font-weight: 500;
  padding: 0 2px;
  outline: none;
  resize: none;
  box-sizing: border-box;
}

.word-textarea:focus {
  background-color: transparent;
}

.word-line-textarea {
  width: 100%;
  border: none;
  background-color: transparent;
  /* DÒNG CHẤM MỜ CHẠY NGANG TRANG GIẤY - CẤM ĐƯỜNG CHẤM DỌC */
  background-image: radial-gradient(circle at 2.5px 23px, #64748b 0.85px, transparent 0.95px);
  background-size: 5px 24px;
  background-repeat: repeat;
  line-height: 24px;
  font-family: var(--font-word) !important;
  font-size: 10.5pt;
  color: #000000;
  font-weight: 500;
  padding: 0 2px;
  outline: none;
  resize: none;
  overflow: hidden;
  display: block;
  box-sizing: border-box;
}

.word-line-textarea:focus {
  background-color: transparent;
}

/* Bảng chuẩn Bộ Y Tế trong Word - table-layout fixed để mép phải thẳng hàng 100% */
.word-table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  box-sizing: border-box !important;
  margin: 4px 0 !important;
  font-size: 10.5pt;
}

.word-table th, .word-table td {
  border: 1px solid #000000 !important;
  padding: 3px 5px !important;
  vertical-align: top;
  box-sizing: border-box !important;
}

.word-table th {
  background-color: #f8fafc;
  font-weight: bold;
  text-align: center;
}

/* Bảng sinh hiệu Trang 2: Huyết áp...mmHg, Mạch, Nhiệt độ luôn nằm trên 1 dòng */
.sinh-hieu-table td {
  white-space: nowrap !important;
  vertical-align: middle !important;
  padding: 3px 2px !important;
}

/* Checkbox kiểu Word */
.word-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
  font-weight: normal;
  font-size: inherit;
}

.word-checkbox input[type="checkbox"], .word-checkbox input[type="radio"] {
  width: 12px;
  height: 12px;
  accent-color: #000000;
  cursor: pointer;
  margin: 0 1px 0 0;
  vertical-align: middle;
}

/* Nút micro ghi âm cạnh từng mục - nhỏ gọn */
.mic-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 10px;
  cursor: pointer;
  margin-left: 2px;
  vertical-align: middle;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mic-btn-inline:hover {
  background-color: #ccfbf1;
  color: #0f766e;
  border-color: #0f766e;
  transform: scale(1.15);
}

.mic-btn-inline.mic-active {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #dc2626 !important;
  animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Sóng âm thanh động */
.sound-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}
.sound-wave span {
  display: block;
  width: 3px;
  background-color: #dc2626;
  border-radius: 3px;
  animation: wave-animation 1.2s infinite ease-in-out;
}
.sound-wave span:nth-child(1) { height: 5px; animation-delay: 0.1s; }
.sound-wave span:nth-child(2) { height: 12px; animation-delay: 0.2s; }
.sound-wave span:nth-child(3) { height: 18px; animation-delay: 0.3s; }
.sound-wave span:nth-child(4) { height: 10px; animation-delay: 0.4s; }
.sound-wave span:nth-child(5) { height: 7px; animation-delay: 0.5s; }

@keyframes wave-animation {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.2); }
}

/* In ấn A4 chuẩn xác - Đúng 1 tờ A4 không bị tràn dòng */
@page {
  size: A4 portrait;
  margin: 8mm 10mm 8mm 10mm;
}

@media print {
  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #000000 !important;
    font-family: "Times New Roman", Times, serif !important;
  }
  .no-print, header, .page-nav-btn, .mic-btn-inline, .mic-btn-corner {
    display: none !important;
  }
  .word-page {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    font-size: 10pt !important;
    line-height: 1.25 !important;
  }
  .word-line-input {
    border: none !important;
    border-bottom: 1px dotted #000000 !important;
    color: #000000 !important;
    font-size: 10pt !important;
    padding: 0 1px !important;
    height: 18px !important;
  }
  .word-dotted-textarea, .word-textarea, .word-line-textarea {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background-image: radial-gradient(circle at 2.5px 23px, #475569 0.85px, transparent 0.95px) !important;
    background-size: 5px 24px !important;
    background-repeat: repeat !important;
    border: none !important;
    color: #000000 !important;
    font-size: 10.5pt !important;
    line-height: 24px !important;
  }
  .word-table th, .word-table td {
    padding: 2px 4px !important;
    font-size: 9pt !important;
    line-height: 1.2 !important;
    border: 1px solid #000000 !important;
  }
  .word-checkbox {
    font-size: 9.5pt !important;
  }
  #page-2, #page-3, #page-4, #page-5 {
    font-size: 10.5pt !important;
    line-height: 1.3 !important;
  }
  #page-2 .word-line-input, #page-3 .word-line-input, #page-4 .word-line-input, #page-5 .word-line-input {
    font-size: 10.5pt !important;
    height: 20px !important;
  }
  #page-2 .word-textarea, #page-3 .word-textarea, #page-4 .word-textarea, #page-5 .word-textarea {
    font-size: 10.5pt !important;
  }
  #page-2 .word-table th, #page-2 .word-table td, #page-5 .word-table th, #page-5 .word-table td {
    font-size: 10pt !important;
  }
  .sinh-hieu-table td {
    white-space: nowrap !important;
    padding: 2px 1px !important;
  }
}

/* ==========================================================================
   MODAL & TOAST & TIẾP NHẬN HÓA ĐƠN VAT / ẢNH CHỤP
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(6, 78, 59, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000 !important;
  padding: 16px;
  overflow-y: auto !important;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(6, 78, 59, 0.5), 0 10px 20px -5px rgba(0, 0, 0, 0.3);
  border: 2px solid #10b981;
  padding: 20px 24px;
  width: 100%;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* ==========================================================================
   MODAL TIẾP NHẬN HÓA ĐƠN VAT & FILE ẢNH: THIẾT KẾ SIÊU RÕ NÉT - TƯƠNG PHẢN CAO
   ========================================================================== */
#invoiceImportModal .modal-content {
  width: 96vw !important;
  max-width: 1440px !important;
  height: 95vh !important;
  max-height: 920px !important;
  background: #ffffff !important;
  border: 3px solid #059669 !important;
  border-radius: 16px !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 25px 60px -10px rgba(6, 78, 59, 0.7), 0 15px 35px rgba(0, 0, 0, 0.4) !important;
}

#invoiceImportModal .invoice-modal-header {
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #059669 100%) !important;
  color: #ffffff !important;
  padding: 12px 20px !important;
  border-bottom: 2.5px solid #10b981 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-shrink: 0 !important;
}

#invoiceImportModal .invoice-modal-header h3 {
  color: #ffffff !important;
  font-weight: 900 !important;
  font-size: 16px !important;
  letter-spacing: 0.3px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#invoiceImportModal .invoice-modal-header p {
  color: #a7f3d0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  margin: 2px 0 0 0 !important;
}

#invoiceImportModal .invoice-modal-body {
  padding: 14px 18px !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  background: #f8fafc !important;
}

#invoiceImportModal .invoice-modal-footer {
  background: #ffffff !important;
  padding: 12px 20px !important;
  border-top: 2px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}

#invoiceImportModal input,
#invoiceImportModal textarea,
#invoiceImportModal select {
  border: 1.5px solid #94a3b8 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  background-color: #ffffff !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
}

#invoiceImportModal input:focus,
#invoiceImportModal textarea:focus {
  border-color: #059669 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25) !important;
  background-color: #f0fdf4 !important;
}

#invoiceImportModal label {
  color: #064e3b !important;
  font-weight: 800 !important;
  font-size: 11px !important;
  letter-spacing: 0.1px !important;
}

/* ==========================================================================
   BUTTONS VÀ PHẦN TỬ TIẾP NHẬN HÓA ĐƠN: ĐẢM BẢO CHỮ VÀ NỀN LUÔN RÕ RÀNG 100%
   ========================================================================== */
#invoiceDropzone {
  background-color: #f0fdf4 !important;
  border: 2.5px dashed #059669 !important;
  border-radius: 12px !important;
  padding: 14px 18px !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12) !important;
}

#invoiceDropzone:hover {
  background-color: #dcfce7 !important;
  border-color: #047857 !important;
}

.invoice-btn-choose-file {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  padding: 10px 20px !important;
  border: 2px solid #34d399 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  text-decoration: none !important;
}

.invoice-btn-choose-file:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.45) !important;
}

.invoice-btn-fill-empty {
  background: #0f766e !important;
  color: #ffffff !important;
  font-size: 12.5px !important;
  font-weight: 900 !important;
  padding: 9px 16px !important;
  border: 2px solid #14b8a6 !important;
  border-radius: 8px !important;
  box-shadow: 0 3px 8px rgba(15, 118, 110, 0.25) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.invoice-btn-fill-empty:hover {
  background: #115e59 !important;
}

.invoice-btn-fill-all {
  background: #059669 !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  padding: 9px 18px !important;
  border: 2.5px solid #34d399 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.invoice-btn-fill-all:hover {
  background: #047857 !important;
}

.invoice-btn-sync-crm {
  background: linear-gradient(135deg, #1d4ed8 0%, #3730a3 50%, #065f46 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  padding: 10px 22px !important;
  border: 2.5px solid #60a5fa !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.45) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.invoice-btn-sync-crm:hover {
  background: linear-gradient(135deg, #2563eb 0%, #4338ca 50%, #047857 100%) !important;
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.6) !important;
}

.invoice-btn-close {
  background: #475569 !important;
  color: #ffffff !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  padding: 9px 18px !important;
  border: 2px solid #64748b !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.invoice-btn-close:hover {
  background: #334155 !important;
}

.invoice-pane-header-btn {
  background: #334155 !important;
  color: #ffffff !important;
  border: 1.5px solid #64748b !important;
  font-weight: 800 !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
}

.invoice-pane-header-btn:hover {
  background: #475569 !important;
}

.invoice-pane-filter-btn {
  background: #059669 !important;
  color: #ffffff !important;
  border: 1.5px solid #34d399 !important;
  font-weight: 800 !important;
  font-size: 11px !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
}

.invoice-pane-filter-btn:hover {
  background: #047857 !important;
}

/* ==========================================================================
   HỆ THỐNG TIẾP NHẬN 15-20 FILE: THANH CHỌN STT 1-20 & MÀN HÌNH 3-TRONG-1
   ========================================================================== */
#batchSttContainer {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 4px;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
}

.batch-stt-btn {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1.5px solid #cbd5e1 !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  padding: 4px 10px !important;
  border-radius: 7px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.batch-stt-btn:hover {
  border-color: #059669 !important;
  color: #059669 !important;
  background: #f0fdf4 !important;
}

.batch-stt-btn.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  border: 2px solid #34d399 !important;
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.4) !important;
  transform: translateY(-1px);
}

.batch-stt-btn.synced {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
}

.batch-stt-btn.synced.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 2px solid #60a5fa !important;
}

/* 3 Cột Đối Soát Tam Giác (Hóa Đơn - Bệnh Án - CRM) */
.batch-col-invoice {
  border: 2px solid #cbd5e1 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
}

.batch-col-benhan {
  border: 2px solid #059669 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
}

.batch-col-crm {
  border: 2px solid #2563eb !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Bảng tổng hợp 20 dòng */
.batch-master-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11.5px;
}

.batch-master-table th {
  background: #064e3b;
  color: #ffffff;
  font-weight: 800;
  padding: 8px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid #047857;
}

.batch-master-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.batch-master-table tr:hover td {
  background-color: #f0fdf4 !important;
  cursor: pointer;
}

.batch-master-table tr.selected td {
  background-color: #d1fae5 !important;
  font-weight: 800;
}



.toast {
  position: fixed;
  top: 125px;
  right: 24px;
  background: linear-gradient(135deg, #064e3b, #047857);
  color: #ffffff;
  padding: 14px 22px;
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  border: 2px solid #34d399;
  font-size: 13.5px;
  font-weight: 800;
  z-index: 999999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 420px;
}

.toast.hidden {
  display: none !important;
}

/* Khung kéo thả tài liệu / hóa đơn */
.invoice-dropzone {
  border: 2px dashed #86efac;
  background-color: #f0fdf4;
  transition: all 0.2s ease;
}

.invoice-dropzone:hover {
  border-color: #16a34a;
  background-color: #dcfce7;
}

/* Khung preview tài liệu */
.invoice-preview-box {
  background-color: #1f2937;
  border-radius: 8px;
  overflow: auto;
  min-height: 380px;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.invoice-preview-box img,
.invoice-preview-box canvas {
  max-width: 100%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

/* ==================== ĐỊNH DẠNG THANH MENU CÂN GIỮA - NỀN TRẮNG - TỰ ĐỘNG ẨN/HIỆN KHI CUỘN ==================== */
#mainAppHeader {
  background-color: #ffffff !important;
  color: #004085 !important;
  border-bottom: 2px solid #0052cc !important;
  box-shadow: 0 4px 14px rgba(0, 50, 100, 0.12) !important;
  font-weight: 800 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  will-change: transform;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#mainAppHeader.header-hidden {
  transform: translateY(-102%) !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

#mainAppHeader.header-visible {
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

#mainAppHeader * {
  color: #004085 !important;
  font-weight: 800 !important;
}

.menu-action-btn {
  background-color: #ffffff !important;
  color: #004085 !important;
  border: 1.5px solid #0284c7 !important;
  font-weight: 800 !important;
  font-size: 11.5px !important;
  padding: 3px 8px !important;
  line-height: 1.25 !important;
  transition: all 0.15s ease !important;
}

.menu-action-btn:hover {
  background-color: #e0f2fe !important;
  color: #002244 !important;
  border-color: #0052cc !important;
}

.menu-action-btn * {
  color: #004085 !important;
  font-weight: 800 !important;
}

.menu-action-btn:hover * {
  color: #002244 !important;
}

/* NÚT CHUYỂN TRANG BỆNH ÁN: CỠ CHỮ LỚN HƠN 1 CHÚT, CHỮ SIÊU ĐẬM */
.menu-page-btn {
  background-color: transparent !important;
  color: #064e3b !important;
  border: 1.5px solid transparent !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  padding: 3px 10px !important;
  line-height: 1.25 !important;
  transition: all 0.15s ease !important;
}

.menu-page-btn:hover {
  background-color: transparent !important;
  color: #047857 !important;
  border-color: #d97706 !important;
}

.menu-page-btn.active {
  background-color: transparent !important;
  color: #d97706 !important;
  border: 1.5px solid #d97706 !important;
  box-shadow: none !important;
}

.menu-page-btn.active,
.menu-page-btn.active * {
  color: #d97706 !important;
  font-weight: 900 !important;
}

/* 4 MỤC CHÍNH Ở HÀNG 2 CỦA MENU (HỒ SƠ, TRANG BỆNH ÁN, IN, HỆ THỐNG CRM) */
.main-menu-tab-btn {
  background-color: transparent !important;
  color: #064e3b !important;
  border: 1.5px solid transparent !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  padding: 4px 14px !important;
  border-radius: 6px !important;
  transition: all 0.15s ease !important;
}

.main-menu-tab-btn:hover {
  background-color: transparent !important;
  color: #047857 !important;
  border-color: #d97706 !important;
}

.main-menu-tab-btn.active {
  background-color: transparent !important;
  color: #d97706 !important;
  border: 1.5px solid #d97706 !important;
  box-shadow: none !important;
}

.main-menu-tab-btn.active * {
  color: #d97706 !important;
  font-weight: 900 !important;
}

/* NÚT THÔNG BÁO TỪ XA: SÁNG RÕ, TƯƠNG PHẢN CAO, DỄ ĐỌC */
#tabBtn_notif {
  background-color: #ffffff !important;
  color: #c2410c !important;
  border: 1.8px solid #ea580c !important;
}

#tabBtn_notif * {
  color: #c2410c !important;
  font-weight: 900 !important;
}

#tabBtn_notif:hover {
  background-color: #fff7ed !important;
  color: #9a3412 !important;
  border-color: #c2410c !important;
}

#tabBtn_notif:hover * {
  color: #9a3412 !important;
}

#tabBtn_notif.active {
  background: linear-gradient(135deg, #ea580c, #c2410c) !important;
  color: #ffffff !important;
  border: 1.8px solid #7c2d12 !important;
  box-shadow: 0 3px 10px rgba(234, 88, 12, 0.4) !important;
}

#tabBtn_notif.active * {
  color: #ffffff !important;
  font-weight: 900 !important;
}

/* ==========================================================================
   TIỆN ÍCH TƯƠNG PHẢN CAO & KHẮC PHỤC TAILWIND JIT
   ========================================================================== */
.bg-\[\#064e3b\],
[class*="bg-[#064e3b]"] {
  background-color: #064e3b !important;
}

.border-\[\#10b981\],
[class*="border-[#10b981]"] {
  border-color: #10b981 !important;
}

.text-\[\#d1fae5\],
[class*="text-[#d1fae5]"] {
  color: #d1fae5 !important;
}

/* Đảm bảo toàn bộ chữ trong modal hóa đơn luôn sắc nét, không bị mờ nhạt */
#invoiceImportModal input,
#invoiceImportModal select,
#invoiceImportModal textarea {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   MÀN HÌNH ĐỐI SOÁT 3-TRONG-1 & THANH SỐ THỨ TỰ 1-20
   ========================================================================== */
.batch-stt-btn {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  font-family: monospace !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
}

.batch-stt-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

.batch-stt-btn.active {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%) !important;
  color: #ffffff !important;
  border: 2px solid #fbbf24 !important;
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.4) !important;
  transform: translateY(-1px) !important;
}

.batch-stt-btn.synced {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #22c55e !important;
}

.batch-stt-btn.synced.active {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%) !important;
  color: #ffffff !important;
  border: 2px solid #facc15 !important;
}

.batch-col-invoice {
  border: 2px solid #334155 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #020617 !important;
}

.batch-col-benhan {
  border: 2px solid #059669 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #f8fafc !important;
}

.batch-col-crm {
  border: 2px solid #2563eb !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #f8fafc !important;
}

.batch-master-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 12px !important;
}

.batch-master-table th {
  background: #0f172a !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  padding: 8px 10px !important;
  border: 1px solid #334155 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  text-align: left !important;
}

.batch-master-table td {
  padding: 8px 10px !important;
  border: 1px solid #e2e8f0 !important;
  vertical-align: middle !important;
}

/* ==========================================================================
   CHẾ ĐỘ PHÓNG TO CHUẨN KHỔ TRANG A4 TỪNG Ô (HÓA ĐƠN, BỆNH ÁN, CRM)
   ========================================================================== */
.col-header-title-btn {
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.col-header-title-btn:hover {
  filter: brightness(1.25) !important;
}

/* Khung phóng to chuẩn kích thước và tỉ lệ trang A4 (Rộng ~850px, Cao 94vh) căn giữa màn hình */
.batch-col-fullscreen {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 850px !important;
  max-width: 95vw !important;
  height: 94vh !important;
  max-height: 96vh !important;
  z-index: 100005 !important;
  margin: 0 auto !important;
  border-radius: 12px !important;
  border: 2px solid #475569 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8), 0 0 0 100vmax rgba(2, 6, 23, 0.82) !important;
  animation: a4ZoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes a4ZoomIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.batch-col-hidden-full {
  display: none !important;
}

.maximized-multi-cols {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
  gap: 12px !important;
  align-items: start !important;
}




