/* ============================================================================
   GÓI GIAO DIỆN CHUẨN ĐỨC MINH (DUCMINH DESIGN SYSTEM - 100% OFFLINE FONTS)
   Đồng bộ chuẩn xác từ ns.ducminh.tech & cauti.ducminh.tech sang MediSync, BCSS...
   Cách dùng: @import './ducminh-ui-kit/css/ducminh-design-system.css';
   ============================================================================ */

@import '../fonts/fonts.css';

/* ============================================================================
   1. HỆ BIẾN MÀU & FONT MẶC ĐỊNH — CHẾ ĐỘ 1: Y TẾ CHUẨN SÁNG (CLINICAL LIGHT)
   ============================================================================ */
:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --emerald-50: #ecfdf5;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-700: #b45309;
  --rose-50: #fff1f2;
  --rose-200: #fecdd3;
  --rose-600: #e11d48;

  /* Nền & Họa tiết y khoa */
  --bg: #f1f5f9;
  --pattern-dot: rgba(15, 23, 42, 0.055);
  --top-wash: linear-gradient(180deg, rgba(7, 89, 133, 0.055) 0%, rgba(15, 118, 110, 0.025) 140px, rgba(241, 245, 249, 0) 280px);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --bg-sidebar: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.94);

  /* Viền */
  --border: #cbd5e1;
  --border-input: #cbd5e1;
  --border-strong: #94a3b8;
  --line: #e2e8f0;

  /* Chữ */
  --heading: #0f172a;
  --text: #0f172a;
  --text-2: #1e293b;
  --text-3: #475569;
  --text-4: #64748b;
  --placeholder: #64748b;
  --nav: #334155;

  /* Tông màu nhận diện thương hiệu: Xanh Dương Y Tế (#075985) & Ngọc Y Tế (#0F766E) */
  --brand-primary: #075985;
  --brand-secondary: #0f766e;
  --brand-accent: #0c4a6e;
  --brand-soft: rgba(3, 105, 161, 0.12);
  --brand-border: rgba(3, 105, 161, 0.38);
  --gradient-primary: linear-gradient(135deg, #075985 0%, #0f766e 100%);
  --gradient-banner: linear-gradient(135deg, rgba(7, 89, 133, 0.09) 0%, rgba(15, 118, 110, 0.06) 100%);
  --primary: #075985;
  --primary-hover: #0c4a6e;
  --primary-strong: #0f766e;
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.18);

  /* Trạng thái ngữ nghĩa */
  --info-bg: #f0f9ff;
  --info-text: #075985;
  --warn-bg: var(--amber-50);
  --warn: var(--amber-700);
  --bad: var(--rose-600);
  --bad-bg: var(--rose-50);
  --bad-border: var(--rose-200);
  --good: var(--emerald-700);
  --good-bg: var(--emerald-50);

  /* Bo góc & Đổ bóng chuẩn Đức Minh */
  --radius: 14px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-elevated: 0 10px 25px -5px rgba(7, 89, 133, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  /* Hệ 4 bộ Font Offline (.woff2) */
  --font-heading: 'Plus Jakarta Sans', 'Inter', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font: 'Inter', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-report: 'Be Vietnam Pro', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* Kích thước khung chuẩn */
  --sidebar: var(--sb-width, 264px);
  --pad: 16px;
  --tap: 44px;
  color-scheme: light;
}

html.sb-collapsed {
  --sidebar: 72px;
}

/* ============================================================================
   2. CHẾ ĐỘ 2: CA TRỰC ĐÊM (NIGHT SHIFT DARK - CHỐNG CHÓI MỎI MẮT)
   ============================================================================ */
