:root {
  --bg-main: #f1f5f9;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --blue-primary: #2980b9;
  --green-primary: #10b981;
  --purple-primary: #8b5cf6;
  --orange-primary: #f59e0b;
  --red-primary: #ef4444;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;

  /* Modern Sidebar Variables (Dark Luxury Slate) */
  --sidebar-width: 275px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 58px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active-bg: rgba(56, 189, 248, 0.1);
  --sidebar-active-border: #38bdf8;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #38bdf8;
  --sidebar-border: rgba(255, 255, 255, 0.07);
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* ==================== 1. APP LAYOUT CHÍNH ==================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR DỌC HIỆN ĐẠI (ENTERPRISE LUXURY) */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  position: relative;
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  white-space: nowrap;
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s;
}

.brand-company {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #f8fafc;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  text-transform: uppercase;
}

.btn-toggle-sidebar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-toggle-sidebar:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.icon-toggle-svg {
  transition: transform 0.25s ease;
}

/* MENU LIST */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.menu-category {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  margin: 16px 0 6px 0;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
  border-left: 3px solid #f59e0b;
  color: #fde68a;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.02) 100%);
}

.menu-category:first-of-type {
  margin-top: 4px;
}

.menu-category::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: 3px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.menu-item:hover {
  background: var(--sidebar-hover);
  color: #f1f5f9;
}

.menu-item:hover .menu-icon {
  color: #e2e8f0;
}

.menu-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  border-left: 3px solid var(--sidebar-active-border);
  font-weight: 600;
}

.menu-item.active .menu-icon {
  color: var(--sidebar-text-active);
}

.menu-icon {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: #64748b;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.menu-title {
  flex: 1;
  white-space: nowrap;
  overflow: visible;
  line-height: 1.3;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.footer-db-status {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.footer-db-info {
  display: flex;
  flex-direction: column;
}

.db-label {
  font-size: 0.6rem;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.db-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
}

.btn-sidebar-lock {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-sidebar-lock:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* COLLAPSED STATE (THU GỌN MENU) */
.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.app-sidebar.collapsed .brand-text,
.app-sidebar.collapsed .menu-category,
.app-sidebar.collapsed .menu-title,
.app-sidebar.collapsed .footer-db-info,
.app-sidebar.collapsed .lock-text {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0 6px;
}

.app-sidebar.collapsed .btn-toggle-sidebar {
  position: absolute;
  right: -14px;
  top: 15px;
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 1001;
}

.app-sidebar.collapsed .btn-toggle-sidebar .icon-toggle-svg {
  transform: rotate(180deg);
}

.app-sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 10px 0;
  border-left: none;
}

.app-sidebar.collapsed .menu-item.active {
  background: var(--sidebar-active-bg);
  border-radius: 8px;
}

.app-sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 10px 0;
}

/* ==================== 2. APP MAIN & TOPBAR ==================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f1f5f9;
}

.app-topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-mobile-menu {
  display: none;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 1.15rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mobile-menu:hover {
  background: #e2e8f0;
}

.topbar-path {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.path-root {
  color: #64748b;
  font-weight: 600;
}

.path-sep {
  color: #cbd5e1;
}

.path-current {
  color: #0f172a;
  font-weight: 800;
  font-size: 1.05rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.server-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-primary);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.topbar-clock {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0ea5e9;
  background: #f0f9ff;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #e0f2fe;
}

/* ==================== 3. APP WORKSPACE ==================== */
.app-workspace {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 30px 24px;
  scrollbar-width: thin;
}

.app-workspace::-webkit-scrollbar {
  width: 6px;
}

.app-workspace::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* RESPONSIVE (MOBILE & TABLET) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  transition: opacity 0.3s ease;
}

.btn-close-mobile-sidebar {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 1.15rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}
.btn-close-mobile-sidebar:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

body.drawer-open {
  overflow: hidden !important;
}

@media (max-width: 1024px) {
  .btn-mobile-menu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  
  .btn-toggle-sidebar {
    display: none !important;
  }
  
  .btn-close-mobile-sidebar {
    display: flex !important;
  }

  .app-sidebar,
  .app-sidebar.collapsed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 290px !important;
    max-width: 85vw !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    z-index: 1050 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .app-sidebar.mobile-open,
  .app-sidebar.open-mobile {
    transform: translateX(0) !important;
  }

  /* Hiển thị đầy đủ nhãn chữ trong sidebar trên mobile dù desktop có bị collapsed */
  .app-sidebar.collapsed .brand-text,
  .app-sidebar.collapsed .menu-category,
  .app-sidebar.collapsed .menu-title,
  .app-sidebar.collapsed .footer-db-info,
  .app-sidebar.collapsed .lock-text {
    display: block !important;
  }
  .app-sidebar.collapsed .sidebar-header {
    justify-content: space-between !important;
    padding: 0 16px !important;
  }
  .app-sidebar.collapsed .menu-item {
    justify-content: flex-start !important;
    padding: 10px 14px !important;
  }

  .sidebar-backdrop.active {
    display: block !important;
  }

  .app-workspace {
    padding: 12px 14px;
  }
  .topbar-clock {
    display: none;
  }
}

