/* ===================================================
   HỆ THỐNG QUẢN LÝ THIẾT BỊ CƠ QUAN - STYLESHEET
   Phong cách chuẩn hành chính hiện đại, trực quan
   =================================================== */

:root {
  --primary: #1e40af;       /* Xanh lam đậm phong cách cơ quan nhà nước */
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0f766e;     /* Xanh ngọc sẫm */
  --accent: #b45309;        /* Màu vàng đồng / nâu đỏ trang trọng */
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --dark: #0f172a;
  --slate: #475569;
  --light-gray: #f8fafc;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: #f1f5f9;
  color: var(--dark);
  line-height: 1.5;
  font-size: 14px;
}

/* ==================== HEADER & NAVBAR ==================== */
header.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: #facc15;
  color: #1e3a8a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.brand-title h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffffff;
}

.brand-title p {
  font-size: 12px;
  color: #93c5fd;
  margin-top: 2px;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge .role-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-tag.admin {
  background: #ef4444;
  color: #ffffff;
}

.role-tag.user {
  background: #0284c7;
  color: #ffffff;
}

.role-tag.adminview {
  background: #d97706;
  color: #ffffff;
}

.btn-logout {
  background: #b91c1c;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: #991b1b;
}

/* ==================== NAVIGATION BAR ==================== */
nav.app-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-item {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.nav-item:hover {
  color: var(--primary);
  background-color: var(--light-gray);
}

.nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: var(--light-gray);
}

/* ==================== MAIN CONTENT CONTAINER ==================== */
main.main-content {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px 60px;
}

/* ==================== LOGIN VIEW ==================== */
.login-container {
  max-width: 480px;
  margin: 60px auto;
  background: #ffffff;
  padding: 36px 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header .logo-large {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #1e3a8a;
  color: #facc15;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.login-header h2 {
  font-size: 12px;
  color: #1e3a8a;
  font-weight: 700;
  text-transform: uppercase;
}

.login-header p {
  color: var(--slate);
  font-size: 14px;
  margin-top: 4px;
}

.login-accounts-box {
  margin-top: 24px;
  padding: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
}

.login-accounts-box h4 {
  font-size: 12px;
  color: #1e3a8a;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.login-accounts-box ul {
  list-style-type: none;
  padding-left: 0;
  display: grid;
  gap: 4px;
}

.login-accounts-box code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  color: #0f172a;
  cursor: pointer;
}

.login-accounts-box code:hover {
  background: #cbd5e1;
}

/* ==================== CARDS & SECTIONS ==================== */
.card {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: visible;
}

.card-header {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ==================== STATS SECTION ==================== */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-box {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-box.blue { border-left-color: #2563eb; }
.stat-box.green { border-left-color: #16a34a; }
.stat-box.teal { border-left-color: #0d9488; }
.stat-box.amber { border-left-color: #d97706; }

.stat-info p {
  font-size: 12px;
  color: var(--slate);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-info h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark);
  margin-top: 4px;
}

.stat-icon {
  font-size: 28px;
  opacity: 0.8;
}

/* Bảng thống kê thu gọn trên cùng */
.mini-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: #ffffff;
}

.mini-summary-table th,
.mini-summary-table td {
  padding: 8px 14px;
  border: 1px solid var(--border);
  font-size: 14px;
  text-align: left;
}

.mini-summary-table th {
  background: #f1f5f9;
  color: #1e3a8a;
  font-weight: 700;
}

.mini-summary-table tr.total-row {
  background: #eff6ff;
  font-weight: 700;
  color: #1e3a8a;
}

/* ==================== ADMIN FILTER CONTROLS ==================== */
.admin-filters-bar {
  background: #f8fafc;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 250px;
}

.filter-group label {
  font-weight: 600;
  color: #1e3a8a;
  white-space: nowrap;
  font-size: 14px;
}

.filter-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #ffffff;
  font-size: 14px;
  color: var(--dark);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ==================== TABLE TOOLBAR & TABS ==================== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.tab-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 8px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.search-input-wrapper {
  position: relative;
  min-width: 240px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

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

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

.btn-success {
  background: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--slate);
}

.btn-outline:hover {
  background: #f1f5f9;
  color: var(--dark);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

/* ==================== DATA TABLE ==================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #1e3a8a;
  white-space: nowrap;
  border-bottom: 2px solid #cbd5e1;
}

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

/* Hiển thị văn bản nhiều dòng chuẩn */
.multiline-text {
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 12px;
  max-width: 250px;
  color: #334155;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}

/* ==================== BADGES & KHẤU HAO ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-gray { background: #e2e8f0; color: #334155; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* Mức khấu hao */
.khauhao-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 90px;
}

.khauhao-badge {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
}

.khauhao-100 { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.khauhao-80  { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
.khauhao-60  { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.khauhao-40  { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.khauhao-20  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.khauhao-0   { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

.khauhao-bar {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
}

.khauhao-progress {
  height: 100%;
  border-radius: 2px;
}

/* ==================== FORMS & MODALS ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #ffffff;
  border-radius: 10px;
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
}

.modal-header h3 {
  font-size: 16px;
  color: #1e3a8a;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 12px;
  cursor: pointer;
  color: #64748b;
}

.modal-close:hover {
  color: #0f172a;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-radius: 0 0 10px 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid.full {
  grid-template-columns: 1fr;
}

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

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-group label {
  font-weight: 600;
  font-size: 14px;
  color: #1e3a8a;
}

.form-group label .required {
  color: #dc2626;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background-color: #ffffff;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.form-control[disabled],
.form-control[readonly] {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  border-style: dashed;
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
  line-height: 1.4;
}

/* Hộp thông báo tính khấu hao realtime */
.depreciation-preview-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.depreciation-preview-box .calc-text {
  font-size: 12px;
  color: #1e40af;
}

.depreciation-preview-box .calc-val {
  font-size: 15px;
  font-weight: 700;
}

/* ==================== TOAST MESSAGES ==================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: 12px 16px;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
.toast.warning { background: #b45309; }
.toast.info { background: #1e40af; }

/* Responsive */
@media (max-width: 768px) {
  .header-container { flex-direction: column; align-items: flex-start; }
  .user-section { width: 100%; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.col-span-2 { grid-column: span 1; }
  .admin-filters-bar { flex-direction: column; }
  .filter-group { width: 100%; }
}

/* ==================== BỔ SUNG NÂNG CẤP MỚI ==================== */
/* Form 3 cột dàn ngang */
.modal-container.large {
  max-width: 960px;
  width: 95%;
}

.modal-container.compact-detail {
  max-width: 720px;
  width: 95%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 820px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* Thẻ số mở rộng */
.stat-box.indigo { border-left-color: #6366f1; }
.stat-box.emerald { border-left-color: #10b981; }

/* Bảng phụ mini chi tiết (khi nhấn con mắt) */
.compact-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.compact-detail-table th {
  width: 170px;
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: #1e3a8a;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}

.compact-detail-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  font-size: 14px;
  color: #1e293b;
}

/* Khối 2 Biểu đồ tròn SVG */
.charts-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 18px;
  margin-top: 18px;
  margin-bottom: 10px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.chart-card-header {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.chart-dual-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.sub-chart-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
}

.sub-chart-header {
  font-weight: 700;
  font-size: 12.5px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-content {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-svg-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.chart-svg-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.chart-svg-center-val {
  font-size: 12px;
  font-weight: 800;
  color: #1e3a8a;
  display: block;
}

.chart-svg-center-label {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
}

.chart-legend-table {
  flex: 1;
  min-width: 160px;
  border-collapse: collapse;
  font-size: 12px;
}

.chart-legend-table th {
  background: #f8fafc;
  padding: 5px 8px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
}

.chart-legend-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.legend-color-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* Trang Thống Kê Chuyên Sâu */
.advanced-stats-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.criteria-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.criteria-box h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}

.criteria-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.criteria-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  padding: 2px 0;
}

.criteria-checkbox-item:hover {
  color: #1e3a8a;
}

.criteria-checkbox-item input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
}

/* ==================== MULTI-SELECT DROPDOWN COMPONENT ==================== */
.ms-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.ms-trigger {
  width: 100%;
  min-height: 40px;
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13.5px;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  user-select: none;
}

.ms-trigger:hover {
  border-color: #94a3b8;
  background-color: #f8fafc;
}

.ms-trigger:focus,
.ms-container.active .ms-trigger {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.ms-trigger-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.ms-trigger-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ms-count-badge {
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.ms-arrow {
  font-size: 10px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.ms-container.active {
  z-index: 1200;
}

.ms-container.active .ms-arrow {
  transform: rotate(180deg);
}

.ms-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 230px;
  z-index: 1250;
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  max-height: 380px;
  animation: msFadeIn 0.15s ease-out;
}

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

.ms-container.active .ms-dropdown-menu {
  display: flex;
}

.ms-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  flex-shrink: 0;
}

.ms-actions-bar button {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.ms-actions-bar button:hover {
  background: #eff6ff;
  text-decoration: underline;
}

.ms-search-box {
  padding: 6px 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ms-search-box input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}

.ms-search-box input:focus {
  border-color: #2563eb;
}

.ms-options-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 4px;
}

.ms-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
  transition: background-color 0.12s ease;
  user-select: none;
  white-space: normal;
  line-height: 1.35;
  word-break: break-word;
}

.ms-option-item:hover {
  background-color: #f1f5f9;
}

.ms-option-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

/* Kiểu dáng cho nhóm phân cấp cha con */
.ms-option-parent {
  font-weight: 700;
  color: #1e3a8a;
  background-color: #eff6ff;
  border: 1px solid #dbeafe;
  margin: 4px 2px 2px;
  padding: 7px 10px;
}

.ms-option-parent:hover {
  background-color: #dbeafe;
}

.ms-option-child {
  padding-left: 28px;
  border-left: 3px solid #cbd5e1;
  margin-left: 14px;
  margin-right: 4px;
  font-weight: 500;
}

.ms-option-child:hover {
  border-left-color: #2563eb;
  background-color: #f8fafc;
}

/* Grid các bộ lọc Dropdown Thống kê chuyên sâu */
.adv-dropdowns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
  z-index: 10;
}

.adv-dropdown-col {
  position: relative;
}

.adv-dropdown-col:has(.ms-container.active),
.adv-dropdown-col.active-dropdown {
  z-index: 1200;
}

.adv-dropdown-col label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 6px;
}

/* Badge hiển thị cấp đơn vị trong bảng */
.unit-badge-root {
  background: #1e3a8a;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.unit-badge-sub {
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