html[data-theme='dark'] {
  --slate-50: #111827;
  --slate-100: #1e293b;
  --slate-200: #334155;
  --slate-300: #475569;
  --slate-400: #64748b;
  --slate-500: #94a3b8;
  --slate-600: #cbd5e1;
  --slate-700: #e2e8f0;
  --slate-800: #f1f5f9;
  --slate-900: #f8fafc;

  --bg: #090e17;
  --pattern-dot: rgba(255, 255, 255, 0.04);
  --top-wash: linear-gradient(180deg, rgba(56, 189, 248, 0.07) 0%, rgba(9, 14, 23, 0) 280px);
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-3: #1f2937;
  --bg-sidebar: #0b1120;
  --header-bg: rgba(17, 24, 39, 0.9);

  --border: #1e293b;
  --border-input: #334155;
  --border-strong: #475569;
  --line: #1e293b;

  --heading: #f8fafc;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;
  --placeholder: #64748b;
  --nav: #cbd5e1;

  --brand-primary: #38bdf8;
  --brand-secondary: #2dd4bf;
  --brand-accent: #7dd3fc;
  --brand-soft: rgba(56, 189, 248, 0.14);
  --brand-border: rgba(56, 189, 248, 0.35);
  --gradient-primary: linear-gradient(135deg, #0284c7 0%, #0f766e 100%);
  --gradient-banner: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(45, 212, 191, 0.06) 100%);
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-strong: #0284c7;

  --info-bg: rgba(56, 189, 248, 0.14);
  --info-text: #7dd3fc;
  --warn-bg: rgba(245, 158, 11, 0.15);
  --warn: #fbbf24;
  --bad: #fb7185;
  --bad-bg: rgba(244, 63, 94, 0.15);
  --bad-border: rgba(244, 63, 94, 0.35);
  --good: #34d399;
  --good-bg: rgba(16, 185, 129, 0.15);

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 12px 28px -4px rgba(0, 0, 0, 0.65), 0 0 15px 0 rgba(56, 189, 248, 0.1);
  color-scheme: dark;
}

/* ============================================================================
   3. CHẾ ĐỘ 3: BAN GIÁM ĐỐC (LUXURY EMERALD & GOLD - NGỌC LỤC BẢO & VÀNG KIM)
   ============================================================================ */
html[data-theme='luxury'] {
  --slate-50: #f7f5f0;
  --slate-100: #f2efe9;
  --slate-200: #e5dec9;
  --slate-300: #d5cbb0;
  --slate-400: #8c9c95;
  --slate-500: #647872;
  --slate-600: #374b45;
  --slate-700: #1d352e;
  --slate-800: #0f2922;
  --slate-900: #072a20;

  --bg: #f7f5f0;
  --pattern-dot: rgba(11, 93, 70, 0.055);
  --top-wash: linear-gradient(180deg, rgba(197, 155, 39, 0.07) 0%, rgba(11, 93, 70, 0.03) 160px, rgba(247, 245, 240, 0) 300px);
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --surface-3: #ebe6dc;
  --bg-sidebar: #072a20;
  --header-bg: rgba(255, 255, 255, 0.94);

  --border: #e5dec9;
  --border-input: #dfd6be;
  --border-strong: #c59b27;
  --line: #f2efe9;

  --heading: #0f2922;
  --text: #0f2922;
  --text-2: #374b45;
  --text-3: #647872;
  --text-4: #8c9c95;
  --placeholder: #8c9c95;
  --nav: #f5f2eb;

  --brand-primary: #0b5d46;
  --brand-secondary: #b8860b;
  --brand-accent: #c59b27;
  --brand-soft: rgba(11, 93, 70, 0.09);
  --brand-border: rgba(197, 155, 39, 0.45);
  --gradient-primary: linear-gradient(135deg, #072a20 0%, #0e5a44 65%, #9a7418 100%);
  --gradient-banner: linear-gradient(135deg, rgba(11, 93, 70, 0.08) 0%, rgba(197, 155, 39, 0.1) 100%);
  --primary: #0b5d46;
  --primary-hover: #072a20;
  --primary-strong: #b8860b;

  --shadow-card: 0 4px 18px -2px rgba(7, 42, 32, 0.06), 0 1px 4px -1px rgba(184, 134, 11, 0.06);
  --shadow-elevated: 0 12px 30px -4px rgba(7, 42, 32, 0.14), 0 0 0 1px rgba(197, 155, 39, 0.28);
  color-scheme: light;
}

/* ============================================================================
   4. NỀN CHẤM Y KHOA, TYPOGRAPHY & HIỆU ỨNG DÙNG CHUNG
   ============================================================================ */
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--top-wash), radial-gradient(var(--pattern-dot) 1px, transparent 1px);
  background-size: 100% 300px, 20px 20px;
  background-repeat: no-repeat, repeat;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--heading);
}