.module-pane {
  display: none;
}

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

/* 2-Column Charts Row */
.charts-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.charts-row-65-35 {
  display: grid;
  grid-template-columns: 65% calc(35% - 16px);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1024px) {
  .charts-row-2col, .charts-row-65-35 {
    grid-template-columns: 1fr;
  }
}

/* Tab Navigation */
.tab-container {
  display: flex;
  background: #e4e7eb;
  padding: 6px 20px 0;
  border-bottom: 1px solid #dcdde1;
}

.tab-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 700;
  color: #576574;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-dark);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--blue-primary);
  border-top: 3px solid var(--blue-primary);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
}

/* Main Container */
.main-content {
  flex: 1;
  padding: 16px 20px;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane, .bcl-tab-pane {
  display: none;
}

.tab-pane.active, .bcl-tab-pane.active {
  display: block;
}

/* Header & KPI Bar */
.filter-kpi-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
  background: transparent;
}

.kpi-cards-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: 6px;
  padding: 12px 18px;
  width: 250px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  position: relative;
  border: 1px solid #e1e8ed;
}

.kpi-card.card-blue { border-left: 5px solid var(--blue-primary); }
.kpi-card.card-green { border-left: 5px solid var(--green-primary); }
.kpi-card.card-purple { border-left: 5px solid var(--purple-primary); }

.kpi-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 4px 0;
  white-space: nowrap;
}

.kpi-growth {
  font-size: 0.8rem;
  font-weight: 700;
  cursor: help;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.growth-up { color: var(--green-primary); }
.growth-down { color: var(--red-primary); }
.growth-equal { color: var(--text-muted); }

/* Controls Area */
.controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid #e1e8ed;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  margin-left: auto;
}

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

.control-item label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.form-control {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #ffffff;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.15);
}

.btn {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.9;
}

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

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

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

/* Charts Containers */
.chart-box {
  background: var(--card-bg);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e1e8ed;
}

.chart-header {
  margin-bottom: 12px;
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Month Matrix Grid */
.month-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.month-card {
  background: var(--card-bg);
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid #e1e8ed;
  border-top: 4px solid var(--blue-primary);
  transition: transform 0.2s, box-shadow 0.2s;
}

.month-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.month-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f2f6;
}

.month-card-row {
  margin-bottom: 10px;
}

.month-card-row:last-child {
  margin-bottom: 0;
}

.month-row-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.month-row-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-row-val {
  font-size: 1rem;
  font-weight: 700;
}

.month-row-val.ds-val { color: var(--blue-primary); }
.month-row-val.hh-val { color: var(--green-primary); }