.font-mono,
.tabular-nums {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

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

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

@keyframes sbDotPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Viền ánh kim Vàng - Ngọc Lục Bảo trên đỉnh thẻ Card trong chế độ Luxury */
html[data-theme='luxury'] .card:not(.paper)::after,
html[data-theme='luxury'] .kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #c59b27, #0b5d46, #c59b27, transparent);
  opacity: 0.72;
  pointer-events: none;
}

/* ============================================================================
   5. BỘ CHỌN GIAO DIỆN 3 CHẾ ĐỘ (THEMESWITCHER POPOVER NỀN TỐI KÍNH MỜ)
   ============================================================================ */
.theme-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-switcher-btn:hover {
  border-color: var(--brand-border);
  background: var(--surface);
}

.theme-switcher-label {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 700;
}

.theme-icon-light { color: #0284c7; }
.theme-icon-dark { color: #38bdf8; }
.theme-icon-luxury { color: #d97706; }

.dm-theme-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 326px;
  padding: 10px;
  border: 1px solid #334155 !important;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.96) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #ffffff !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  animation: slideDownBanner 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.dm-theme-head {
  padding: 4px 10px 6px;
  color: #94a3b8;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dm-theme-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dm-theme-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dm-theme-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dm-theme-item.is-selected {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(56, 189, 248, 0.42);
}

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

.dm-theme-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}

.dm-theme-sub {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  color: #cbd5e1;
}

.dm-theme-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dm-swatch-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 9999px;
}

.dm-theme-check {
  margin-left: 4px;
  color: #34d399;
}

/* ============================================================================
   6. SIDEBAR GỌN & CHÂN SIDEBAR 3 TẦNG CHUẨN SIDEBAR.TSX
   ============================================================================ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  transition: width 0.22s ease;
}

.sb-main-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sb-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sb-collapse-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.sb-collapse-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #ffffff;
  transform: scale(1.04);
}

.sb-nav-scroll {
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

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

.nav-group {
  padding: 4px 0 0;
  border-top: 1px solid var(--line);
}

.nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.nav-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 15px;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
}

.nav-group.open > .nav-group-head {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand-primary);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 2px 10px;
  padding-left: 9px;
  border-left: 2px solid var(--brand-border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6.5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--nav);
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.nav-item:hover {
  background: var(--brand-soft);
  color: var(--heading);
}

.nav-item.active {
  font-weight: 700;
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand-primary);
}

/* Chân Sidebar 3 tầng: Hàng APK + Thường trực 24/24 gọn + Tài khoản người dùng dưới cùng */
.sb-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sb-apk-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sb-apk-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-decoration: none;
}

.sb-apk-link:hover {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.sb-apk-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sb-apk-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-apk-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  border: 1px solid var(--brand-border);
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-family: var(--mono);
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 13px;
}

.sb-apk-dl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--gradient-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(7, 89, 133, 0.18);
}

.sb-duty-box {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.sb-duty-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 15px;
}

.sb-duty-live {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--heading);
}

.sb-duty-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 9999px;
  background: #14a08a;
  animation: sbDotPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.sb-duty-code {
  flex-shrink: 0;
  color: var(--brand-primary);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
}

.sb-duty-sub {
  margin: 0;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 400;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 6px;
  border-radius: 8px;
  color: inherit;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.sb-user-row:hover {
  background: rgba(15, 23, 42, 0.045);
}

.sb-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.sb-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sb-user-name {
  color: var(--heading);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-user-sub {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tương thích Sidebar Ngọc Lục Bảo Đậm trong chế độ Luxury */
html[data-theme='luxury'] .sidebar {
  background-color: #072a20;
  background-image: radial-gradient(rgba(197, 155, 39, 0.09) 1px, transparent 1px);
  background-size: 18px 18px;
  border-right: 1px solid rgba(197, 155, 39, 0.35);
  color: #f5f2eb;
}

html[data-theme='luxury'] .sb-brand-bar { border-bottom-color: rgba(197, 155, 39, 0.22); }
html[data-theme='luxury'] .sb-bottom { background: transparent; border-top-color: rgba(197, 155, 39, 0.22); }
html[data-theme='luxury'] .sb-collapse-btn { background: rgba(197, 155, 39, 0.16); border-color: rgba(197, 155, 39, 0.4); color: #fde68a; }
html[data-theme='luxury'] .nav-group { border-top-color: rgba(197, 155, 39, 0.16); }
html[data-theme='luxury'] .nav-group-head { color: #d5cbb0; }
html[data-theme='luxury'] .nav-group.open > .nav-group-head { background: rgba(197, 155, 39, 0.16); border-color: rgba(197, 155, 39, 0.4); color: #fde68a; }
html[data-theme='luxury'] .nav-sub { border-left-color: rgba(197, 155, 39, 0.35); }
html[data-theme='luxury'] .nav-item { color: rgba(245, 242, 235, 0.82); }
html[data-theme='luxury'] .nav-item:hover { background: rgba(197, 155, 39, 0.15); color: #ffffff; }
html[data-theme='luxury'] .nav-item.active {
  background: linear-gradient(90deg, rgba(197, 155, 39, 0.24) 0%, rgba(11, 93, 70, 0.42) 100%);
  border-color: rgba(197, 155, 39, 0.48);
  color: #fde68a;
}
html[data-theme='luxury'] .sb-apk-link,
html[data-theme='luxury'] .sb-duty-box { background: rgba(255, 255, 255, 0.05); border-color: rgba(197, 155, 39, 0.28); color: #fde68a; }
html[data-theme='luxury'] .sb-duty-live,
html[data-theme='luxury'] .sb-user-name { color: #f5f2eb; }
html[data-theme='luxury'] .sb-duty-code { color: #fde68a; }
html[data-theme='luxury'] .sb-duty-sub,
html[data-theme='luxury'] .sb-user-sub { color: #a3b8b0; }
html[data-theme='luxury'] .sb-user-avatar { background: rgba(197, 155, 39, 0.2); border-color: rgba(197, 155, 39, 0.45); color: #fde68a; }
html[data-theme='luxury'] .sb-user-row:hover { background: rgba(197, 155, 39, 0.14); }
html[data-theme='dark'] .sb-user-row:hover { background: rgba(255, 255, 255, 0.06); }

/* ============================================================================
   7. PANEL NỘI DUNG PHẢI (.MAIN) & STICKY TOPBAR (.PAGE-HEADER)
   ============================================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 0 var(--pad) 16px;
  transition: margin-left 0.22s ease;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0 calc(-1 * var(--pad)) 12px;
  padding: 8px var(--pad);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ph-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.ph-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: #ffffff;
}

.ph-crumb {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 1px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 14px;
  color: var(--text-3);
}

.ph-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.ph-text h1 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  line-height: 22px;
  letter-spacing: -0.015em;
  color: var(--heading);
}

.ph-sub-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
}

.ph-right,
.ph-actions,
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================================
   8. KHUNG MODULE BANNER NGỌC LỤC BẢO ĐẬM (MODULEBANNER)
   ============================================================================ */
.dm-banner {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
  padding: 13px 16px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 15px;
  background: linear-gradient(90deg, #0b463f 0%, #0e554c 50%, #13685d 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px -4px rgba(11, 70, 63, 0.25), 0 2px 6px -1px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  animation: cardFadeUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dm-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}

.dm-banner-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.dm-banner-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.dm-banner-badge {
  display: inline-flex;
  align-items: center;
  padding: 2.5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dm-banner-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
}

.dm-banner-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #d1fae5;
}

.dm-banner-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.dm-banner-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dm-banner-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dm-banner-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .dm-banner-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dm-banner-grid.cols-2,
  .dm-banner-grid.cols-3,
  .dm-banner-grid.cols-4 { grid-template-columns: 1fr; }
  .dm-banner-hint { display: none; }
}

.dm-banner-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.dm-banner-item:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(167, 243, 208, 0.72);
  transform: translateY(-1px);
}

.dm-banner-item.is-active {
  background: rgba(255, 255, 255, 0.26);
  border-color: #6ee7b7;
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.45), 0 6px 14px rgba(0, 0, 0, 0.16);
}

.dm-bi-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #ecfdf5;
}

.dm-banner-item:hover .dm-bi-icon,
.dm-banner-item.is-active .dm-bi-icon {
  background: #34d399;
  color: #042f2e;
}

.dm-bi-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.dm-bi-label {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-bi-meta {
  flex-shrink: 0;
  padding: 1.5px 7px;
  border-radius: 9999px;
  background: rgba(4, 47, 46, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #d1fae5;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.dm-banner-item.is-active .dm-bi-meta {
  background: #ecfdf5;
  border-color: #ecfdf5;
  color: #065f46;
}

html[data-theme='dark'] .dm-banner {
  background: linear-gradient(90deg, #062e29 0%, #0b423b 50%, #0f5249 100%);
  border-color: rgba(45, 212, 191, 0.32);
}

html[data-theme='luxury'] .dm-banner {
  background: linear-gradient(90deg, #072a20 0%, #0b4635 55%, #125842 100%);
  border-color: rgba(197, 155, 39, 0.5);
}
html[data-theme='luxury'] .dm-banner-badge {
  background: rgba(197, 155, 39, 0.22);
  border-color: rgba(253, 230, 138, 0.45);
  color: #fde68a;
}
html[data-theme='luxury'] .dm-banner-item.is-active {
  border-color: #fde68a;
  background: rgba(197, 155, 39, 0.22);
}
html[data-theme='luxury'] .dm-banner-item:hover .dm-bi-icon,
html[data-theme='luxury'] .dm-banner-item.is-active .dm-bi-icon {
  background: #fde68a;
  color: #072a20;
}

/* ============================================================================
   9. ĐẦU THẺ CHUẨN (.DM-CARD-HEAD) & KHAY NÚT PHÂN ĐOẠN (.DM-SEG-BAR)
   ============================================================================ */
.dm-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.dm-ch-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dm-ch-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: #ffffff;
}

.dm-ch-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.dm-ch-title-row h3,
.dm-ch-title-row h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--heading);
}

.dm-ch-badge {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 8px;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.dm-ch-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
}

.dm-ch-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dm-seg-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-3);
}

.dm-seg-bar button,
.dm-seg-bar .pill {
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dm-seg-bar button.is-active,
.dm-seg-bar .pill-on {
  background: var(--gradient-primary);
  color: #ffffff;
  font-weight: 700;
}

/* ============================================================================
   10. CHÂN TRANG ĐƠN VỊ & DÒNG TÁC GIẢ / COPYRIGHT 11PX (HOSPITALFOOTER)
   ============================================================================ */
.dm-footer {
  display: block; /* Bắt buộc display: block để 2 tầng trên/dưới xếp dọc qua đường kẻ ngăn cách */
  width: 100%;
  max-width: 1600px;
  margin: auto auto 0;
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.55;
}

.dm-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 1024px) {
  .dm-footer-grid { grid-template-columns: 1fr 1fr; }
  .dm-footer-about { grid-column: 1 / -1; }
}

.dm-footer-about,
.dm-footer-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dm-footer-heading {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--heading);
}

.dm-footer-col-title {
  margin-bottom: 2px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  color: var(--heading);
}

.dm-footer-about p,
.dm-footer-col p {
  margin: 0;
  font-size: 12px;
  color: var(--text-2);
}

.dm-footer-about strong,
.dm-footer-col strong {
  font-weight: 700;
  color: var(--heading);
}

.dm-footer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dm-footer-list a {
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
}

.dm-footer-list a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.dm-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding-top: 10px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 16px;
}

.dm-footer-author {
  color: var(--heading);
  font-weight: 700;
  text-decoration: none;
}

.dm-footer-author:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

/* ============================================================================
   11. BẢO VỆ MẪU GIẤY IN A4 & CHẾ ĐỘ MOBILE / PRINT
   ============================================================================ */
.paper {
  background: #ffffff !important;
  color: #17263c !important;
}

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
  .dm-footer { display: none; }
}

@media print {
  .sidebar,
  .page-header,
  .dm-banner,
  .dm-footer,
  .dm-ch-right,
  .no-print {
    display: none !important;
  }
  .main {
    margin: 0 !important;
    padding: 0 !important;
  }
}