.month-row-growth {
  font-size: 0.85rem;
  font-weight: 700;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e1e8ed;
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tooltip Custom */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
  .controls-group {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-topbar {
    padding: 0 10px;
    height: 52px;
  }
  .topbar-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .topbar-path .path-root,
  .topbar-path .path-sep {
    display: none;
  }
  .topbar-path .path-current {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }
  .server-status {
    display: none;
  }
  .topbar-clock {
    display: none;
  }
  .topbar-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .user-badge-topbar {
    padding: 3px 6px;
    gap: 4px;
  }
  .user-badge-name {
    display: none;
  }
  .btn-change-pin-topbar {
    padding: 5px 8px;
    font-size: 0.76rem;
  }
  .btn-lock {
    padding: 5px 8px;
    font-size: 0.76rem;
  }

  .tab-container {
    padding: 4px 8px 0;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-container::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .app-workspace {
    padding: 10px 10px 24px 10px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .controls-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  .control-item {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
  }
  .control-item label {
    font-size: 0.8rem;
    margin-bottom: 2px;
  }
  .form-control {
    width: 100%;
    font-size: 0.85rem;
    height: 36px;
  }

  .actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    margin-top: 6px;
  }
  .actions-group button,
  .actions-group .btn {
    flex: 1 1 calc(50% - 4px);
    padding: 8px 10px;
    font-size: 0.82rem;
    justify-content: center;
    text-align: center;
  }

  .kpi-cards-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }
  .kpi-card {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
  }
  .kpi-value {
    font-size: 1.15rem;
  }

  .table-responsive,
  .dm-table-wrap,
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  /* Danh Mục Khách Hàng & Thương Lái trên Mobile */
  .dm-header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .dm-search-filter-box {
    flex-direction: column;
    width: 100%;
  }
  .dm-search-input,
  .dm-select-filter {
    width: 100%;
  }
  .dm-buttons-group {
    display: flex;
    gap: 6px;
    width: 100%;
  }
  .dm-buttons-group button {
    flex: 1;
    justify-content: center;
  }

  /* Phân quyền người dùng trên Mobile */
  .pq-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .pq-menu-grid {
    padding: 10px !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .pq-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px !important;
  }
  .pq-quick-actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* Modals trên Mobile */
  .dm-modal-content {
    width: 96% !important;
    max-height: 94vh !important;
    margin: 8px !important;
    border-radius: 12px !important;
  }
  .dm-form-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .dm-modal-header {
    padding: 12px 14px !important;
  }
  .dm-modal-legend {
    display: none !important;
  }
  .dm-modal-footer {
    padding: 12px 14px !important;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .dm-modal-footer button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .kpi-cards-group {
    grid-template-columns: 1fr;
  }
  .topbar-path .path-current {
    max-width: 110px;
  }
  .control-item {
    flex: 1 1 100%;
  }
  .actions-group button,
  .actions-group .btn {
    flex: 1 1 100%;
  }
}

/* ========================================================= */
/* MÀN HÌNH KHÓA MÃ PIN BẢO VỆ                               */
/* ========================================================= */
.lock-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1e272e 0%, #2f3542 100%);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lock-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-box {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  padding: 36px 30px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lock-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e8f4fd;
  color: var(--blue-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  margin-bottom: 16px;
}

.lock-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #2c3e50;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.lock-subtitle {
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-bottom: 24px;
}

/* 6 Ô chấm PIN */
.pin-dots {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 20px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #bdc3c7;
  background: transparent;
  transition: all 0.2s ease;
}

.pin-dot.filled {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  transform: scale(1.15);
}

.pin-error {
  color: #e74c3c;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 24px;
  margin-bottom: 16px;
  line-height: 1.4;
  word-break: break-word;
}

.pin-error .lockout-alert {
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.pin-error .inactivity-alert {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

/* Bàn phím số Numpad */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 280px;
  transition: all 0.3s ease;
}

.numpad-grid.locked {
  pointer-events: none;
  opacity: 0.4;
  filter: grayscale(1);
  cursor: not-allowed;
}

.num-btn {
  height: 56px;
  border-radius: 12px;
  border: 1px solid #e1e8ed;
  background: #f8f9fa;
  font-size: 1.35rem;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}

.num-btn:hover {
  background: #e9ecef;
}

.num-btn:active {
  transform: scale(0.94);
  background: #dee2e6;
}

.num-btn.btn-action {
  font-size: 0.9rem;
  font-weight: 700;
  color: #7f8c8d;
}

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

.num-btn.btn-unlock:hover {
  background: #2471a3;
}

/* Animation rung lắc khi gõ sai PIN */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.lock-box.shake {
  animation: shake 0.4s ease-in-out;
}

/* Nút Khóa màn hình trên Header */
.btn-lock {
  background: #f1f2f6;
  color: #576574;
  border: 1px solid #dcdde1;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-lock:hover {
  background: #e4e7eb;
  color: #2c3e50;
}

/* ========================================================================= */
/* PHÂN HỆ: ĐỐI SOÁT TIỀN THU NGÂN                                           */
/* ========================================================================= */

.chot-so-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.3s;
}

.chot-so-status-badge.da-chot {
  background: #e8f8f5;
  color: #27ae60;
  border: 1.5px solid #2ecc71;
}

.chot-so-status-badge.da-chot .status-dot {
  background: #27ae60;
}

.chot-so-status-badge.chua-chot {
  background: #fef9e7;
  color: #d35400;
  border: 1.5px solid #f39c12;
}

.chot-so-status-badge.chua-chot .status-dot {
  background: #e67e22;
}

/* Master-Detail Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-doisoat {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  color: #2c3e50;
}

.table-doisoat thead th {
  background: #f8f9fa;
  color: #34495e;
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.table-doisoat tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.table-doisoat tbody tr.master-row {
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.table-doisoat tbody tr.master-row:hover {
  background-color: #f1f6fa;
}

.table-doisoat tbody tr.master-row.expanded {
  background-color: #ebf5fb;
  border-left: 4px solid #2980b9;
}

.btn-toggle-row {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #cbd5e0;
  background: #ffffff;
  color: #4a5568;
  font-weight: bold;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.master-row.expanded .btn-toggle-row {
  transform: rotate(90deg);
  background: #2980b9;
  color: #ffffff;
  border-color: #2980b9;
}

/* Chi tiết phiếu nộp (Detail subtable) */
.table-doisoat tbody tr.detail-row {
  display: none;
}

.table-doisoat tbody tr.detail-row.open {
  display: table-row;
}

.table-doisoat tbody tr.detail-row td {
  background: #f8fafc;
  padding: 14px 20px 20px 48px;
  border-bottom: 2px solid #e2e8f0;
}

.detail-container {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.detail-header {
  background: #edf2f7;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4a5568;
  display: flex;
  justify-content: space-between;
}

.table-sub-detail {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-sub-detail th {
  background: #f7fafc;
  color: #718096;
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.table-sub-detail td {
  padding: 8px 12px;
  border-bottom: 1px solid #edf2f7;
}

.table-sub-detail tbody tr:last-child td {
  border-bottom: none;
}

/* Badge Đánh giá */
.badge-eval {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-eval.khop {
  background: #e8f8f5;
  color: #27ae60;
}

.badge-eval.thieu {
  background: #fde8e8;
  color: #e74c3c;
}

.badge-eval.thua {
  background: #e8f4fd;
  color: #2980b9;
}

.badge-sub-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-sub-status.da-duyet {
  background: #d4edda;
  color: #155724;
}

.badge-sub-status.cho-duyet {
  background: #fff3cd;
  color: #856404;
}

/* Dòng tổng cộng Footer */
.table-doisoat tfoot tr.row-total td {
  background: #f1f4f9;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-top: 2px solid #cbd5e0;
}

/* ========================================================================= */
/* PHÂN HỆ: CÔNG NỢ KHÁCH HÀNG                                               */
/* ========================================================================= */

.quick-filter-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-filter-cn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  background: #ffffff;
  color: #4a5568;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-filter-cn:hover {
  background: #edf2f7;
  color: #2b6cb0;
}

.btn-filter-cn.active {
  background: #2b6cb0;
  color: #ffffff;
  border-color: #2b6cb0;
}

/* Badge Tuổi nợ */
.badge-age {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-age-green {
  background: #e8f8f5;
  color: #27ae60;
}

.badge-age-yellow {
  background: #fef9e7;
  color: #d35400;
}

.badge-age-red {
  background: #fde8e8;
  color: #c0392b;
  font-weight: 800;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.badge-limit-alert {
  display: inline-block;
  background: #fde8e8;
  color: #c0392b;
  border: 1px solid #f5c6cb;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}

/* Nút Báo nợ Zalo */
.btn-zalo-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: #0088cc;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-zalo-copy:hover {
  background: #0077b5;
  transform: translateY(-1px);
}

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

.btn-zalo-copy.copied {
  background: #27ae60;
}

/* Lưới 2 cột hiển thị chi tiết Mua Hàng & Trả Nợ */
.two-col-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 992px) {
  .two-col-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================= */
/* PHÂN HỆ: QUẢN LÝ NỢ TOA LÁI (Toa_NhungToaChuaTra & Toa_NhungDaTra)        */
/* ========================================================================= */

.btn-filter-nl {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  background: #ffffff;
  color: #4a5568;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-filter-nl:hover {
  background: #edf2f7;
  color: #c0392b;
}

.btn-filter-nl.active {
  background: #c0392b;
  color: #ffffff;
  border-color: #c0392b;
}

/* Badge Duyệt chi */
.badge-duyet-chi {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-duyet-chi.da-duyet {
  background: #e8f8f5;
  color: #27ae60;
}

.badge-duyet-chi.cho-duyet {
  background: #fef9e7;
  color: #d35400;
}

/* Nút Duyệt chi */
.btn-action-duyet {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #27ae60;
  background: #ffffff;
  color: #27ae60;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action-duyet:hover {
  background: #27ae60;
  color: #ffffff;
}

/* Khối phân rã chi phí chi tiết của toa */
.toa-cost-pill {
  display: inline-block;
  background: #edf2f7;
  color: #4a5568;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 3px 4px;
}

.toa-cost-pill b {
  color: #2c3e50;
}

/* ========================================================================= */
/* MODULE 6: SỔ BÁO CÁO BÁN LẺ (BaoCao_SoBaoCao_Le)                          */
/* ========================================================================= */
.btn-filter-bcl {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter-bcl:hover {
  background: var(--bg-hover);
  border-color: #3498db;
  color: #3498db;
}

.btn-filter-bcl.active {
  background: #2980b9;
  border-color: #2980b9;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(41, 128, 185, 0.35);
}

.badge-bcl-vanglai {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e8f8f5;
  color: #27ae60;
  border: 1px solid #a3e4d7;
}

.badge-bcl-khachno {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fef5e7;
  color: #d35400;
  border: 1px solid #f8c471;
}

.btn-action-bill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #3498db;
  background: #ffffff;
  color: #3498db;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action-bill:hover {
  background: #3498db;
  color: #ffffff;
}

/* Modal In Bill K80 & Generic Modals */
.bill-modal-overlay,
.dm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.dm-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.bill-modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 95%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.bill-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.bill-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #2c3e50;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #7f8c8d;
  cursor: pointer;
}

.bill-paper {
  padding: 24px 20px;
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-y: auto;
  border-bottom: 1px dashed #ccc;
}

.bill-header-text {
  text-align: center;
  margin-bottom: 12px;
}

.bill-header-text h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 4px 0;
}

.bill-divider {
  border-top: 1px dashed #000;
  margin: 8px 0;
}

.bill-row {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}

.bill-total-highlight {
  font-size: 1.15rem;
  font-weight: 800;
}

.bill-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  background: #f8f9fa;
}

/* Tối ưu in Bill và in A4 */
@media print {
  body * {
    visibility: hidden;
  }
  #billPaperContent, #billPaperContent * {
    visibility: visible;
  }
  #billPaperContent {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* ========================================================= */
/* PHÂN HỆ 7: DỮ LIỆU COUCHDB SERVER (SOBANLE_TONGHOP)        */
/* ========================================================= */
.couchdb-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

.couchdb-kpi-grid .kpi-card {
  width: 100% !important;
  box-sizing: border-box;
  margin: 0 !important;
}

@media (max-width: 1280px) {
  .couchdb-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .couchdb-kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

#tableCouchDbTongHop thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.couchdb-group-header {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  border-top: 2px solid #cbd5e1 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  transition: background 0.15s ease;
}

.couchdb-group-header td {
  background: #f1f5f9 !important;
  padding: 10px 14px !important;
}

.couchdb-group-header:hover td {
  background: #e2e8f0 !important;
}

.couchdb-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  font-size: 0.75rem;
  color: #0284c7;
  transition: transform 0.2s;
}

.couchdb-group-toggle.collapsed {
  transform: rotate(-90deg);
}

.row-nhaptay {
  background-color: transparent !important;
}

.row-nhaptay td {
  color: inherit !important;
}

.badge-nhaptay {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

.badge-tudong {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.badge-draft {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  white-space: nowrap;
}

.badge-saved {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #dbeafe;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}

/* ========================================================= */
/* PHÂN HỆ 8: QUẢN TRỊ DANH MỤC KHÁCH HÀNG & THƯƠNG LÁI       */
/* ========================================================= */
.dm-tab-pane {
  display: none;
}

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

.btn-filter-dm {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  background: #ffffff;
  color: #4a5568;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-filter-dm:hover {
  background: #edf2f7;
  color: #0284c7;
}

.btn-filter-dm.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.badge-dm-active {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-dm-inactive {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.badge-dm-nhom {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.btn-dm-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-dm-edit {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.btn-dm-edit:hover {
  background: #2563eb;
  color: #ffffff;
}

.btn-dm-delete {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  margin-left: 4px;
}
.btn-dm-delete:hover {
  background: #dc2626;
  color: #ffffff;
}

.btn-dm-toggle {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  margin-left: 4px;
}
.btn-dm-toggle:hover {
  background: #475569;
  color: #ffffff;
}

/* ==========================================================================
   POPUP QUẢN TRỊ DANH MỤC: KHÁCH HÀNG & THƯƠNG LÁI (PHONG CÁCH ERP CHUYÊN NGHIỆP)
   ========================================================================== */
.dm-modal-content {
  background: #ffffff;
  border-radius: 10px;
  width: 95%;
  max-width: 680px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(148, 163, 184, 0.2);
  overflow: hidden;
  animation: dmModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: linear-gradient(180deg, #f0f7ff 0%, #e2eefb 100%);
  border-bottom: 1.5px solid #bfdbfe;
}

.dm-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #1e3a8a;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.dm-modal-legend {
  font-size: 0.82rem;
  color: #dc2626;
  font-weight: 700;
  margin-left: auto;
  margin-right: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dm-modal-legend-bar {
  display: inline-block;
  width: 3.5px;
  height: 14px;
  background: #dc2626;
  border-radius: 1px;
}

.dm-btn-close {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dm-btn-close:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.dm-modal-body {
  padding: 18px 22px;
  max-height: 72vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8fafc;
}

.dm-form-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.dm-form-row.single-col {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.dm-form-row:last-child {
  margin-bottom: 0;
}

.dm-form-group {
  display: flex;
  flex-direction: column;
}

.dm-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.dm-required-bar {
  display: inline-block;
  width: 3.5px;
  height: 13px;
  background: #dc2626;
  border-radius: 1px;
}

.dm-input {
  width: 100%;
  height: 38px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #0f172a;
  background: #ffffff;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

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

.dm-input.is-uppercase {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.dm-input.has-error {
  border-color: #ef4444 !important;
  background: #fff1f2 !important;
}

.dm-input.has-success {
  border-color: #22c55e !important;
  background: #f0fdf4 !important;
}

.dm-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #0f172a;
  background: #ffffff;
  resize: vertical;
  min-height: 58px;
  box-sizing: border-box;
  font-family: inherit;
}

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

.dm-feedback-text {
  font-size: 0.8rem;
  margin-top: 4px;
  font-weight: 600;
  line-height: 1.3;
}

.dm-feedback-error {
  color: #dc2626;
}

.dm-feedback-success {
  color: #16a34a;
}

.dm-suggestion-list {
  margin-top: 6px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #92400e;
  max-height: 90px;
  overflow-y: auto;
}

.dm-suggestion-item {
  padding: 3px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #fef3c7;
}

.dm-suggestion-item:last-child {
  border-bottom: none;
}

.dm-checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  cursor: pointer;
  height: 38px;
  box-sizing: border-box;
}

.dm-checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #16a34a;
}

.dm-checkbox-container label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #15803d;
  cursor: pointer;
  margin: 0;
  user-select: none;
}

.dm-modal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.dm-btn-save {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  border: none;
  padding: 10px 34px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.dm-btn-save:hover {
  background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
  box-shadow: 0 6px 14px rgba(225, 29, 72, 0.35);
  transform: translateY(-1px);
}

.dm-btn-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dm-btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dm-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* ========================================================= */
/* PHÂN QUYỀN & QUẢN TRỊ NGƯỜI DÙNG                          */
/* ========================================================= */

/* 1. Ô nhập tài khoản trên màn hình khóa */
.lock-user-input-group {
  width: 100%;
  max-width: 280px;
  margin-bottom: 16px;
  text-align: left;
}

.lock-user-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.lock-user-input-wrap {
  width: 100%;
}

.lock-user-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
}

.lock-user-input:focus {
  background: #ffffff;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

/* 2. Huy hiệu User trên Topbar */
.user-badge-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.user-badge-icon {
  font-size: 0.95rem;
}

.user-badge-name {
  color: #0f172a;
}

.user-badge-role {
  background: #2563eb;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-badge-role.role-user {
  background: #0d9488;
}

/* 3. Ẩn menu khi không có quyền */
.menu-item.hidden-perm,
.menu-category.hidden-perm {
  display: none !important;
}

/* 4. Giao diện Phân hệ Phân Quyền */
.pq-header-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.pq-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.pq-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
}

.pq-btn-add {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.pq-btn-add:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.pq-grid-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 992px) {
  .pq-grid-layout {
    grid-template-columns: 1fr;
  }
}

.pq-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.pq-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.pq-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
}

.pq-badge-count {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.pq-btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
}

.pq-btn-icon:hover {
  background: #e2e8f0;
}

.pq-quick-actions {
  display: flex;
  gap: 8px;
}

.pq-btn-small {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s ease;
}

.pq-btn-small:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.pq-users-list {
  max-height: 560px;
  overflow-y: auto;
  padding: 8px;
}

.pq-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background: #ffffff;
}

.pq-user-item:hover {
  background: #f1f5f9;
}

.pq-user-item.active {
  background: #eff6ff;
  border-color: #93c5fd;
}

.pq-user-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pq-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.pq-user-avatar.is-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.pq-user-info {
  display: flex;
  flex-direction: column;
}

.pq-user-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
}

.pq-user-sub {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.pq-role-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  text-transform: uppercase;
}

.pq-role-tag.admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.pq-user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pq-user-status-dot.active {
  background: #10b981;
}

.pq-user-status-dot.inactive {
  background: #ef4444;
}

.pq-user-actions {
  display: flex;
  gap: 4px;
}

.pq-action-btn {
  background: none;
  border: 1px solid transparent;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #64748b;
  transition: all 0.15s ease;
}

.pq-action-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.pq-admin-notice {
  margin: 16px 20px 0 20px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.pq-menu-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pq-menu-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
  transition: all 0.2s ease;
}

.pq-menu-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.pq-menu-card.selected {
  border-color: #93c5fd;
  background: #f8fafc;
}

.pq-menu-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.pq-sub-perms-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border-top: 1px dashed #cbd5e1;
  background: #f1f5f9;
  border-radius: 8px;
}

.pq-sub-perms-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pq-sub-perms-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pq-sub-perm-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  background: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  transition: all 0.15s ease;
  user-select: none;
}

.pq-sub-perm-item:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.pq-sub-perm-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #0284c7;
  width: 16px;
  height: 16px;
}

.pq-menu-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding-right: 12px;
}

.pq-menu-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.pq-menu-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.pq-menu-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.3;
}

/* Switch Toggle hiện đại */
.pq-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.pq-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pq-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.pq-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pq-switch input:checked + .pq-slider {
  background-color: #2563eb;
}

.pq-switch input:focus + .pq-slider {
  box-shadow: 0 0 1px #2563eb;
}

.pq-switch input:checked + .pq-slider:before {
  transform: translateX(20px);
}

.pq-switch input:disabled + .pq-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.pq-card-footer {
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  text-align: right;
}

.pq-btn-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 10px 30px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.pq-btn-save:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.pq-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 5. Nút Đổi PIN trên Topbar */
.btn-change-pin-topbar {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-change-pin-topbar:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* 6. Hộp quy định bảo mật mã PIN */
.pin-rules-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.pin-rules-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 6px;
}

.pin-rules-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.82rem;
  color: #3b82f6;
  line-height: 1.5;
}

.pin-rules-list strong {
  color: #1d4ed8;
}

.pin-rules-list code {
  background: #dbeafe;
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  color: #1e40af;
}

.pin-feedback-msg {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 5px;
  line-height: 1.3;
}

.pin-feedback-msg.error {
  color: #dc2626;
}

.pin-feedback-msg.success {
  color: #16a34a;
}

/* 7. Thông báo Toast nổi hiện đại (Toast Container) */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.custom-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.custom-toast.toast-fadeout {
  opacity: 0;
  transform: translateX(50px);
}

.custom-toast.toast-success {
  border-left: 5px solid #10b981;
}

.custom-toast.toast-error {
  border-left: 5px solid #ef4444;
}

.custom-toast.toast-warning {
  border-left: 5px solid #f59e0b;
}

.custom-toast.toast-info {
  border-left: 5px solid #3b82f6;
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-msg {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.toast-close:hover {
  color: #1e293b;
  background: #f1f5f9;
}

/* ========================================================= */
/* CSS GIAO DIỆN DUYỆT TIỀN (BÀN LẺ & CẤP CAO)               */
/* ========================================================= */
.dt-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.dt-toggle-label input[type="checkbox"] {
  accent-color: #2563eb;
  cursor: pointer;
}

.dt-alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.dt-alert-banner.idle {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.dt-alert-banner.alert-active {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fde68a 100%);
  border: 2px solid #f59e0b;
  color: #92400e;
  animation: pulse-gold-glow 1.4s infinite ease-in-out;
}
@keyframes pulse-gold-glow {
  0% {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.75), 0 0 10px rgba(245, 158, 11, 0.4);
  }
  50% {
    border-color: #fbbf24;
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0), 0 0 20px rgba(245, 158, 11, 0.6);
  }
  100% {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.75), 0 0 10px rgba(245, 158, 11, 0.4);
  }
}

/* Chấm đèn LED Radar Live nhấp nháy phát sóng */
.dt-radar-dot {
  width: 10px;
  height: 10px;
  background-color: #d97706;
  border-radius: 50%;
  display: none;
  position: relative;
  flex-shrink: 0;
}
.dt-radar-dot::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #f59e0b;
  animation: radar-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes radar-ping {
  0% { transform: scale(0.8); opacity: 1; }
  75%, 100% { transform: scale(2.3); opacity: 0; }
}

/* Icon chuông lắc nhẹ thu hút ánh nhìn */
.dt-alert-banner.alert-active .dt-alert-icon {
  display: inline-block;
  font-size: 1.25rem;
  animation: ring-bell 1.5s infinite ease-in-out;
  transform-origin: top center;
}
@keyframes ring-bell {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-14deg); }
  20%, 40% { transform: rotate(14deg); }
  50% { transform: rotate(0deg); }
}

.dt-card-section {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.dt-card-section.pending-card {
  border: 2px solid #cbd5e1;
  transition: all 0.3s ease;
}
.dt-card-section.pending-card.has-pending {
  border: 2px solid #f59e0b;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.2);
}
.dt-card-section.pending-card.quanly-theme {
  border: 2px solid #cbd5e1;
  transition: all 0.3s ease;
}
.dt-card-section.pending-card.quanly-theme.has-pending {
  border: 2px solid #f59e0b;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.2);
}
.dt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.dt-card-header.pending-header {
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
}
.dt-card-header.pending-header-ql {
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
  color: #3730a3;
}
.dt-card-header.history-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
}
.dt-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.dt-header-hint {
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
}
.dt-pending-badge {
  background: #dc2626;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  animation: pulse-badge 1s infinite alternate;
}
@keyframes pulse-badge {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}
.dt-history-stat {
  font-size: 0.85rem;
  color: #334155;
}

.dt-table-container {
  max-height: 480px;
  overflow-y: auto;
}
.dt-table th {
  background: #f1f5f9;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  padding: 10px 12px;
  white-space: nowrap;
}
.dt-table td {
  padding: 10px 12px;
  font-size: 0.85rem;
  vertical-align: middle;
}
.dt-table tbody tr:hover {
  background: #f8fafc;
}
.dt-empty-text {
  text-align: center;
  color: #94a3b8;
  padding: 24px !important;
  font-style: italic;
}

/* Nút Duyệt & Từ chối */
.dt-action-cell {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.dt-btn-duyet {
  background: #059669;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dt-btn-duyet:hover {
  background: #047857;
  transform: translateY(-1px);
}
.dt-btn-tuchoi {
  background: #dc2626;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dt-btn-tuchoi:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.dt-btn-inlai {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dt-btn-inlai:hover {
  background: #1d4ed8;
}

.dt-btn-huyduyet {
  background: #d97706;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dt-btn-huyduyet:hover {
  background: #b45309;
}

/* Định dạng dòng lịch sử */
.dt-row-rejected {
  color: #dc2626 !important;
  background: #fff5f5;
  text-decoration: line-through;
}
.dt-row-rejected td:first-child,
.dt-row-rejected td:last-child {
  text-decoration: none; /* Không gạch nút bấm */
}
.dt-badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none !important;
}
.dt-badge-approved {
  background: #d1fae5;
  color: #065f46;
}
.dt-badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* Modal lý do từ chối */
.dt-quick-reason {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.dt-quick-reason:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* ========================================================= */
/* CSS KHUNG IN PHIẾU THU KHỔ K80 (80MM / 72MM IN THỰC TẾ)  */
/* ========================================================= */
.k80-receipt {
  width: 76mm;
  min-height: 100mm;
  background: #ffffff;
  color: #000000;
  padding: 16px 12px;
  font-family: 'Cambria', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1.4;
}
.k80-header {
  text-align: center;
  margin-bottom: 12px;
}
.k80-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #000;
  margin-bottom: 4px;
}
.k80-datetime {
  font-size: 11px;
  color: #444;
}
.k80-body {
  margin-bottom: 14px;
}
.k80-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 13px;
}
.k80-label {
  color: #333;
  flex-shrink: 0;
}
.k80-value {
  color: #000;
  text-align: right;
  word-break: break-word;
}
.k80-value.bold {
  font-weight: 700;
}
.k80-value.font-mono {
  font-family: monospace;
  font-size: 12px;
}
.k80-amount-row {
  align-items: baseline;
  margin: 6px 0 2px 0;
}
.k80-amount {
  font-size: 18px;
  font-weight: 900;
  color: #000;
}
.k80-words {
  font-size: 12px;
  font-style: italic;
  text-align: center;
  color: #222;
  margin-bottom: 6px;
  padding: 0 4px;
  line-height: 1.3;
}
.k80-divider {
  border-top: 1px dashed #777;
  margin: 8px 0;
}
.k80-footer {
  margin-top: 10px;
}
.k80-sign-box {
  display: flex;
  justify-content: space-between;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 35px;
}
.k80-sign-col {
  width: 48%;
  display: flex;
  flex-direction: column;
}
.sign-note {
  font-size: 10px;
  font-weight: normal;
  font-style: italic;
  color: #555;
}
.k80-thanks {
  font-size: 11px;
  font-style: italic;
  text-align: center;
  color: #444;
  border-top: 1px dotted #999;
  padding-top: 8px;
}

/* ========================================================= */
/* CSS KHI THỰC HIỆN LỆNH IN (PRINT STYLES KHỔ 80MM)         */
/* ========================================================= */
@media print {
  body * {
    visibility: hidden !important;
  }
  #modalInPhieuK80,
  #modalInPhieuK80 .dm-modal-content,
  #modalInPhieuK80 .dm-modal-body,
  #k80ReceiptContent,
  #k80ReceiptContent * {
    visibility: visible !important;
  }
  #modalInPhieuK80 {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  .dm-modal-backdrop,
  .dm-modal-header,
  .dm-modal-footer {
    display: none !important;
  }
  .dm-modal-content {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .dm-modal-body {
    background: transparent !important;
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #k80ReceiptContent {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 72mm !important;
    max-width: 72mm !important;
    padding: 2mm 3mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
  @page {
    size: 80mm auto;
    margin: 0;
  }
}





